(function ($) {
	Drupal.behaviors.gs_gallery_block = {
		attach: function(context, settings) {
			var changeState = function(radioEl) {
				var panel = $(radioEl).closest('td');
				switch($(radioEl).val()) {
					case 'FULL_IMAGE':
						$('div[id$=full-width-image-fid-ajax-wrapper]',	panel).fadeIn();
						$('.gs-field-text',								panel).css('display','none');
						$('.gs-field-testimonial-nid',					panel).css('display','none');
						$('div[id$=left-image-fid-ajax-wrapper]',		panel).css('display','none');
						$('div[id$=right-image-fid-ajax-wrapper]',		panel).css('display','none');
						break;
					case 'FULL_TEXT_TEST':
						$('div[id$=full-width-image-fid-ajax-wrapper]',	panel).css('display','none');
						$('.gs-field-text',								panel).fadeIn();
						$('.gs-field-testimonial-nid',					panel).fadeIn();
						$('div[id$=left-image-fid-ajax-wrapper]',		panel).css('display','none');
						$('div[id$=right-image-fid-ajax-wrapper]',		panel).css('display','none');
						break;
					case '2_COL_2_IMG':
						$('div[id$=full-width-image-fid-ajax-wrapper]',	panel).css('display','none');
						$('.gs-field-text',								panel).css('display','none');
						$('.gs-field-testimonial-nid',					panel).css('display','none');
						$('div[id$=left-image-fid-ajax-wrapper]',		panel).fadeIn();
						$('div[id$=right-image-fid-ajax-wrapper]',		panel).fadeIn();
						break;
					case '2_COL_IMG_TEXT':
						$('div[id$=full-width-image-fid-ajax-wrapper]',	panel).css('display','none');
						$('.gs-field-text',								panel).fadeIn();
						$('.gs-field-testimonial-nid',					panel).fadeIn();
						$('div[id$=left-image-fid-ajax-wrapper]',		panel).fadeIn();
						$('div[id$=right-image-fid-ajax-wrapper]',		panel).css('display','none');
						break;
					case 'DELETE':
						$('div[id$=full-width-image-fid-ajax-wrapper]',	panel).css('display','none');
						$('.gs-field-text',								panel).css('display','none');
						$('.gs-field-testimonial-nid',					panel).css('display','none');
						$('div[id$=left-image-fid-ajax-wrapper]',		panel).css('display','none');
						$('div[id$=right-image-fid-ajax-wrapper]',		panel).css('display','none');
						break;
				} // switch..case
			} // function..changeState
			
			$('.gs-field-type .form-radios .form-radio:checked', context).each(function () {
				changeState(this);
			}); // click

			$('.gs-field-type .form-radio', context).click(function () {
				changeState(this);
			}); // click
		} // attach
	};// Drupal.behaviors
}(jQuery));
;
(function ($) {
	Drupal.behaviors.gs_menu_default_create = {
		attach: function(context, settings) {
			//-- if we are in the context of editing Project content,
			//-- update the menu to put this content under the client
			//-- we have chosen.
			$('#edit-field-client-name-und').change( function() {
				var currClient = $('option:selected',this).text();
				$("#edit-menu-parent option")
					.filter(function(){ return $(this).text().replace(/^-*\s/,'')==currClient; })
					.attr("selected", "selected"); //-- jQuery 1.6 will want "prop" instead
			}); // change
		} // attach
	};// Drupal.behaviors
}(jQuery));
;

