var SYMBOL_DATE_NUM = 47;							//Para el '/'
var SYMBOL_DATE_NUM_CONV = 45;						//Para el '-'

var SYMBOL_DATE = "/";								//Puede ser '-' o '/'
var SYMBOL_DATE_CONV = "-";							//Para uso de la BD Oracle solamente
var SYMBOL_DATE_NUMOUT = SYMBOL_DATE_NUM_CONV;		//Para el algoritmo de validación de fecha


/* CENTRADO DE LOS FORMULARIOS*/

//<script>
function centrar() {
    iz=(screen.width-document.body.clientWidth) / 2;
    de=(screen.height-document.body.clientHeight) / 2;
    moveTo(iz,de);
}
//</script>

function contactenos(pagina)
{
   window.open ('http://mundoit.com.pe/'+pagina,'titulo','scrollbars=yes,status=no,resizable=no,toolbars=0,location=0,directories=0,menubar=0,width=617,height=370');
}

function soporte(pagina)
{
   window.open ('http://mundoit.com.pe/'+pagina,'titulo','scrollbars=yes,status=no,resizable=no,toolbars=0,location=0,directories=0,menubar=0,width=617,height=490');
}

function formulario(pagina)
{
   window.open (pagina,'titulo','scrollbars=yes,status=no,resizable=no,toolbars=0,location=0,directories=0,menubar=0,width=617,height=600');
}


function banner(pagina)
{
   window.open (pagina,'titulo','scrollbars=no,status=no,resizable=no,toolbars=0,location=0,directories=0,menubar=0,width=500,height=360');
}

function templates(pagina)
{
   window.open ('http://mundoit.com.pe/'+pagina,'titulo','scrollbars=yes,status=no,resizable=no,toolbars=0,location=0,directories=0,menubar=0,width=630,height=558');
}


function flipImage(url)
{
    if (window.event.srcElement.tagName == "IMG" ) {
        window.event.srcElement.src = url;
    }
}

function noClick()
{
   var a;
   if(event.type == 'mousedown' && event.button == 2)
   {
     alert("Elaborado en los talleres de Mundo IT S.A.C.");
   }
}

        function fn_AYUD_GEN_FECHA(opcion) {
                switch (opcion)
                {
                        case 1 : {
                                                fecha=document.wfrmPropuestaServicio.txtFecInicio;
                                                break;
                                         }
                        case 2 : {
                                                fecha=document.wfrmPropuestaServicio.txtFecFin;
                                                break;
                                         }
                        case 3 : {
                                                fecha=document.wfrmRegVoluntarios.txtFechaNac;
                                                break;
                                         }
                        case 4 : {
                                                fecha=document.wfrmTerminoReferencia.txtFecha;
                                                break;
                                         }
                        case 5 : {
                                                fecha=document.wfrmProfReq.txtFecIni;
                                                break;
                                         }
                        case 6 : {
                                                fecha=document.wfrmProfReq.txtFecFin;
                                                break;
                                         }
                        case 9 : {
                                                fecha=document.listado.txt_fec_inicio;
                                                break;
                                         }
                        case 10 : {
                                                fecha=document.listado.txt_fec_fin;
                                                break;
                                         }
                        case 11 : {
                                                fecha=document.listado.txt_fec_inicio1;
                                                break;
                                         }
                        case 12 : {
                                                fecha=document.listado.txt_fec_fin1;
                                                break;
                                         }
                        case 13 : {
                                                fecha=document.llenado.txt_fec_inicio;
                                                break;
                                         }
                        case 14 : {
                                                fecha=document.llenado.txt_fec_fin;
                                                break;
                                         }
                        case 15 : {
                                        fecha=document.llenado.txt_fecinicioest;
                           break;
                        }
                        case 16 : {
                                        fecha=document.llenado.txt_fecfinest;
                           break;
                        }
                        case 17 : {
                                        fecha=document.listado.txt_fecinicio
                           break;
                        }
                        case 18 : {
                                        fecha=document.listado.txt_fecfin;
                           break;
                        }
                        case 19 : {
                                        fecha=document.listado.txt_fec_creaini;
                           break;
                        }
                        case 20 : {
                                        fecha=document.listado.txt_fec_creafin;
                           break;
                        }
                }

                var myWindow=window.open('calendario.htm','windowref','location=no,width=250,height=295,scrollbars=no,top=140,left=250');
                myWindow.location.href = 'calendario.htm';
                if (!myWindow.opener)
                        myWindow.opener=self;

        }

        function fn_AYUD_GEN_MES_Y_ANO(opcion) {
                switch (opcion)
                {
                        case 2 : {
                                                fecha=document.listado.txt_fec_publicacion;
                                                break;
                                         }
                                                 case 4 : {
                                                fecha=document.llenado.txt_fecinicioest;
                                                break;
                                                                                                 }                                 
                        case 5 : {
                                                fecha=document.llenado.txt_fecfinest;
                                                break;
                                         }
                                                case 6 : {
                                                fecha=document.listado.txt_fec_retiro1;
                                                break;
                                         }
                                                case 7 : {
                                                fecha=document.listado.txt_fecinicio;
                                                break;
                                                                                                 }                                 
                        case 8 : {
                                                fecha=document.listado.txt_fecfin;
                                                break;
                                         }
                                                
                                                                                 
                }

                var myWindow=window.open('mya_picker.htm','windowref','location=no,width=160,height=10,scrollbars=no,top=140,left=250');
                myWindow.location.href = 'mya_picker.htm';
                if (!myWindow.opener)
                        myWindow.opener=self;

        }


        function aceptaEntero(evt){
        // NOTA: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
                var key = evt.keyCode;
                if (!(key <= 13 || (key >= 48 && key <= 57))) {
                        window.event.keyCode="";
                }
        }

        function aceptaFlotante(evt,obj){
        // NOTA: Backspace = 8, Enter = 13, '0' = 48, '9' = 57, '.' = 46
                var key = evt.keyCode;
                var cad = obj.value;
                if (!(key <= 13 || (key >= 48 && key <= 57) || key == 46)) {
                        window.event.keyCode="";
                }
                if ((cad.indexOf('.')>0) && (key == 46)) {
                        window.event.keyCode="";
                }
        }

        function aceptaCadena(evt){
        // NOTA: Backspace = 8, Enter = 13, 'A' = 65, 'Z' = 90 , 'a' = 97 , 'z' = 122 , '.' = 46 , '-' = 45
        //       '_' = 95 , '(' = 40, ')' = 41, '0' = 48, '9' = 57 , SPACE = 32
                var key = evt.keyCode;
                if (!(key <= 13 || (key == 32) || (key >= 47 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || key == 46 || key == 45 || key == 95 || key == 40 || key == 41  || key == 241 || key == 109 || key == 130 || (key >= 160 && key <=163) || key == 225 || key == 233 || key == 237 || key == 243 || key == 250 || key == 44 || key == 46 || key == 43 || key == 58 || key == 209  )) {
                        window.event.keyCode="";
                }
        }

        function aceptaCadenaNoEnter(evt){
        // NOTA: Backspace = 8, Enter = 13, 'A' = 65, 'Z' = 90 , 'a' = 97 , 'z' = 122 , '.' = 46 , '-' = 45
        //       '_' = 95 , '(' = 40, ')' = 41, '0' = 48, '9' = 57 , SPACE = 32
                var key = evt.keyCode;
                if (!(key < 13 || (key == 32) || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || key == 46 || key == 45 || key == 95 || key == 40 || key == 41  || key == 241 || key == 109 || key == 130 || (key >= 160 && key <=163) || key == 225 || key == 233 || key == 237 || key == 243 || key == 250 || key == 44 || key == 46 || key == 43 || key == 58 || key == 209 )) {
                        window.event.keyCode="";
                }
        }

        function aceptaMail(evt){
        // NOTA: Backspace = 8, Enter = 13, 'A' = 65, 'Z' = 90 , 'a' = 97 , 'z' = 122 , '.' = 46 , '-' = 45
        //       '_' = 95 , '(' = 40, ')' = 41, '0' = 48, '9' = 57 , SPACE = 32
                var key = evt.keyCode;
                if (!(key <= 13 || (key >= 48 && key <= 57) || key == 64 || (key >= 97 && key <= 122) ||  key == 95 || key == 46)) {
                        window.event.keyCode="";
                }
        }

    function noEscritura(evt){
                window.event.keyCode="";
        }

    function aceptaCodigo(evt){
        // NOTA: Backspace = 8, Enter = 13, 'A' = 65, 'Z' = 90 , 'a' = 97 , 'z' = 122 , '0' = 48, '9' = 57
                var key = evt.keyCode;
                if (!(key <= 13 || (key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122))) {
                        window.event.keyCode="";
        }
    }
    function validaEmail(email)
        {
                var re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
                if (!re.test(email)) {
                        return false;
                }
                return true;
        }
		
	function habilita()
	{	
		
		document.frm.dom.disabled = false;
		document.frm.des.disabled = false;
		document.frm.hos.value="0";
		document.frm.dom.value="2";
		document.frm.des.value="3";
		
		document.frm.valhos.value="$ " +35.00;
		document.frm.valdom.value="$ " +0;
		document.frm.valdes.value="$ " +0;		
		document.frm.answer.value="$ " +35.00;
		
		res1=35;
		res2=0;
		res3=0;

	}
	function deshabilita()
	{ 
		
		document.frm.dom.disabled = true;
		document.frm.des.disabled = true;
		document.frm.hos.value="0";
		document.frm.valhos.value="$ " +170;
		document.frm.valdom.value="$ " +0;
		document.frm.valdes.value="$ " +0;		
		document.frm.answer.value="$ " +170;

		res1=170;
		res2=0;
		res3=0;

	}
	
		var tot,res1=0,res2=0,res3=0;
		var resultado;
		
		function mostr(combo,indice,num)
			{								
				var valor = combo.options[indice].value;
				
				 if (document.frm.seleccion[0].checked) {
				 	
					if (num==1){
						if (valor==0)
							res1=35.00;
						if (valor==1)
							res1=60.00;
						if (valor==2)
							res1=100.00;
						if (valor==3)	
							res1=0;											
					}
								
					if (num==3){
						if (valor==0)
							res3=150;
						if (valor==1)
							res3=210;
						if (valor==2)
							res3=380;			
						if (valor==3)
							res3=0;
					}					

					if (num==2){
						if (valor==0) 
							res2=12.00; 
						if (valor==1)
							res2=42.00;		
						if (valor==2)
							res2=0;						
					}

					tot=res1+res2+res3;
					resultado="$ " + tot;
					
					document.frm.valhos.value="$ " +res1;
					document.frm.valdom.value="$ " +res2;
					document.frm.valdes.value="$ " +res3;
				 }
				 else{
				 	
					if (valor==0)
						resultado="$ 170";
					if (valor==1)
						resultado="$ 250";
					if (valor==2)
						resultado="$ 400";			
					if (valor==3)
				 		resultado="$ 0";		
						
					document.frm.valhos.value=resultado;
						
				 }
				
				
				document.frm.answer.value=resultado;
			}							
	
	
	
	var remplaza = /\+/gi; 
	var url = window.location.href;
	
	url = unescape(url);
	url = url.replace(remplaza, " ");
	
function mostrwin(combo,indice,num)
			{								
				var valor = combo.options[indice].value;
				
					if (num==1){
						if (valor==0)
							res1=119;
						if (valor==1)
							res1=215;
						if (valor==2)
							res1=360;
						if (valor==3)	
							res1=0;											
					tot=res1;
					resultado="$ " + tot;
					
					document.frm.valhos.value="$ " +res1;
				 }
				
				document.frm.answer.value=resultado;
			}							
	
	var remplaza = /\+/gi; 
	var url = window.location.href;
	
	url = unescape(url);
	url = url.replace(remplaza, " ");



	function obtener_valor(variable) 
	{ 
	var variable_may = variable;
	var variable_pos = url.indexOf(variable_may);
	
	if (variable_pos != -1) 
	{
	var pos_separador = url.indexOf("&", variable_pos);
	
	if (pos_separador != -1) 
	{
	return url.substring(variable_pos + variable_may.length + 1, pos_separador);
	} else
	{
	return url.substring(variable_pos + variable_may.length + 1, url.length);
	}
	} else 
	{
	return "";
	}
	}

	function combovalor(){

		var va=obtener_valor('val');
		var ve=obtener_valor('vd');
		var vi=obtener_valor('pc');
		var dom=obtener_valor('domain');
/*
		if (dom==null) {
			document.frm.valdom.value="";
			document.frm.dom.selectedIndex=0;
	    }
		else {
		  if (dom==12) {
			document.frm.dom.selectedIndex=1;
			document.frm.valdom.value="$"+dom;
		    }
		}
*/
		if (va != null){
			if (va==35.00){
				document.frm.hos.selectedIndex=1;
				res1=35.00;
				document.frm.valhos.value="$ 35.00";
				document.frm.answer.value="$ 35.00";
			}
			
			if (va==60.00){
				document.frm.hos.selectedIndex=2;
				res1=60.00;
				document.frm.valhos.value="$ 60.00";
				document.frm.answer.value="$ 60.00";
			}
			
			if (va==100.00){
				document.frm.hos.selectedIndex=3;
				res1=100.00;
				document.frm.valhos.value="$ 100.00";
				document.frm.answer.value="$ 100.00";
			}
		
		}
		
		if (ve != null){
			if (ve==150){
				document.frm.des.selectedIndex=1;
				res3=150;
				document.frm.valdes.value="$ 150";
				document.frm.answer.value="$ 150";
			}
			
			if (ve==210){
				document.frm.des.selectedIndex=2;
				res3=210;
				document.frm.valdes.value="$ 210";
				document.frm.answer.value="$ 210";
			}
			
			if (ve==380){
				document.frm.des.selectedIndex=3;
				res3=380;
				document.frm.valdes.value="$ 380";
				document.frm.answer.value="$ 380";
			}
		}
		
		if (vi != null){
			if (vi==170){
				document.frm.hos.selectedIndex=1;
				document.frm.dom.selectedIndex=1;				
				document.frm.des.selectedIndex=1;	
				document.frm.dom.disabled = true;
		        document.frm.des.disabled = true;
				document.frm.valhos.value="$ 170";
		        document.frm.valdom.value="$   0";				
				document.frm.valdes.value="$   0";
				document.frm.answer.value="$ 170";
	
				res1=170;
				res2=0;
				res3=0;
			}
			
			if (vi==250){
				document.frm.hos.selectedIndex=2;
				document.frm.des.selectedIndex=2;	
				document.frm.dom.disabled = true;
		        document.frm.des.disabled = true;				
				document.frm.valhos.value="$ 250";				
		        document.frm.valdom.value="$   0";				
				document.frm.valdes.value="$   0";
				document.frm.answer.value="$ 250";
			}
			
			if (vi==400){
				document.frm.hos.selectedIndex=3;			
				document.frm.des.selectedIndex=3;	
				document.frm.dom.disabled = true;
		        document.frm.des.disabled = true;				
				document.frm.valhos.value="$ 400";				
		        document.frm.valdom.value="$   0";				
				document.frm.valdes.value="$   0";
				document.frm.answer.value="$ 400";
			}
			
			//document.frm.dom.selectedIndex=1;
			//res2=10;
			//document.frm.valdom.value="$ 10";
			//document.frm.answer.value="$ 10";
			if (vi == 170 || vi == 250  || vi == 400){
			document.frm.seleccion[1].checked=true;
			}
			else  {
			document.frm.seleccion[0].checked=true;
			}
		}
	
}

function combovalorwin(){

		var va=obtener_valor('val');
		
		if (va != null){
			if (va==119){
				document.frm.hos.selectedIndex=1;
				res1=119;
				document.frm.valhos.value="$ 119";
				document.frm.answer.value="$ 119";
			}
			
			if (va==215){
				document.frm.hos.selectedIndex=2;
				res1=215;
				document.frm.valhos.value="$ 215";
				document.frm.answer.value="$ 215";
			}
			
			if (va==360){
				document.frm.hos.selectedIndex=3;
				res1=360;
				document.frm.valhos.value="$ 360";
				document.frm.answer.value="$ 360";
			}
		}
		
}


function valores(){
	var a=document.frm.hos.selectedIndex;
	var b=document.frm.dom.selectedIndex;
	var c=document.frm.des.selectedIndex;
	var d=document.frm.ubi.selectedIndex;
	 
	if (document.frm.seleccion.value==2){
		 if (a==0)
	 		document.frm.paq.value=0
	 	 else if (a==1)
	 		document.frm.paq.value=140
		 else if (a==2)
	 		document.frm.paq.value=210
		 else if (a==3)
	 		document.frm.paq.value=390
		
	}
	else{
		
	 if (a==0)
	 	document.frm.ho.value=0
	 else if (a==1)
	 	document.frm.ho.value=35.00
	 else if (a==2)
	 	document.frm.ho.value=60.00
	 else if (a==3)
	 	document.frm.ho.value=100.00
		
	 if (b==0)
	 	document.frm.domi.value=0
	 else if (b==1)
	 	document.frm.domi.value=12.00		
	 else if (b==2)
	 	document.frm.domi.value=42.00
	
	 if (c==0)
	 	document.frm.drr.value=0
	 else if (c==1)
	 	document.frm.drr.value=150
	 else if (c==2)
	 	document.frm.drr.value=210
	 else if (c==3)
	 	document.frm.drr.value=380
		
	}
	if (document.frm.ubi.value==5){
		document.frm.who.value='Ninguna'
	}
	else{
	 if (d==0)
	 	document.frm.who.value='Nada'
	 else if (d==1)
	 	document.frm.who.value='Google'
	 else if (d==2)
	 	document.frm.who.value='Amarillas'
	 else if (d==3)
	 	document.frm.who.value='Un conocido'
	 else if (d==4)
	 	document.frm.who.value='Centros COFIDE'
	 else if (d==5)
	 	document.frm.who.value='Otros'

    }		
}

function valoresencontro(){
	var d=document.frm.ubi.selectedIndex;
	 
	if (document.frm.ubi.value==5){
		document.frm.who.value='Ninguna'
	}
	else{
	 if (d==0)
	 	document.frm.who.value='Nada'
	 else if (d==1)
	 	document.frm.who.value='Google'
	 else if (d==2)
	 	document.frm.who.value='Amarillas'
	 else if (d==3)
	 	document.frm.who.value='Un conocido'
	 else if (d==4)
	 	document.frm.who.value='Centros COFIDE'
	 else if (d==5)
	 	document.frm.who.value='Otros'
    }		
}



function valoreswin(){
	var a=document.frm.hos.selectedIndex;
		
	 if (a==0)
	 	document.frm.ho.value=0
	 else if (a==1)
	 	document.frm.ho.value=119
	 else if (a==2)
	 	document.frm.ho.value=215
	 else if (a==3)
	 	document.frm.ho.value=360
}

function verifica(formu) {
	
	var vermail=ValidarEmail(formu.txtmail.value);
	
	if ((formu.txtdominio.value == "") || (formu.txtdominio.value== null)) {
	alert("Debe ingresar nombre de Dominio"); 
	formu.txtdominio.focus();
	return false;
	}
	else 
	if ((formu.txtnombre.value == "") || (formu.txtnombre.value== null)) {
	alert("Debe ingresar nombre de Contacto"); 
	formu.txtnombre.focus();
	return false;
	}
	else 
	if ((formu.txtdireccion.value == "") || (formu.txtdireccion.value== null)) {
	alert("Debe ingresar Dirección"); 
	formu.txtdireccion.focus();
	return false;
	}
	else
	if ((formu.txttelefono.value == "") || (formu.txttelefono.value== null)) {
	alert("Debe ingresar número de Teléfono"); 
	formu.txttelefono.focus();
	return false;
	}	
	else
	if ((formu.txtmail.value == "") || (formu.txtmail.value== null) || (vermail==false)) {
	alert("Dirección E-mail no valida o no ingresada"); 
	formu.txtmail.focus();
	return false;
	}	
	else 
	return true;	
	
}

function verificaterminos(formu) {
	
	if (formu.acepto.checked  == false)  {
	alert("Debe leer términos y condiciones del servicio. Marque el recuadro."); 
	return false;
	}
	else 
	return true;	
}



function probar()
	{ 
		var val=verifica(frm);
   		if (val == true) {
        var terminos=verificaterminos(frm);
		if ((val == true) && (terminos == true)) {
			valoresencontro()
			document.frm.action='pruebahost.php'
			document.frm.submit();
		}
		} 
	}

function enviar()
	{ 
		var valida=verifica(frm);
   		if (valida == true) {
		var terminos=verificaterminos(frm);
		if ((valida == true) && (terminos == true)) {
			valores()
			document.frm.action='ventahost.php'
			document.frm.submit();
		} 
		}
	}


function enviarjunior()
	{ 
		var valida=verifica(frm);
   		if (valida == true) {
		var terminos=verificaterminos(frm);
		if ((valida == true) && (terminos == true)) {
			valoresencontro()			
			document.frm.ho.value=24
			document.frm.action='ventahost.php'
			document.frm.submit();
		} 
		}
	}

function enviarwin()
	{ 
		var valida=verifica(frm);
   		if (valida == true) {
		var terminos=verificaterminos(frm);
		if ((valida == true) && (terminos == true)) {
			valoreswin()
			document.frm.action='ventahost.php'
			document.frm.submit();
		} 
		}
	}

function enviatemplate()
	{ 
		var valida=verifica(frm);
   		if (valida == true) {
		var terminos=verificaterminos(frm);
		if ((valida == true) && (terminos == true)) {
			document.frm.action='ventatemplate.php'
			document.frm.submit();
		} 
		}
	}

function moddominio()
	{ 
		var val=verifica(frm);
		if (val == true){
			document.frm.action='moddominio.php'
			document.frm.submit();
		}
		
	}

function ValidarEmail(email){
    var cadena = "Direccion de correo no valida: " + email;     

    if( email.indexOf('@',0) <= 0  || email.indexOf(';',0) != -1
     || email.indexOf(' ',0) != -1 || email.indexOf('/',0) != -1
     || email.indexOf(';',0) != -1 || email.indexOf('<',0) != -1
     || email.indexOf('>',0) != -1 || email.indexOf('*',0) != -1
     || email.indexOf('|',0) != -1 || email.indexOf('`',0) != -1
     || email.indexOf('&',0) != -1 || email.indexOf('$',0) != -1
     || email.indexOf('!',0) != -1 || email.indexOf('"',0) != -1
     || email.indexOf(':',0) != -1 )
       { return false; }
    else return true;
    }


function MiImagen(){
		var va=obtener_valor('val');
		document.frm.txtdominio.value=va;
	
			
}

function cambia_template()
{
var pagina=document.forms.frmTemplate.cmbgaleria.item(document.forms.frmTemplate.cmbgaleria.selectedIndex).text;
if(pagina=="Comercio/Entretenimiento/Varios"){ location.href="template_comercio.html"; }
if(pagina=="Negocios/Consultoría/Industria"){ location.href="template_main.html"; }
}
