
var anioDesde = "1900";
var anioHasta = "2010";
var numeros="0123456789";
var separadorfecha="/";
var separadorhora=":";
var puntodecimal=".";
var signos="+-";
telefonos="0123456789-";

error= new creaerror();  
errores= new Array();

  
  
errores[1]="The field is empty.";
// fecha
errores[2]="Illegal character in a date input";
errores[3]="Separators missing in a date input";
errores[4]="Incorrect year in a date input. Must be greater than " + anioDesde + " and smaller than " + anioHasta;
errores[5]="Incorrect month in a date input";
errores[6]="Incorrect day in a date input";
//hora
errores[7]="Illegal character in an hour input";
errores[8]="Separators missing in an hour input";
errores[9]="Incorrect hour value in an hour input. Must be 'HH'";
errores[10]="Incorrect minute value in an hour input. Must be 'MM'";
errores[11]="Incorrect seconds value in an hor input. Must be 'SS'";

// numeros
errores[12]="Illegal character in a numeric input";
errores[13]="Illegal character (Must be +, - or a number)";
errores[14]="You have only input the symbol";
errores[15]="Missing decimal portion";

//telefonos
errores[16]="Illegal character in a Telephone Number. You can only enter numbers (0-9) or dashes (-)";
errores[17]="Please use just one dash per block of numbers (999-999-9999)";
errores[18]="A Telephone Number can't start with a dash";
errores[19]="A Telephone Number can't finish with a dash";

//email
errores[20]="Illegal character in an email input";

errores[21] = "The maximum length for this field is "
errores[22] = "The minimum length for this field is "

//ssn + Tax ID
errores[23]="Incorrect Format. (###-##-####) for Social Security Number or (##-#######) for Taxpayer Identification Number.";
// Crea un objeto que guarda un indice a la posición y al mensaje de error

//zip code
errores[24]="Illegal character in this number. You can only enter numbers (0-9) or dashes (-)";
errores[25]="Please use just one dash per block of numbers (999-999-9999)";
errores[26]="This number can't start with a dash";
errores[27]="This number can't finish with a dash";

function creaerror()
{
this.valor=0;
this.posicion=0;
return this
}
  
// Determina si un caracter es un número
function numero(car)
{
	return (numeros.indexOf(car)>=0)
}

// Determina si un año es bisiesto
function bisiesto(anio) 
{
	if (((anio % 4 == 0) && anio % 100 != 0) || anio % 400 == 0) 
		return true;
	return false;
}

// Comprueba si una fecha es correcta
function compruebafecha(contenido,error,desde,hasta)
{
   
	if ((contenido.length==0))
	{
		error.valor=1;
		error.posicion=1; 
		return false;
	} 
	var nsep=0;
	// Comprobación de la sintáxis de una fecha 
	for (var i=0; i<contenido.length; ++i)
	{
		var car=contenido.charAt(i);
		if (!numero(car)&&car!=separadorfecha)
		{
			error.valor=2;
			error.posicion=i+1; 
			return false;
		} 
		if (car==separadorfecha)
			nsep++ 
	}
	if (nsep!=2)
	{
		error.valor=3;
		error.posicion=i+1; 
		return false;
	}
	// Comprobación de la semántica de una fecha
	var pos1=contenido.indexOf(separadorfecha);
	var mes=contenido.substring(0,pos1);
	var pos2=contenido.indexOf(separadorfecha,pos1+1);
	var dia=contenido.substring(pos1+1,pos2); 
	var anio=contenido.substring(pos2+1,10);
	if (anio<desde||anio>hasta)
	{
		error.valor=4;
		error.posicion=6; 
		return false;
	} 
	if (mes<1||mes>12)
	{
		error.valor=5;
		error.posicion=2;
		return false;
	}
	if ((dia<1 || dia>31)||(mes==4&&dia>30)||(mes==6&&dia>30)
	||(mes==9&&dia>30)||(mes==11&&dia>30)
	||(mes==2&&bisiesto(anio)&&dia>29)
	||(mes==2&&!bisiesto(anio)&&dia>28))
	{
		error.valor=6;
		error.posicion=4;
		return false;
	} 
	return true 
}

function compruebafechacombo(dia, mes, anio, error)
{
	if ((dia<1 || dia>31)||(mes==4&&dia>30)||(mes==6&&dia>30)
	||(mes==9&&dia>30)||(mes==11&&dia>30)
	||(mes==2&&bisiesto(anio)&&dia>29)
	||(mes==2&&!bisiesto(anio)&&dia>28))
	{
		error.valor=6;
		error.posicion=2;
		return false;
	} 
	return true 

}
 
var isNav4 = false, isNav5 = false, isIE4 = false;
if(navigator.appName == "Netscape") 
{
	if (navigator.appVersion < "5") 
	{
		isNav4 = true;
		isNav5 = false;
	}
	else
		if (navigator.appVersion > "4") 
		{
			isNav4 = false;
			isNav5 = true;
		}
}
else 
{
	isIE4 = true;
}

function compruebaemail(contenido, error)
{
	var correcto = sintaxisemail(contenido);
	if (!correcto)
	{
		error.valor=20;
		return false;
	}
	return true;
}

function sintaxisemail(str){
	supported = 0;
	if (window.RegExp) 
	{
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") >0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}


// Comprueba si una hora es correcta
function compruebahoraminutosegundo(contenido,error)
{
	if ((contenido.length==0))
	{
		error.valor=1;
		error.posicion=1; 
		return false;
	} 
	var nsep=0; 
	// Comprobación de la sintáxis de una hora 
	for (var i=0; i<contenido.length; ++i)
	{
		var car=contenido.charAt(i);
		if (!numero(car) && car!=separadorhora)
		{
			error.valor=7;
			error.posicion=i+1; 
			return false;
		} 
		if (car==separadorhora)
			nsep++ 
	}
	if (nsep!=2)
	{
		error.valor=8;
		error.posicion=i+1; 
		return false;
	}
	// Comprobación de la semántica de una hora 
	var pos1=contenido.indexOf(separadorhora);
	var horas=contenido.substring(0,pos1);
	var pos2=contenido.indexOf(separadorhora,pos1+1);
	var minutos=contenido.substring(pos1+1,pos2); 
	var segundos=contenido.substring(pos2+1,10);
	if (horas>12 || horas.length!=2)
	{
		error.valor=9;
		error.posicion=2; 
		return false;
	} 
	if (minutos>59 || minutos.length!=2)
	{
		error.valor=10;
		error.posicion=4;
		return false;
	}
	if (segundos>59 ||segundos.length!=2)
	{
		error.valor=11;
		error.posicion=6;
		return false;
	} 
		return true 
}
function compruebahoraminuto(contenido,error)
{
	if ((contenido.length==0))
	{
		error.valor=1;
		error.posicion=1; 
		return false;
	} 
	var nsep=0; 
	// Comprobación de la sintáxis de una hora 
	for (var i=0; i<contenido.length; ++i)
	{
		var car=contenido.charAt(i);
		if (!numero(car) && car!=separadorhora)
		{
			error.valor=7;
			error.posicion=i+1; 
			return false;
		} 
		if (car==separadorhora)
			nsep++ 
	}
	if (nsep!=1)
	{
		error.valor=8;
		error.posicion=i+1; 
		return false;
	}
	// Comprobación de la semántica de una hora 
	var pos1=contenido.indexOf(separadorhora);
	var horas=contenido.substring(0,pos1);
	//var pos2=contenido.indexOf(separadorhora,pos1+1);
	var minutos=contenido.substring(pos1+1,6); 
	//var segundos=contenido.substring(pos2+1,10);
	if (horas>12 || horas.length!=2)
	{
		error.valor=9;
		error.posicion=2; 
		return false;
	} 
	if (minutos>59 || minutos.length!=2)
	{
		error.valor=10;
		error.posicion=4;
		return false;
	}
		return true 
}
	  
// Determina si un carácter es un signo positivo o negativo
function signo(car)
{
	return (signos.indexOf(car)>=0)
}

    
// Comprueba si el contenido es un número es natural incluido el 0
function compruebanatural(contenido,error)
{
	if (contenido.length == 0)
	{
		error.valor=1;
		error.posicion=1; 
		return false;
	}  
	for (var i=0; i<contenido.length;i++)
	{
		if (!numero(contenido.charAt(i)))
		{
			error.valor=12;
			error.posicion=i+1;
			return false;
		} 
	}
	return true;
}

// Comprueba si un signo se encuetra en la posición correcta 
function signocorrecto(contenido,error)
{
	if (contenido.length == 0)
	{
		error.valor=1;
		error.posicion=1; 
		return false;
	}
	else 
		if (!numero(contenido.charAt(0))&&!signo(contenido.charAt(0)))
		{
			error.valor=13;
			error.posicion=1; 
			return false;
		}
		else
			return true;
}

// Comprueba si el contenido es un número es entero
function compruebaentero(contenido,error)
{ 
	if (!signocorrecto(contenido,error))    
		return false;    
	else 
		if (numero(contenido.charAt(0)))
			var aux=compruebanatural(contenido,error);
		else
		{ 
			var aux=compruebanatural(contenido.substring(1,contenido.length),error);
			if (!aux)
				error.posicion++; 
			if (error.valor==1)
			{
				error.valor=14;
				error.posicion=1;
			}
		}
	return aux;   
}

// Comprueba si el contenido es un número es real
function compruebareal(contenido,error)
{ 
	var aux=compruebaentero(contenido,error);
	var posicionpunto=error.posicion-1;
	if (!aux && error.valor==12 && puntodecimal.indexOf(contenido.charAt(posicionpunto))>=0) 
	{
		var aux=compruebanatural(contenido.substring(error.posicion,contenido.length),error); 
		if (!aux && error.valor==1)
		{
			error.valor=15;
		}
		if (!aux)
			error.posicion+=posicionpunto+1;
	}
	return aux;
}

// Comprueba si contenido está vacio
function compruebavacio(contenido,error)
{
	if (contenido.length == 0)
	{
		error.valor=1;
		error.posicion=1; 
		return false;
	}
	for (var i=0; i<contenido.length; i++)
	{
		if (contenido.charAt(i)!=' ' && contenido.charAt(i)!='\t')
		{
			return true;
		} 
	}
	error.valor=1;
	error.posicion=1; 
	return false;

}
function compruebassn(contenido,error)
{
	if (contenido.length != 11)
	{
		error.valor=23;
		error.posicion= contenido.length; 
		return false;
	}  

	var pos1=contenido.indexOf("-");
	var parte1=contenido.substring(0,pos1);
	var pos2=contenido.indexOf("-",pos1+1);
	var parte2=contenido.substring(pos1+1,pos2); 
	var parte3=contenido.substring(pos2+1,11);

	if (pos1 == -1)
	{
		var parte1=contenido.substring(0,11);
	}
	var correcto
	correcto = compruebanatural(parte1,error);
	if (!correcto)
	{
		return false;
	}
	if (parte1.length != 3)
	{
		error.valor=23;
		error.posicion=1; 
		return false;
	}  

	correcto = compruebanatural(parte2,error);

	if (!correcto)
	{
		error.posicion += (pos1+1);
		return false;
	}
	if (parte2.length != 2)
	{
		error.valor=23;
		error.posicion=1; 
		return false;
	}  

	correcto = compruebanatural(parte3,error);
	if (!correcto)
	{
		error.posicion += (pos2+1);
		return false;
	}
	if (parte3.length != 4)
	{
		error.valor=23;
		error.posicion=1; 
		return false;
	}  

	return true;

}
function compruebataxid(contenido,error)
{
	if (contenido.length != 10)
	{
		error.valor=23;
		error.posicion= contenido.length; 
		return false;
	}  

	var pos1=contenido.indexOf("-");
	var parte1=contenido.substring(0,pos1);
	var parte2=contenido.substring(pos1+1,10); 

	if (pos1 == -1)
	{
		var parte1=contenido.substring(0,10);
	}
	var correcto
	correcto = compruebanatural(parte1,error);
	if (!correcto)
	{
		return false;
	}
	if (parte1.length != 2)
	{
		error.valor=23;
		error.posicion=1; 
		return false;
	}  

	correcto = compruebanatural(parte2,error);

	if (!correcto)
	{
		error.posicion += (pos1+1);
		return false;
	}
	if (parte2.length != 7)
	{
		error.valor=23;
		error.posicion=1; 
		return false;
	}  
	return true;

}
function telefono(car)
{
	return (telefonos.indexOf(car)>=0)
}
function compruebalongitudcampo(contenido,error,longitud)
{
	if (contenido.length > longitud)
	{
		error.valor=21;
		error.posicion=longitud;
		return false;
	}
	return true;
}
function compruebaminimalongitudcampo(contenido,error,longitud)
{
	if (contenido.length < longitud)
	{
		error.valor=22;
		error.posicion=longitud;
		return false;
	}
	return true;
}
function compruebatelefono(contenido,error)
{
	guiones = "-"
	for (var i=0; i<contenido.length;i++)
	{
		guiones += "-";
		if (!telefono(contenido.charAt(i)))
		{
			error.valor=16;
			error.posicion=i+1;
			return false;
		}
		// Comprueba que no haya 2 o más guiones seguidos
		if (contenido.indexOf(guiones)>=0)
		{
			error.valor=17;
			error.posicion=contenido.indexOf(guiones)+1;
			return false;
		} 
	}
	if (contenido.charAt(0) == "-")
	{
		error.valor=18;
		error.posicion=1;
		return false;
	}
	if (contenido.charAt(contenido.length-1) == "-")
	{
		error.valor=19;
		error.posicion=contenido.length;
		return false;
	}
	
	
	
	return true;
}

function compruebazipcode(contenido,error)
{
	guiones = "-"
	for (var i=0; i<contenido.length;i++)
	{
		guiones += "-";
		if (!telefono(contenido.charAt(i)))
		{
			error.valor=24;
			error.posicion=i+1;
			return false;
		}
		// Comprueba que no haya 2 o más guiones seguidos
		if (contenido.indexOf(guiones)>=0)
		{
			error.valor=25;
			error.posicion=contenido.indexOf(guiones)+1;
			return false;
		} 
	}
	if (contenido.charAt(0) == "-")
	{
		error.valor=26;
		error.posicion=1;
		return false;
	}
	if (contenido.charAt(contenido.length-1) == "-")
	{
		error.valor=27;
		error.posicion=contenido.length;
		return false;
	}
	
	
	
	return true;
}

function mascaranatural(campo,valor,e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;

	var alphaCheck = "0123456789";
	var caracter=valor.charAt(valor.length-1);
	
	if (alphaCheck.indexOf(caracter) < 0) 
	{
		campo.value = campo.value.substr(0, (valor.length-1));
		return false;

	}
}

function mascaraentero(campo,valor,e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	var alphaCheck = "0123456789+-";
	var caracter=valor.charAt(valor.length-1);
	
	if (alphaCheck.indexOf(caracter) < 0) 
	{
		campo.value = campo.value.substr(0, (valor.length-1));
		return false;

	}
	if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
		return false;
	else 
	{
		if ((caracter == "+" || caracter == "-") && valor.length > 1)
		{
			campo.value = campo.value.substr(0, (valor.length-1));
			return false;
		}

	}
}
function mascarareal(campo,valor,e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	var alphaCheck = "0123456789.+-";
	var caracter=valor.charAt(valor.length-1);
	
	if (alphaCheck.indexOf(caracter) < 0) 
	{
		campo.value = campo.value.substr(0, (valor.length-1));
		return false;

	}
	if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
		return false;
	else 
	{
		if ((caracter == "+" || caracter == "-") && valor.length > 1)
		{
			campo.value = campo.value.substr(0, (valor.length-1));
			return false;
		}
		verificador = valor.substr(0, (valor.length-1));
		if (caracter == "." && (verificador.indexOf(".") >= 0 || valor == "." || valor == "+." || valor == "-."))
		{
			campo.value = campo.value.substr(0, (valor.length-1));
			return false;
		}
	}
}

function mascaratelefono(campo,valor,e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	var alphaCheck = "0123456789-";
	var caracter=valor.charAt(valor.length-1);
	
	if (alphaCheck.indexOf(caracter) < 0) 
	{
		campo.value = campo.value.substr(0, (valor.length-1));
		return false;

	}
	if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
		return false;
	else 
	{
		if (valor.charAt(0) == "-")
		{
			campo.value = campo.value.substr(0, (valor.length-1));
			return false;
		}
		if (caracter == "-" && valor.charAt(valor.length-2) == caracter)
		{
			campo.value = campo.value.substr(0, (valor.length-1));
			return false;
		}
	}
}

function mascarafecha(campo,valor,e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (valor.length > 8 && isNav4) 
	{
		if (valor.indexOf("/") >= 1)
			return true;
	}
	
	if (valor.length == 3 && valor.charAt(valor.length-1) == "/")
	{
		return true;
	}
	if (valor.length == 6 && valor.charAt(valor.length-1) == "/")
	{
		return true;
	}

	//var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";
	var alphaCheck = "0123456789";
	var caracter=valor.charAt(valor.length-1);
	
	if (alphaCheck.indexOf(caracter) < 0) 
	{
		campo.value = campo.value.substr(0, (valor.length-1));
		return false;

	}
	if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
		return false;
	else 
	{
		//Create numeric string values for 0123456789/
		//The codes provided include both keyboard and keypad values
		var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
		if (strCheck.indexOf(whichCode) != -1) 
		{
			if (valor.length == 2) 
			{
				campo.value += "/";
			}
			if (valor.length == 5) 
			{
				campo.value += "/";
			}
			if (valor.length == 3 && valor.length != "/")
			{
				campo.value = campo.value.substr(0, (valor.length-1)) + "/" + campo.value.substr((valor.length-1), valor.length);
			}
			if (valor.length == 6 && valor.length != "/") 
			{
				campo.value = campo.value.substr(0, (valor.length-1)) + "/" + campo.value.substr((valor.length-1), valor.length);
			}
		}
	}
}
function mascarahoraminuto(campo,valor,e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (valor.length > 8 && isNav4) 
	{
		if (valor.indexOf(":") >= 1)
			return true;
	}
	
	if (valor.length == 3 && valor.charAt(valor.length-1) == ":")
	{
		return true;
	}
	if (valor.length > 5)
	{
		campo.value = campo.value.substr(0, 5);
	}
	
	var alphaCheck = "0123456789";
	var caracter=valor.charAt(valor.length-1);
	
	if (alphaCheck.indexOf(caracter) < 0) 
	{
		campo.value = campo.value.substr(0, (valor.length-1));
		return false;

	}
	if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
		return false;
	else 
	{
		//Create numeric string values for 0123456789/
		//The codes provided include both keyboard and keypad values
		var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
		if (strCheck.indexOf(whichCode) != -1) 
		{
			if (valor.length == 2) 
			{
				campo.value += ":";
			}
			if (valor.length == 3 && valor.length != ":")
			{
				campo.value = campo.value.substr(0, (valor.length-1)) + ":" + campo.value.substr((valor.length-1), valor.length);
			}
		}
	}
}
function mascarahoraminutosegundo(campo,valor,e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (valor.length > 8 && isNav4) 
	{
		if (valor.indexOf(":") >= 1)
			return true;
	}
	
	if (valor.length == 3 && valor.charAt(valor.length-1) == ":")
	{
		return true;
	}
	if (valor.length == 6 && valor.charAt(valor.length-1) == ":")
	{
		return true;
	}
	if (valor.length > 8)
	{
		campo.value = campo.value.substr(0, 8);
	}
	
	var alphaCheck = "0123456789";
	var caracter=valor.charAt(valor.length-1);
	
	if (alphaCheck.indexOf(caracter) < 0) 
	{
		campo.value = campo.value.substr(0, (valor.length-1));
		return false;

	}
	if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
		return false;
	else 
	{
		//Create numeric string values for 0123456789/
		//The codes provided include both keyboard and keypad values
		var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
		if (strCheck.indexOf(whichCode) != -1) 
		{
			if (valor.length == 2) 
			{
				campo.value += ":";
			}
			if (valor.length == 5) 
			{
				campo.value += ":";
			}
			if (valor.length == 3 && valor.length != ":")
			{
				campo.value = campo.value.substr(0, (valor.length-1)) + ":" + campo.value.substr((valor.length-1), valor.length);
			}
			if (valor.length == 6 && valor.length != ":")
			{
				campo.value = campo.value.substr(0, (valor.length-1)) + ":" + campo.value.substr((valor.length-1), valor.length);
			}
		}
	}
}

function convierteFechaIngles (contenido)
{
	var pos1=contenido.indexOf(separadorfecha);
	var mes=contenido.substring(0,pos1);
	var pos2=contenido.indexOf(separadorfecha,pos1+1);
	var dia=contenido.substring(pos1+1,pos2); 
	var anio=contenido.substring(pos2+1,10);
	if (dia < 10)
	{
		if (dia.length == 1)
		{
			dia = "0" + dia; 
		}
	}
	if (mes < 10) 
	{
		if (mes.length == 1)
		{
			mes = "0" + mes; 
		}
	}
	var cont = anio + mes + dia;
	return cont
}
function convierteHora (contenido)
{
	var pos1=contenido.indexOf(separadorhora);
	var horas=contenido.substring(0,pos1);
	var minutos=contenido.substring(pos1+1,5); 
	if (horas < 10)
	{
		if (horas.length == 1)
		{
			horas = "0" + horas; 
		}
	}
	if (minutos < 10) 
	{
		if (minutos.length == 1)
		{
			minutos = "0" + minutos; 
		}
	}
	var cont = horas + minutos;
	return cont;
}
function comparaDosFechasIngles(fecha1,fecha2)
{
// Devuelve 0 si son las dos iguales, 1 si fecha1 es mayor y 2 si fecha2 es mayor
	var fechaStart = convierteFechaIngles(fecha1);
	var fechaEnd = convierteFechaIngles(fecha2);
	if (fechaStart > fechaEnd)
	{
		return 1;
	}
	if (fechaStart < fechaEnd)
	{
		return 2;
	}
	if (fechaStart == fechaEnd)
	{
		return 0;
	}
}
function comparaDosHoras(hora1,hora2)
{
	var timeStart = convierteHora(hora1);
	var timeEnd = convierteHora(hora2);
	if (timeStart > timeEnd)
	{
		return 1;
	}
	if (timeStart < timeEnd)
	{
		return 2;
	}
	if (timeStart == timeEnd)
	{
		return 0;
	}
}
function abrirVentana(url,pagina,w,h)
{
	win = window.open(url,pagina, "top=10,left=10,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,location=no,directories=no,resizable=yes,scrollbars=yes,status=no")
	//win = window.open(url,pagina, "top=10,left=10,width=640,height=500,toolbar=yes,menubar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes,status=yes")
}
function abrirVentanaEspecial(url,pagina,w,h,parametros)
{
	win = window.open(url,pagina, "top=10,left=10,width=" + w + ",height=" + h + "," + parametros)
	//win = window.open(url,pagina, "top=10,left=10,width=640,height=500,toolbar=yes,menubar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes,status=yes")
}

function maximizarPagina()
{
	if (window.screen)
	{
		aw = screen.availWidth;
		ah = screen.availHeight;
		window.moveTo(0,0);
		window.resizeTo(aw,ah);
	}
}
function autoChange(varTime)
{
	var timeID = setTimeout("location.href='LogOut.aspx'", varTime);
}