function impdocu()
	{

	var ficha = document.getElementById('paimp');

	var ventimp = window.open('./impresion.asp', 'datos','left=2px,top:2px,width=900px,height=900px');

	ventimp.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n');
	ventimp.document.write('<html xmlns="http://www.w3.org/1999/xhtml">\n');
	ventimp.document.write('<head>\n');
	ventimp.document.write('<title>Datos a imprimir</title>\n');
	ventimp.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n');
    ventimp.document.write('<link rel="stylesheet" type="text/css" media="print" href="../lib/principal.css">\n');
	ventimp.document.write('<link rel="stylesheet" type="text/css" media="print" href="./estilos/imprimir.css">\n');
	ventimp.document.write('<link rel="stylesheet" type="text/css" media="screen" href="../lib/principal.css">\n');
	ventimp.document.write('<link rel="stylesheet" type="text/css" media="screen" href="./estilos/ambitos.css">\n');
	ventimp.document.write('</head>\n');
	ventimp.document.write('<body>\n');
	ventimp.document.write('<div id=\"paimp\">\n');
	ventimp.document.write( ficha.innerHTML );	
	ventimp.document.write('</div>\n');
	ventimp.document.write('</body>\n');
	ventimp.document.write('</html>\n');
	
	//ventimp.opener.focus();
	ventimp.focus(); 
	//ventimp.document.close();
	//ventimp.print( );	
//	ventimp.close();	
	} 
function pepito()
{alert("hola caracola");}
function cambiar1(capa){	
	if (document.getElementById(capa).style.visibility=="visible"){
		document.getElementById(capa).style.visibility='hidden';
		document.getElementById(capa).style.height='0';	
		}
}

function cambiar(capa){	
	if (document.getElementById(capa).style.visibility=="hidden"){
		document.getElementById(capa).style.visibility='visible';
		document.getElementById(capa).style.height='auto';	
		}
	else{
		document.getElementById(capa).style.visibility='hidden';
		document.getElementById(capa).style.height='0';
		}
}

// JavaScript Document
function restaurar(desde,pag) {
	location.href=desde+"?codigo="+pag;
}
	function cantidad(aki) {
		if(document.getElementById(aki).value.length >= 253){ 
			alert('No tiene mas espacio disponible.'); 			
		 	}
		}
	
	
	
	function numerico(aki){
		var campo = document.getElementById(aki).value;	
		campo = document.getElementById(aki).value;		

		if (campo!="") {
			var tam = campo.length;		
			var letra = campo.substring(tam-1,tam);	

			if ( isNaN(parseInt(letra)) )	{
				alert("tiene que escribir un numero.");
				if (tam>0) 
					{document.getElementById(aki).value = campo.substring(0,tam-1);}
				else
					{document.getElementById(aki).value = "";}
				}	
			}		
	}
	
	function arroba(aki) {
		var x = 0;
		var aux = 0;
		var campo = document.getElementById(aki).value;
		campo = document.getElementById(aki).value;
		var tam = campo.length;
		for (x=0;x<tam;x++) {
				if (campo.substring(x,x+1)=="@") 
					{aux = 1;}
			}
		if (aux==1) {
			aux = 0;
			for (x=(tam-4);x<tam;x++) {
				if (campo.substring(x,x+1)==".") {
					aux = 1;
					}
				}
			}	
		if (aux==0){
			alert("Compruebe su correo electronico");
			}	
		}
		
		
function MM_reloadPage(init) {	// Recarga la pagina si se cambia el tamaño de Netscape
  	if (init==true) with (navigator) {
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    			document.MM_pgW=innerWidth;
			document.MM_pgH=innerHeight;
			onresize=MM_reloadPage; 
		}
	} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}
	MM_reloadPage(true);


//MENSAJES IDIOMA
var msn_fecha;
var msn_boton;
var msn_errores;
var msn_obligatorio;
var msn_maxmin;
var msn_y;
var msn_num;
var msn_email;
var capa;

function cargaridioma(idioma)
{
if (idioma=='E')
	{
		msn_fecha="Data ez da zuzena.";
		msn_boton="Botoia sakatzea debekatuta dago.";
		msn_errores="Hurrengo erroreak aurkitu dira:" ;
		msn_obligatorio=" beharrezkoa da" ;
		msn_maxmin=" zenbaki hauen arteko bat behar da" ;
		msn_y=" eta " ;
		msn_num=" zenbakia izan behar da";
		msn_email=" baliodun bat izan behar da";
	}
else
	{
		msn_fecha="La fecha es inválida";
		msn_boton="Pulsación de botón no permitida";
		msn_errores="Se han detectado los siguientes errores:";
		msn_obligatorio=" es necesario";
		msn_maxmin=" debe contener un numero entre";
		msn_y=" y ";
		msn_num=" debe ser número";
		msn_email=" debe contener una dirección de e-mail válida";
		
	}
}
//Elegir idioma de entrada
function validaridioma(formulario,idioma)
{
	document.forms[formulario].idioma.value=idioma;
	document.forms[formulario].submit();
}
//------------------------------------------------------------------------------------------------------------------------
//funcion obligatorio

function MM_findObj(n, d) { //v4.01
var p, i, x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0, p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n, d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var titulo,i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  { 
    test=args[i+2]; 
    val=MM_findObj(args[i]);
	titulo=args[i+1]; 
    if (val) 
		{nm=val.name; 
		 if ((val=val.value)!="") 
			{if (test.indexOf('isEmail')!=-1)
			   { p=val.indexOf('@');
        		if (p<1 || p==(val.length-1)) errors+='- '+titulo+msn_email+'\n';
      			} else if (test!='R') 
					{ num = parseFloat(val);
			        if (isNaN(val)) errors+='- '+titulo+msn_num+'\n';
			        if (test.indexOf('inRange') != -1) 
						{ p=test.indexOf(':');
			        	  min=test.substring(8,p); max=test.substring(p+1);
				          if (num<min || max<num) errors+='- '+titulo+msn_maxmin+min+' msn_y '+max+'.\n';
					    } 
					} 
				} else if (test.charAt(0) == 'R') errors += '- '+titulo+msn_obligatorio+'\n'; }
	           } 
			   if (errors) alert(msn_errores+'\n\n'+errors);
		       document.MM_returnValue = (errors == '');
		}
		

function mensaje(texto) {
	if(confirm(texto)){
		returnMen = true;
	}
	else{
		returnMen = false;
	}
}

function numbersOnly(el) {
    el.value = el.value.replace(/[^0-9]/g, "");
}
