
var home_actual;

function timedCount()
{
    cambia_imagen();

}

function cambia_imagen(){

    /*alert(home_actual);*/

    document.getElementById("home_principal_imagen").src=myhomes[home_actual][1];
    document.getElementById("home_principal_enlace").href=myhomes[home_actual][2];

    home_actual=home_actual+1;
    if(home_actual==myhomes.length){
        home_actual=0;
    }
    if(myhomes.length>1){
    t=setTimeout("cambia_imagen()",3000);
    }

}


var i;
var imagenes = new Array("images/menu_1_on.gif","images/menu_2_on.gif","images/menu_3_on.gif","images/menu_4_on.gif","images/menu_5_on.gif","images/menu_6_on.gif","images/menu_7_on.gif","images/menu_8_on.gif","images/menu_9_on.gif","images/menu_10_on.gif");
var lista_imagenes = new Array();
function cargarimagenes(){
for(i in imagenes){
lista_imagenes[i] = new Image();
lista_imagenes[i].src = imagenes[i];
}
}



function activar_provincia(id){
    if(document.getElementById(id).value=="1"){
        document.getElementById("destino_provincia").disabled="";
    }else{
        document.getElementById("destino_provincia").disabled="disabled";
    }
}

function borrar_input(id,texto){
    if(document.getElementById(id).value==texto){
        document.getElementById(id).value="";
    }


}

function escribir_input(id,texto){
    if(document.getElementById(id).value==''){
        document.getElementById(id).value=texto;
    }
}


var Ventana2;
function openIT(theURL,W,H, wname,S) {
  var prop;

  if (S!='no') S="yes"

  prop = "width="+W+",height="+H+",scrollbars="+S;


if (Ventana2) {
    if (Ventana2.closed) {
      Ventana2=open(theURL,wname,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      Ventana2.focus();
    }
    else {
      Ventana2=open(theURL,wname,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      Ventana2.focus();
    }
  }
  else {
      Ventana2=open(theURL,wname,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      Ventana2.focus();
  }
}


function emutation_ToObject(id) {
		if(document.layers){
			return (document.layers[id])?eval(document.layers[id]):null;
		}
		else if(document.all && !document.getElementById){
			return (eval("window."+id))?eval("window."+id):null;
		}
		else if(document.getElementById && document.body.style) {
			return (document.getElementById(id))?eval(document.getElementById(id)):null;
		}
	}
  
function emutation_FlashWrite(miEMswf, miEMcreativewidth, miEMcreativeheight, miEMwmode, miEMbgcolor, miID){
	
	var emswf = miEMswf; 
	var emcreativewidth = miEMcreativewidth;
	var emcreativeheight = miEMcreativeheight;
	var emwmode = miEMwmode;
	var embgcolor = miEMbgcolor;
	
	ntcode = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+ emcreativewidth +"' height='"+ emcreativeheight +"' id='"+ miID +"'>";
	ntcode +="<param name='movie' value='" + emswf + "'>";
	ntcode +="<param name='quality' value='high'>";
	ntcode +="<param name='bgcolor' value='#" + embgcolor +"'>";
	ntcode +="<param name='wmode' value='"+ emwmode +"'>";
	ntcode +="<param name='menu' value='false'>";
	ntcode +="<embed src='" + emswf + "' quality='high' wmode='" + emwmode + "' width='" + emcreativewidth + "' height='" + emcreativeheight + "' bgcolor='#" + embgcolor +"' type='application/x-shockwave-flash' menu='false' name='"+ miID +"' swLiveConnect='true'></embed></object>";
  	document.write(ntcode);
}

function emutation_FlashInnerHTML(htmlElementId,code){
  var x=emutation_ToObject(htmlElementId);
  if(x){
    if(document.getElementById||document.all){
      x.innerHTML='';
      x.innerHTML=code;
      }
    else if(document.layers){
      x.document.open();
      x.document.write(code);
      x.document.close();
      }
    }
  }
  
  
function valEmail(valor){
    re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/
    if(!re.exec(valor)){
        return false;
    }else{
        return true;
    }
}


function validarEntero(valor){
      //intento convertir a entero.
     //si era un entero no le afecta, si no lo era lo intenta convertir
     valor = parseInt(valor)

      //Compruebo si es un valor numérico
      if (isNaN(valor)) {
            //entonces (no es numero) devuelvo el valor cadena vacia
            return ""
      }else{
            //En caso contrario (Si era un número) devuelvo el valor
            return valor
      }
} 
