if (document.images) {
		window.name = "FramWindow";
		window.focus();
	}
	
	function submitLink(url) {
		document.form1.action = url;
		document.form1.target = "_blank";
		document.form1.submit();
	}
	
	/* ******************************************************************************* */	
	
	function siteMap() {
		sitemap = window.open('../sitemap/index.php', 'sitemap', "scrollbars=yes,width=750,height=500");
		sitemap.focus();
	}

	/* ******************************************************************************* */
	
	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");
	}

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

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

	/* ******************************************************************************* */	
	
	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 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 newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}
	
	/* ******************************************************************************* */
	
	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 openXrefWin() {
		window.open('/partsCatalog/xref.php', 'popup', 'location=0,menubar=0,titlebar=0,scrollbars=yes,resizable=yes,width=815,height=710');
	}
	
	/* ******************************************************************************* */
	
	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];
			}
		}
	}
	
	/* ******************************************************************************* */
	
	function heroAnimation() {
		openWin('/hero/pop.php?b=fram', '720', '375', 'no', 'no', 'no', 'no');
	}
	
	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");
			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) {
					alert( "Please fill out your first name.");
					return false;
			}
				else if(! lastName.value) {
					alert( "Please fill out your last name.");
					return false;
			}
				else if(! displayName.value) {
					alert( "Please fill out your display name.");
					return false;
			}
				else if(! state.options[state.selectedIndex].value) {
					alert( "Please fill out your state.");
					return false;
			}
				else if(! zip.value) {
					alert( "Please fill out your zip code.");
					return false;
			}
				else if(!gender[0].checked && !gender[1].checked) {
					alert( "Please fill out your gender.");
					return false;
			}
				else if(! emailAddr1.value || !emailAddr2.value) {
					alert( "Please fill out your email address.");
					return false;
			}
				else if(! pass1.value ||! pass2.value ) {
					alert( "Please fill out your password.");
					return false;
			}				
				else if(! carNick.value) {
					alert( "Please fill out your car's nick name.");
					return false;
			}
				else if(! carYear.value || carYear.value == 'null') {
					alert( "Please fill out your car's year.");
					return false;
			} 	
				else if(!carMake.value || carMake.value == 'null') {
					alert( "Please fill out your car's Make.");
					return false;
			}	else if(!carModel.value || carModel.value == 'null') {
					alert( "Please fill out your car's Model.");
					return false;
			}	else if(! currentMileage.value) {
					alert( "Please fill out your car's Mileage.");
					return false;
			}
				else if(! milesPerMonth.value) {
					alert( "Please fill out your car's Miles Per Month.");
					return false;
			}
				
			//}
			if (emailAddr1.value != emailAddr2.value) {
				alert( "Your Email Addresses don't match");
				return false;
			}
			if (pass1.value != pass2.value) {
				alert( "Your 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 init()
	{
		preloadImages();
		homeButtons();
	}
	
	var menuY    	= 77;
	productsMenu    = new AnimatedMenu("productsMenu", "down", 235, menuY, 120, 280);
	partsCatalogMenu	= new AnimatedMenu("partsCatalogMenu", "down", 310, menuY, 100, 120);
	carCareMenu   	= new AnimatedMenu("carCareMenu", "down", 476, menuY, 100, 120);
	companyMenu		= new AnimatedMenu("companyMenu", "down", 541, menuY, 100, 120);
	motorSportsMenu	= new AnimatedMenu("motorSportsMenu", "down", 608, menuY, 120, 120);
	
	
/* ********************************************************************************* */

/* HOME PAGE BUTTON POPUPS */

function homeButtons () {


	$('#homeMain #btn_4 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_7 a').click(
		function (){
			var href = $(this).attr('href');
			
			var newWindow = window.open(href,'popup','width=750,height=450,left=0,top=0,toolbar=No,location=No,status=No,resizable=yes,scrollbars=yes,fullscreen=No');  
			newWindow.focus();
			
			return false;
		}
	);
	
}
	
