//<script language="javascript">

document.write('<meta http-equiv="expires" content="Tue, 01 Jan 1981 01:00:00 GMT">');

if (document.all)
	document.write('<link rel="stylesheet" type="text/css" href="../includes/zeusreservas_ie.css" />');
else
	document.write('<link rel="stylesheet" type="text/css" href="../includes/zeusreservas_ns.css" />');
	
	document.write('<link rel="stylesheet" type="text/css" href="../includes/zeusmenu.css" />');
	
document.write('<link type="text/css" rel="stylesheet" href="../includes/js/dhtmlgoodies_calendar.css?random=20051112" media="screen"/>');
//document.write('<SCRIPT type="text/javascript" src="../includes/js/dhtmlgoodies_calendar.js?random=20060118"></script>');
	
// Calendar Functions

// reference a new window open
var w = null;
// object control used to put a date from the calendar object
var oFecha = null;
var oColor = null;
// Position and size from the new window
var ileft=150, iTop=50, iWidth=0, iHeight=0;


/***************************************************************************************
CenterWindow
- Change the <iLeft> and <Top> to set the window centered.
***************************************************************************************/
function CenterWindow()	{
   iLeft = parseInt((screen.availWidth - iWidth) / 2);
   iTop = parseInt((screen.availHeight - iHeight) / 2);
}


function OpenPage(pPage, pWindow)	{
	if (!pWindow) pWindow = 'wBlank';

	// if the window is opened, then close it.
//	if (document.layers) if (w) w.close();
   
    var sFeatures = 
		"width=" + iWidth + "," 
		+ "height=" + iHeight + "," 
		+ "copyhistory=0," 
		+ "location=0," 
		+ "menubar=0," 
		+ "directories=0," 
		+ "resizable=0," 
		+ "scrollbars=0," 
		+ "status=0," 
		+ "titlebar=0," 
		+ "toolbar=0," 
		+ "hotkeys=0," 
		+ "screenx=" + iLeft + ","  //NSN Only
		+ "screeny=" + iTop + ","	//NS Only
		+ "left=" + iLeft + ","     //IE Only
		+ "top=" + iTop;			//IE Only

	w = window.open(pPage, pWindow, sFeatures);

/*
	// repositioning the window when opening before calling it.
	w.resizeTo(iWidth, iHeight);
	w.moveTo(iLeft, iTop);
*/

	// set the focus over it.
	window.setTimeout("if (w.focus) w.focus();", 500);

/*
	// if netscape set it again, because sometimes is not updated.
	if (document.layers)	{
		w.location.href = pPage;
		w.location.reload();
   }
*/
}



/***************************************************************************************
GetEnglish
- Show a new window where the user may select a date an write it on <pControl> object
***************************************************************************************/
function inEnglish(form, control,name,index,size)	{
	var f,pControl;
	
	if (typeof(size)=='undefined') size='100';
	
	pControl='document.'+form+'.'+control;
	
	if (index)
	oInput = pControl +'_en'+ index ;
	else
	oInput = pControl +'_en';
	
	f=eval(oInput +'.value');
	
	if (index)
	input=eval(pControl+ index +'.type');
	else
	input=eval(pControl +'.type');
	
	if (document.all) iWidth=500, iHeight=152;
//   if (document.all) iWidth=260, iHeight=220;
	if (document.layers) iWidth=500, iHeight=155;
	CenterWindow();
	
	OpenPage('../common/english_input.asp?t='+ input +'&n='+name+'&f='+f+'&s='+size, '_wSelDate');
	
}

/***************************************************************************************
PutEnglish
- function called from the select-date window, to set the date: <pFecha> as the value
***************************************************************************************/
function PutEnglish(pInput)	{
	var f;
   if (oInput)	{
   //alert(oFecha);
   //alert(pFecha);
   
   f=eval(oInput);
   f.value=pInput;
   //document.frmEntry.dt_to.value=pFecha;
   //oFecha.value = pFecha;
   }
}

/***************************************************************************************
GetDate
- Show a new window where the user may select a date an write it on <pControl> object
***************************************************************************************/
function GetDate(pControl)	{
   oFecha = pControl;
	
	if (document.all) iWidth=244, iHeight=202;
//   if (document.all) iWidth=260, iHeight=220;
	if (document.layers) iWidth=275, iHeight=205;
	CenterWindow();

	OpenPage('../common/calendar.asp', '_wSelDate');
}

/***************************************************************************************
PutDate
- function called from the select-date window, to set the date: <pFecha> as the value
***************************************************************************************/
function PutDate(pFecha)	{
	var f;
   if (oFecha)	{
   //alert(oFecha);
   //alert(pFecha);
   
   f=eval(oFecha);
   f.value=pFecha;
   //document.frmEntry.dt_to.value=pFecha;
   //oFecha.value = pFecha;
   }
}

/***************************************************************************************
GetColor
- Show a new window where the user may select a color an write it on <pControl> object
***************************************************************************************/
function GetColor(pControl)	{
   oColor = pControl;
	
	if (document.all) iWidth=662, iHeight=449;
//   if (document.all) iWidth=260, iHeight=220;
	if (document.layers) iWidth=662, iHeight=449;
	CenterWindow();

	OpenPage('../hotel/popup_color.asp', '_wSelDate');
}

/***************************************************************************************
PutCOlor
- function called from the select-color window, to set the color: <pColor> as the value
***************************************************************************************/
function PutColor(pColor)	{
	var f;
   if (oColor)	{
   //alert(oFecha);
   //alert(pFecha);
   
   f=eval(oColor);
   f.value=pColor;
   //document.frmEntry.dt_to.value=pFecha;
   //oFecha.value = pFecha;
   }
}
	
function goIdiom(ds)	{
	var f = document.frmIdiom;
	f.lg.value=ds;
	//f.action='default.asp';//window.location.href;
	f.submit();
}

function other_room(id_plan){
		var d = eval('document.all.other_room_'+id_plan);
		if (d.style.visibility=="hidden")
			show_other_room(id_plan)
		else hidden_other_room(id_plan)
	}
	
	function show_other_room(id_plan){
		var e = eval('document.all.other_room_'+id_plan);
		e.style.visibility = 'visible';
		e.style.display = '';
	}
	
	function hidden_other_room(id_plan){
		var g = eval('document.all.other_room_'+id_plan);
		g.style.visibility = 'hidden';
		g.style.display = 'none';
	}
	
function English(type,tm,id)	{	
	var URL="popup_description_en.asp?tp="+type+'&tm='+tm+'&id='+id;
	
			OpenPopup(URL, 'Description', 500, 170, 250, 250, 'scrollbars=false')
	}
//</script>	


function nuevoAjax(){
var xmlhttp=false;
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

function loadList(tablename,fieldds,fieldid,fieldfilter,controlname,contenct,controlparent,controlsize,id,ds_Where,ds_name,ds_object_type)
{
    var ajax = null
    var loading    
    if(!ds_object_type) ds_object_type = "";
    
    if (gsIdiom=='ES'){
        loading='Cargando...';
    }else{
        loading='Loading...';    
    }

    if (controlparent==''){
            var valuefilter='';
    }else{
    	    var valuefilter=document.getElementById(controlparent).options[document.getElementById(controlparent).selectedIndex].value;        
    }
    
    if (ds_object_type == 'TABLELIST'){
        valuefilter = fieldfilter;
    }
	//var valord=document.getElementById('cmbDpto').options[document.getElementById('cmbDpto').selectedIndex].value;
	//alert("Ente -->"+valorp);
	url="../common/c_dinamic_lst.asp?table="+tablename+"&fieldds="+fieldds+"&fieldid="+fieldid+"&cname="+controlname+"&fieldf="+fieldfilter+"&filterv="+valuefilter+"&csize="+controlsize+"&id="+id+"&where="+ds_Where+"&ds_name="+ds_name+ "&ds_type=" + ds_object_type
	//alert("Ente -->"+url);

		ajax=nuevoAjax();
		
		//document.getElementById('conte').innerHTML = '<p style="text-align:center;"><img src="image/esperando.gif"/></p>';
		ajax.open("GET", url+"&ms"+new Date().getTime(), true);
		ajax.onreadystatechange=function()
		{ 
			if (ajax.readyState==1)
			{
				
				//combo=document.getElementById(controlname);
				
			     if (id ==''){
				        var tempcontenct=document.getElementById(contenct);
				        tempcontenct.innerHTML="";
				        document.getElementById(contenct).innerHTML='<p class="TableContent" style="text-align:left;"><img src="../images/loading.gif"/> Cargando...</p>';
				        /*var nuevoCombo=document.createElement("select");
				        nuevoCombo.name=controlname
				        nuevoCombo.style.width=controlsize
				        nuevoCombo.length=0;
				        var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML=loading;
				        nuevoCombo.appendChild(nuevaOpcion); nuevoCombo.disabled=true;				
				        tempcontenct.appendChild(nuevoCombo);*/
				}else{
				    //   document.getElementById(contenct).innerHTML="Cargando...";
				       document.getElementById(contenct).innerHTML='<p class="TableContent" style="text-align:center;"><img src="../images/loading.gif"/><br>Cargando...</p>';
				       
				}
				//document.getElementById('load').innerHTML = '<p style="text-align:center;"><img src="gif/remembermilk_orange.gif"/><br><font color="#fffff">Loading.....</font></p>';
			}
			//alert("Ente -->"+ajax.readyState);
			if (ajax.readyState==4)
			{ 				
				var cadena=unescape(ajax.responseText);
                var cadenafinal=cadena.replace(/\+/gi," ");
				document.getElementById(contenct).innerHTML=unescape(ajax.responseText);
				//document.getElementById('load').innerHTML = '';
			} 
		}
		ajax.send(null);
	
}


function load_Search_List_Ajax(cd_section,cd_plan,ds_Idiom,id_day,id_month,id_year,am_nights,am_rooms,am_adults,am_additional,am_children,id_hotel,contenct)
{
    var ajax = null
    var loading    
    
    if (gsIdiom=='ES'){
        loading='Cargando...';
    }else{
        loading='Loading...';    
    }

    
    
   
	//var valord=document.getElementById('cmbDpto').options[document.getElementById('cmbDpto').selectedIndex].value;
	//alert("Ente -->"+valorp);
	url="../common/c_dinamic_lst.asp?cd_type=1&cd_section="+cd_section+"&ds_Idiom="+ds_Idiom+"&id_day="+id_day+"&id_month="+id_month+"&id_year="+id_year+"&am_nights="+am_nights+"&am_rooms="+am_rooms+"&am_adults="+am_adults+"&am_additional="+am_additional+"&am_children="+am_children+"&id_hotel="+id_hotel
	//alert("Ente -->"+url);

		ajax=nuevoAjax();
		
		//document.getElementById('conte').innerHTML = '<p style="text-align:center;"><img src="image/esperando.gif"/></p>';
		ajax.open("GET", url+"&ms"+new Date().getTime(), true);
		ajax.onreadystatechange=function()
		{ 
			if (ajax.readyState==1)
			{
				
				//combo=document.getElementById(controlname);
				
			     
				    //   document.getElementById(contenct).innerHTML="Cargando...";
				       document.getElementById(contenct).innerHTML='<p class="TableContent" style="text-align:center;"><img src="../images/loading.gif"/><br>Cargando...</p>';
				       
				
				//document.getElementById('load').innerHTML = '<p style="text-align:center;"><img src="gif/remembermilk_orange.gif"/><br><font color="#fffff">Loading.....</font></p>';
			}
			//alert("Ente -->"+ajax.readyState);
			if (ajax.readyState==4)
			{ 				
				var cadena=unescape(ajax.responseText);
                var cadenafinal=cadena.replace(/\+/gi," ");
				document.getElementById(contenct).innerHTML=unescape(ajax.responseText);
				//document.getElementById('load').innerHTML = '';
			} 
		}
		ajax.send(null);
	
}


    /*=================================================================
	Function: loadList
	Purpose:  Get List Dynamically with AJAX
	Input:    none
	Returns:  none
	==================================================================*/
    function loadListDropDown(cd_option, ds_like, cd_sel_value, am_control_width, control_name, id_container, controlparent, ds_event,in_parent_value,id_general1) {
        var ajax = null
        var text = null
       
        if (!id_general1){
            id_general1=0;
        }
      
            
        var url="../common/c_dinamic_lst.asp?cd_option=" + cd_option + 
                    "&ds_name_node=" + control_name + "&cd_sel_value=" + 
                    cd_sel_value + "&am_width=" + am_control_width + 
                    "&ds_event=" + escape(ds_event)+"&id_general="+id_general1
          
        if (controlparent != ''){
            var valuefilter
            if(in_parent_value == '1'){
                valuefilter = controlparent
            }else{                
                valuefilter=document.getElementById(controlparent).options[document.getElementById(controlparent).selectedIndex].value;
            }                        
            if (cd_option == 'cm'){
                url = url + "&ds_like=" + valuefilter
            }else{
                url = url + "&ds_like=" + ds_like 
                url = url  + "&cd_filter=" + valuefilter
            }  
            
        }else{
            url = url + "&ds_like=" + ds_like 
        }
        if (gsIdiom == 'EN'){
            text = 'Loading...';
        }else{
            text = 'Cargando...';
        }
        
       
        ajax = nuevoAjax();
        
        ajax.open("GET", url+"&ms"+new Date().getTime(), true);
        
        ajax.onreadystatechange=function(){ 
        
            if (ajax.readyState==1){
           
                combo=document.getElementById(control_name);
                combo.length=0;
                var nuevaOpcion=document.createElement("option"); 
                nuevaOpcion.value=''; 
           
                nuevaOpcion.innerHTML=text;
                combo.appendChild(nuevaOpcion); 
                    
                //combo.disabled=true;
                combo.readOnly = true;
            }
            
            if (ajax.readyState==4){ 
                var cadena=ajax.responseText;
                var cadenafinal=cadena.replace(/\+/gi," ");
                document.getElementById(id_container).innerHTML = unescape(cadenafinal);
            } 
        }
        ajax.send(null);
    }