// JScript File
function FL_CloseFlash()
{
 	return CL_removePopup();
}
// -------------------------------------------------
// show google map - companies
// -------------------------------------------------
function showGoogleMap(object, url) {
    if (url != "") {
        var o = MM_findObj(object);
        if (o != null) {
            var dmy = o.getAttribute('googleLoaded');

            if (dmy == '0') {
                o.setAttribute('googleLoaded', 1);
                o.innerHTML = "<div class='googleMap'><iframe width=\"499\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=" + url + "></iframe></div>";
            }
        }
    }
    return false;
}
// -------------------------------------------------
// show/hide objects
// -------------------------------------------------
function showhide(object) {
    var o = MM_findObj(object);
    if (o != null) {
        if (o.className == 'hidingdivs')
            o.className = '';
        else
            o.className = 'hidingdivs';
    }

    return false;
}

function showhideSearch(object) {
    var o = MM_findObj(object);
    if (o != null) {
        if (o.className == 'hiddencontent')
            o.className = 'searchcontent';
        else
            o.className = 'hiddencontent';
    }

    return false;
}
// ----------------------------------------------------- 
// Quick express
// ----------------------------------------------------- 

var _qeArrivalID;
var _qeDurationID;
var _qePersonsID;
var _qeTypeID;
var _qeComfortID;

var _qeBoardtype = new Array(2,3,4,1);

function CU_qeSearch(mode)
{
    var boardType = MM_findObj(_qeComfortID);
    
	var params = '&qry=';
	params+=CU_getParam(_qeArrivalID);
	params+=CU_getParam(_qeDurationID);
	params+=CU_getParam(_qeComfortID);
	params+=CU_getParam(_qeTypeID);
	params+=CU_getParam(_qePersonsID);
	
	if (boardType!=null) params+=_qeBoardtype[boardType.selectedIndex];

	return CU_qeExtendedSearch(mode,params);
}

function CU_qeExtendedSearch(mode,params)
{
	var width = 615;
	var height = 600;
	var lang = __language.toUpperCase();	
	params = params == null ? '' : params;

	switch(mode)
	{
		case 0: 
			height = 600;
			break;

		case 2: 
			width = 635;
			height = 550;
			break;
			
	    case 3: 
			break;
	    
	}

	return CL_popupDiv('/pages/popupQuickRequest.aspx?__language='+lang+'&mode='+mode+params,width,height,null,20,false)		
}

function CU_getParam(id)
{
	var o = MM_findObj(id);
	var result = '';
	
	if (o)
		result+=encodeURI(o.value)+'|';
	
	return result;
}
// ----------------------------------------------------- 
// Holiday Farm
// ----------------------------------------------------- 
var _modules = new Array("welcome", "price", "address", "arrival","rooms", "contact");
var _actualModule = 0;
function CL_SetActiveDiv(activeDiv)
{
	if (activeDiv)
	{
		var o = MM_findObj(activeDiv);
		if (o!=null)
		{
			o.className = "";
			
			for(i=0;i<_modules.length;i++)
			{
				if(_modules[i]!=activeDiv)
				{
					o = MM_findObj(_modules[i]);
					if (o!=null) o.className = "hidingDivs";
				}
				else
				{
					_actualModule = i;
				}
			}
		}
	}
	 createCookie("ActiveFarmSite", _actualModule, 365)
	return false;
}

window.onload = function(e) {
  _actualModule = readCookie("ActiveFarmSite");
  CL_SetActiveDiv(_modules[_actualModule]);
}

