function MM_preloadImages() {
  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) { 
  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_resizeImage() { 
  var i,j=0,x,a=MM_resizeImage.arguments; document.MM_rr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_rr[j++]=x; if(!x.oSrc) x.owidth=x.width; x.width=a[i+2];}
}
function MM_resizeImgRestore() { 
  var i,x,a=document.MM_rr; for(i=0;a&&i<a.length&&(x=a[i])&&x.owidth;i++) x.width=x.owidth;
}
function MM_swapImage() {
  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 MM_swapImgRestore() { 
  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_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function Showtooltip_res(evt,name,tip,img,size)
{
	if ($(img).style.width != size) $(img).style.width=size;
	x = evt.clientX+document.body.scrollLeft-70;
	y = evt.clientY+document.body.scrollTop +20;
	if ($(name).innerHTML != tip) $(name).innerHTML = tip;
	$(name).style.left = x;
	$(name).style.top = y;
	if ($(name).style.visibility != "visible") $(name).style.visibility="visible";
}
function Movetooltip_res(evt,name,tip)
{
	x = evt.clientX+document.body.scrollLeft-70;
	y = evt.clientY+document.body.scrollTop +20;
	if ($(name).innerHTML != tip) $(name).innerHTML = tip;
	$(name).style.left = x;
	$(name).style.top = y;
	if ($(name).style.visibility != "visible") $(name).style.visibility="visible";
}
function Hidetooltip_res(name,img,size)
{
	//setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
	$(img).style.width=size;
	$(name).style.visibility="hidden";
}
function Hidetooltip_res1(name)
{
	$(name).style.visibility="hidden";
}
function Hidetooltip_res2(img,size)
{
	if ($(img).style.width != size) $(img).style.width=size;
}

//FORM
function validate_cv() {
	var form1=MM_findObj('form_cv');
	var errors='';
	if ((form1.email.value.indexOf('@')<1) || (form1.email.value.indexOf('@')==(form1.email.value.length-1))) errors+='- e-mail.\n';
	if (form1.name.value=="") errors += "- name \n";
	if (form1.tag_n.value=="") errors += "- tag_n \n";
	if (form1.quantity.value=="") errors += "- quantity \n";
	if (form1.allow_sound_press.value=="") errors += "- Allowable sound pressure level \n";
	if (form1.nps_in_out.value=="") errors += "- NPS (inlet/outlet) \n";
	if (form1.thk_sch.value=="") errors += "- thk/Sch. \n";
	if (form1.proc_fluid_desc.value=="") errors += "- Process fluid description \n";
	if (form1.proc_fluid_stat.value=="") errors += "- Process fluid status \n";
	if ((form1.flow_rate_min.value=="")||(form1.flow_rate_norm.value=="")||(form1.flow_rate_max.value=="")) errors += "- Flow rate \n";
	if ((form1.p1_min.value=="")||(form1.p1_norm.value=="")||(form1.p1_max.value=="")) errors += "- Inlet press. P1 \n";
	if ((form1.p2_min.value=="")||(form1.p2_norm.value=="")||(form1.p2_max.value=="")) errors += "- Outlet press. P2 \n";
	if ((form1.temp_min.value=="")||(form1.temp_norm.value=="")||(form1.temp_max.value=="")) errors += "- Temperature \n";
	if ((form1.pv_min.value=="")||(form1.pv_norm.value=="")||(form1.pv_max.value=="")) errors += "- Vapour pressure Pv \n";
	if (form1.pc_norm.value=="") errors += "- Critical pressure Pc \n";
	if (form1.visc_norm.value=="") errors += "- Viscosity \n";
	if (form1.ratio_heats.value=="") errors += "- Ratio of specific heats \n";
	if (form1.compress_z.value=="") errors += "- Compressibility factor  Z \n";
	if (form1.dp_norm.value=="") errors += "- Shutoff diff. pressure Dp \n";
	if ((form1.air_sup_min.value=="")||(form1.air_sup_max.value=="")) errors += "- Air supply \n";
	if (form1.pow_fail.value=="") errors += "- Power failure pos \n";
	if (form1.vba_end.value=="") errors += "- End conn. \n";
	if (form1.vba_saet.value=="") errors += "- Saet leakage class \n";
	if (form1.act_type.value=="") errors += "- ACTUATOR Type \n";
	if (errors){
		alert('Fill fields:\n'+errors);
		return false;
	}
	return true;
}
function validate_sv() {
	var form1=MM_findObj('form_sv');
	var errors='';
	if ((form1.email.value.indexOf('@')<1) || (form1.email.value.indexOf('@')==(form1.email.value.length-1))) errors+='- e-mail.\n';
	if (form1.name.value=="") errors += "- name \n";
	if (errors){
		alert('Fill fields:\n'+errors);
		return false;
	}
	return true;
}
function validate_sat() {
	var form1=MM_findObj('form_sat');
	var errors='';
	if ((form1.email.value.indexOf('@')<1) || (form1.email.value.indexOf('@')==(form1.email.value.length-1))) errors+='- e-mail.\n';
	if (form1.name.value=="") errors += "- name \n";
	if (errors){
		alert('Fill fields:\n'+errors);
		return false;
	}
	return true;
}
function validate_sod() {
	var form1=MM_findObj('form_sod');
	var errors='';
	if ((form1.email.value.indexOf('@')<1) || (form1.email.value.indexOf('@')==(form1.email.value.length-1))) errors+='- e-mail.\n';
	if (form1.name.value=="") errors += "- name \n";
	if (errors){
		alert('Fill fields:\n'+errors);
		return false;
	}
	return true;
}
function validate_reg() {
	var form1=MM_findObj('form_reg');
	var errors='';
	if ((form1.email.value.indexOf('@')<1) || (form1.email.value.indexOf('@')==(form1.email.value.length-1))) errors+='- e-mail.\n';
	if (form1.name.value=="") errors += "- name \n";
	if (form1.surname.value=="") errors += "- surname \n";
	if (form1.company.value=="") errors += "- company \n";
	if (errors){
		alert('Fill fields:\n'+errors);
		return false;
	}
	return true;
}
function validate_log() {
	var form1=MM_findObj('form_log');
	var errors='';
	if ((form1.email.value.indexOf('@')<1) || (form1.email.value.indexOf('@')==(form1.email.value.length-1))) errors+='- e-mail.\n';
	if (form1.password.value=="") errors += "- password \n";
	if (errors){
		alert('Fill fields:\n'+errors);
		return false;
	}
	return true;
}
function validate_work() {
	var form1=MM_findObj('form_work');
	var errors='';
	if ((form1.email.value.indexOf('@')<1) || (form1.email.value.indexOf('@')==(form1.email.value.length-1))) errors+='- e-mail.\n';
	if (form1.name.value=="") errors += "- name \n";
	if (form1.surname.value=="") errors += "- surname \n";
	if (errors){
		alert('Fill fields:\n'+errors);
		return false;
	}
	return true;
}

