var ROOT_PATH = ""
var menu_izq_root = "";

/******************************************************
 * FUNCIONES DISEÑO DREAMW
 ******************************************************/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function VOTAR_OVER (obj) { obj.setAttribute("src","/img/b-votar-over.gif"); }	 
function VOTAR_OUT (obj)  { obj.setAttribute("src","/img/b-votar.gif"); }	 

function BUSCAR_OVER (obj) { obj.setAttribute("src","/img/b-buscar-over.gif"); }	 
function BUSCAR_OUT (obj)  { obj.setAttribute("src","/img/b-buscar.gif"); }	 

/******************************************************
 * FUNCIONES PARA ESTACIONES
 ******************************************************/
 function goToEstacion(id,pais,region,destino,idpais,idregion,iddestino) {
    document.mainform.id.value = id;
	document.mainform.pais.value = pais;
	document.mainform.region.value = region;
	document.mainform.destino.value = destino;
	document.mainform.idpais.value = idpais;
	document.mainform.idregion.value = idregion;
	document.mainform.iddestino.value = iddestino;
	document.mainform.action = "/estaciones/detalle.asp?temporada="+document.mainform.temporada.value+"&id="+id+"&pais="+pais+"&region="+region+"&destino="+destino+"&idpais="+idpais+"&idregion="+idregion+"&iddestino="+iddestino;
	document.mainform.submit();	
 }
 function chgPaisEstacion() {
    document.mainform.frm_region.selectedIndex = 0;
	document.mainform.submit();
 }
/******************************************************
 * FUNCIONES PARA ALOJAMIENTOS
 ******************************************************/  
function goToAlojamiento(id,pais,region,destino) {
    document.mainform.id.value = id;
	document.mainform.pais.value = pais;
	document.mainform.region.value = region;
	document.mainform.destino.value = destino;
	document.mainform.action = "/alojamientos/detalle.asp?temporada="+document.mainform.temporada.value+"&id="+id+"&pais="+pais+"&region="+region+"&destino="+destino+"&temp=undefined";
	document.mainform.submit();	
 }
function goToListAlojaDest(id,pais,region,destino) {
    document.mainform.iddestino.value = id;
	document.mainform.pais.value = pais;
	document.mainform.region.value = region;
	document.mainform.destino.value = destino;
	document.mainform.action = "/alojamientos/index.asp?temporada="+document.mainform.temporada.value+"&iddestino="+id+"&pais="+pais+"&region="+region+"&destino="+destino;
	document.mainform.submit();	
 }
 
 function goToCursos(id,pais,region,destino) {
    document.mainform.id.value = id;
	document.mainform.pais.value = pais;
	document.mainform.region.value = region;
	document.mainform.destino.value = destino;
	document.mainform.action = "/cursos/detalle.asp?temporada="+document.mainform.temporada.value+"&id="+id+"&pais="+pais+"&region="+region+"&destino="+destino;
	document.mainform.submit();	
 } 
function chgRegionAlojamiento() {
    document.mainform.frm_destino.selectedIndex = 0;
	document.mainform.submit();
}
function viewDetallePrecioFecha(id,temp) {
    var win = window.open("/alojamientos/popupDetallePrecios.asp?id="+id+"&temp="+temp,"detallePrecios","width=800,height=600,left=0,toop=0,scrollbars=yes");
	 	win.focus();
}
function viewT1Link(id) {
    var win = window.open("/especiales/popupLink.asp?id="+id,"detalleLink","width=600,height=500,left=0,toop=0,scrollbars=yes");
	 	win.focus();
}
/******************************************************
 * FUNCIONES PARA ESPECIALES
 ******************************************************/  
function goToEspeciales(id,tipo,tipo2) {
    document.mainform.id.value = id;
	document.mainform.tipo2.value = tipo2;
	document.mainform.action = "/especiales/detalle_"+tipo+".asp?temporada="+document.mainform.temporada.value+"&id="+id+"&tipo2="+tipo2;
	document.mainform.submit();	
 }
function goToMayoristas(linkmay,ventanavert) {
	document.mainform.frm_link.value = linkmay;
	document.mainform.frm_ventanavert.value = ventanavert;
	document.mainform.action = "/especiales/mayoristas.asp?temporada="+document.mainform.temporada.value+"&frm_link="+linkmay+"&frm_ventanavert="+ventanavert;
	document.mainform.submit();	
 } 
function goToListadoHotelesEspeciales(idEst,id,pais,region,destino) {
    document.mainform.iddestino.value = idEst;
	document.mainform.id.value = id;
	document.mainform.pais.value = pais;
	document.mainform.region.value = region;
	document.mainform.destino.value = destino;
	document.mainform.action = "/especiales/detallehoteles.asp?temporada="+document.mainform.temporada.value+"&iddestino="+idEst+"&id="+id+"&pais="+pais+"&region="+region+"&destino="+destino;
	document.mainform.submit();	
 }
/******************************************************
 * FUNCIONES PARA GALERIAS
 ******************************************************/  
 function viewPhoto(id,w,h,t) {
    w = w + 100;
	h = h + 100;
	if (w>750) { w=750; } if (h>550) { h=550; }
    var win = window.open("/galerias/popupPhoto.asp?id="+id+"&type="+t,"popupPhoto","width=" + w + ",height=" + h);
			win.focus()		
 }
 function viewPlano(id,w,h,t) {
    w = w + 100;
	h = h + 100;
    var win = window.open("/galerias/popupPhoto.asp?id="+id+"&type="+t,"popupPlano","scrollbars=yes, resizable=yes","width=" + w + ",height=" + h);
			win.focus()		
 }

//  ########################################################## 6/11/04
/******************************************************
 * FUNCIONES PARA LAYERS
 ******************************************************/  
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
/******************************************************
 * FUNCIONES PARA EMAIL
 ******************************************************/  
function contEmail() {

	if (!emailCheck(document.mainform.frm_email.value)) { 
		alert('La dirección de correo electronico (Email) no es valida');
		document.mainform.frm_email.focus();
	 	return; }
 	
    var win = window.open("/comun/email.asp?email="+document.mainform.frm_email.value,"email","width=300,height=200,left=0,toop=0,scrollbars=no");
	 	win.focus()
}

 function emailCheck (emailStr) {
		var emailPat=/^(.+)@(.+)$/ 
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]" 
		var validChars="\[^\\s" + specialChars + "\]" 
		var quotedUser="(\"[^\"]*\")" 
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) { return false; }
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) { return false; }
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) { return false; }
			}
			return true
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) { return false; }
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (len<2) { return false; }
		return true;
	}

/**************************************************************
/* FUNCIONES GENERALES	
/**************************************************************/
	
function botonChgImg(obj,imgP) { obj.setAttribute("src",imgP); }

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function chkPaisC(form,o) {
  form.frm_provincia.selectedIndex = (o.value != 62) ? (form.frm_provincia.options.length-1) : 27;  
  form.frm_provincia.disabled = (o.value != 62) ? true : false;
  form.frm_prov_c.value = "0";
  chkProvinciaC(form,form.frm_provincia)
}
function chkProvinciaC(form,o) {
  form.frm_prov_c.value = o.value;
}
function chgSubSecc(val) {
  document.mainform.frm_subsecc.value=val;
  document.mainform.action = menu_izq_root + "index.asp";
  SubmitForm();
}
function SubmitForm() {
   var o = document.mainform;
   if (checkTextChars(o)) { o.submit(); }
   else                   { alert("ERROR PRG: unknow"); }     
}
function checkTextChars(o) {
   for (var i=0; i<o.elements.length; i++) {
      if (o.elements[i].type == "text" || o.elements[i].type == "textarea" || o.elements[i].type == "hidden") {
	   rExpQuot = /\'|\"/gi;
	   o.elements[i].value = o.elements[i].value.replace(rExpQuot,"&quot;")
	   //alert(o.elements[i].name + " => " + o.elements[i].value);
	  } 
   }	   
   return true;
}
/******************************************************
 * FUNCIONES PARA CONDICIONES
 ******************************************************/  

function viewInfo(Info) {
    var win = window.open("/info/popupInfo.asp?info="+Info,"Informacion","width=600,height=400,left=0,toop=0,scrollbars=yes");
	 	win.focus();
}		

/******************************************************
 * FUNCIONES PARA DESTACADOS
 ******************************************************/  
function goToDesglosar(Desglose,Destino) {
   	document.mainform.frm_desglosar.value = Desglose;
	document.mainform.action = Destino;
	document.mainform.submit();
 }