/* Not avail advice */ 
function ps(minstay,timelimit,forcedci,event) {
		var tmpHTML = '<tr><td><Strong>' + warningMessage + '</Strong></td></tr>';
		if (timelimit!='0') tmpHTML = tmpHTML + '<tr><td nowrap="nowrap">' + timelimitMessage + ' ' + timelimit + ' ' + hoursMessage + '</td></tr>';
		if (minstay!='0') tmpHTML = tmpHTML + '<tr><td nowrap="nowrap">' + minstayMessage + ' ' + minstay + ' ' + daysMessage + '</td></tr>'
		if (forcedci!='0') tmpHTML = tmpHTML + '<tr><td nowrap="nowrap">' + forcedciMessage + ' ' + forcedci + "</td></tr>";
		tmpHTML = '<table cellpadding="0" cellspacing="0">' + tmpHTML + "</table>";
		show('float_baloon',tmpHTML,event);
}

/* Tip advice (text is passed as parameter) */ 
function show_message(mess,event) {
	show('float_baloon','<table cellpadding="0" cellspacing="0"><tr><td>' + mess + '</td></tr></table>',event);
}

/* Message advice (text is referred as message id) */
function as(id,event) {
	var tmpHTML;
	switch (id) {
		case 18 : tmpHTML = message18; break;
		case 19 : tmpHTML = message19; break;
		case 80 : tmpHTML = message80; break;
		otherwise :	return;
	}
	show('float_baloon','<table cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap">' + tmpHTML + '</td></tr></table>',event);
}

/* Select filter and submit form */
function filter_by(selectId,optionId) {
	var select = document.getElementById(selectId);
	if (select !== null) {
		var index = 0;
		for(var i = 0; i < select.options.length; i++) if (select.options[i].value == optionId) index = i;
		if (index) {
			select.selectedIndex = index;
			select.form.submit();
		}
	}
	return;
}

/* Popup map */
/* common_map variable must be defined */
function map_popup(idhtl,idzone) {
	if (idhtl || arguments.length == 2 && idzone) {
		var link = common_map + '&bodyonly=1&param[is_popup]=1'
		if (arguments.length == 2) link += '&param[idzone]=' + idzone;
		if (idhtl) link += '&param[idhtl]=' + idhtl;
		var a = window.open(link,'Hotel map','height=500,width=650,scrollbars=no,resizable=no,status=no,toolbar=no,location=no');
	}
	return;
}

function ghrs_mapPopup(idhtl,idzone) {
	if (idhtl || arguments.length == 2 && idzone) {
		var link = common_map + '&bodyonly=1&param[is_popup]=1'
		if (arguments.length == 2) link += '&param[idzone]=' + idzone;
		if (idhtl) link += '&param[idhtl]=' + idhtl;
		return ghrs_ajaxMapPopup(link);
	}
	return false;
}


/* Advanced results filter */
var ghrs_mltTimeoutId = 0;
var ghrs_mltSubmitDelay = 1000;
var ghrs_mltWaitImage = ghrs_createElementWithAttribute('img',{'src':'lcl/img/form/wait/ldr.gif','class':'ghrs_mltWaitImage'},null);
function ghrs_mltSelected(container,all,form) {
	if (ghrs_mltTimeoutId) window.clearTimeout(ghrs_mltTimeoutId);
	if (document.getElementById(container)) {
		var inputs = document.getElementById(container).getElementsByTagName('input');
		for (var i=0;i<inputs.length;i++) {
			var test = inputs[i].getAttribute('id').indexOf('none');
			if ((all ? (test < 0) : (test > 0)) && inputs[i].checked) inputs[i].checked = false;
		}
	}
	if (form!='') ghrs_mltTimeoutId = window.setTimeout('ghrs_mltFormSubmit(\''+form+'\')',ghrs_mltSubmitDelay);
}

function ghrs_mltFormSubmit(name) {
	if (document.getElementById('mlt_fltr')) {
		var inputs = document.getElementById('mlt_fltr').getElementsByTagName('input');
		for (var i=0;i<inputs.length;i++) inputs[i].setAttribute('onClick','return false;');
		if (document.getElementById('src_rslts')) {
			var src_rslts = document.getElementById('src_rslts');
			src_rslts.style.position = 'relative'; // Force for positioning
			var lightBox = ghrs_showElementLightBox('src_rslts','src_rslts','hide_white'); // Reload trasparency wrapper
			ghrs_mltWaitImage.style.zIndex = lightBox.style.zIndex + 1;
			src_rslts.appendChild(ghrs_mltWaitImage);
			window.scrollTo(0,0);
			ghrs_disableMainPageScroll();
		}
	}
	document.forms[name].submit();
}

var ghrs_mltFltChangedCounter;
function ghrs_mltFltSwtch(id) {
	ghrs_mltFltChangedCounter = 0;
	if (document.getElementById(id)) {
		var li = document.getElementById(id).getElementsByTagName('li');
		for(var i=0;i<li.length;i++)	setTimeout('ghrs_mltFltSwtchLi(\''+id+'\','+i+')',20*i);
	}
	setTimeout('ghrs_mltFltSwtchImg(\''+id+'\')',20*++i);
	setTimeout('ghrs_mltFltSwtchForm(\''+id+'\')',20*++i);
}

function ghrs_mltFltSwtchLi(ref,index) {
	if (document.getElementById(ref)) {
		var li = document.getElementById(ref).getElementsByTagName('li');
		var input = li[index].getElementsByTagName('input')[0];
		li[index].style.display = (li[index].style.display == '') ? 'none' : '';
		if (input.checked && !(input.getAttribute('id').search('none') >= 0)) ghrs_mltFltChangedCounter++;
		input.checked = input.getAttribute('id').search('none') >= 0;
	}
}

function ghrs_mltFltSwtchImg(ref) {
	if (document.getElementById(ref+'_enabler')) {
		var img = document.getElementById(ref+'_enabler');
		img.src = (img.src.search('down') >= 0) ? img.src.replace('down','up') : img.src.replace('up','down');
		img.alt = (img.alt == '^') ? 'v' : '^';
	}
	// Set hidden parameter
	if (document.getElementById(ref+'_hidden')) {
		var hiddenInput = document.getElementById(ref+'_hidden');
		hiddenInput.disabled = !(hiddenInput.disabled);
	}
}

function ghrs_mltFltSwtchForm(id) { if (ghrs_mltFltChangedCounter > 0) ghrs_mltSelected(id,true,'mlt_form'); }
