// JavaScript Document
function saluda(){
	alert ("hola");
}

function fvalido(formu){
	if(formu.nombre.value==""){
		alert("Debe completar los campos obligatorios");
		return false;
	}
	if(formu.apellidos.value==""){
		alert("Debe completar los campos obligatorios");
		return false;
	}
	if(formu.mail.value==""){
		alert("Debe completar los campos obligatorios");
		return false;
	}
	if((formu.dni.value=="")&&(formu.pasaporte.value=="")){
		alert("Debe completar los campos obligatorios");
		return false;
	}
	if((formu.dni.value.length>0)&&(formu.dni.value.length<5)){
		alert("El D.N.I no es correcto");
		return false;
	}
	
	if(formu.mail.value.search(/^[A-Za-z][A-Za-z0-9._-]*@[A-Za-z0-9_-]+\.[A-Za-z0-9_.]+[A-za-z]$/))
	{
        alert("La direccion Mail no es valida. Formato correcto: nombre@servidor.dominio");
        return false;
    }
	if(formu.domicilio.value==""){
		alert("Debe completar los campos obligatorios");
		return false;
	}
	if(formu.provincia.value==""){
		alert("Debe completar los campos obligatorios");
		return false;
	}	
	if(formu.pais.value==""){
		alert("Debe completar los campos obligatorios");
		return false;
	}
	if(formu.fpago.value==""){
		alert("Debe completar los campos obligatorios");
		return false;
	}

	var $estado;
	for(i=0;i<formu.fpago.length; i++){
		if(formu.fpago[i].checked){
			$estado="si";
			return true;
		}else{
			$estado="no";
		}
	}
	if($estado=="no"){
		alert("Debe seleccionar una Forma de Pago");
		return false;
	}
}

function wopen(url, name, w, h)
{
	w += 32;
	h += 96;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(url,
	name,
	'width=' + w + ', height=' + h + ', ' +
	'left=' + wleft + ', top=' + wtop + ', ' +
	'location=no, menubar=no, ' +
	'status=no, toolbar=no, scrollbars=no, resizable=no');
	// Just in case width and height are ignored
	win.resizeTo(w, h);
	// Just in case left and top are ignored
	win.moveTo(wleft, wtop);
	win.focus();
}
function wopen2(url, name, w, h){
	w += 32;
	h += 96;
	wleft = (screen.width - w) / 2;
	wtop = (screen.height - h) / 2;
	var win = window.open(url,
	name,
	'width=' + w + ', height=' + h + ', ' +
	'left=' + wleft + ', top=' + wtop + ', ' +
	'location=no, menubar=no, ' +
	'status=no, toolbar=no, scrollbars=yes, resizable=yes');
	// Just in case width and height are ignored
	win.resizeTo(w, h);
	// Just in case left and top are ignored
	win.moveTo(wleft, wtop);
	win.focus();
}
