//abre una nueva ventana
function openWindow(mypage, myname, w, h, t, l, scroll,resizable) {				
	if (t == 0 || l == 0){
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
	}else{
		var winl = l;
		var wint = t;
	}
	
	var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resizable+',toolbar=no'
	var win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4)
		{
			win.window.focus();
		}
}	
//imprime pagina
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 
//
function printPage()
{ 
	if (pr) // NS4, IE5   
		window.print() 
	else if (da && !mac) // IE4 (Windows)
		vbPrintPage() 
	else // other browsers
		alert("Lo sentimos, Tu browser no soporta este método, imprimelo desde el menú");  
}
//
function buscar(){
	document.buscardor.submit();
}
//
function sendHistorial(){
	document.historial.submit();
}
//
function validarEmail(valor, forma) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
	    return (true)
	} else {
    	alert("La dirección de e-mail es incorrecta.")
	    return (false)
	}
}
//
function checkFirma(theForm){
	if (theForm.nombre.value == ""){
		alert(": Alerta : \n _______________________________________\n\n El campo Nombre no puede se omitido.")
		theForm.nombre.focus()
		return (false)
	}else if(theForm.codigo.value == ""){
		alert(": Alerta : \n _______________________________________\n\n Introduce el Código de Seguridad que aparece en la imagen.")
		theForm.codigo.focus()
		return (false)
	}else if(theForm.comentarios.value == ""){
		alert(": Alerta : \n _______________________________________\n\n El campo Comentarios no puede se omitido.")
		theForm.comentarios.focus()
		return (false)
	}
}
//
function buscarPorFecha(theForm) {
	document.buscarFecha.submit();
}
//
function buscarPorFechaOld(theForm) {
	document.buscarFechaOld.submit();
}
//
function view(id){
	document.getElementById("contacto"+id).style.display = "";
}
//
function hide(id){
	document.getElementById("contacto"+id).style.display = "none";
}