if (document.images) {
	    window.name = "AutoliteWindow";
		window.focus();
	}
	
	
	function siteMap() {
		sitemap = window.open('../sitemap/index.php', 'sitemap', "scrollbars=yes,width=750,height=500");
		sitemap.focus();
	}

	/* ******************************************************************************* */	
	
	function submitLink(url) {
		document.form1.action = url;
		document.form1.target = "_blank";
		document.form1.submit();
	}
	
	/* ******************************************************************************* */
	
	function openWTB(product) {
		if (product != "") {
			window.open('/products/whereToBuy.php?product=' + product, 'popup', 'location=0,menubar=0,titlebar=0,scrollbars=yes,resizable=yes,width=815,height=710');
		}
	}

	/* ******************************************************************************* */
	
	function joinNewsletter() {
		Newsletter = window.open('../newsletter/index.php', 'Newsletter', "scrollbars=yes,width=750,height=450");
		Newsletter.focus();
	}

	/* ******************************************************************************* */
	
	function getSearch(form)
	{
		window.open('/search/index.php?key='+searchForm.key.value, 'l', "scrollbars=yes,resizable=yes,location=no,toolbar=no,width=785").focus();
		//alert("The search feature will be activated soon.");
	}

	/* ******************************************************************************* */	
	
	function loginPopup()
	{
		//window.open('/login.php', 'login', "scrollbars=auto,width=300,height=200,top=0,left=0");
		window.location = "/mycar/signup.php?location="+ window.location.href;
	}

	/* ******************************************************************************* */	
	
	function signUpPopup()
	{
		//window.open('/mycar/stub_createProfile.php', 'signup', "scrollbars=auto,width=400,height=500,top=0,left=0");
		window.location = "/mycar/signup.php?location="+ window.location.href;
	}

	/* ******************************************************************************* */	
		
	
	function enlargeView(file)
	{
		window.open(file, 'enlargedView', "scrollbars=auto,width=825,height=625,top=0,left=0");
	}

	/* ******************************************************************************* */
	
	function getPressRelease(year,article)
	{
		window.open('/company/press.php?year='+year+'&article='+article, 'l', 
			"scrollbars=yes,resizable=yes,location=no,toolbar=no,width=700").focus();
	}
	
	/* ******************************************************************************* */
	
	function getPressRelease_es(year,article)
	{
		window.open('/company/press_es.php?year='+year+'&article='+article, 'l', 
			"scrollbars=yes,resizable=yes,location=no,toolbar=no,width=700").focus();
	}

	/* ******************************************************************************* */
	
	function contactPage() {
		window.open('/contact.php', 'contact', "scrollbars=yes,resizable=yes,location=no,toolbar=no,height=700,width=700").focus();
	}

	/* ******************************************************************************* */	
	
	function heroAnimation() {
		openWin('/hero/pop.php', '720', '375', 'no', 'no', 'no', 'no');
	}
	 
	var menuY    		= 77;
	productsMenu    	= new AnimatedMenu("productsMenu", "down", 229, menuY, 230, 280);
	motorCyclesMenu     = new AnimatedMenu("motorCyclesMenu", "down", 302, menuY, 100, 120);
	carCareMenu   		= new AnimatedMenu("carCareMenu", "down", 521, menuY, 100, 120);
	partsCatalogMenu	= new AnimatedMenu("partsCatalogMenu", "down", 310, menuY, 100, 120);
	companyMenu			= new AnimatedMenu("companyMenu", "down", 590, menuY, 100, 120);
	motorSportsMenu		= new AnimatedMenu("motorSportsMenu", "down", 661, menuY, 120, 120);
	/*
	var menuY    		= 77;
	productsMenu    	= new AnimatedMenu("productsMenu", "down", 229, menuY, 230, 280);
	carCareMenu   		= new AnimatedMenu("carCareMenu", "down", 470, menuY, 100, 120);
	partsCatalogMenu	= new AnimatedMenu("partsCatalogMenu", "down", 310, menuY, 100, 120);
	companyMenu			= new AnimatedMenu("companyMenu", "down", 540, menuY, 100, 120);
	motorSportsMenu		= new AnimatedMenu("motorSportsMenu", "down", 605, menuY, 120, 120);
    */
	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}
	
	/* ******************************************************************************* */
	
	function changeImages() {
		if (document.images && (preloadFlag == true)) {
			for (var i=0; i<changeImages.arguments.length; i+=2) {
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}
	
	/* ******************************************************************************* */
	
	var preloadFlag = false;
	function preloadImages() {
		if (document.images) {
			menuHome_over = newImage("/images/menuHome_on.jpg");
			menuProducts_over = newImage("/images/menuProducts_on.jpg");
			menuPartsCat_over = newImage("/images/menuPartsCat_on.jpg");
			menuMyGarage_over = newImage("/images/menuMyGarage_on.jpg");
			menuCarCare_over = newImage("/images/menuCarCare_on.jpg");
			menuCompany_over = newImage("/images/menuCompany_on.jpg");
			menuMotorSports_over = newImage("/images/menuMotorSports_on.jpg");
			menuSpecialOffers_over = newImage("/images/menuSpecialOffers_on.jpg");			
			preloadFlag = true;
		}
	}
	
	/* ******************************************************************************* */
	function toggleVisibile(div) {
		var toggle = document.getElementById(div);
		if(toggle.style.display == 'none') {
			toggle.style.display = '';
		} else {
			toggle.style.display = 'none';
		}
	}
		/* ******************************************************************************* */	
	function makeVisible(div) {
		var toggle = document.getElementById(div);
		toggle.style.display = '';
	}
	/* ******************************************************************************* */	
	
	function surveyFluidsAns() {
		var ac = document.getElementById('acFluids');
		var oth = document.getElementById('otherFluids');
		ac.style.display = 'none';
		oth.style.display = 'none';
		
		var oChks= document.getElementsByName("q4[]")

		for(i=0;i<oChks.length;i++){
			if(oChks[i].checked==true){
				if(oChks[i].value == 42) {
					ac.style.display = '';
					break;
				}else {
					oth.style.display= '';
				}				
			 }
		}
	}
	
	/* ******************************************************************************* */	
	
	function myCarSignUp() {
		swf = getFlashMovieObject('mymovie');		
		//theyear = swf.GetVariable("/content:theyear");
		//themake = swf.GetVariable("/content:themake");
		//themodel = swf.GetVariable("/content:themodel");		
		document.myCarSignupForm.carYear.value = swf.GetVariable("/content:theyear");
		document.myCarSignupForm.carMake.value = swf.GetVariable("/content:themake");
		document.myCarSignupForm.carModel.value = swf.GetVariable("/content:themodel");
		
		if(chkForm()) document.forms.myCarSignupForm.submit();
	}
	
	/* ******************************************************************************* */	
	
	function chkForm() 
	{ /* checks form fields */
		with ( document.myCarSignupForm ) {
			if ( ! 	firstName.value
				|| ! lastName.value
				|| ! displayName.value
				|| ! state.options[state.selectedIndex].value
				|| ! zip.value
				//|| ! gender.value
				|| ! emailAddr1.value
				|| ! emailAddr2.value
				|| ! pass1.value
				|| ! pass2.value
				|| ! carNick.value
				|| ! carYear.value 	|| carYear.value == 'null'
				|| ! carMake.value	|| carMake.value == 'null'
				|| ! carModel.value	|| carModel.value == 'null'
				|| ! currentMileage.value
				|| ! milesPerMonth.value				
				) {
					alert( "Please make sure you have filled out all of the required fields before submitting.");
					return false;
			}
			if (emailAddr1.value != emailAddr2.value) {
				alert( "Email Addresses don't match");
				return false;
			}
			if (pass1.value != pass2.value) {
				alert( "Passwords don't match");
				return false;
			}			
			return true;	
		}
	
	} // {{ end chkForm()
	
	
	
	function getFlashMovieObject(movieName)	{
	  if (window.document[movieName]) 
	  {
		  return window.document[movieName];
	  }
	  if (navigator.appName.indexOf("Microsoft Internet")==-1)
	  {
		if (document.embeds && document.embeds[movieName])
		  return document.embeds[movieName]; 
	  }
	  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	  {
		return document.getElementById(movieName);
	  }
	}
/* ******************************************************************************* */	
	
	function openWin(url, w, h, resize,tools,loc,scrollb) {
		window.open(url, 'popup', 'resizable='+resize+',location='+loc+',toolbar='+tools+',width='+w+',height='+h+',scrollbars='+scrollb).focus();

	}	
	
	/* ******************************************************************************* */
	function init()
	{
		preloadImages();
		homeButtons();
	}

	
	/* ********************************************************************************* */

/* HOME PAGE BUTTON POPUPS */

function homeButtons () {
	
	/*$('#homeMain #btn_2 a').click(
		function (){
			var href = $(this).attr('href');
			
			var newWindow = window.open(href, 'popup', 'location=0,menubar=0,titlebar=0,resizable=yes,scrollbars,width=620,height=600');  
			newWindow.focus();
			
			return false;
		}
	);
*/
	$('#homeMain #btn_5 a').click(
		function (){
			var href = $(this).attr('href');
			
			var newWindow = window.open(href,'newWin','width=750,height=450,left=0,top=0,toolbar=No,location=No,status=No,resizable=yes,scrollbars=yes,fullscreen=No');  
			newWindow.focus();
			
			return false;
		}
	);
	
}
	
	
	