function newform1(theURL,winName,features)
{ 
	//v2.0
	window.open(theURL,winName,features);
}
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

function isEmail(email) {
    invalidChars = " ~\'^\`\"*+=\\|][(){}$&!#%/:,;";
	email = emailStr = trim(email);
    // Check for null
    if (email == "") {
        return false;
    }

    // Check for invalid characters as defined above
    for (i=0; i<invalidChars.length; i++) {
        badChar = invalidChars.charAt(i);
        if (email.indexOf(badChar,0) > -1) {
            return false;
        }
    }
    lengthOfEmail = email.length;
    if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
        return false;
    }
    Pos = email.indexOf("@",1);
    if (email.charAt(Pos + 1) == ".") {
        return false;
    }
    while ((Pos < lengthOfEmail) && ( Pos != -1)) {
        Pos = email.indexOf(".",Pos);
        if (email.charAt(Pos + 1) == ".") {
            return false;
        }
        if (Pos != -1) {
            Pos++;
        }
    }

    // There must be at least one @ symbol
    atPos = email.indexOf("@",1);
    if (atPos == -1) {
        return false;
    }

    // But only ONE @ symbol
    if (email.indexOf("@",atPos+1) != -1) {
        return false;
    }

    // Also check for at least one period after the @ symbol
    periodPos = email.indexOf(".",atPos);
    if (periodPos == -1) {
        return false;
    }
    if (periodPos+3 > email.length) {
        return false;
    }
    return true;
}


function validar()
{
	//alert(document.PZ_MainForm.FirstName.value);
	
	var objform = document.forms.PZ_MainForm;
	var scorreo = trim(objform.correo.value);
	var strerror = "";
	if (objform.FirstName.value=="")
	{
		alert("Debe de especificar un nombre valido.");
		objform.FirstName.focus();
		exit();
	}
	if (objform.DaySelector.value=="")
	{
		alert("Debe de especificar un día valido.");
		objform.DaySelector.focus();
		exit();
	}
	if (objform.MonthSelector.value=="")
	{
		alert("Debe de especificar un mes valido.");
		objform.MonthSelector.focus();
		exit();
	}
	if (objform.YearSelector.value=="")
	{
		alert("Debe de especificar un año valido.");
		objform.MonthSelector.focus();
		exit();
	}
	if (scorreo.length<1)
	{
		alert("Debe de especificar una dirección valida de correo.");
		exit();
	}
	else
	{
		if (!isEmail(scorreo))
		{
			alert("La direccion de correo especificada no es valida.");
			exit();
		}
	}
	document.PZ_MainForm.submit();
}
function noespacios(objtextbox)
{
	var er = new RegExp(/\s/);
	//var web = document.getElementById('cdusuario_web').value;
                var web = objtextbox;

	if(er.test(web))
                {
		alert('No se permiten espacios');
		return false;
	}
                else
		return true;
}

function prueba()
{
	alert("Hola como estas");

}
function validarSubmit()
{
	return false;
}

function ventanitaimagen(strimg,intWinWidth,intWinHeight)
{
	var theURL = strimg;
	//document.images[strimg].src;
	//alert(theURL);
	infoWindows = window.open("/view_images.php?id="+theURL,"informacion","status=no,scrollbars=no,resizable=no,left=5,top=5,screenX=5,screenY=5,width="+intWinWidth+",height="+intWinHeight);
}

function fnValidacionSuscripcion()
{
	
	var strnombre = PZ_MainForm.nombre.value;	
	var intDay = PZ_MainForm.DaySelector.value;
	var intMonth = PZ_MainForm.MonthSelector.value;
	var intYear = PZ_MainForm.YearSelector.value;
	var strcorreo = PZ_MainForm.correo.value;
	var strMsgError = "";
	if (strnombre.length<15 && strnombre=="")
	{
		alert("Debe escribir su nombre completo.");		
	}
	else
	{
		if (intDay=="")
		{
			alert("Debe completar el formulario.");			
		}
		else
		{
			if (intMonth=="")
			{
				alert("Debe completar el formulario.");
			}
			else
			{
				if (intYear=="")
				{
					alert("Debe completar el formulario.");
				}
				else
				{
					if (!isEmail(strcorreo))
					{
						alert("Debe escribir una dirección de correo valida.");							
					}
					else
					{
						document.PZ_MainForm.submit();
					}
				}
			}
		}
	}	
}
function sventanita(strimg,intWinWidth,intWinHeight)
{
	var theURL = strimg;
	//document.images[strimg].src;
	//alert(theURL);
	infoWindows = window.open(theURL,"informacion","status=no,scrollbars=no,resizable=no,left=5,top=5,screenX=5,screenY=5,width="+intWinWidth+",height="+intWinHeight);
}