function actualiza_producto(){
	document.cesta.action="cesta.php?car=update";
	document.cesta.submit();	
}

function validar_acceso(url){
	if(document.f1.email.value==""){
		alert("ERROR: ingrese su email ");
		document.f1.email.focus();
		return false;
	}else if(checkemail(document.f1.email.value)== false){
		document.f1.email.value="";
		document.f1.email.focus();
		return false;
	}else if(document.f1.password.value==""){
		alert("ERROR: ingrese password ");
		document.f1.password.focus();
		return false;
	}else{
		document.f1.action = url;
		document.f1.submit();
	}	
}

function validar_acceso_left(url){
	if(document.fmail.email.value==""){
		alert("ERROR: ingrese su email ");
		document.fmail.email.focus();
		return false;
	}else if(checkemail(document.fmail.email.value)== false){
		document.fmail.email.value="";
		document.fmail.email.focus();
		return false;
	}else if(document.fmail.password.value==""){
		alert("ERROR: ingrese password ");
		document.fmail.password.focus();
		return false;
	}else{
		document.fmail.action = url;
		document.fmail.submit();
	}	
}

var testresults
function checkemail(value){
	var str = value
	var filter=/^.+@.+\..{2,3}$/

	if (filter.test(str))
		testresults=true
	else{
		alert("Por favor ingrese un e-mail valido...");
		testresults=false
	}
	return (testresults)
}
function validpsw(e) { 
	tecla = (document.all) ? e.keyCode : e.which; 
	//alert(tecla)
    if (tecla==8 || tecla==46 || tecla==13) return true; //Tecla de retroceso (para poder borrar) 
    // dejar la línea de patron que se necesite y borrar el resto 
    //patron =/[A-Za-z]/; // Solo acepta letras 
    //patron = /\d/; // Solo acepta números
    patron = /\w/; // Acepta números y letras 
    //patron = /\D/; // No acepta números 
    // patron = /[\d.-]/; numeros el punto y el signo -
    te = String.fromCharCode(tecla); 
    verifica= patron.test(te);
	if(verifica==false){
		alert("El caracter que esta tratando de ingresar no se permite");		
		return false;
	}else{
		return true
	}	
	// uso  onKeyPress="return validpsw(event)"
}

function validacaracter(e) { 
	tecla = (document.all) ? e.keyCode : e.which; 
	//alert(tecla)
    if (tecla==8 || tecla==46 || tecla==13 || tecla==32) return true; //Tecla de retroceso (para poder borrar) 
    // dejar la línea de patron que se necesite y borrar el resto 
    //patron =/[A-Za-z]/; // Solo acepta letras 
    //patron = /\d/; // Solo acepta números
    patron = /\w/; // Acepta números y letras 
    //patron = /\D/; // No acepta números 
    // patron = /[\d.-]/; numeros el punto y el signo -
    te = String.fromCharCode(tecla); 
    return patron.test(te);	
	// uso  onKeyPress="return validacaracter(event)"
}
function validar_clientes(opcion){
	if(document.f1.nombre.value==""){
			alert(" Error: Por favor ingrese su nombre");
			document.f1.nombre.focus();
			return false
		}else if(document.f1.apellidos.value==""){
			alert(" ERROR: Por favor ingrese su apellido ");
			document.f1.apellidos.focus();
			return false
		}else if(document.f1.direccion.value==""){
			alert(" ERROR: Por favor ingrese su direccion ");
			document.f1.direccion.focus();
			return false
		}else if(document.f1.ciudad.value==""){
			alert(" ERROR: Por favor ingrese su ciudad ");
			document.f1.ciudad.focus();
			return false
		}else if(document.f1.departamento.value==""){
			alert(" ERROR: Por favor ingrese su departamento ");
			document.f1.departamento.focus();
			return false

		}else if(checkemail(document.f1.email.value)== false){
			document.f1.email.focus();
			return false;
		}else if(document.f1.telefono.value==""){
			alert(" ERROR: Por favor ingrese su telefono ");
			document.f1.telefono.focus();
			return false
		}else if(document.f1.password_confirma.value==""){
			alert(" ERROR: Por favor ingrese la confirmacion de su password");
			document.f1.password_confirma.focus();
			return false
		}else if(document.f1.password.value != document.f1.password_confirma.value){
			alert(" ERROR: al confirmar el password");
			document.f1.password_confirma.focus();
			return false
		}else if(document.f1.password.value==""){
			alert(" ERROR: Por favor ingrese  su password");
			document.f1.password.focus();
			return false
		}else{
			document.f1.action='cuenta.php?cuenta='+opcion;
			//document.f1.submit();
		}		
}
function validar_clientes_update(opcion){
	if(document.f1.nombre.value==""){
			alert(" Error: Por favor ingrese su nombre");
			document.f1.nombre.focus();
			return false
		}else if(document.f1.apellidos.value==""){
			alert(" ERROR: Por favor ingrese su apellido ");
			document.f1.apellidos.focus();
			return false
		}else if(document.f1.direccion.value==""){
			alert(" ERROR: Por favor ingrese su direccion ");
			document.f1.direccion.focus();
			return false
		}else if(document.f1.ciudad.value==""){
			alert(" ERROR: Por favor ingrese su ciudad ");
			document.f1.ciudad.focus();
			return false
		}else if(document.f1.departamento.value==""){
			alert(" ERROR: Por favor ingrese su departamento ");
			document.f1.departamento.focus();
			return false;
		}else if(document.f1.telefono.value==""){
			alert(" ERROR: Por favor ingrese su telefono ");
			document.f1.telefono.focus();
			return false
		}else{
			document.f1.action='cuenta.php?cuenta='+opcion;
			document.f1.submit();
		}		
}

function confirmacion(){
	if(document.fpedido.comprobante.options[document.fpedido.comprobante.selectedIndex].value == 0){
		alert("Error: por favor seleccione el comprobante de pago");	
		return false;
	}else{
		document.fpedido.action='pedido.php?pedido=finalizar';

		
	}	
}

function VerificaChecks_1(){
		var a=0;
		for (var i=0;i<document.f1.elements.length;i++){
		  var e = document.f1.elements[i];
		  if (e.checked && e.disabled==false){
			a++;
		  }
		}
		if(a==0){
			alert('Seleccione al menos un servicio para la notificación.');
		return false;
		}
	}
	
function confirma(){
		if(VerificaChecks_1()!=false){				
			//document.formu.save.value=1;
			//document.forms.formu.submit();
			document.frm_srvc.action='cuenta.php?cuenta=renovacion';
			document.frm_srvc.submit();
		}else{
				return false;
		}
}
function  validar_notificacion(){
		var f1 = eval("document.f1");
		if(f1.monto.value == ""){
			alert("Error: por favor especifique el Nro de operación");
			f1.monto.focus();
		}else if(f1.cboBanco.value == 0){
			alert("Error: por favor especifique el banco");
			f1.cboBanco.focus();
		}else if(f1.txtFecha.value == ""){
			alert("Error: por favor especifique la Fecha de Pago");
			f1.txtFecha.focus();
		}else{
			/*f1.action='cuenta.php?cuenta=EmailNotificacion';
			f1.submit();*/	
			if(VerificaChecks_1()!=false){				
			//document.formu.save.value=1;
			//document.forms.formu.submit();
				/*document.frm_srvc.action='cuenta.php?cuenta=renovacion';
				document.frm_srvc.submit();*/
				f1.action='cuenta.php?cuenta=EmailNotificacion';
				f1.submit();
			}else{
				return false;
			}
		}
}

function validar_dns_update(opcion,id){
		if(document.f1.nombre.value==""){
			alert(" Error: Por favor ingrese el nombre de dominio");
			document.f1.nombre.focus();
			return false
		}else if(document.f1.dns1.value==""){
			alert(" ERROR: Por favor ingrese el DNS primario ");
			document.f1.dns1.focus();
			return false
		}else if(document.f1.dns2.value==""){
			alert(" ERROR: Por favor ingrese el DNS secundario");
			document.f1.dns2.focus();
			return false
		}else{
			//alert(id);
			document.f1.action='cuenta.php?cuenta='+opcion+'&id='+id;
		
		}		
}

function validar_traslado(opcion){
		if(document.f3.dominio.value==""){
			alert(" Error: Por favor ingrese el nombre de dominio");
			document.f3.dominio.focus();
			return false
		}else if(document.f3.txtcodigo.value==""){
			alert(" Error: Por favor ingrese el codigo");
			document.f3.txtcodigo.focus();
			return false
		}else{
			document.f3.action='dominios.php?traslado='+opcion;
			document.f3.submit();
		}
		
}

function VerificaChecks(){
		var a=0;
		for (var i=0;i<document.frm_srvc.elements.length;i++){
		  var e = document.frm_srvc.elements[i];
		  if (e.checked && e.disabled==false){
			a++;
		  }
		}
		if(a==0){
			alert('Seleccione los servicios a renovar.');
		return false;
		}
	}
	
function confirma(){
		if(VerificaChecks()!=false){				
			//document.formu.save.value=1;
			//document.forms.formu.submit();
			document.frm_srvc.action='cuenta.php?cuenta=renovacion';
			document.frm_srvc.submit();
		}else{
				return false;
		}
}
function calcular(){
	subtotal=0;
	tot=document.getElementById("tot").value;
	for(var g=0;g<tot;g++){
		document.getElementById('total'+g).value=document.getElementById('cboAnio'+g).value*document.getElementById('totalh'+g).value;
		subtotal = subtotal + parseInt(document.getElementById('total'+g).value);
	}
	document.getElementById("subtot").value=subtotal.toFixed(2);
	igv = subtotal*0.19;
	document.getElementById("igv").value=igv.toFixed(2);
	
	
	total=subtotal+(subtotal*0.19);
	document.getElementById("total_re").value=total.toFixed(2);
}

function delete_renova(val){
	//alert(val);
	document.frm_reno.action='cuenta.php?cuenta=renovacion&id_renova_delete='+val;
	document.frm_reno.submit();
	
}

function add_renovacion(){
	document.frm_reno.action='cuenta.php?cuenta=add_renovacion';
	document.frm_reno.submit();
}
function valida_domain(){
	if(document.fdomain.domain.value != ""){
		document.fdomain.action = 'dominios.php';
		
	}else{
		alert('Error :Ingrese un nombre de dominio');
		document.fdomain.domain.focus();
		return false;
	}
}


function recuperar_password(){
	window.open("recuperar.php","","width=500,height=150");
}
	 var menu = new Array();
	 var hmenu = new Array();
	 
	 menu[0] = "aplication/webroot/imgs/ico_home.jpg"
	 menu[1] = "aplication/webroot/imgs/ico_nosotros.jpg"
	 menu[2] = "aplication/webroot/imgs/ico_hosting.jpg"
	 menu[3] = "aplication/webroot/imgs/ico_dominios.jpg"
	 menu[4] = "aplication/webroot/imgs/ico_contacto.jpg"
	 
	 hmenu[0] = "aplication/webroot/imgs/ico_home_0.jpg"
	 hmenu[1] = "aplication/webroot/imgs/ico_nosotros_1.jpg"
	 hmenu[2] = "aplication/webroot/imgs/ico_hosting_2.jpg"
	 hmenu[3] = "aplication/webroot/imgs/ico_dominios_3.jpg"
	 hmenu[4] = "aplication/webroot/imgs/ico_contacto_4.jpg"
	 
$(document).ready( function(){						   
		 	
/*	$("#menu_sup img").mouseover( function(){
		//var name = $(this).attr("src");
		$(this).hide();
		$(this).attr("src", hmenu[index]).fadeIn('fast'); 
	});	
	*/
	$('#menu_sup li').each(function(index){ 
		$(this).mouseover(function(){			
			$(".im",this).attr("src",hmenu[index]) 
		});
 		$(this).mouseout(function(){   
			$(".im",this).attr("src",menu[index])
		}); 		
	});	
 
 
	
	$("#tabla_color a").click( function(){
		var title = $(this).attr("title");
		 window.open("aplication/utilities/imagen.php?img="+title,"","resizable=0"); 
	});	
	 	
});


function validar_password(){
	
	if(document.frmc.email.value == ""){
		alert("Error Ingrese Un Email");
			document.frmc.email.focus();
			return false;	
	}else if(checkemail(document.frmc.email.value)== false){
			document.frmc.email.focus();
			return false;
	}else{
		document.frmc.action='recuperar.php';
	}
}
