
//CONTROL JQUERY
	
	//FEATURE PANEL FUNCTIONS
	
	$(document).ready(function(){
		if(iAdminMode == 0){
			$(".contentEditWrapper").corner("5px");
			$(".subMenuWrapper").corner("5px");
			$(".panel").css('background','none');
		}
		else{
			$(".panel").css('background','#ccc');
		}
		
		$(".featureItemWrapper:first").show();
		var sBorder = "solid 1px " + $(".featureItemSelector:first").css("background-color")
		$(".featureItemWrapper").css('border-bottom',sBorder);
		
		$(".featureItemSelector:first").css('margin-top','-1px');
		$(".featureItemWrapper").corner("top 8px");
		$(".featureItemSelector").click(function(){
			$(".featureItemWrapper").hide();
			$(".featureItemSelector").css('margin-top','2px');
			$(this).css('margin-top','-1px');
			$("#" + $(this).attr("id").replace("_","")).show();
			var sBorder = "solid 1px " + ($(this).css("background-color"))
			$(".featureItemWrapper").css('border-bottom',sBorder);
		});
	});
	
	//END FEATURE PANEL FUNCTIONS
	
	//SUMMARY PANEL FUNCTIONS
	
	$(document).ready(function(){
		$(".control").corner("8px");
		 //slides the element with class "menu_body" when paragraph with class "menu_head" is clicked 
		$(".controlExpand").click(function()
		{
			
			if($(this).parent().next("div.controlBody").is(":visible")){
			   $(this).attr("src","shared/images/panel.arrow.right.gif").attr("alt","Show control").parent().next("div.controlBody").slideUp(300);
			}
			else {
				$(this).attr("src","shared/images/panel.arrow.down.gif").attr("alt","Hide control").parent().next("div.controlBody").slideDown(300);
				
			}
		});
			
		$(".controlItemBody").find("li:gt(4)").hide()
		//Add control item
		$(".controlItemAdd").click(function()
		{
			$(this).parent().parent().next(".controlItemBody").find("li:hidden:first").show();
			if($(this).parent().parent().next(".controlItemBody").find("li:last").is(":visible")){
				$(this).fadeTo(10,0.5);
			}
			$(this).next(".controlItemRemove").fadeTo(10,1);
		});
			
		//Remove control item
		$(".controlItemRemove").click(function()
		{
			$(this).parent().parent().next(".controlItemBody").find("li:visible:last").hide();
			if($(this).parent().parent().next(".controlItemBody").find("li:first").is(":hidden")){
				$(this).fadeTo(10,0.5);
			}
			$(this).prev(".controlItemAdd").fadeTo(10,1);
		});
		//Select visual item
		$(".summaryDiv").mouseover(function(){
			$(this).parent().find(".summaryDiv").css('font-weight','normal').removeClass("active")
			$(this).css('font-weight','bold').addClass("active")
			/* Replace Image */
			var sFileVariationID = $(this).attr("id").replace("div","")
			var sURL = "streamhandler.ashx?FileVariationID=" + sFileVariationID
			if (sFileVariationID == "") {sURL = "images/default.summary.image.jpg";}
			$(this).parent().find(".summaryImage").attr("src",sURL);
			/* Replace Link */
			var sLink = $(this).find("a").attr("href");
			$(this).parent().find(".summaryLink").attr("href",sLink);
			
			
			
		});
	});
	
	
	
	// GALLERY CAROUSEL FUNCTIONS
	$(document).ready(function(){
	
		$("div.panel.portal div.scrollable").scrollable({vertical:false, size: 2}); 
		$("div.panel.portal div.scrollable").css('width','250px');
		
		$("div.panel.main div.scrollable").scrollable({vertical:false, size: 3}); 
		$("div.panel.main div.scrollable").css('width','370px');
		
		$("div.panel.feature div.scrollable").scrollable({vertical:false, size: 4}); 
		$("div.panel.feature div.scrollable").css('width','490px');
		
		$("div.panel.master div.scrollable").scrollable({vertical:false, size: 5}); 
		$("div.panel.master div.scrollable").css('width','610px');
		
		$("div.panel:not(.portal,.main,.feature,.master) div.scrollable").scrollable({vertical:false, size: 1}); 
		$("div.panel:not(.portal,.main,.feature,.master) div.scrollable").css('width','130px');
		
	});
	
	//GALLERY STYLE FUNCTIONS
	
	//GALLERY STYLE
	
	//$(document).ready(function(){
	//	$('.feature #photos').galleryView({
	//		panel_width: 648,
	//		panel_height: 290,
	//		frame_width: 100,
	//		frame_height: 75,
	//		overlay_height: 30,
	//		transition_interval:0,
	//		overlay_opacity: 0.4,
	//		background_color:'#5c6a82'
	//	});
		
	//	$('.main #photos').galleryView({
	//		panel_width: 480,
	//		panel_height: 480,
	//		frame_width: 100,
	//		frame_height: 75,
	//		overlay_height: 30,
	//		transition_interval:0,
	//		overlay_opacity: 0.4,
	//		background_color:'#5c6a82'
	//	});
	//	$('.main #photos .imgPanel img').css('margin-left','40px');
	//	$('.main #photos .imgPanel .galleryBody').css('width','100%');
		
	//	$('.portal #photos').galleryView({
	//		panel_width: 318,
	//		panel_height: 490,
	//		frame_width: 100,
	//		frame_height: 75,
	//		overlay_height: 30,
	//		transition_interval:0,
	//		overlay_opacity: 0.4,
	//		background_color:'#5c6a82'
	//	});
	//	$('.portal #photos .imgPanel img').css('width','310px').css('margin-left','5px');
	//	$('.portal #photos .imgPanel .galleryBody').css('width','100%');
	//});
	
	//SECTION FEATURE PANEL FUNCTIONS
	//$(document).ready(function() {
	//	  $('.sectionFeatureItem').hide();  
	//	  $('.sectionFeatureItems > h4').click(function() {
	//	    $(this).next('div').slideToggle('fast')
	//	    .siblings('div:visible').slideUp('fast');
	//	  });
	//});
	
	//END SECTION FEATURE PANEL FUNCTIONS
	
//END CONTROL JQUERY


