var msgValidEmail=' you should enter a valid email ';var JsCheck=' Please check the following Information ';var MustNumber=' must contain a number ';var MustNumberBetween=' must contain a number between ';var Jsand=' and ';var isReq=' is Required field ';var PassShould=' The Password should have at least 6 digits ';var PassRetype=' Please check, Password must be the same as Retype of password ';

function redirect(url) { //v4.0
  document.location.href = url;
  return false;
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

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]);nm = args[i+1];
    if (val) {  if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' '+msgValidEmail+'.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+ MustNumber+'.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+MustNumberBetween +min+ Jsand +max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+isReq+ '\n'; }
  } if (errors) alert(JsCheck+':\n'+errors);
  document.MM_returnValue = (errors == '');
}

function ValidPassword(p1,p2)
{
var objp1=eval("document.getElementById('"+p1+"')")
var objp2=eval("document.getElementById('"+p2+"')")

if (objp1.value.length<6){
		objp1.select(); 
		objp1.focus();
		alert(PassShould);
		return false;
}
	
if (objp1.value != objp2.value)
{
		objp2.select(); 
		objp2.focus();
		alert(PassRetype);
		return false;
}
return true;
}

function abreventana(direccion,nomven,propiedades) {
  MiVentana=open(direccion,nomven,propiedades);
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function HideShowTotal(div1, div2) 
 {
 
    var objUsd=document.getElementById(div1);
    if (null!=objUsd)  objUsd.style.display = "block";
    
    var objLocal=document.getElementById(div2);
    if (null!=objLocal) objLocal.style.display = "none";
    
    if (null!=document.getElementById("TotalCur")) document.getElementById("TotalCur").value=div1;
    
 }

function HideShow3divs(div1, div2,div3) 
 {
 
    var objdiv1=document.getElementById(div1);
    if (null!=objdiv1)  objdiv1.style.display = "block";
    
    var objdiv2=document.getElementById(div2);
    if (null!=objdiv2) objdiv2.style.display = "block";
    
    var objdiv3=document.getElementById(div3);
    if (null!=objdiv3) objdiv3.style.display = "none";
    
    
 }

