//Esto pone la parte de la izquierda, derecha y centro a la misma altura
window.onload = redimensionar;
function redimensionar(){
	id="izq"
	var e=document.getElementById(id);
	if(!e) {
		return false
	}else{
		n1 = document.getElementById('izq').offsetHeight//+'px'
		n2 = document.getElementById('der').offsetHeight//+'px'
		n3 = document.getElementById('centro').offsetHeight//+'px'
		
		valor_izq=n1
		valor_der=n2+33
		valor_cen=n3+33
		//+33 porque izq empieza desde más arriba
		
		if (valor_izq>valor_der){
			if (valor_izq>valor_cen){
				valor=valor_izq//El más grande el de la izq
				valor_izq=valor
				valor_der=valor-33
				//valor_cen=valor
			}else{
				valor=valor_cen//El más grande el de la centro
				valor_izq=valor
				valor_der=valor-33
				valor_cen=valor
				
			}
		}else{
			if (valor_der>valor_cen){
				valor=valor_der//El más grande el de la der
				valor_izq=valor+33
				valor_der=valor
			}else{
				valor=valor_cen//El más grande el de la centro
				valor_izq=valor
				valor_der=valor-33
				valor_cen=valor
			}
		}
		if (valor_izq<980){
			ana=980-valor_izq
			valor_izq=valor_izq+ana
			valor_der=valor_der+ana
			valor_cen=valor_cen+ana
		}
		document.getElementById('izq').style.height = valor_izq+'px'
		document.getElementById('centro').style.height = valor_cen+'px'
		document.getElementById('der').style.height = valor_der+'px'
	}
}

function ignoreSpaces(string) {
	var temp = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(v = 0; v < splitstring.length; v++)
	temp += splitstring[v];
	//devuelve vacio o relleno
	return temp;
}
function dolar(string) {
	var temp = "";
	string = '' + string;
	splitstring = string.split("$");
	for(v = 0; v < splitstring.length; v++)
	temp += splitstring[v]+"'";
	//devuelve vacio o relleno
	return temp;
}
//Introducción de e-mail correcto
function validarEmail(valor) {
	ema=valor
	mal=0
	if ((ema!="")&&(ema.indexOf("@")==-1)){
		mal=1
	}
	if ((ema!="")&&(ema.indexOf("@")!=ema.lastIndexOf("@"))){
		mal=1
	}
	if ((ema!="")&&(ema.charAt(0)=="@")){
		mal=1
	}
	if ((ema!="")&&(ema.charAt(ema.length-1)=="@")){
		mal=1
	}
	if ((ema!="")&&(ema.lastIndexOf(".")==-1)){
		mal=1
	}
	if ((ema!="")&&(ema.indexOf(" ")!=-1)){
		mal=1
	}
	if ((ema!="")&&(ema.charAt(0)==".")){
		mal=1
	}
	if ((ema!="")&&(ema.charAt(ema.length-1)==".")){
		mal=1
	}
	if ((ema!="")&&(ema.indexOf("@")>ema.lastIndexOf("."))){
		mal=1
	}
	if ((ema!="")&&(ema.lastIndexOf(".")-ema.indexOf("@")<2)){
		mal=1
	}
	return mal
}


//------------------------------------------------
var daysInMonth = makeArray(12);
daysInMonth[1] = 31;
daysInMonth[2] = 29;
daysInMonth[3] = 31;
daysInMonth[4] = 30;
daysInMonth[5] = 31;
daysInMonth[6] = 30;
daysInMonth[7] = 31;
daysInMonth[8] = 31;
daysInMonth[9] = 30;
daysInMonth[10] = 31;
daysInMonth[11] = 30;
daysInMonth[12] = 31;

function makeArray(n) {
   for (var i = 1; i <= n; i++) {
      this[i] = 0;
   } 
   return this;
}

function daysInFebruary(whichYear) {
    return (whichYear % 4 == 0 && (!(whichYear % 100 == 0)
 || (whichYear % 400 == 0)) ? 29 : 28);
}

function isDate(campo) {
	dd=campo.substring(0,2)*1
	mm=campo.substring(3,5)*1
	aa=campo.substring(6,10)*1
	if (mm !="" && !(mm > 0 && mm < 13)){
		alert ("¡Fecha no existente!");
		return false;
	}
	if (dd !="" && !(dd > 0 && dd < 32)){
		alert ("¡Fecha no existente!");
		return false;
	}
	if ((dd!="" && mm!="") && dd > daysInMonth[mm]){
		alert ("¡Fecha no existente!")
		return false;
	}
	if ((mm=="2" || mm=="02" && dd!="" && yyyy!="") && dd > daysInFebruary(yyyy)){
		alert ("¡Fecha no existente!")
		return false;
	}
return true;
}
function ventana(page, x, y){
	posx = (screen.availWidth-x)/2;
	posy = (screen.availHeight-y)/2;
	window.open(page, 'DETALLE','toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width='+x+', height='+y+', top='+posy+', left='+posx);
}
function transicion(){
	if (document.all){
		document.images.visor.style.filter="blendTrans(duration=2)"
		document.images.visor.style.filter="blendTrans(duration=duracion)"
		document.images.visor.filters.blendTrans.Apply()      
	}
	document.images.visor.src = precarga[j].src
	if (document.all){
		document.images.visor.filters.blendTrans.Play()
	}
	j = j + 1
	if (j > (p-1)) j=0
	t = setTimeout('transicion()', velocidad)
}
