// ----------------------------------------------------- 
// Open Gallery
// ----------------------------------------------------- 

function OpenGallery(ItemId,language,startImage)
{
    return CL_popupDiv('/pages/popupGallery.aspx?gallery='+ItemId+'&language='+language+'&startimage='+startImage,800,850,null,50);
}

function FL_CloseFlash()
{
 	return CL_removePopup();
}

// ----------------------------------------------------- 
// ServiceWeather switcher
// ----------------------------------------------------- 

//var _modules = new Array("Meteo", "Webcams", "MountainWeather");
//var _actualModule = 0;
//var _stylesheets = new Array("normal", "Large", "XLarge");

//function autoSetActiveStyleSheet()
//{
//	var index;
//	
//	index = 0;
//	for(i=0;i<_stylesheets.length;i++)
//	{
//		if (_activeStyle == _stylesheets[i])
//		{
//			index = i;
//			break;
//		}	
//	}

//    if (index<_stylesheets.length-1)
//        index++;
//    else
//        index = 0;
//    
//    setActiveStyleSheet(_stylesheets[index]);
//    return false;
//}

//function 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;
//				}
//			}
//		}
//	}
//	return false;
//}

//    window.onload = function(e) {
//	  var WeatherCookie = readCookie("ServiceWeather");
//	  SetActiveDiv(_modules[WeatherCookie]);
//	}

//	window.onunload = function(e) {
//	  var Weathertitle = getActiveStyleSheet();
//	  createCookie("ServiceWeather", _actualModule, 365);
//	}

// ----------------------------------------------------- 
// 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;	
	params = params == null ? '' : params;

	switch(mode)
	{
		case 0: 
			height = 600;
			if(lang == "nl") 
                lang = "fl";
			break;

		case 2: 
		    if(lang == "nl") 
                lang = "fl";
			width = 635;
			height = 550;
			break;
			
	    case 3: 
			if(lang == "nl") 
                lang = "fl";
			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;
}

// -------------------------------------------------
// show/hide objects
// -------------------------------------------------
function showhide(object, image) {
    var o = MM_findObj(object);
    var i = MM_findObj(image);
    var lang = __language;
    if (o != null) {
        if (o.className == 'hidingdivs') {
            o.className = '';

            i.src = '/media/' + lang + '/icon_min.gif';
        }
        else {
            o.className = 'hidingdivs';
            i.src = '/media/' + lang + '/icon_max.gif';
        }
    }

    return false;
}

window.onload = function(e) {
    var frameEventsCookie = readCookie("frameEvents");
    var o = MM_findObj("eventsHide");
    var lang = __language;
    if (o != null && frameEventsCookie != null) {
        o.className = frameEventsCookie;
       
    }
    var i = MM_findObj("imageHide");
    if (i != null) {
        if (o.className == "hidingdivs") {
            i.src = '/media/' + lang + '/icon_max.gif';
        }
        else {
            i.src = '/media/' + lang + '/icon_min.gif';
        }
    }
}

window.onunload = function(e) {
    var o = MM_findObj("eventsHide");
    var frameEvents = o.className;
    createCookie("frameEvents", frameEvents, 365);
}