function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function setLang(mylang) {
	document.mylangform.mylang.value = mylang;
	document.mylangform.submit();
}

MM_preloadImages('../english_home/navbar/nav_bar_du_f2.gif','../english_home/navbar/nav_bar_es_f2.gif','../english_home/navbar/nav_bar_fr_f2.gif','../english_home/navbar/nav_bar_home_en_f2.gif','../english_home/navbar/nav_bar_companypro_en_f2.gif','../english_home/navbar/nav_bar_prod_en_f2.gif','../english_home/navbar/nav_bar_prodcat_en_f2.gif','../english_home/navbar/nav_bar_lit_en_f2.gif','../english_home/navbar/nav_bar_news_en_f2.gif','../english_home/navbar/nav_bar_careers_en_f2.gif','../english_home/navbar/nav_bar_hortonstore_en_f2.gif','../english_home/navbar/nav_bar_contact_en_f2.gif');

function openSearch(pSearchType) {
	openWin("search", "search.asp?dboProductType=" + pSearchType,800,600);
}

function openWin(pName, pURL, pWidth, pHeight){
	//winprops = 'height='+pHeight+',width='+pWidth+',top='+100+',left='+100+',scrollbars='+1 +",resizable="  + 1 + ",status=1"
	//aWindow = window.open("",  pName ,winprops);
	aWindow = window.open("",  pName);
	aWindow.location.href=pURL;
	aWindow.focus();
}

// -------------------------------------------------------------

function submitForm(pType){
	var sValue;
	switch (pType) {
		case "fanDriveApp":
			//window.alert("got here");
			if (document.frmCatalog.dboFanDriveApp.value == -2)
			{
				window.open("./catalogs/pdfs/Europe/HortonEurope_fan_drive_AppsWeb.pdf","catdoc");
			}
			else if (document.frmCatalog.dboFanDriveApp.value != 0)
			{
				sValue= document.frmCatalog.dboFanDriveApp.options[document.frmCatalog.dboFanDriveApp.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else
				{
					window.location = "fan_drive_apps.asp?truck_id=" + sValue + "&units=" + document.settingsForm.units.value;
				}
			}
			break;
		case "fanBladeApp":
			return true;
			break;
			// this function no longer used

			if (document.frmCatalog.dboFanBladeApp.value == -2)
			{
				window.open("./catalogs/pdfs/Europe/WindMasterHFSPagesWeb.pdf","catdoc");
			}
			else if (document.frmCatalog.dboFanBladeApp.value != 0)
			{
				sValue= document.frmCatalog.dboFanBladeApp.options[document.frmCatalog.dboFanBladeApp.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else if (sValue == "18")
				{
					window.location = "fan_blade.asp?component_id=18"  + "&units=" + document.settingsForm.units.value;
				}
				else
					window.location = "mod_search.asp?searchType=app&dboProductType=6&dboTruckMan=" + sValue + "&dboYear=0&dboTruckModel=0&dboEngineMan=0&dboEngineModel=0&x=34&y=9"  + "&units=" + document.settingsForm.units.value;
			}
			break;
		case "fanBladeAcc":
			if (document.frmCatalog.dboFanBladeAcc.value != 0)
			{
				sValue= document.frmCatalog.dboFanBladeAcc.options[document.frmCatalog.dboFanBladeAcc.selectedIndex].value
				if (sValue == "1")
				{
					window.location = "fan_blade.asp?component_id=16"  + "&units=" + document.settingsForm.units.value;
				}
				else if (sValue == "2")
				{
					window.location = "fan_blade.asp?component_id=17"  + "&units=" + document.settingsForm.units.value;
				}
				else if (sValue == "18")
				{
					window.location = "fan_blade.asp?component_id=18"  + "&units=" + document.settingsForm.units.value;
				}
				else
				{
					window.self.location.reload();
				}
			}
			break;
		case "directDriveApp":
			if (document.frmCatalog.dboDirectDriveApp.value != 0)
			{
				sValue = document.frmCatalog.dboDirectDriveApp.options[document.frmCatalog.dboDirectDriveApp.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else
					window.location = "direct_drive_apps.asp?truck_id=" + sValue + "&units=" + document.settingsForm.units.value;
			}
			break;

		case "fanDriveDim":
			if (document.frmCatalog.dboFanDriveDim.value == -2)
			{
				window.open("./catalogs/pdfs/Europe/HortonEurope_fan_drive_dimWeb.pdf","catdoc");
			}
			else if (document.frmCatalog.dboFanDriveDim.value != 0)
			{
				sValue = document.frmCatalog.dboFanDriveDim.options[document.frmCatalog.dboFanDriveDim.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else
				{
					window.location = "fan_drive_dim.asp?engine_id=" + sValue + "&units=" + document.settingsForm.units.value;
				}
			}
			break;
		case "directDriveDim":
			if (document.frmCatalog.dboDirectDriveDim.value != 0)
			{
				sValue = document.frmCatalog.dboDirectDriveDim.options[document.frmCatalog.dboDirectDriveDim.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else
					window.location = "direct_drive_dim.asp?engine_id=" + sValue + "&units=" + document.settingsForm.units.value;
			}
			break;
		case "crossReference":
			if (document.frmCatalog.dboCrossReference.value != 0) {
				sValue=document.frmCatalog.dboCrossReference.options[document.frmCatalog.dboCrossReference.selectedIndex].value;
				if (sValue == "search") {
					window.self.location.reload();
					openSearch();
				} else {
					window.location = "cross_reference.asp?engine_mfg=" + document.frmCatalog.dboCrossReference.options[document.frmCatalog.dboCrossReference.selectedIndex].value + "&units=" + document.settingsForm.units.value;;
				}
			}
			break;
		case "repairKit":
			if (document.frmCatalog.dboRepairKit.value == 999)
				window.location = "RepairOptions.asp";
			else if (document.frmCatalog.dboRepairKit.value >= 0)
			{
				sValue=document.frmCatalog.dboRepairKit.options[document.frmCatalog.dboRepairKit.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else
				{
					window.location = "repair_kit.asp?type_id=" + document.frmCatalog.dboRepairKit.options[document.frmCatalog.dboRepairKit.selectedIndex].value + "&units=" + document.settingsForm.units.value;
					//window.location = "repair_options_2.asp?type_id=" + document.frmCatalog.dboRepairKit.options[document.frmCatalog.dboRepairKit.selectedIndex].value;
				}
			}
			break;
		case "fanBlades":
			if (document.frmCatalog.dboFanBlade.value == -2)
			{
				window.open("./catalogs/pdfs/Europe/WindMasterHFSPagesWeb.pdf","catdoc");
			}
			else if (document.frmCatalog.dboFanBlade.value != 0)
			{
				sValue=document.frmCatalog.dboFanBlade.options[document.frmCatalog.dboFanBlade.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else if (sValue == "18")
				{
					window.location = "fan_blade.asp?component_id=18"  + "&units=" + document.settingsForm.units.value;
				}
				else
				{
					window.location = "fan_blade.asp?component_id=" + sValue + "&dim_id=" + sValue  + "&units=" + document.settingsForm.units.value;
				}
			}
			break;
		case "fanBladeDia":
			sValue=document.frmCatalog.dboFanBladeDia.options[document.frmCatalog.dboFanBladeDia.selectedIndex].value;
			window.location = "fan_blade.asp?component_id=-5" + "&dim_id=" + sValue  + "&units=" + document.settingsForm.units.value;
			break;

		case "fanDrivePart":
			if (document.frmCatalog.dboFanDrivePart.value != 0)
			{
				sValue=document.frmCatalog.dboFanDrivePart.options[document.frmCatalog.dboFanDrivePart.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else
				{
					//window.location = "mod_fan_drive_part.asp?id=" + sValue + "&units=" + document.settingsForm.units.value;
					var sURL = '';
					switch (sValue) {
						case '1': {
							sURL = './sub_bracket.asp';
							break; }
						case '2': {
							sURL = './tensioner.asp';
							break; }
						case '3': {
							sURL = './pulley.asp';
							break; }
						case '4': {
							sURL = './misc_acc.asp';
							break; }
						default : {}
					}  // end switch
					window.location.href = sURL;
				}	// end else
			}	// end case
			break;
		case "fanDriveReman":
			if (document.frmCatalog.dboFanDriveReman.value == -2)
			{
				window.open("./catalogs/pdfs/reman/22515.pdf", "catdoc");
				return;
			}
			if (document.frmCatalog.dboFanDriveReman.value == -3)
			{
				window.open("./catalogs/pdfs/reman/22818.pdf", "catdoc");
				return;
			}
			if (document.frmCatalog.dboFanDriveReman.value != 0)
			{
				sValue=document.frmCatalog.dboFanDriveReman.options[document.frmCatalog.dboFanDriveReman.selectedIndex].value;
				window.location = "core_id.asp?engine_mfg_id=" + sValue;
				return;
			}
			break;

		case "pneumatic":
			if (document.frmCatalog.dboPneumatic.value == -2)
			{
				window.open("./catalogs/pdfs/Europe/WireGuardHFSPagesWeb.pdf", "catdoc");
			}
			else if (document.frmCatalog.dboPneumatic.value == -3)
			{
				window.location = "/product/roller_bushings.asp";
			}
			else if (document.frmCatalog.dboPneumatic.value == -4)
			{
				window.open("./catalogs/pdfs/22822.pdf", "catdoc");
			}
			else if (document.frmCatalog.dboPneumatic.value != 0)
			{
				sValue=document.frmCatalog.dboPneumatic.options[document.frmCatalog.dboPneumatic.selectedIndex].value;
				if (sValue == "search")
				{
					window.self.location.reload();
					openSearch();
				}
				else
				{
					//window.location = "mod_pneumatic.asp?id=" + sValue + "&units=" + document.settingsForm.units.value;
					switch (sValue) {
						case '1': {
							sURL = 'pneu_solenoid_valve.asp';
							break; }
						case '2': {
							sURL = 'pneu_thermal_switch.asp';
							break; }
						case '4': {
							sURL = 'pneu_ac_pressure_valve.asp';
							break; }
						case '5': {
							sURL = 'pneu_restrictor_valve.asp';
							break; }
						case '6': {
							sURL = 'pneu_misc.asp';
							break; }
						case '9':{
							sURL = 'show_content.asp?content=144&title=Pneumatic%20Fan%20Drive%20Cntrls&subtitle=Selecting%20Proper%20Controls';
							break; }
					}

					window.location.href = sURL;
				}
			}
			break;

		default:
	}
	//document.frmCatalog.dboFanDriveApp.value = 0;
	document.frmCatalog.dboCrossReference.value = 0;
	//document.frmCatalog.dboDirectDriveApp.value = 0;
	document.frmCatalog.dboDirectDriveDim.value =0;
	document.frmCatalog.dboFanBlade.value=0;
	document.frmCatalog.dboFanDriveDim.value=0;
	document.frmCatalog.dboFanDrivePart.value=0;
	document.frmCatalog.dboPneumatic.value=0;
	document.frmCatalog.dboRepairKit.value=0;


}


function setConversionType()
{
	
	if (document.settingsForm.units.value == 'metric')
	{
		document.settingsForm.convert.value = 'View in Metric units';
		document.settingsForm.units.value = 'english';
		document.getElementById("unitsOfMeasure").innerHTML = "ENGLISH";
	}
	else
	{
		document.settingsForm.convert.value = 'View in English units';
		document.settingsForm.units.value = 'metric';
		document.getElementById("unitsOfMeasure").innerHTML = "METRIC";
	}
	
	//window.location.href = "index.asp";
}

function setFilterStuff()
{// this is disabled by request of client
	/*if (document.frmCatalog.filterField.value == 'On')
	{
		document.frmCatalog.filterField.value = 'Off';
		document.frmCatalog.filterButton.value = 'On';
	}
	else
	{
		document.frmCatalog.filterField.value = 'On';
		document.frmCatalog.filterButton.value = 'Off';
	}*/
}

function fixConversionButton()
{
	if (document.settingsForm.units.value == 'metric')
		document.settingsForm.convert.value = 'View in English units';
	else
		document.settingsForm.convert.value = 'View in Metric units';
}

function gotoSearch()
{
	window.location = "search2.asp?dboProductType=undefined&units=" + document.settingsForm.units.value;
}
