function popimg(imageName) {
 	windx = window.open(imageName,"LargeImage","width=660,height=640,scrollbars=no,toolbar=no,menubar=no,status=no");
	windx.focus();
}
function popwin(imageName) {
 	windx = window.open(imageName,"LargeImage","width=660,height=640,toolbar=no,menubar=no,status=no,scrollbars=yes");
	windx.focus();
}

function updatePressure(){
	var Pa = parseFloat(document.forms['pressure'].pressure1.value * document.forms['pressure'].unit1.value);
	document.forms['pressure'].pressure2.value = Math.round((Pa / document.forms['pressure'].unit2.value)*1000000000)/1000000000;
}
function updatePressureb(){
	var Pa = parseFloat(document.forms['pressureb'].pressure3.value * document.forms['pressureb'].unit3.value);
	document.forms['pressureb'].pressure4.value = Math.round((Pa / document.forms['pressureb'].unit4.value)*1000000000)/1000000000;
}

function updateTemp(){
	if(document.forms['temp'].tempunit1.value=="C"){
		var temp=parseFloat(document.forms['temp'].temp1.value) + 273.15;
	}else if(document.forms['temp'].tempunit1.value=="F"){
		var temp=parseFloat(((document.forms['temp'].temp1.value)-32)/1.8) + 273.15;
	}else if(document.forms['temp'].tempunit1.value=="K"){
		var temp=parseFloat(document.forms['temp'].temp1.value);
	}
	if(document.forms['temp'].tempunit2.value=="C"){
  	document.forms['temp'].temp2.value = Math.round((temp - 273.15)*1000000000)/1000000000;
	}else if(document.forms['temp'].tempunit2.value=="F"){
		document.forms['temp'].temp2.value = Math.round((((temp - 273.15)*1.8)+32)*1000000000)/1000000000;
	}else if(document.forms['temp'].tempunit2.value=="K"){
  	document.forms['temp'].temp2.value = Math.round(temp*1000000000)/1000000000;
	} 
}
function updateTempb(){
	if(document.forms['tempb'].tempunit3.value=="C"){
		var temp=parseFloat(document.forms['tempb'].temp3.value) + 273.15;
	}else if(document.forms['tempb'].tempunit3.value=="F"){
		var temp=parseFloat(((document.forms['tempb'].temp3.value)-32)/1.8) + 273.15;
	}else if(document.forms['tempb'].tempunit3.value=="K"){
		var temp=parseFloat(document.forms['tempb'].temp3.value);
	}
	if(document.forms['tempb'].tempunit4.value=="C"){
  	document.forms['tempb'].temp4.value = Math.round((temp - 273.15)*1000000000)/1000000000;
	}else if(document.forms['tempb'].tempunit4.value=="F"){
		document.forms['tempb'].temp4.value = Math.round((((temp - 273.15)*1.8)+32)*1000000000)/1000000000;
	}else if(document.forms['tempb'].tempunit4.value=="K"){
  	document.forms['tempb'].temp4.value = Math.round(temp*1000000000)/1000000000;
	} 
}

function updateIP(){
	var expl1 = new Array('No protection','Protected against touch by hands (&gt;50mm)','Protected against touch by fingers (&gt;12mm)','Protected against tools and wires (&gt;2.5mm)','Protected against tools and small wires (&gt;1mm)','Limited dust ingress protection','Total dust ingress protection');
	var expl2 = new Array('No protection','Protected against condensation','Protected against water spray &lt; 15 degrees from vertical','Protected against water spray &lt; 60 degrees from vertical','Protected against water spray from any direction','Protected against low pressure water jets from any direction','Protected against high pressure water jets from any direction','Protected against immersion between 15cm and 1m depth','Protected against long term immersion to a specified pressure','Protected against steam jet cleaning');
	var val1 = parseInt(document.forms['ip'].ip1.value);
	var val2 = parseInt(document.forms['ip'].ip2.value);
	document.getElementById('expl1').innerHTML = expl1[val1];
	document.getElementById('expl2').innerHTML = expl2[val2];
}
function updateIPb(){
	var expl3 = new Array('No protection','Protected against touch by hands (&gt;50mm)','Protected against touch by fingers (&gt;12mm)','Protected against tools and wires (&gt;2.5mm)','Protected against tools and small wires (&gt;1mm)','Limited dust ingress protection','Total dust ingress protection');
	var expl4 = new Array('No protection','Protected against condensation','Protected against water spray &lt; 15 degrees from vertical','Protected against water spray &lt; 60 degrees from vertical','Protected against water spray from any direction','Protected against low pressure water jets from any direction','Protected against high pressure water jets from any direction','Protected against immersion between 15cm and 1m depth','Protected against long term immersion to a specified pressure','Protected against steam jet cleaning');
	var val3 = parseInt(document.forms['ipb'].ip3.value);
	var val4 = parseInt(document.forms['ipb'].ip4.value);
	document.getElementById('expl3').innerHTML = expl3[val3];
	document.getElementById('expl4').innerHTML = expl4[val4];
}


function checkForm(frm){
	if(frm.name.value==''){
		alert('Please Complete the Required Fields (Name, Email)');
		return false;
	}else if(frm.email.value=='' || frm.email.value.indexOf("@") < 1){
		alert('Please Complete the Required Fields (Name, Email)');
		return false;
	}else{
		return true;
	}
}

function checkPaypal(frm){
	if(!frm.tandc.checked){
		alert('Please Accept the Terms and Conditions before proceeding');
		return false;
	}else{
		return true;
	}
}