function MM_openBrWindow(theURL,winName,features){
  window.open(theURL,winName,features);
  window.focus();
}
//-----------------------------------------------------------------------------------------------------------------------------

function DoOnLoad(){
	window.focus();
	if(typeof(roomChanged)!="undefined")roomChanged()
	if(typeof(WriteTimeout)!="undefined")WriteTimeout()
}
//-----------------------------------------------------------------------------------------------------------------------------

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  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 openWindowApointment (url,wdth,hght) {
	window.open(url,'flag','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+wdth+',height='+hght+',top=100,left='+((screen.availWidth - 500) /2));
}
//-----------------------------------------------------------------------------------------------------------------------------

function removeProduct(ptoken, spui) {
	document.forms['remove'].PTOKEN.value=ptoken;
	document.forms['remove'].SPUI.value=spui;
	document.forms['remove'].REMOVE.value='remove';
	document.forms['remove'].submit();
}
//-----------------------------------------------------------------------------------------------------------------------------

//function MM_validateForm() { //v4.0
//  var i,p,q,nm,test,num,mini,maxi,errors='',args=MM_validateForm.arguments;
//  for (i=0; i<(args.length-2); i+=3) { 
//  	test=args[i+2]; 
//	val=document.getElementById(args[i]);
//	if (val) { nm=args[i+1]; if ((val=val.value)!="") {
//      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
//	  	var rmail=document.getElementById("r_Mail").value;
//        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
//        if (rmail!=val) errors+='- Your email address has not been confirmed.\n';
//		
//      } else if (test!='R') { num = parseFloat(val);
//        if (isNaN(val)) errors+='- '+nm+' debe ser numérico.\n';
//        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
//          mini=test.substring(8,p); max=test.substring(p+1);
//          if (num<mini || maxi<num) errors+='- '+nm+' debe contener un número entre '+mini+' y '+maxi+'.\n';
//    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
//    } if(errors){alert('ERROR:\n---------------------------------\n'+errors)}else{setTimeout('document.getElementById(\'confirmationButton\').disabled=1;',500);};
//  if(errors == '') {
//	document.form1.submit();  
//  }
//}


function MM_validateForm() { //v4.0
	var i,p,q,nm,test,num,mini,maxi,errors='',args=MM_validateForm.arguments;
  	for (i=0; i<(args.length-2); i+=3) { 
  		test=args[i+2]; 
		val=document.getElementById(args[i]);
		if (val) { 
			nm=args[i+1]; 
			if ((val=val.value)!="") {
      				if (test.indexOf('isEmail')!=-1) { 
      					p=val.indexOf('@');
	  				var rmail=document.getElementById("r_Mail").value;
        				if (p<1 || p==(val.length-1)) {
        					errors+='- '+nm+' must contain an e-mail address.\n';
        					document.getElementById(args[i]).style.border="1px solid red";
        				}
        				if (rmail!=val) {
        					errors+='- Your email address has not been confirmed.\n';
        					document.getElementById(args[i]).style.border=red;
					}
			      	} else if (test!='R') { 
			      		num = parseFloat(val);
				        if (isNaN(val)) {
				        	errors+='- '+nm+' debe ser numérico.\n';
				        	document.getElementById(args[i]).style.border="1px solid red";
				        }
        				if (test.indexOf('inRange') != -1) { 
        					p=test.indexOf(':');
          					mini=test.substring(8,p); 
          					max=test.substring(p+1);
          					if (num<mini || maxi<num) {
          						errors+='- '+nm+' debe contener un número entre '+mini+' y '+maxi+'.\n';
          						document.getElementById(args[i]).style.border="1px solid red";
          					}
    					} 
    				} 
    			} else if (test.charAt(0) == 'R') {
    				errors += '- '+nm+' is required.\n'; 
					document.getElementById(args[i]).style.border="1px solid red";
				}
    		}
    	} 
    	
    	if(errors){
    		alert('ERROR:\n---------------------------------\n'+errors);
    	}

		if(errors == '') {
			document.form1.submit();  
		}
}




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 changeLanguage(lang) {
	var frm=document.getElementById("f_search");
	if(frm) {
		document.forms["f_search"].language.value=lang;
		document.forms["f_search"].submit();		
	} else {
		document.forms["ft_search"].language.value=lang;
		document.forms["ft_search"].submit();
	}
}