function hideDiv(div_name,id) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(id).style.display = 'none'; 
	} 
	else { 
		if (document.layers) { // Netscape 4 
			document.div_name.display = 'none'; 
		} 
		else { // IE 4 
			document.all.div_name.style.display = 'none'; 
		} 
	} 
} 

function showDiv(div_name,id) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(id).style.display = 'block'; 
	} 
	else { 
		if (document.layers) { // Netscape 4 
			document.div_name.display = 'block'; 
		} 
		else { // IE 4 
				document.all.div_name.style.display = 'block'; 
		} 
	} 
} 

//hide one div and show other div
function hideShowDiv (show_div_name,show_id, hide_div_name, hide_id) { 

	hideDiv(hide_div_name,hide_id)
	showDiv(show_div_name,show_id)

}
//hide two divs
function hideDivs (hide_div_name,hide_id, hide_div_name2, hide_id2) { 

	hideDiv(hide_div_name,hide_id)
	hideDiv(hide_div_name2,hide_id2)
	
	

}



//check what option(lifts, escalators, moving walkways) is selected and show appropriate fields
function displaycorrectproduct()
{
	
	var selectname=document.form.product.selectedIndex
	
	switch (selectname) {
		
	case 1: //escalators selected
   			showDiv(escalators,'escalators')
			 hideDivs(lifts,'lifts',walkways,'walkways')
			hideDivs (hideshow2,'hideshow2',hideshow,'hideshow')
			hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
			hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
	case 2: //moving walkways selected
      
	 	  showDiv(walkways,'walkways')
		  hideDivs(escalators,'escalators',lifts,'lifts')
		  hideDivs (hideshow2,'hideshow2',hideshow,'hideshow')
	 	  hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
		  hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
  	 case 3: // lifts selected
	 		form.lifts_type.options[0].selected="selected"
			 showDiv(lifts,'lifts')
			showDiv(hideshow,'hideshow')
			hideDivs(escalators,'escalators',walkways,'walkways')
			hideDiv(hideshow2,'hideshow2')
			hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
			hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
	case 4: // platform lifts selected
			form.product.options[4].selected="selected"
			form.lifts_type.options[3].selected="selected"
  			 showDiv(lifts,'lifts')
			 showDiv(platform_lift_select,'platform_lift_select')
			 hideDivs(escalators,'escalators',walkways,'walkways')
			hideDivs(hideshow2,'hideshow2',hideshow,'hideshow')
			hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
			hideDiv (vertical_lift,'vertical_lift')
     	 break
 	default:
   	   break
	}
}

//display correct product via query string
function displayProduct()
{
var product_query=window.location.search.substring(1);


	switch (product_query) {
		
	case "escalators": //escalators selected
	
			form.product.options[1].selected="selected"
   			showDiv(escalators,'escalators')
			 hideDivs(lifts,'lifts',walkways,'walkways')
			hideDivs (hideshow2,'hideshow2',hideshow,'hideshow')
			hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
			hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
	case "walkways": //moving walkways selected
     	 form.product.options[2].selected="selected"
	 	  showDiv(walkways,'walkways')
		  hideDivs(escalators,'escalators',lifts,'lifts')
		  hideDivs (hideshow2,'hideshow2',hideshow,'hideshow')
	 	  hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
		  hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
  	 case "lifts": // lifts selected
	 		form.product.options[3].selected="selected"
  			showDiv(lifts,'lifts')
			showDiv(hideshow,'hideshow')
			hideDivs(escalators,'escalators',walkways,'walkways')
			hideDiv(hideshow2,'hideshow2')
			hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
			hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
	case "platformlifts": // platform lifts selected
			form.product.options[4].selected="selected"
			form.lifts_type.options[3].selected="selected"
  			showDiv(lifts,'lifts')
			showDiv(platform_lift_select,'platform_lift_select')
			hideDivs(escalators,'escalators',walkways,'walkways')
			hideDivs(hideshow2,'hideshow2',hideshow,'hideshow')
			hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
			hideDiv (vertical_lift,'vertical_lift')
     	 break
		 
	case "esc_outdoor_apps": // outdoor applications selected from escalators page
			form.product.options[1].selected="selected"
			form.esc_location.options[1].selected="selected"
   			showDiv(escalators,'escalators')
			 hideDivs(lifts,'lifts',walkways,'walkways')
			hideDivs (hideshow2,'hideshow2',hideshow,'hideshow')
			hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
			hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
	case "walkways_outdoor_apps": // outdoor applications selected from walkways page
		  form.product.options[2].selected="selected"
		  form.walkways_location.options[1].selected="selected"
	 	  showDiv(walkways,'walkways')
		  hideDivs(escalators,'escalators',lifts,'lifts')
		  hideDivs (hideshow2,'hideshow2',hideshow,'hideshow')
	 	  hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
		  hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
     	 break
		 
 	default:
   	   break
	}
}

//check what option(passenger, goods only, passenger goods, platform lifts) are selected and show appropriate fields
function displaycorrectoptions()
{
	var selectname=document.form.lifts_type.selectedIndex
	
	switch (selectname) {
	case 0: //passenger lifts selected, show hideshow
	
		hideShowDiv (hideshow,'hideshow',hideshow2,'hideshow2')
		hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
		hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
      break
   case 1: //passenger goods lifts selected, show hideshow2
   
		hideShowDiv (hideshow2,'hideshow2',hideshow,'hideshow')
		hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
		hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
      break
   case 2: //goods only lifts selected, show hideshow2
   
		hideShowDiv (hideshow2,'hideshow2',hideshow,'hideshow')
		hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
		hideDivs (vertical_lift,'vertical_lift',platform_lift_select,'platform_lift_select')
      break
   case 3: //platform lifts selected
      hideDivs (hideshow2,'hideshow2',hideshow,'hideshow')
	   showDiv (platform_lift_select,'platform_lift_select');
	   hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
	   hideDiv (vertical_lift,'vertical_lift')
      break
   default:
      break
	}
}

function display_platform_lift_form(){
var selectname=document.form.platform_lifts.selectedIndex
	
	switch (selectname) {
	case 1: //vertical lifts selected
		
		hideDivs (open_lift,'open_lift', inclined_lift,'inclined_lift')
		showDiv(vertical_lift,'vertical_lift')
      break
   case 2: //open lifts selected
   		
		hideDivs (vertical_lift,'vertical_lift', inclined_lift,'inclined_lift')
		showDiv(open_lift,'open_lift')
      break
   case 3: //inclined lifts selected
   		
		hideDivs (open_lift,'open_lift', vertical_lift,'vertical_lift')
		showDiv(inclined_lift,'inclined_lift')
      break
   default:
     break
	}

}

function hideshow_hydraulic_traction(){ 
//hideshow hydraulic and traction fields depending on option selected in maintenance contract quotation form
var selectname=document.form2.maintenance_lift_type.selectedIndex
	
	if(selectname<3){ //options passenger lift, passenger/goods lift and goods lifts selected
		
		showDiv(hydraulic_traction,'hydraulic_traction')
	}
	else{
		
		hideDiv(hydraulic_traction,'hydraulic_traction')
	}


}
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


