// JavaScript Document
 $(document).ready(function(){
 		$('img[@src$=.png]').ifixpng(); 
		 $("#photogallery").jqGalScroll({height:367,width:550,speed:400,titleOpacity:0,direction:'vertical'});
		 $("#contactform").validate({ 
		rules: { 
			firstname: "required", 
			lastname: "required", 
			email: { 
				required: true, 
				email: true 
			},
			fileupload: {
				required: false,
				accept: "jpg|jpeg|gif|png"
			}
			
			
		}, 
		messages: { 
			firstname: "Please enter your name", 
			lastname: "Please enter your name", 
			email: "Please enter a valid email address",
			fileupload: "Please only upload images"
			} 
		});    	 
	 	if (self.document.location.hash.substring(1) ==	"service") {
			$("#sendto").val(0);
		} else if (self.document.location.hash.substring(1) ==	"question") {
			$("#sendto").val(1);
		} else if (self.document.location.hash.substring(1) ==	"comment") {
			$("#sendto").val(2);
		} else if (self.document.location.hash.substring(1) ==	"happycustomers") {
			$("#sendto").val(3);
			$("#uploader").slideDown();
		} else if (self.document.location.hash.substring(1) ==	"aroundtheworld") {
			$("#sendto").val(4);
			$("#uploader").slideDown();
		} else if (self.document.location.hash.substring(1) ==	"socialist") {
			$("#sendto").val(5);
		} else if (self.document.location.hash.substring(1) ==	"products") {
			$("#sendto").val(6);
		} else if (self.document.location.hash.substring(1) ==	"press") {
			$("#sendto").val(7);
		} else if (self.document.location.hash.substring(1) ==	"jobs") {
			$("#sendto").val(8);
		} else if (self.document.location.hash.substring(1) ==	"chad") {
			$("#sendto").val(9);
		} else if (self.document.location.hash.substring(1) ==	"jeff") {
			$("#sendto").val(10);
		}
	});

    function showField(value){
    		if(value == 3 || value == 4){
   	 		   	$("#uploader").slideDown();
   	 		}else{
   	 			$("#uploader").slideUp();
   	 		}
   	 	}

   	 	
   	 	
	function showdiv(state){
	
		if (state == "all"){
		document.getElementById('northernca').style.display = "block";
		
		document.getElementById('southernca').style.display = "block";
		
		document.getElementById('tx').style.display = "block";
		
		document.getElementById('or').style.display = "block";
		
		document.getElementById('il').style.display = "block";
		
		document.getElementById('wy').style.display = "block";
		
		document.getElementById('wa').style.display = "block";
		
		document.getElementById('japan').style.display = "block";
		document.getElementById('canada').style.display = "block";
		document.getElementById('online').style.display = "block";
		document.getElementById('indonesia').style.display = "block";
		document.getElementById('co').style.display = "block";
		document.getElementById('fl').style.display = "block";
		document.getElementById('ks').style.display = "block";
		document.getElementById('mi').style.display = "block";
		document.getElementById('la').style.display = "block";
		document.getElementById('mo').style.display = "block";
		document.getElementById('nd').style.display = "block";
		document.getElementById('ny').style.display = "block";
		document.getElementById('mo').style.display = "block";
		document.getElementById('mn').style.display = "block";
			
		
		}else{
	
		//first turn all off
		document.getElementById('northernca').style.display = "none";
		
		document.getElementById('southernca').style.display = "none";
		
		document.getElementById('tx').style.display = "none";
		
		document.getElementById('or').style.display = "none";
		
		document.getElementById('il').style.display = "none";
		
		document.getElementById('wy').style.display = "none";
		
		document.getElementById('wa').style.display = "none";
		
		document.getElementById('japan').style.display = "none";
		document.getElementById('canada').style.display = "none";
		document.getElementById('online').style.display = "none";
		document.getElementById('indonesia').style.display = "none";
		document.getElementById('co').style.display = "none";
		document.getElementById('fl').style.display = "none";
		document.getElementById('ks').style.display = "none";
		document.getElementById('mi').style.display = "none";
		document.getElementById('la').style.display = "none";
		document.getElementById('mo').style.display = "none";
		document.getElementById('nd').style.display = "none";
		document.getElementById('ny').style.display = "none";
		document.getElementById('mo').style.display = "none";
		document.getElementById('mn').style.display = "none";
		
		//show the one we like
		
		document.getElementById(state).style.display = "block";
		
	}
	
}
	sfHover = function() {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
			
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);