//Verifica que la fecha de salida sea posterior a la de llegada
var cont;

//Funcion que cambia atributos de un formulario
//[forma]    = Nombre del formulario
//[onsubmit] = Si valor  quiere  decir que reemplace el obsubmit que tenia el formulario 
//[action]   = Si valor, debe  cambiar la action del formulario/////
function SubmitForm(forma,onsubmit,url,param1) {
	var error = false; //No Hubo error
	//Ya tiene onsubmit el formulario? True  False
	var existe = (typeof(forma.onsubmit) != "undefined" && forma.onsubmit != null ) ? true :  false;
	//si quieren cambiar el onsubmit o Agregar !!!
	if (onsubmit!="") { 
	   forma.onsubmit = onsubmit; existe= true;  //cambio 	
	}
	//Tiene ruta? Cambia la accion
	if(url!=""){ forma.action = url;}
	//Si tiene onsubmit el formulario ?
	if(existe==true)  { 
		//Ejecuto onsubmit:  False: Todo bien; True: Hubo Error	 
		if (forma.onsubmit()==true) {error = false;} else {error = true;}
	} 			
	if (error == false)  //Si no hay error hago el submit del form..
	  forma.submit();

}

function ActivaControlFlash()
{
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}

function verificaFechas()
{ 
	var fechaI
	var fechaF
	var mensaje = "";
	var idioma = fdic.lang(null);
	
	fechaI = document.getElementById("fechaIda").value;
	fechaF = document.getElementById("fechaRegreso").value;
	
	//alert(fechaI);
	//alert(fechaF);
	
	/*fechaI = arrMonths[parseInt(document.getElementById("desde_mes").value) - 1] + ' ' + document.getElementById("desde_dia").value + ', ' + document.getElementById("desde_anio").value;
	fechaF = arrMonths[parseInt(document.getElementById("hasta_mes").value) - 1] + ' ' + document.getElementById("hasta_dia").value + ', ' + document.getElementById("hasta_anio").value;*/
	if (Date.parse(fechaI) > Date.parse(fechaF))
	{
		alert(fdic.trad(disFechaSalidaPosterior,idioma));
		return false;
	}
	return true;
}

function verificaTipoOnSubmit()
{ 

    /*var texto 
    
    var indice = document.forma.HotelID.selectedIndex     
    var valor = document.forma.HotelID.options[indice].value     
    var textoEscogido = document.forma.HotelID.options[indice].text     
    */
	var i;
	var url, mionsubmit;
	var hotel;
	hotel = document.getElementById("HotelID").value;		
	//alert(hotel);
	//if(document.getElementById("RadioHotel").checked == true) {
		url = '/Reservations/'; 
		//alert(url);
	//}
	//else {
		//url = '/ReservationsPackages/'; 
	//}
	
		
	switch (hotel)
		{
		case "230":	//Gran Porto Real	
			url = url +  'Gran-Porto-Real';
			break;
		case "5":	//Gran Caribe Real
			url = url +  'Gran-Caribe-Real';
			break;
		case "231":	//Real	Playa Carmen
			url = url +  'Real-Playa-Carmen';
			break;
		case "487":	//The Royal Playa Carmen
			url = url +  'The-Royal-Playa-Carmen';
			break;
		case "1209": //The Royal Cancun		
			url = url +  'The-Royal-Cancun';
			break;
		default:		
			break;		
		}		
		
		if(document.getElementById("RadioHotel").checked == true) {
			url = url + '/default.asp'; 
			document.getElementById("forma").action = url;
			return verificaFechas();			
		}
		else if (document.getElementById("RadioHotelAvion").checked == true) {
			url = url + '/defaultPackages.asp'; 
			document.getElementById("forma").action = url;
			/*return validaPackHotel('formaReal',9,document.formaReal.desde_anio.value,document.formaReal.desde_mes.value,document.formaReal.desde_dia.value,document.formaReal.hasta_anio.value,document.formaReal.hasta_mes.value,document.formaReal.hasta_dia.value);*/
		}
		else if (document.getElementById("RadiosAvionHotel").checked == true) {
			url = url + '/defaultPackages.asp'; 
			document.getElementById("forma").action = url;
			/*return validaPackHotel('formaReal',9,document.formaReal.desde_anio.value,document.formaReal.desde_mes.value,document.formaReal.desde_dia.value,document.formaReal.hasta_anio.value,document.formaReal.hasta_mes.value,document.formaReal.hasta_dia.value);*/
		}
		else{
			url = '/Flight/'; 
			document.getElementById("forma").action = url;			
			/*return validaPackHotel('formaReal',9,document.formaReal.desde_anio.value,document.formaReal.desde_mes.value,document.formaReal.desde_dia.value,document.formaReal.hasta_anio.value,document.formaReal.hasta_mes.value,document.formaReal.hasta_dia.value);		*/
		}
		
		
}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  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);
function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger) {

// by E Michael Brandt of ValleyWebDesigns.com - Please leave this comment intact.

	alt=alt+"  ** Click window to close **"
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

    if(w<740){
      var lift=0.90;
    }
    if(w>=740 & w<835){
      var lift=0.91;
    }
    if(w>=835){
      var lift=0.93;
    }

	if (imageWidth>w){	
		byFactor = w / imageWidth;			
		imageWidth = w;
		imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
		byFactor = h / imageHeight;
		imageWidth = (imageWidth * byFactor);
		imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
		imageHeight=imageHeight*lift;
		imageWidth=imageWidth*lift;
	}

	var posLeft=0
	var posTop=0
	
	if (hugger=="hug image") {
		posTop = (scrHeight-imageHeight)/2;
		posLeft = ((w-imageWidth)/2);
		scrHeight = imageHeight-adj;
		scrWidth = imageWidth-adj;
 	}
	
	imageHeight=imageHeight-adj;
	imageWidth=imageWidth-adj;

	newWindow = window.open("","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt=\"Click\&nbsp\;screen\&nbsp\;to\&nbsp\;close.\" >'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// openWindow function for online reservations

function openBestday(aux) {

            popupWin = window.open(aux,'bestday', 'top=5,left=5,width=627,height=600,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=yes,directories=no,toolbar=no')

}

 

// Put Focus if Called

if (window.focus) {

            self.focus();

            }
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_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_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];}
}


/// Funciones para fechas

var arrDays   = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var arrMonths = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var myDate    = new Date();
var intCurrentMonth = myDate.getMonth()+1;
var intCurrentYear  = myDate.getFullYear();
var intCurrentDay   = myDate.getDate();
var intSelectedMonth
var intSelectedYear
var intSelectedDay

intSelectedYear = ""
intSelectedMonth = "" 
intSelectedDay = ""

function cleanSelect(arg_Select){
	while (arg_Select.options.length > 0){
		arg_Select.options[0] = null
	}	
}

function fillYearsSelect(arg_Select){
	cleanSelect(arg_Select);		
	arg_Select.options[0] = new Option(intCurrentYear,intCurrentYear, false, false);
	arg_Select.options[1] = new Option(intCurrentYear + 1,intCurrentYear + 1, false, false);	
	if((intSelectedYear > 0) && (intSelectedYear != intCurrentYear))
		arg_Select.options[1].selected = true
}

function fillMonthsSelect(arg_Year, arg_Select, arg_DaySelect, blnFromLoad){
	var i
	var j
	var k = 0
	var dayDiff
	var intUntil
    var mes_actual
	var opcion
	var mes = arg_Select.value;
	
	cleanSelect(arg_Select); 
	if(arg_Year == intCurrentYear){	
		j = intCurrentMonth-1
	}	
	else{
		j = 0;	
	}
	intUntil = 11;
	for (i=j; i<=intUntil; i++){
		if((intSelectedYear == arg_Year) && (intSelectedMonth == i) && (blnFromLoad)){
			arg_Select.options[k++] = new Option(arrMonths[i],i + 1,true,true);
		}	
		else
			arg_Select.options[k++] = new Option(arrMonths[i],i + 1,false,false);
	}
    mes_actual=12-arg_Select.length+1
	
	if(mes_actual<=mes){
	    opcion=mes-mes_actual;
	    arg_Select.options[opcion].selected = true;
	}
	else
		arg_Select.options[0].selected = true;
	
	fillDaysSelect(arg_Year, arg_Select.value, arg_DaySelect, blnFromLoad);		
}

function fillDaysSelect(arg_Year, arg_Month, arg_Select, blnFromLoad){
    var i
	var j
	var k = 0
	var intUntil
	var ultimodia
	var dia = arg_Select.value;
	
	//Empty Combo
	cleanSelect(arg_Select); 
	// j has the value for the first day
	if((arg_Year == intCurrentYear) && (arg_Month == intCurrentMonth)){
			j = intCurrentDay
		}	
	else{
		j=1;
	}
	
	//Number of days in the selected month
	intUntil = arrDays[arg_Month-1]
	if(arg_Month == 2){
		if (arg_Year % 4 == 0){
			intUntil++
		}	 
	}
	
	//Fill the days combo and if there is a selected date select it here too.
	for (i=j; i<=intUntil; i++){
		    if((intSelectedYear == arg_Year) && (intSelectedMonth == arg_Month) && (intSelectedDay == i-1) && (blnFromLoad))
				arg_Select.options[k++] = new Option(i ,i,true,true);
			else
				arg_Select.options[k++] = new Option(i ,i,false,false);
		
	}	
	
	if(arg_Select.length>=dia)
	    arg_Select.options[dia-1].selected = true;
	else{
	    ultimodia=arg_Select.length;
		arg_Select.options[ultimodia-1].selected = true;}
		
	if((arg_Year == intCurrentYear) && (arg_Month == intCurrentMonth)){
		if((dia >= j) && (dia <= i-1)){
	    		cont=0;
				indice=0;
				for(s=j; s<=i-1; s++)
				{
		 		  if (s == dia)
			   	  indice=cont;	
				  cont=cont+1;  
				 }
	    		arg_Select.options[indice].selected = true;
				
		 }
		 else
		 	 arg_Select.options[0].selected = true;
	}
	
	
}


// **********************************************************************************************************
//                       FUNCIONES PARA PAQUETES DE AVION + HOTEL
// **********************************************************************************************************


function showPage(sshow)
{
	//0 = Oculta
	//1 = Mostrar		
	var obj = document.getElementById('cajon')	
	//Si existe oculta el div de pagina espera
	if (obj != null) 
	{		
		if (sshow == 1)   {
			eval ("document.getElementById('cajon').style.display=''");  
		}
		else {
			eval ("document.getElementById('cajon').style.display='none'");  
		}
	}
 }


maxNumNinios = 8; 
sinAdultos = false;

//Funcion para Mostrar los Cuartos de Paquetes de Avion  (SOLO PUNTO.TRAVEL)
function Travel_ShowRoom(forma)
{
  var numcuartos = eval("document." + forma + ".num_cuartos.value");	//numero de cuartos
	eval("document.getElementById('DivTablaNinos').style.display='none'");	//Oculto la Tabla de Rooms-ninos
	eval("document.getElementById('DivTablaNinos_1').style.display='none'"); //Oculto la Tabla de Room1-ninos
	for(s=2; s<=5;s++) 
	{
		//eval("document.getElementById('DivTabla_" + s + "').style.display='none'");	//Oculto la Tabla adultos-ninos
		eval("document.getElementById('DivTablaNinos_" + s + "').style.display='none'"); //Oculto la Tabla de Rooms-ninos
	 	eval("document.getElementById('Divnum_adultos_" + s + "').style.display='none'");  //Combo de Adultos	 
	 	eval("document.getElementById('Divnum_ninos_" + s + "').style.display='none'");	//Combo de Ninos 
	}
	for (s=2; s<= numcuartos; s++)
	{
	   // eval("document.getElementById('DivTabla_" + s + "').style.display=''");	//Muestro la Tabla Contenedora				
		eval("document.getElementById('Divnum_adultos_" + s + "').style.display=''");  //Combo de Adultos		
		eval("document.getElementById('Divnum_ninos_" + s + "').style.display=''");	//Combo de Ninos	 		
	}	
	Travel_CleanChild(forma,0); //Limpia los combos de ninos y oculta tablas de Rooms-ninos
}



//Muestro los Cobos de los Nios  (SOLO PUNTO.TRAVEL)
function Travel_CleanChild(forma,k)
{	
   //debugger;
	if(k==0)
	{
		eval("document." + forma + ".num_ninos.value=0"); //Limpio combo de Ninos Room1
		eval("document.getElementById('DivTablaNinos_1').style.display='none'");	//Muestro la Tabla Contenedora
		Travel_LimpiaNinos(forma,1);
		for (s=2; s<=5; s++)
		{ 
			Travel_LimpiaNinos(forma,s);
			eval("document." + forma + ".num_adultos_" + s + ".value=0"); //Limpio combo de Ninos
			eval("document." + forma + ".num_ninos_" + s + ".value=0"); //Limpio combo de Ninos
			eval("document.getElementById('DivTablaNinos_" + s + "').style.display='none'"); //Oculto la Tabla de Rooms-ninos
		}
	}
	else
	{
		Travel_LimpiaNinos(forma,k);
		eval("document.getElementById('DivTablaNinos').style.display=''");	//Oculto la Tabla de Rooms-ninos
		eval("document.getElementById('DivTablaNinos_" + k + "').style.display='none'");	//Muestro la Tabla Contenedora
	}
}


//Muestro los Cobos de los Nios (SOLO PUNTO TRAVEL)
function Travel_LimpiaNinos(forma,k)
{	//debugger;
        if (k==1)
	       { b=''; }
	    else
	       { b='_'+ k; }
	    
	    //Limpio a todos los objetos edades
		for (var a=1; a <= maxNumNinios; a++)
		  {
			  //alert(a);
		   eval("document." + forma + ".EdadNino" + a + b +".value=-1");  
		  }	
}

//Muestro los DIV de Edades de los Nios (SOLO PUNTO TRAVEL)
function Travel_ShowNinos(forma,k)
{ 
	if (k==1)
	{ b=''; }
	else
	{ b='_'+ k; }
	eval("document.getElementById('DivTablaNinos_" + k + "').style.display='none'");	//Muestro la Tabla Contenedora
	var prende = 0;
	if(eval("document." + forma + ".num_ninos.value")>0) // reviso que el combo de ninos Room1 sea mayor que 0
			prende = 1;
	for (var s = 2; s<=5; s++) // reviso que el combo de ninos Rooms (2,3,4,5) sea mayor que 0
	{
		if(eval("document." + forma + ".num_ninos_" + s +".value")>0)
			prende = 1;
	}
	if (prende == 0)
		eval ("document.getElementById('DivTablaNinos').style.display='none'");//Oculta todo el div general de Rooms edades
	
	// Oculto o muestro los combos de edades y el div contenedor
	if(eval("document." + forma + ".num_ninos" + b +".value") == 0)
	{
		Travel_LimpiaNinos(forma,k); //Limpio Combos
		eval("document.getElementById('DivTablaNinos_" + k + "').style.display='none'");	//Oculto la Tabla de edades ninos
	}
	else
	{
		eval ("document.getElementById('DivTablaNinos').style.display=''"); //Muestro Tabla general de edades
		eval("document.getElementById('DivTablaNinos_" + k + "').style.display=''");	//Muestro la Tabla Contenedora
		for (var ninios = 1; ninios <= 8; ninios++)
	    {		
			// Oculto o muestro todos los combos de edades del Room seleccionado
			if(ninios <= eval("document." + forma + ".num_ninos" + b +".value"))
			{
				eval ("document." + forma + ".EdadNino" + ninios + "" + b +".style.display=''"); 
			}
			else
			{
				eval ("document." + forma + ".EdadNino" + ninios + "" + b +".style.display='none'"); 
			}
	    }
	}
} 


function $()
{
    //debugger;
	var _10=new Array();
	for(var i=0;i<arguments.length;i++)
	{ 	var _12=arguments[i];
		if(typeof _12=="string")
		{ _12=document.getElementById(_12);
		}
		if(arguments.length==1)
		{
		return _12;
		}
		_10.push(_12);
	}
	return _10;
}

// id: id del objeto; s: 1 para desplegar y 0 para ocultar
function DisplayObj(id,s) {
	//alert(id + '-' + s);
	var e = $(id); if(e != null) if(s){eval("e.style.display = ''");}else{eval("e.style.display = 'none'");}
		/*var e = document.getElementById(id) 
		
		if(e != null) 
			if(s)
			{e.style.display = 'block';}
			else
			{e.style.display = 'none';}*/
}

function CajaReservas(Tipo) {
	if(Tipo=="H") {  	// Hotel Only
		DisplayObj("DivLeavingFrom",0);
		DisplayObj("DivRooms",0);
	}
	else { 				// Hotel + Avion
		DisplayObj("DivLeavingFrom",1);
		DisplayObj("DivRooms",1);
	} 
}


// AJAX

var descripcionGral = '';
function ClearField(Obj,descripcion) 
{    
    descripcionGral = descripcion;
     var descObj = Obj.value;       
     ///if ((Cadena == "City Name or Airport Code") || (Cadena == "Teclee el nombre de la ciudad  codigo del Aeropuerto")) {     
     if (descObj == descripcion) {     
        Obj.value="";    
        //Obj.className="iputmust";
     }
     else {
        Obj.focus();
        Obj.select();
     }
}


function displayLayer(layerName, popup) 
{
    var currentLayer = $(layerName);
	displayLayerAsObj(currentLayer, popup);
}
function hideLayer(layerName) 
{   
	DisplayObj(layerName,0);
    /*var divObj = $(layerName);
    
	divObj.style.visibility = "hidden";
	divObj.style.display = "none";*/
}
function hidePopup(layerName) 
{    
	var Version =navigator.appVersion.substring(22,25);
	Version = parseInt(Version);
	if (navigator.appName=="Microsoft Internet Explorer")
		if (Version < 7)	    
			Mostrar_Elementos();
	hideLayer(layerName); 
}



//Mueve a la posicion el elemento que le pacen..
function setPositionElement(s)
{        
    //document.onresize= setPositionElement();
    //Que si tenga el nombre del objeto donde se posicionara el elemento
    var Tobj = typeof(Tmpobj);   
    //que exista el objeto
    if (Tobj != "undefined")
    {                   
        var popupDiv = $(Tmpmoveobj);  //Objeto como string  elemento que se mueve de Ubicacion
        var posElementXY = getPositionElement(Tmpobj);  //Objeto donde se pretende mover
	    var defWidth = popupDiv.clientWidth;  //Ancho del elemento
    			
	    mleft = (posElementXY[0] +20);  //Left 20
        mTop = (posElementXY[1] + 20);	 //Top
    		
	    popupDiv.style.left = mleft + "px"; //left del Objeto  //((windowSize[0] - popupWidth ) / 2) + scrollXY[0];
	    popupDiv.style.top = mTop + "px";  //Top del Objeto  //((windowSize[1] - popupHeight) / 2) + scrollXY[1];
	    popupDiv.style.zIndex = 100;	
	}
	  
}

//1.- La Declaracion del Arreglo debe estar en la Pagina
//2.- El div que se movera de ubicacion, debera existir en la Pagina
function displayHelp(obj,moveobj,idhtml) 
{   
    //debugger;    
    var Version =navigator.appVersion.substring(22,25);
		Version = parseInt(Version);
		if (navigator.appName=="Microsoft Internet Explorer")
			if (Version < 7)
	        Ocultar_Elementos();
    var content ="";      
    if (arrHelp != null || arrHelp.length > 0)
    {        
        content = arrHelp[idhtml];              //Obtengo el html 
        //obj = nombre del objeto como cadena      
        showPopHelp(obj,moveobj,idhtml, content) //Incrusto el Html al div con sus atributos
    }
   
    
}


//fucnion que mueve el objeto a la posicion de otro objeto
//obj = nombre del objeto como cadena
function showPopHelp(obj,moveobj,idhtml, content) 
{  
    //debugger;
    var mleft;
    var mTop;
    
	var popupDiv = $(moveobj);  	
	popupDiv.innerHTML = content;   //"<div>"+ popupHtml+"</div>";
	popupDiv.style.display = "block";
	
	//var windowSize = getWindowSize();	
	//var scrollXY = getScrollXY();		
	
	popupDiv.style.position = "absolute";
	
	var posElementXY = getPositionElement(obj);
	Tmpobj =  obj;  //Objeto que se va a mover
	Tmpmoveobj = moveobj;  //Paso que elemento me llamo anteriormente	
	var defWidth = popupDiv.clientWidth;
			
	mleft = (posElementXY[0] +20);  //Left 20
    mTop = (posElementXY[1] + 20);	 //Top
		
	popupDiv.style.left = mleft + "px"; //left del Objeto  //((windowSize[0] - popupWidth ) / 2) + scrollXY[0];
	popupDiv.style.top = mTop + "px";  //Top del Objeto  //((windowSize[1] - popupHeight) / 2) + scrollXY[1];
	popupDiv.style.zIndex = 100;
	
	displayLayer(popupDiv,true);
}


function displayLayerAsObj(divObj, popup) 
{
    if(popup == true) 
	{
	 divObj.style.zIndex = 100;
	}
	divObj.style.visibility = "visible";
	divObj.style.display = "inline";
}


//Me da la Posicion Izquierda del elemento
function getPositionElement(elem)
{   
    var curleft=0;  //default left
    var curtop=0;   //default top       
    var obj = $(elem);   //tomo el nombre del elemento y convierto en objeto
    
    //Si tenemos al objeto
    if (obj != null)
     {       
        if (obj.offsetParent) 
        {
            curleft = obj.offsetLeft;  //tomo la posicion left del objeto
            curtop = obj.offsetTop;  //tomo el tope del objeto
            while (obj = obj.offsetParent) 
             {
                curleft += obj.offsetLeft;
                curtop += obj.offsetTop;
             }
        }
        curleft=parseInt(curleft);
        curtop=parseInt(curtop); 
    }   
    return [curleft, curtop];
} 


var xElemt;
var offsetX;
var yElemt;
var offsetY;
var suelta=false;
function unDrag(event)
{
  suelta = false;
}
function Drag_Drop(e)
{
    //una ves soltado el objeto lo muevo de ubicacion
    if (suelta)
    {
        var x = xElemt + e.clientX - offsetX;
        var y = yElemt + e.clientY - offsetY;

        var popupDiv = $('help');  
        popupDiv.style.position = "absolute";					
	    mleft = x;  
        mTop = y;	
    	
	    popupDiv.style.left = mleft + "px";
	    popupDiv.style.top = mTop + "px";
	    popupDiv.style.zIndex = 100;
   }
}
//Toma las posiciones del objeto que se va a mover 
function inicializeDrag(e)
{      
   if (!e) e = window.event;   
   var popupDiv = $('help');
    offsetX = e.clientX;  
    offsetY = e.clientY;
    xElemt = parseInt(popupDiv.style.left);
    yElemt = parseInt(popupDiv.style.top);
    suelta = true;
    //document.onmousemove = Drag_Drop(e);    
    
}

function showPage(sshow)
{
	//0 = Oculta
	//1 = Mostrar		
	var obj = document.getElementById('cajon')	
	//Si existe oculta el div de pagina espera
	if (obj != null) 
	{		
		if (sshow == 1)   {
			eval ("document.getElementById('cajon').style.display=''");  
		}
		else {
			eval ("document.getElementById('cajon').style.display='none'");  
		}
	}
 }

//MUESTRA TABLA  ADULTOS Y NIOS  SEGUN LOS DATOS QUE TENGA EN ESE MOMENTO

function Show_RoomPackageInicio()
{

    //Oculto todos los elementos pro default
	for(s=2; s<=5;s++)
	{
	   eval("document.getElementById('DivTabla_" + s + "').style.display='none'");	//Muestro la Tabla Contenedora				
	   eval("document.getElementById('Divnum_adultos_" + s + "').style.display='none'");  //Combo de Adultos		
	   eval("document.getElementById('Divnum_ninos_" + s + "').style.display='none'");	//Combo de Ninos	 		
	
	}
	//Si no es Hotel de solo Adultos:  
	//                      Muesttro la tabla, Adultos y nios
	//                      Muestro los nios
	
    if (document.formahotel.Adult_Only.value == "no")
    {
        //Muestro la primera opcion de edades de Nios
	    Show_DivNinos(1);   //****  Show_ChildPaquete(1)
	    for (s=2; s<=document.formahotel.num_cuartos.value; s++)
	    { 
	        eval("document.getElementById('DivTabla_" + s + "').style.display=''");	//Muestro la Tabla Contenedora				
	        eval("document.getElementById('Divnum_adultos_" + s + "').style.display=''");  //Combo de Adultos		
	        eval("document.getElementById('Divnum_ninos_" + s + "').style.display=''");	//Combo de Ninos	 		
		    	    
	        //Muestro los Combos de Nios, ya que no es hotel de solo adultos
		    Show_DivNinos(s);  //****  Show_ChildPaquete(s);
	    }
	}
}

//Muestro los DIV de Edades de los Nios
function Show_DivNinos(k)
{
  
  if (document.formahotel.Adult_Only.value == "no")
  { 
      //Mensaje de especificar edades de los nios 
      //eval ("document.getElementById('DivMsgNinos').style.display=''");
        
	  if(k==1)
	  {

		if (document.formahotel.num_ninos.value !=0)
		eval ("document.getElementById('DivMsgNinos').style.display=''");
	  else
		eval ("document.getElementById('DivMsgNinos').style.display='none'");


     	HideAgesPaquetesAvion(1);     	
	  	for (var ninios = 1; ninios <= document.formahotel.num_ninos.value; ninios++)
	 	  {			  
			eval ("document.getElementById('DivEdadNino" + ninios + "').style.display=''");
	  	  }
       }
	    //cuarto 2 a 5
	    else
	   { 	    	 
		  HideAgesPaquetesAvion(k); 		 
		  for (var ninios = 1; ninios <= eval("document.formahotel.num_ninos_" + k +".value"); ninios++)
	        {		
			  eval ("document.getElementById('DivEdadNino" + ninios + "_" + k +"').style.display=''");
	        }
        }
  }
} 


function HideAgesPaquetesAvion(k)
{
    
	if (k==1)
		b='';
	else
	 	b='_'+ k;
			
	// Repetir el ciclo de acuerdo al nmero maximo de ninos permitidos
	for (var ninios = 1; ninios <= maxNumNinios; ninios++)
	  {  		
		eval ("document.getElementById('DivEdadNino" + ninios + b +"').style.display='none'");
	  } 
} 


//Funcion que Valida el Submit del Formulario de Hotel mas Avion  ( Nivel de Hotel )
// 1.- Que se especifique un Aeropuerto
// 2.- Que No haya cruce de Fechas
// 3.- Que se Indique las Edades
// 4.- Que el  Total de Pasajeros Nios y Adultos sea N Total que se le envie
function validaPackHotel(forma,maxTotal,anio_desde,mes_desde,dia_desde,anio_hasta,mes_hasta,dia_hasta)
{   
  // Valida 1.-
  if (validaAereopuerto(forma) == false)
   {  return false;
   }
  //Valida 2.-
  if (validaFechas(anio_desde,mes_desde,dia_desde,anio_hasta,mes_hasta,dia_hasta) == false)
   {  return false;
   }
  //Valida 3.-
  if (validateEdades(forma) == false)
   {  return false;
   } 
  //Valida 4.- 
  if (validaTotalAdNi(forma,maxTotal) == false)
   {  return false;
   }
  return true;  //Todo bien
}


//Valida que se seleccione el Aereopuerto de Salida del Cliente
function validaAereopuerto(forma)
{  
   //var idioma = document.getElementById('Idioma').value;  //Obtengo el Idioma
	var idioma = fdic.lang(null);
    var mensaje =  fdic.trad(disSelectAeropOrigen,idioma);  // alertAereopIng; 
      
    //Que tenga Clave de Aereopuerto y Codigo de Aerop    
    if (eval("document." + forma + ".Leavingfrom.value") == "" | eval("document." + forma + ".CodeAirport.value") == "")
    //if (document.formahotel.Leavingfrom.value == "" | document.formahotel.CodeAirport.value == "")
    {
     alert(mensaje);
     return false;
    }    
    return true;
}


//Verifica que el Total de Pasajeros para el Paquete sea a N valor especificado 
function validaTotalAdNi(forma,maxTotal)
{
  var b;  
  var rooms;
  var adultos = 0;
  var ninios = 0;  
  var pTotal = 0;
  var pGranTotal = 0;
  
  disTotRebasa_ING = "Please specify at least 1 but no more than "  + maxTotal +  " travelers.";
  disTotRebasa_ESP = "Por favor especifique al menos 1 y hasta "  + maxTotal +  " pasajeros.";
  
  var idioma = document.getElementById("Idioma");	
  if ( idioma ==null)
    idioma = "ing";  //si viene en nulo le asigno un defualt
  else
    idioma = idioma.value;  //Idioma del Objeto 
    
  //var idioma = document.getElementById('Idioma').value;  //Idioma
  
  rooms = eval("document." +  forma  + ".num_cuartos.value"); //Total de Cuartos
  //rooms = document.formahotel.num_cuartos.value; //Total de Cuartos
  
  //Recorro todos los cuartos 
  for(var i=1; i<=rooms;i++) 
    {
     //en mascaro a los Objetos de Adultos y Nios
     if (i==1)
	   { b=''; }
	 else			 
	   { b='_'+ i; }
	 
	 adultos = eval("document." + forma + ".num_adultos" + b +".value");  //Numero de adultos  
	 //adultos = eval("document.formahotel.num_adultos" + b +".value");  //Numero de adultos
	 //Si no trae valor los adultos le pongo cero para que no truene
	 if (adultos =="")
	  { 
	    adultos = 0;
	  }	   
     //Si se permiten Nios: entonces sumo Nios
     if (eval("document." + forma + ".Adult_Only.value") == "no")
     //if (document.formahotel.Adult_Only.value == "no")
       { 
          ninios = eval("document." + forma + ".num_ninos" + b +".value");   //Numero de Nios     
          //ninios = eval("document.formahotel.num_ninos" + b +".value");   //Numero de Nios             
         //Si no trae valor los nios le pongo cero para que no truene
         if (ninios =="")
	       { 
	         ninios = 0;
	       }              
	       
       } 
       
     pTotal = parseInt(adultos) +  parseInt(ninios);  //Suma Adultos y Nios
     pGranTotal += pTotal;
     //Si Revasa al total permitido para el avion  mando error  
     if (pGranTotal > maxTotal)
       {
         //Si es Espaol ....  Mando alerta en el Idioma
         if (idioma.toLowerCase() == "esp")
         {
           alert(disTotRebasa_ESP);
         }else
         {
            alert(disTotRebasa_ING);
         }
         
         return false;                 
       }
    }
      
  return true;
}


disAlertRates_ESP = "Debe introducir las edades de los ninos";
disAlertRates_ING = "You must write the childrens ages";
disAlertAdultos_ING = "Sorry, We cannot accept rooms with no adults.";
disAlertAdultos_ESP = "No podemos aceptar habitaciones sin adultos.";

//Recorre a los Elementos Nios que tengan un valor valido
function validateEdades(forma)
{
    var msg="";
    var msgAd="";    
    var rooms;
    var adultos;
    var ninios;
    
    var idioma = document.getElementById("Idioma");	
    if ( idioma ==null)
		idioma = "ing";  //si viene en nulo le asigno un defualt
	else
		idioma = idioma.value;  //Idioma del Objeto 
        
    //Muestro el mensaje en el Idioma
    if (idioma.toLowerCase() == "esp")
    {   msg = disAlertRates_ESP;
        msgAd = disAlertAdultos_ESP;
    }
    else
    {   msg = disAlertRates_ING;
        msgAd = disAlertAdultos_ING;
    }

    if (eval("document." + forma + ".Adult_Only.value") == "no")
    //if (document.formahotel.Adult_Only.value == "no")
    {
    
        rooms = eval("document." + forma + ".num_cuartos.value");
        //rooms = document.formahotel.num_cuartos.value;
        
        //Recorro todos los cuartos 
        for(var i=1; i<=rooms;i++) 
	    {	        
	        if (i==1)
			    { b=''; }
			else			 
				{ b='_'+ i; }
			
			adultos = eval("document." + forma + ".num_adultos" + b + ".value");  //Numero de adultos	
			//adultos = eval("document.formahotel.num_adultos" + b +".value");  //Numero de adultos
			
			//Que haya un adulto para cada cuartos
			if (adultos <= 0)
			{   alert(msgAd);  //Especificar adultos
			    return false;
			}
			ninios 	= eval("document." + forma + ".num_ninos" + b +".value");
			//ninios 	= eval("document.formahotel.num_ninos" + b +".value");
			
	        //eval("document.formahotel.num_adultos" + b +".value=0");
	        for (var y=1; y<=ninios;y++)
	        {   //Si el valor que tiene el combo de nios = ?  regreso error                   
	            if (eval("document." + forma + ".EdadNino" + y  + b +".value") == "-1" )  //valor = ? Clave = -1
			    //if (eval("document.formahotel.EdadNino" + y  + b +".value") == "-1" )  //valor = ? Clave = -1
			    {
			        alert(msg);  //Especificar edad de los Nios
			        return false;  //Regreso error
			    }
			           
	        }
	        
	    }
  
    }
  
  return true;
}

//Verifica que la fecha de salida sea posterior a la de llegada
//Nueva funcion para caja de busqueda multiple (hotel, hotel & avion, tour, traslado)
//Nota el anio_desde, etc, es el valor del objeto
function validaFechas(anio_desde,mes_desde,dia_desde,anio_hasta,mes_hasta,dia_hasta)
{ 
	var idioma = document.getElementById("Idioma");
	var mensaje = "";
	if ( idioma ==null)
		idioma = "ing";  //si viene en nulo le asigno un defualt
	else
		idioma = idioma.value;  //Idioma del Objeto  
	
	var fechaI;
	var fechaF;
	fechaI = arrMonths[parseInt(mes_desde) - 1] + ' ' + dia_desde + ', ' + anio_desde;
	fechaF = arrMonths[parseInt(mes_hasta) - 1] + ' ' + dia_hasta + ', ' + anio_hasta;
	if (Date.parse(fechaI) > Date.parse(fechaF))
	{
		if (idioma.toLowerCase() == "ing")
      		alert("The departure date must be earlier than your return date.");
    	else    
      		alert("La fecha de salida debe ser posterior a la fecha de llegada."); 
		return false;
	}
	return true;
}

//Funcion para Mostrar los Cuartos de Paquetes de Avion
function Show_RoomPackage()
{
	for(s=2; s<=5;s++) 
	{
	 eval("document.getElementById('DivTabla_" + s + "').style.display='none'");	//Oculto la Tabla Contenedora
	 eval("document.getElementById('Divnum_adultos_" + s + "').style.display='none'");  //Combo de Adultos	 
	 eval("document.getElementById('Divnum_ninos_" + s + "').style.display='none'");	//Combo de Ninos	 
	 
	}
	for (s=2; s<=document.formahotel.num_cuartos.value; s++)
	{
	    eval("document.getElementById('DivTabla_" + s + "').style.display=''");	//Muestro la Tabla Contenedora				
		eval("document.getElementById('Divnum_adultos_" + s + "').style.display=''");  //Combo de Adultos		
		eval("document.getElementById('Divnum_ninos_" + s + "').style.display=''");	//Combo de Ninos	 		
		for (k=s; k<=5; k++) 
		{
			if (k==1)
				{ b=''; }
			else
			 
				  b='_'+ k;
				  eval("document.formahotel.num_adultos" + b +".value=0");		//Pongo  al combo valor cero				
				  eval("document.formahotel.num_ninos" + b +".value=0");   				//Pongo  al combo valor cero
				  //Linpia los valores del Combo
				  Clean_ChildPaquete(s);   //****  Show_ChildPaquete(s);
				
		}
	}	
}


//Muestro los Cobos de los Nios
//function Show_ChildPaquete(k)
function Clean_ChildPaquete(k)
{
    //Si el Hotel permite Nios muestro los Combos
    if (document.formahotel.Adult_Only.value == "no")
	{ 
        if (k==1)
	       { b=''; }
	    else
	       { b='_'+ k; }
	    
	    //Limpio a todos los objetos edades
		for (var a=1; a <= maxNumNinios; a++)
		  {
		   eval("document.formahotel.EdadNino" + a  + b +".value=-1");  
		  }	
		Show_DivNinos(k);  //Muestro los Divs de Edades
    }
	
}


function changeactionform(forma,url){
	forma.action = url;        
}


function Ocultar_Elementos() {
	var x=document.getElementsByTagName("SELECT");  
	for (i=0;i<x.length;i++)
	{
		x[i].style.visibility= "hidden";
	}  
}
     
function Mostrar_Elementos() {
	var x=document.getElementsByTagName("SELECT");  
	for (i=0;i<x.length;i++)
	{
		x[i].style.visibility= "visible";
	}	    
}



//funcion que se utiliza para la Matriz de Aerolines y Vuelos
var posReal;
function showMoreflights(max,id,idName) {
	var pos;
	
	//Nota:  +						(Posicionarme a uno Mas)
	//		 -						(Posicionarme a uno menos)
	//		 1,2,3,4,5,6,etc..		(Es Numerico forzo elemento a mostrar)
	if (parseInt(id) > 0 ) {				
		pos = parseInt(id); 	 
	}else {
		pos = document.getElementById('pos').value; //posicion actual (por defaul es 1 al inicio)	
				
		if (id == "+") 	{	
			pos++; 					
			if (pos > max ) 
				pos = 1;  //Si es el Mayor del ultimo grupo lo Regreso al Primero
			
		} else if (id == "-") {
			pos--;				
			if (pos < 1) 
				pos = max;  //Si es el primer elemento lo regreso al ultimo grupo		
		} else {
				pos =1;
		}	
	}
	document.getElementById('pos').value = pos;  //Reasigno su ultima posicion del elemento
	
	//Muestro o Oculto los Grupos 
	for (var i = 1; i <= max; i++) {
		     
		if (i == pos)  //Si es la igual la posicion Muestro
			DisplayObj(idName + i,1);  //Muestra el div			
		else 
			DisplayObj(idName + i,0);  //Oculta el div
					
	}
	
}



var tooltip=function(){	
	//Var. ToolTip
	var id = 'help';
	var top = 5;
	var left = 5;
	var maxwidth = 500; //Ancho  Maximo del ToolTip
	var minwidth = 150; //Ancho Minimo del ToolTip
	var tt,t,c,b,h;
	var ie = document.all ? true : false; 
	var widthObj = 0;var cad='';
	return{		
		show:function(_id,_textHTML,_width,_hide,evento,_minwidth,_maxwidth){
			
			//Si NO recibe Texto 
			if (typeof _textHTML =='undefined' || _textHTML ==null || _textHTML == '') return;
			
			//Trae Nombre ?  Tomo su nombre si No la de dafault
			id = (typeof _id !='undefined' &&  _id !=null) ? _id : id;
			
			//Valida que ya exista el elemento con ese ID
			if(document.getElementById(id) != null) {
				//Es el mismo Objeto ? Si Borra el documento
				if(tt.id.toLowerCase() != id.toLowerCase()) {
					tt = null;
					document.body.removeChild(document.getElementById(id));
				}
			}
			else {
				tt = null;
			}
					
			//Valida que la variable tt sea null para crear el elemento
			if(tt == null){
				if(typeof _minwidth != 'undefined') minwidth = _minwidth;
				if(typeof _maxwidth != 'undefined') maxwidth = _maxwidth;
				widthObj = _width;
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
			}  //debugger;
			//tt.style.opacity = 97;
			//tt.style.filter = 'alpha(opacity=97)';
			c.innerHTML = _textHTML;
			tt.style.display = 'block';
			tt.style.width = _width ? _width + 'px' : 'auto';			//Si no hay _width de default toma width=auto
			tt.style.left = (ie ? event.clientX : evento.pageX) + 'px'; //Posicion del evento
			if(tt.offsetWidth > maxwidth){ tt.style.width = maxwidth + 'px'	}
			//Si es caja que se mueve con el mouse
			_hide = (_hide != null  && typeof _hide  == "boolean") ? _hide :  true;
			

			if (_hide) { 
				document.onmousemove = this.pos; 
			} 
			else {
				document.onmousemove = ""; //por click
				tooltip.pos(evento);
			}
			//Valida que el objeto este visible, que sea IE y que sea version menor a 7
			if (tt.style.display != "none" && ie && navigator.appVersion.substring(22,25) < 7) Ocultar_Elementos();

		},
		pos:function(e){
			//scrollTop y scrollLeft: para Doctype HTML usa document.body y para XHTML se usa document.documentElement
			//offsetWidth y offsetHeight: se usa document.documentElement para todo tipo de Doctype
			var u = ie ?  event.clientY + document.body.scrollTop + document.documentElement.scrollTop : e.pageY;
			var l = ie ?  event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft : e.pageX;
			var difHeight = (ie ? (document.body.scrollTop + document.documentElement.scrollTop) : 0) + document.documentElement.offsetHeight - u; 
			//Hay espacio abajo antes de que termina la pagina para que muestre el objeto?
			if(difHeight < tt.offsetHeight) 
			   tt.style.top = (u - tt.offsetHeight - top) + 'px'; //Mueve el Objeto hacia Abajo del Posicion del Mouse
			else 
			   tt.style.top = (u + top) + 'px';  //Mueve el Objeto hacia Arriba del Posicion del Mouse
			//tt.style.top = (u + top) + 'px'; 					//Mueve el Objeto hacia Abajo de la Posicion del Mouse
			var difWidth = (widthObj != 0 ) ? widthObj : minwidth //Existe ancho minimo?
			if((document.documentElement.offsetWidth - l)  < difWidth) {  	//(Ancho pagina - posicion evento) < ancho del objeto
				tt.style.width = difWidth;
				tt.style.left = ((ie ? event.clientX : e.pageX)) - difWidth - left + 'px';
			}
			else tt.style.left = (l + left) + 'px';
			if(tt.offsetWidth > maxwidth){ tt.style.width = maxwidth + 'px'	} // Tamao maximo del objeto
		},
		hide:function(id){
			var e = $('#'+id);
			if(e != null) {	
				// Valida que sea IE y que sea version menor a 7
				if(ie && navigator.appVersion.substring(22,25) < 7) Mostrar_Elementos();
				document.onmousemove = "";
				e.css('display','none');
			}
		}
	};
}();

// Mandar cookies de un dominio a otro para Google Analytics
// [tipo] = L (Link) o F (Formulario)
// Si es "L" [valor] = Ruta   ----    Si es "F" [valor] = EL formulario (this)
function pageTrackerGoogle(tipo,valor) {
	//alert(typeof pageTracker);
	if(tipo.toUpperCase()=="L") {
		if(typeof pageTracker != 'undefined') pageTracker._link(valor); 
		return false; 
	} else {
		if(typeof pageTracker != 'undefined') pageTracker._linkByPost(valor); 
		return true;
	}	
}



function SubmitFromArray(formaArr){
        formaArr.submit() ;
        }
		
// openWindow function for calendar
function openCalendar(src,width,height) {	
	var _width  = (typeof width=='undefined')? 400: width;
	var _height = (typeof width=='undefined')? 380: height;
	popupWin = window.open(src,'calendar', 'top=35,left=35,width=' + _width + ',height=' + _height + ',buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no')
}

// openWindow function for billing and cancelation policies
function openTerms(src) {
	popupWin = window.open(src,'Terms', 'top=25,left=25,width=500,height=300,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no')
}

// openWindow function for room info
function openRoomInfo(src) {
	popupWin = window.open(src,'Rooms', 'top=25,left=25,width=415,height=300,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no')
}


	var ttRoyalServ = "<h2>Royal Service&reg; Featuring Royal Housekeeping&reg;</h2>"+ 
"<ul>"+
"  <li>Upgraded suites with prime locations and views</li>"+
"  <li>World´s first select and assign your own available suite; preview interior suite photos and see 180º panoramic views from the terrace of your selected suite within 48 hours of arrival or at the resort</li>"+
"  <li>Bose stereo and speaker system with DVD/CD/Radio player plus	loaded iPod with music selections for all tastes & complimentary DVD library</li>"+
"  <li>Complimentary wireless Internet access in suites and public areas (available from Royal Jr. Stes. Oceanfront and upper categories)</li>"+
"  <li>Luxurious bath amenities</li>"+
"  <li>Decide your own time for daily suite make-up and special, comprehensive evening turndown service including choice of 3 aromatherapy scents (romantic, relaxing or invigorating)"+
"  <li>Pillow Menu: Extra Soft Plus Hypo-allergenic; Orthopedic; Memory; Aromatic; and Sweet Dreams</li>"+
"  <li>Upgraded mini-bar with premium international beverages, liquor cabinet system and snack selection</li>"+
"  <li>His &amp; Hers plush bathrobes and slippers</li>"+
"  <li>Special welcome amenity</li>"+
"  <li>Royal Concierge & Romance Concierge ready to anticipate, assist, advise and take care of your every need</li>"+
"</ul>";

	var ttRoyalServPlaya = "<h2>Royal Service&reg; Featuring Royal Housekeeping&reg;</h2>"+ 
"<ul class='OneCol'>"+
"  <li>NEW! Innovative (Mexico´s first) online check-in available within 48 hours of arrival</li>"+
"  <li>NEW! Bose stereo with DVD/CD/Radio plus loaded iPod with music for all tastes & complimentary DVD library (except for Royal Junior Suites)</li>"+
"  <li>NEW! Rotating 32” LCD satellite TV for multiple-position viewing from bed, Jacuzzi or terrace</li>"+
"  <li>Upgraded mini-bar, liquor cabinet system and snack selection</li>"+
"  <li>NEW! Decide your own time for daily suite make-up and special, comprehensive evening turndown service including choice of 3 aromatherapy scents (romantic, relaxing or invigorating)</li>"+
"  <li>Decide your own time for daily suite make-up and special, comprehensive evening turndown service including choice of 3 aromatherapy scents (romantic, relaxing or invigorating)"+
"  <li>NEW! Pillow Menu: Extra Soft Plus Hypo-allergenic; Orthopedic; Memory; Aromatic; and Sweet Dreams</li>"+
"  <li>His &amp; Hers plush bathrobes and slippers</li>"+
"  <li>Luxurious bath amenities</li>"+
"  <li>NEW! Special welcome amenity</li>"+
"  <li>Complimentary wireless Internet access in public areas and suites (available from Royal Jr. Ste. Oceanfront and upper categories) and complimentary internet access in the business center</li>"+
"  <li>Royal Concierge & Romance Concierge ready to anticipate, assist, advise and take care of your every need</li>"+
"</ul>";

	var ttRoyalBed = "<h2>Royal Bed</h2> <p>The new white-on-white plush Royal Bed adds an incomparable level of style and comfort to Reals new luxury ROYAL hotel brand. Designed to pamper guests with a luxurious combination of excellent support and extreme comfort, the bed features an oversized hand-carved mahogany headboard, bed skirt, plush custom designed ten-inch pillow-top mattress set, and a soft pillow-top pad covered by a quilted mattress cover. The bed is further complemented with two pillows from each of the three comfort levels (Support, Soothe, Soft) for a total of six pillows. The bedding features 300-thread-count Egyptian cotton sheets, a hypo-allergenic comforter nestled inside a cotton duvet cover, decorative pillows and a colorful bed scarf. Plus, an extensive pillow menu is available for guests staying in the Royal Service suites, ensuring pillow selections that match each guests personal preferences... Sweet Dreams!</p>";
	
	var Telefonos = '<img src="/_lib/images/close.png" onclick=tooltip.hide("help"); align="right" border="0" style="cursor:pointer;"><p><strong>Call free from USA & Canada:</strong><br />1 800 760 0944<br /><strong>Call free from Mexico:</strong><br />01 800 216 5500<br /><strong>International</strong><br />+52.998.881.7340 / 7341</p>';

	var Meses = '<div style="font-weight:12px;"><p>* 7, 15, 21 no interest monthly payments (Bancomer) or<br />** 6 Fixed Rate Payments (Banorte, Santander o American Express)</p><b>* Only Mexican Credit Cards</b>&nbsp;&nbsp; -&nbsp;&nbsp; <span onclick=tooltip.hide("help");>Close</span>';
	
function ExistsObj(obj) { 
	if (typeof obj=='string' && obj=='undefined') {
		return false;
	} else if (typeof obj!='undefined' && obj!=null) { 
		return true; 
	} else { return false; } 
}

function openInfoTour(src,objs,remplaza,_width,_height) {

    var ie = document.all ? true : false; 
	if (ExistsObj(remplaza)==true) {		
		if (objs!=''){		
			//Tipo de delimitador de datos 
			var delimitadorObj	  = (objs.indexOf(",") > -1) ?  "," : "|";
			var delimitadorValues = (remplaza.indexOf(",") > -1) ?  "," : "|";	 	
			objs = objs.split(delimitadorObj);  //Separo los Objetos con el delimitador
			remplaza = remplaza.split(delimitadorValues);  //Separo los valores con el delimitador	 	
			for(var i=0;i<objs.length;i++) { 	
				var _obj = objs[i];  //Nombre del Primer Objeto encontrado
				if (_obj.indexOf('document.')>-1) {
					_obj = eval(_obj); //Obtengo el Objeto
					if (ExistsObj(_obj)==true)
						if (ExistsObj(remplaza[i])==true) {						
							src = src.replace(remplaza[i],_obj.value) //Busca en el src  y remplaza por el valor					
						}
				}						
			}	
		}
	}	
	_width = (ExistsObj(_width) == true && _width > 0)? _width : 550; //Tomo el Ancho de la Ventana
	_height = (ExistsObj(_height) == true && _height > 0)? _height : 600;  //Tomo el Alto de la Ventana
	popupWin = window.open(src,'Tour', 'top=25,left=25,width=' + _width +  ',height=' + _height + ',buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no')
	
}




	
