$(document).ready(function(){
				   
	$(window).load(function() {
					
		//var theCookie = $("#checkUser").val();
		//if(theCookie == 0 ){
		//if (theCookie = null && ! theCookie){
			
			$.fn.smartBackgroundImage = function(url){
				var t = this;
				$('<img />').attr('src', url).load(function(){
											  
					t.each(function(){ 
						$(this).css('backgroundImage', 'url('+url+')' );
					});
					
				});
				
			   return this;
			   
			 }
	
			$('#lightbox').smartBackgroundImage('/images/pop_bbqSurvey.png');
			$("#lightbox").slideDown("slow");					
			$("#takeSurvey").click(function(){
				window.document.location = '/Scripts/Ajax/surveyRedirect.ajax.asp?path=http://www.surveymonkey.com/s/2R3TVZS';		  
			});
			
			$("#noThanks").click(function(){
					$("#lightbox").slideUp("slow");	  
			});
				
		//}
	});
			
	//because ie doesnt allow opacity on transparent images, just switch the image instead of changing opacity
	if(navigator.appName == "Microsoft Internet Explorer"){
		//Hover event for main navigation
		$('div.home_rollovers').hover(
			function() {
				var original = document.getElementById(this.id + "Button")
				var opaque = document.getElementById(this.id + "ButtonOpaque")
				original.style.display = "none";
				opaque.style.display = "block";
			},
			function() {
				var original = document.getElementById(this.id + "Button")
				var opaque = document.getElementById(this.id + "ButtonOpaque")
				original.style.display = "block";
				opaque.style.display = "none";
			}
		);
	
	//Use the fade animation for ff and safari
	}else{
		
		//Hover event for main navigation
		$('div.home_rollovers').hover(
			function() {
				$(this).fadeTo("fast",0.4);
			},
			function() {
				$(this).fadeTo("fast",1);
			}
		);
	}
	
	$("a[href$='pdf']").addClass("pdf");
		
 });

function showSubNavMenu(id){
	
	$('<div class="tab" id="sideNavTab_'+id+'"><a href="javascript:void(0)" class="sideNavOpenButton" onClick="closeSubNavMenu('+id+')">x</a></div>').replaceAll("#sideNavTab_"+id);
	var tempArray = getByClass("subMenu");
	for (i=0; i<tempArray.length; i++) {
		if(tempArray[i].style.display == 'block'){
			$(tempArray[i]).hide("fast")
		}
	}
	$("#subMenu"+id).show("fast");
	
}

function closeSubNavMenu(id){
	
	//$("#subMenu"+id).slideUp("fast");
	//$("#subMenu"+id).fadeOut("slow");
	$('<div class="tab" id="sideNavTab_'+id+'"><a href="javascript:void(0)" class="sideNavOpenButton" onClick="showSubNavMenu('+id+')">+</a></div>').replaceAll("#sideNavTab_"+id);
	$("#subMenu"+id).hide("fast");
	
}

