
today = new Date();
month = today.getMonth();
armonth = new Array("enero.png", "febrero.png", "marzo.png", "abril.png", "mayo.png", "junio.png", "julio.png", "agosto.png", "septiembre.png", "octubre.png", "noviembre.png", "diciembre.png");







var newwindow;

function veimgs(url)

{

	newwindow=window.open(url,'name','height=600,width=600');

	if (window.focus) {newwindow.focus()}

}



//Validacin de nombre

function IsEmpty(nombre)

{

	if((nombre.value.length==0) || (nombre.value==null)){

	return true;

	}

	else{

	return false;

	}

}



//Validacin de apellidos

function IsEmpty(apellidos)

{

	if((apellidos.value.length==0) || (apellidos.value==null)){

	return true;

	}

	else{

	return false;

	}

}



//Validacin de delegmunic

function IsEmpty(delegmunic)

{

	if((delegmunic.value.length==0) || (delegmunic.value==null)){

	return true;

	}

	else{

	return false;

	}

}



//Validacin de estado

function IsEmpty(estado)

{

	if((estado.value.length==0) || (estado.value==null)){

	return true;

	}

	else{

	return false;

	}

}



//Validacin de lada

function IsNumeric(lada)

{

   var ValidChars = "0123456789";

   var IsNumber=true;

   var Char;



 

   for (i = 0; i < lada.length && IsNumber == true; i++) 

      { 

      Char = lada.charAt(i); 

      if (ValidChars.indexOf(Char) == -1) 

         {

         IsNumber = false;

         }

      }

   return IsNumber;

   

   }

   

function IsEmpty(lada) {

   if ((lada.value.length==0) ||

   (lada.value==null)) {

      return true;

   }

   else { return false; }

}



//Validacin de telof

function IsNumeric(telof)

{

   var ValidChars = "0123456789";

   var IsNumber=true;

   var Char;



 

   for (i = 0; i < telof.length && IsNumber == true; i++) 

      { 

      Char = telof.charAt(i); 

      if (ValidChars.indexOf(Char) == -1) 

         {

         IsNumber = false;

         }

      }

   return IsNumber;

   

   }

   

function IsEmpty(telof) {

   if ((telof.value.length==0) ||

   (telof.value==null)) {

      return true;

   }

   else { return false; }

}



//Validacion de email1

function IsEmpty(email1)

{

	if((email1.value.length==0) || (email1.value==null)) 

		{

			return true;

		}

	else

		{

			return false;

		}

}



function isValidemail1(email1, required) {

    if (required==undefined) {   // if not specified, assume it's required

        required=true;

    }

    if (email1==null) {

        if (required) {

            return false;

        }

        return true;

    }

    if (email1.length==0) {  

        if (required) {

            return false;

        }

        return true;

    }

    if (! allValidChars(email1)) {  // check to make sure all characters are valid

        return false;

    }

    if (email1.indexOf("@") < 1) { //  must contain @, and it must not be the first character

        return false;

    } else if (email1.lastIndexOf(".") <= email1.indexOf("@")) {  // last dot must be after the @

        return false;

    } else if (email1.indexOf("@") == email1.length) {  // @ must not be the last character

        return false;

    } else if (email1.indexOf("..") >=0) { // two periods in a row is not valid

	return false;

    } else if (email1.indexOf(".") == email1.length) {  // . must not be the last character

	return false;

    }

    return true;

}



function allValidChars(email1) {

  var parsed = true;

  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";

  for (var i=0; i < email1.length; i++) {

    var letter = email1.charAt(i).toLowerCase();

    if (validchars.indexOf(letter) != -1)

      continue;

    parsed = false;

    break;

  }

  return parsed;

}



//Pantallas de Alerta

function ValidateForm(forma)

{

	if(IsEmpty(forma.nombre)) 

   { 

      alert('No ha ingresado su nombre') 

      forma.nombre.focus(); 

      return false; 

   }



	if(IsEmpty(forma.apellidos)) 

   { 

      alert('No ha ingresado sus apellidos') 

      forma.apellidos.focus(); 

      return false; 

   }



	if(IsEmpty(forma.empresa)) 

   { 

      alert('No ha ingresado el nombre de la empresa') 

      forma.empresa.focus(); 

      return false; 

   }

	

	if(IsEmpty(forma.delegmunic)) 

   { 

      alert('No ha ingresado su delegacion o municipio') 

      forma.delegmunic.focus(); 

      return false; 

   } 

   

	if(IsEmpty(forma.estado)) 

   { 

      alert('No ha seleccionado un estado') 

      forma.estado.focus(); 

      return false; 

   }



	if(IsEmpty(forma.lada)) 

   { 

      alert('No ha ingresado la lada') 

      forma.lada.focus(); 

      return false; 

   }

	

	if (!IsNumeric(forma.lada.value)) 

   { 

      alert('Solo numeros por favor') 

      forma.lada.focus(); 

      return false; 

    }



	if(IsEmpty(forma.telof)) 

   { 

      alert('No ha ingresado el telefono') 

      forma.telof.focus(); 

      return false; 

   }

	

	if (!IsNumeric(forma.telof.value)) 

   { 

      alert('Solo numeros por favor') 

      forma.telof.focus(); 

      return false; 

    }

	

	if(IsEmpty(forma.email1)) 

   { 

      alert('No ha ingresado su correo electronico') 

      forma.email1.focus(); 

      return false; 

   }

	

	if (! isValidemail1(forma.email1.value))	{

		alert('Ingrese un correo electronico correcto')	

		forma.email1.focus();

		return false;

	}

 

return true;

 

}











function roll(img_name, img_src)

   {

   document[img_name].src = img_src;

   }
