 $(document).ready(function(){
	
	// ***cookies 
	
	if(!$.cookie('viewCountyId')){	
		$.cookie('viewCountyId', 'all');	
	}
	
	var c = $.cookie('viewCountyId');
	$("#county_id").val(c);


	 $('#county_id').change(function() {
		var countyId = $(this).val();
		$.cookie('viewCountyId', countyId);
		
		var countyName =$('#county_id :selected').text();
		$.cookie('viewCountyName', countyName);
	});
	

	$('#ctest').click(function(){
		
		var c = $.cookie('viewCountyId');
			alert(c);

		var cn = $.cookie('viewCountyName');
			alert(cn);
	})

	$('#ctestoff').click(function(){	
		$.cookie('viewCountyId', 'null');
		$.cookie('viewCountyName','null');
		
		var c = $.cookie('viewCountyId');		
			alert(c);
	})
	
	// *** end cookies 
	
	
	
	// NAV - SUPERFISH/SUCKERFISH
	$('ul.sf-menu').superfish({ 
               hoverClass:    'sfHover',          // the class applied to hovered list items 
				pathClass:     'overideThisToUse', // the class you have applied to list items that lead to the current page 
				pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass 
				delay:        	0,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
				animation:     {height:'show'},   // an object equivalent to first parameter of jQueryÕs .animate() method 
				speed:         'fast',           	// speed of the animation. Equivalent to second parameter of jQueryÕs .animate() method 
				disableHI:     true,              // set to true to disable hoverIntent detection 
				onInit:        function(){},       // callback function fires once Superfish is initialised Ð 'this' is the containing ul 
				onBeforeShow:  function(){},       // callback function fires just before reveal animation begins Ð 'this' is the ul about to open 
				onShow:        function(){},       // callback function fires once reveal animation completed Ð 'this' is the opened ul 
				onHide:        function(){},        // callback function fires after a sub-menu has closed Ð 'this' is the ul that just closed 
			
				autoArrows:  false,                           // disable generation of arrow mark-up 
				dropShadows: false                            // disable drop shadows 
        }); 
        

	
	//set class for links to external sites and other document types
	$('#content a[href^="http://"]').addClass('external').attr('target', '_blank');
	$('#content a[href$=".pdf"]').addClass('pdf').attr('target','_blank');
	$('#content a[href$=".ppt"]').addClass('powerpoint').attr('target','_blank');
	$('#content a[href$=".doc"]').addClass('word').attr('target','_blank');
	$('#content a[href$=".xls"]').addClass('excel').attr('target','_blank');
	$('#content a[href$=".csv"]').addClass('excel').attr('target','_blank');
	
	$('#content a.remove_external').removeClass('external').attr('target', '_blank');


	// facebox for video popup
	$('a[rel*=facebox]').facebox();	


/*		
	$('.social_column a[href^="http://"]').removeClass('external').attr('target', '_blank');
*/	
	
	
	$('.view_details').click(	
		function(){
			var toggleHide = 'images/templates/hide.png';
			var toggleShow = 'images/templates/view.png';
			var eDiv = $('div.'+$(this).attr('rel'));
			var eImg = $(this).children('img');

		if(eDiv.is(':hidden')){
				$(this).children('img').attr('src', toggleHide);
				eDiv.show('slow');							
			}	
			
		else if(eDiv.is(':visible')){
				$(this).children('img').attr('src', toggleShow);
				eDiv.hide('slow');							
			}
		 $(this).blur();
	});

		
	// sidemenu submenu  onclick show page content and hides any previous opened
	$('.view_subpage').click(	
		function(){
			
			var eDiv = $('div.'+$(this).attr('rel'));
			var oDiv = $('div[class*=menudiv_]');

		if(eDiv.is(':hidden')){
			oDiv.hide('slow');
			eDiv.show('slow');
		}	
		else if(eDiv.is(':visible')){
				eDiv.hide('slow');
		}
		 $(this).blur();		
	});


}); /* END DOCUMENT READY */




