﻿$(document).ready(function() { 
    $('#cartoons').cycle({ timeout:5000, pause:1 });

    $("#whyus li > a.current").parent().hide();
    $("li[class^='team/'] > a.current").parent().hide();

		$('#newslist .newstext').expander({
			slicePoint: 80, 
			widow: 2,
			expandEffect: 'show', 
			userCollapseText: 'close text'
		});
		
		$('.expander').expander({
			slicePoint: 80, 
			widow: 2,
			expandEffect: 'show', 
			userCollapseText: 'close text'
		});

		var contentaccordian = $("#contentaccordian").accordion({ 
		change: function(event, ui) {
			var openid = $("#contentaccordian").accordion().accordion('option', 'active');
			$("#contentaccordian h3").each(function (i) {
        $(this).html($(this).html().replace("Close this section","Open this section"));
			});
		  if(openid !== false){
				$("#contentaccordian h3:eq(" + openid + ")").html($("#contentaccordian h3:eq(" + openid + ")").html().replace("Open this section","Close this section"));
			}
		},
		active:false, collapsible: true, autoHeight: false, clearStyle: true }); 
		 
		//$("h3.title", contentaccordian).each(function(index) { 
				//$(this) 
				//.next() 
				//.children(":button") 
				//.filter(".next, .previous") 
				//.click(function() { 
						//contentaccordian.accordion("activate", index + ($(this).is(".next") ? 1 : -1)) 
				//}); 
		//});

});

function toggleLayer(whichLayer) {
    $("#" + whichLayer).toggle();
}

function showLayer( whichLayer ) {
    $("#" + whichLayer).show();
}

function hideLayer( whichLayer ) {
    $("#" + whichLayer).hide();
}

