function correorcp() {
	email=document.frm1.imapuser2.value;
	if(cortarBlancos(email).length==0){
		alert(":: Ingresa tu correo ::");
		document.frm1.imapuser2.focus();
		return;
		
		}
	else{
		document.frm1.method="post";
		document.frm1.action="http://oficina.rcp.net.pe/home/rcp/index_previous.php3";
		document.frm1.target="_blank";
		document.frm1.submit();
		}
	
	}
function validaADSL() {
	email=document.getElementById("email").value;
	nombre=document.getElementById("nombre").value;
	telefono=document.getElementById("telefono").value;
	
	if(cortarBlancos(nombre).length==0){
		alert(":: Ingrese su nombre ::");
		document.getElementById("nombre").value="";
		document.getElementById("nombre").focus();
		return;
		}
	if(cortarBlancos(telefono).length==0){
		alert(":: Ingrese su tel�ono ::");
		document.getElementById("telefono").value="";
		document.getElementById("telefono").focus();
		return;
		}
	if(cortarBlancos(email).length==0){
		alert(":: Ingrese su correo ::");
		document.document.getElementById("email").value="";
		document.document.getElementById("email").focus();
		return;
		}
	if(!validaEmail(email)){
		alert(":: verifique su correo ::");
		document.getElementById("email").focus();
		document.getElementById("email").select();
		return;	
		}
	else{
		document.form1.method="post";
		if(navigator.appName=="Opera") document.form1.action="mail2.php";
		else document.form1.action="mail.php";
		alert("Gracias por enviarnos su informaci�,\n en breve le responderemos.");
		document.form1.submit();
		
		}
	
	}
	
function validaOrdenar() {
	email=document.getElementById("email").value;
	nombre=document.getElementById("nombre").value;
	telefono=document.getElementById("telefono").value;
	empresa=document.getElementById("empresa").value;
	cargo=document.getElementById("cargo").value;
	
	if(cortarBlancos(nombre).length==0){
		alert(":: Ingrese su nombre ::");
		document.getElementById("nombre").value="";
		document.getElementById("nombre").focus();
		return;
		}
	if(cortarBlancos(email).length==0){
		alert(":: Ingrese su correo ::");
		document.document.getElementById("email").value="";
		document.document.getElementById("email").focus();
		return;
		}
	if(!validaEmail(email)){
		alert(":: verifique su correo ::");
		document.getElementById("email").focus();
		document.getElementById("email").select();
		return;	
		}
	if(cortarBlancos(empresa).length==0){
		alert(":: Ingrese instituci� a la que pertenece ::");
		document.getElementById("empresa").value="";
		document.getElementById("empresa").focus();
		return;
		}
	if(cortarBlancos(telefono).length==0){
		alert(":: Ingrese su tel�ono ::");
		document.getElementById("telefono").value="";
		document.getElementById("telefono").focus();
		return;
		}
	if(cortarBlancos(cargo).length==0){
		alert(":: Ingrese su cargo en la instituci� ::");
		document.getElementById("cargo").value="";
		document.getElementById("cargo").focus();
		return;
		}	
	else{
		document.form1.method="post";
		if(navigator.appName=="Opera") document.form1.action="mail2.php";
		else document.form1.action="mail.php";
		alert("Gracias por enviarnos su informaci�,\n en breve le responderemos.");
		document.form1.submit();
		}
	}
	
function validaContactos() {
	email=document.getElementById("email").value;
	nombre=document.getElementById("nombre").value;
	telefono=document.getElementById("telefono").value;
	
	if(cortarBlancos(nombre).length==0){
		alert(":: Ingrese su nombre ::");
		document.getElementById("nombre").value="";
		document.getElementById("nombre").focus();
		return;
		}
	if(cortarBlancos(email).length==0){
		alert(":: Ingrese su correo ::");
		document.document.getElementById("email").value="";
		document.document.getElementById("email").focus();
		return;
		}
	if(!validaEmail(email)){
		alert(":: verifique su correo ::");
		document.getElementById("email").focus();
		document.getElementById("email").select();
		return;	
		}
	if(cortarBlancos(telefono).length==0){
		alert(":: Ingrese su tel�ono ::");
		document.getElementById("telefono").value="";
		document.getElementById("telefono").focus();
		return;
		}
	else{
		document.form1.method="post";
		if(navigator.appName=="Opera") document.form1.action="mail2.php";
		else document.form1.action="mail.php";
		alert("Gracias por enviarnos su informaci�,\n en breve le responderemos.");
		document.form1.submit();
		}
	
	}
	
function validaContactos2() {
	email=document.getElementById("email").value;
	nombre=document.getElementById("nombre").value;
	telefono=document.getElementById("telefono").value;
	
	if(cortarBlancos(nombre).length==0){
		alert(":: Ingrese su nombre ::");
		document.getElementById("nombre").value="";
		document.getElementById("nombre").focus();
		return;
		}
	if(cortarBlancos(email).length==0){
		alert(":: Ingrese su correo ::");
		document.document.getElementById("email").value="";
		document.document.getElementById("email").focus();
		return;
		}
	if(!validaEmail(email)){
		alert(":: verifique su correo ::");
		document.getElementById("email").focus();
		document.getElementById("email").select();
		return;	
		}
	if(cortarBlancos(telefono).length==0){
		alert(":: Ingrese su tel�ono ::");
		document.getElementById("telefono").value="";
		document.getElementById("telefono").focus();
		return;
		}
	else{
		document.form1.method="post";
		if(navigator.appName=="Opera") document.form1.action="mail2.php";
		else document.form1.action="../mail.php";
		alert("Gracias por enviarnos su informaci�,\n en breve le responderemos.");
		document.form1.submit();
		}
	
	}
	
//**************************
// funcion de abrir ventanas
//**************************


function formularioOrdenar(url,titulo,ancho,alto){
	if(navigator.appName=="Opera" && url=="../formulario_contactenos2.html") url="../formulario_contactenos.html"; 
	
	if(navigator.appName=="Opera"){ 
		var izquierda = (screen.availWidth - ancho) / 2; 
		var arriba = (screen.availHeight - alto) / 2; 
		var especificaciones="top=0, left=0, toolbar=0,location=0, status=0,menubar=0,scrollbars=1, resizable=0, width=780,height=400";
		var titulo="ventana";
		window.open(url,'ventana','top='+arriba+', left='+izquierda+',location=no,scrollbars=yes,width='+ancho+',height='+alto+''); 
	}
	else{
		I= 'miId';                          //---- id de la ventana
		N= (screen.availWidth - ancho) / 2;                               //---- posicion x
		n= (screen.availHeight - alto) / 2;                              //---- posicion y
		e= ancho;                            //---- ancho
		r= alto;                             //---- alto
		d= ""+url;                     //---- pagina de carga
		i= titulo; 		 //---- texto de la barra
		v= 'si';                              //---- indica si utiliza CSS
		INNERDIV.newInnerDiv(I,N,n,e,r,d,i,v);
		}
}

function formularioOrdenar2(url,titulo,ancho,alto){
	if(navigator.appName=="Opera" && url=="../formulario_contactenos2.html") url="../formulario_contactenos.html"; 
	if(navigator.appName=="Opera"){ 
		var izquierda = (screen.availWidth - ancho) / 2; 
		var arriba = (screen.availHeight - alto) / 2; 
		var especificaciones="top=0, left=0, toolbar=0,location=0, status=0,menubar=0,scrollbars=1, resizable=0, width=780,height=400";
		var titulo="ventana";
		window.open(url,'ventana','top='+arriba+', left='+izquierda+',location=no,scrollbars=yes,width='+ancho+',height='+alto+''); 
	}
	else{
		I= 'm2Id';                          //---- id de la ventana
		N= (screen.availWidth - ancho) / 2;                               //---- posicion x
		n= (screen.availHeight - alto) / 2;                              //---- posicion y
		e= ancho;                            //---- ancho
		r= alto;                             //---- alto
		d= ""+url;                     //---- pagina de carga
		i= titulo; 		 //---- texto de la barra
		v= 'si';                              //---- indica si utiliza CSS
		INNERDIV.newInnerDiv(I,N,n,e,r,d,i,v);
		}
}
/*
function formularioOrdenar(dir,name,ancho,alto){
var velocidadheight = 7; // Esta es la velocidad con se abre de ancho
var velocidadwidth = 12; // Esta es la velocidad con se abre de alto
var situacionleft = (screen.availWidth - ancho) / 2;  // Esta es la situaci� respecto a la parte izquierda
var situaciontop = (screen.availHeight - alto) / 2; // Esta es la situaci� respecto a la parte derecha
if (document.all) {
var winwidth = ancho;
var winheight = alto;
var ventana = window.open("",name,"left=" + situacionleft + ",top=" + situaciontop + ",width=1,height=1,scrollbars=yes,status=yes"); // En esta linea puedes editar las cualidades de la ventana que se abre

// A partir de aqui no editar \\

for (myheight = 1; myheight < winheight; myheight += velocidadheight) {
ventana.resizeTo("1", myheight);
}
for (mywidth = 1; mywidth < winwidth; mywidth += velocidadwidth) {
ventana.resizeTo(mywidth, myheight);
}
ventana.location = dir;
}
else
window.location = dir;
}

*/


/*function formularioOrdenar(page,titulo,ancho,alto){
	I= 'miId';                          //---- id de la ventana
	N= (screen.availWidth - ancho) / 2;                               //---- posicion x
	n= (screen.availHeight - alto) / 2;                              //---- posicion y
	e= ancho;                            //---- ancho
	r= alto;                             //---- alto
	d= ""+page;                     //---- pagina de carga
	i= titulo; 		 //---- texto de la barra
	v= 'si';                              //---- indica si utiliza CSS
	INNERDIV.newInnerDiv(I,N,n,e,r,d,i,v);
}*/
/*
function formularioOrdenar2(page,titulo,ancho,alto){
	I= 'm2Id';                          //---- id de la ventana
	N= (screen.availWidth - ancho) / 2;                               //---- posicion x
	n= (screen.availHeight - alto) / 2;                              //---- posicion y
	e= ancho;                            //---- ancho
	r= alto;                             //---- alto
	d= ""+page;                     //---- pagina de carga
	i= titulo; 		 //---- texto de la barra
	v= 'si';                              //---- indica si utiliza CSS
	INNERDIV.newInnerDiv(I,N,n,e,r,d,i,v);
}*/

//**************************
// funciones predefinidas
//**************************
function cortarBlancos(cadena){
	var c=cadena.replace( /[ ]+/g,"");//corta todos los espacios en blanco
	return c;
	}
function validaEmail(email){
	var ok2=true;
	var m=cortarBlancos(email);
	if(m.indexOf("@")==-1||m.indexOf(".")==-1||
		(m.indexOf(".")+1)==m.indexOf("@")||m.lastIndexOf(".")==(m.length-1)||
		m.indexOf("@")==0||m.indexOf(".")==0||m.indexOf("@")!=m.lastIndexOf("@")||
		(m.indexOf("@")+1)==m.indexOf(".")){
	  ok2=false;
	}
	return ok2;	
	}
