function updateStates(container, selector) {
	list = new Array();
	$(selector, container).each(function(index, ele){
		list[index] = $(ele).css('display') == 'none' ? false : true;
	});
	$.setCookie('collapse', list, 10);
}

function fixPanels() {
	list = $.getCookie('collapse') + "";
	list = list.split(',');
	for (i in list) {
		if (list[i] == 'false') {
			$('.collapse:eq('+i+')').next(".collapseContent").slideToggle(600);
		}
	}
}

$(document).ready(function() {

	$("#slider1").easySlider({
				//auto: true,
				continuous: true 
			});
	$("#slider2").easySlider({
				//auto: true,
				continuous: true ,
				prevId: 'prevBtn2',
				nextId: 'nextBtn2'
			});
		fixPanels();

	// add maxlength capability to any item that have maxlength_XXX class
	// replace XXX with max number of characters
	$("[class*=maxlength]").each( function(){
		var classes = $(this).attr('class').split(" ");
		var iter;
		var class_split;
		var length;

		for (iter in classes) {
			if (classes[iter].match("maxlength_")){
				class_split = classes[iter].split("_");
				length = class_split[1];
				$(this).maxlength({ maxCharacters: length });
			}
		}
	});

	tooltip();// jquery tooltips
	
	// [s] jquery tabs
	$.tabs("tabbedWrapper1");
	$.tabs("tabbedWrapper2");
	$.tabs("tabbedWrapper3");
	// this opens the details page to appropriate tab if needed
	var tabs = ['tabbedWrapper2', 'tabbedWrapper3']; //array of tabs
			for(var i = 0, length = tabs.length; i < length; i++){
				var tabcheck = new RegExp("^.*\?.*" + tabs[i] + "=([^&]+).*$"); //build regex for this tab, to parse out tab id from link

				if(tabcheck.test(location.href)){ //test if there is a value for the tab
					var tabhref = tabcheck.exec(location)[1]; //get element anchor id inside tab
					$("#" + tabs[i]+ ">ul>li>a[href='#" + tabhref +"']").click(); //simulate click event
				}
			}
	// [e] jquery tabs

	// [s] jquery collapsible content ### panels disabled for now ###
	/*
	$(".collapse").click(function(){
		$(this).next(".collapseContent").slideToggle(600, function(){
			updateStates($(this).parent(), '.collapseContent');
		});
	});
	*/
	// [e] jquery collapsible content
	
		
<!-- language selection drop box -->	
	
		$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
		
		$("ul.topnav li span").click(function() { //When trigger is clicked...
			
			//Following events are applied to the subnav itself (moving subnav up and down)
			$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
	
			$(this).parent().hover(function() {
			}, function(){	
				$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
			});
	
			//Following events are applied to the trigger (Hover events for the trigger)
			}).hover(function() { 
				$(this).addClass("subhover"); //On hover over, add class "subhover"
			}, function(){	//On Hover Out
				$(this).removeClass("subhover"); //On hover out, remove class "subhover"
		});

<!-- /language selection drop box -->

});
