var closeTimerSubMenu = new Array();

function showSubMenu(id){
	resetTimeOut(id);
	document.getElementById(id).style.display='block';
}

function closeSubMenu(id){
	closeTimerSubMenu[id]=window.setTimeout('hideSubMenu(\''+id+'\')',500);
}

function resetTimeOut(id){
	window.clearTimeout(closeTimerSubMenu[id]);
}

function hideSubMenu(id){
	document.getElementById(id).style.display='none';
}

function changeImage(id)
{
	document.getElementById('featured_link_0').style.display='none';
	document.getElementById('featured_link_1').style.display='none';
	document.getElementById('featured_link_2').style.display='none';
	document.getElementById('featured_link_3').style.display='none';
	document.getElementById(id).style.display = '';
}

function SubmitForm(){
	if(LRI.WEB.SS.FLAG__DEST_OPEN==true&&LRI.WEB.SS.FLAG__DEST_MOUSEOUT==true)Destinations_Close();
	if(LRI.WEB.SS.FLAG__REG_OPEN==true&&LRI.WEB.SS.FLAG__REG_MOUSEOUT==true)Regions_Close();
	if(LRI.WEB.SS.FLAG__LOC_OPEN==true&&LRI.WEB.SS.FLAG__LOC_MOUSEOUT==true)Locations_Close();
	if(LRI.WEB.SS.FLAG__FT_OPEN==true&&LRI.WEB.SS.FLAG__FT_MOUSEOUT==true)LRI.WEB.SS.Features_Close();
	var date_now=new Date();
	var dummyParam=date_now.getSeconds();
	var parameters="";
	var bedMin=$jQ("#BedMin option:selected").val();
	var bedMax=$jQ("#BedMax option:selected").val();
	var priceMin=$jQ("#PriceMin option:selected").val();
	var priceMax=$jQ("#PriceMax option:selected").val();
	var currencySelector=$jQ("#CurrencySelector option:selected").val();
	var arrivalSearch=$jQ("#arrivalSearch").val();
	var departureSearch=$jQ("#departureSearch").val();
	if (arrivalSearch == departureSearch)
	{
		alert(trArrivalDepartureMessage);
		return false;
	}
	if(LRI.WEB.SS.SelectedFeatures!=null&&LRI.WEB.SS.SelectedFeatures!="")parameters+="/featuresIds/"+LRI.WEB.SS.SelectedFeatures;
	//if(LRI.WEB.SS.SelectedDestinations!=null&&LRI.WEB.SS.SelectedDestinations!="")
	parameters+="/destinationsIds/"+LRI.WEB.SS.SelectedDestinations;
	if(LRI.WEB.SS.SelectedRegions!=null&&LRI.WEB.SS.SelectedRegions!="")parameters+="/regionsIds/"+LRI.WEB.SS.SelectedRegions;
	if(LRI.WEB.SS.SelectedLocations!=null&&LRI.WEB.SS.SelectedLocations!="")parameters+="/locationsIds/"+LRI.WEB.SS.SelectedLocations;
	if(bedMin!=null&&bedMin!="")parameters+="/bedmin/"+bedMin;
	if(bedMax!=null&&bedMax!="")parameters+="/bedmax/"+bedMax;
	if(priceMax!=null&&priceMax!="")parameters+="/pricemax/"+priceMax;
	if(priceMin!=null&&priceMin!="")parameters+="/pricemin/"+priceMin;
	if(currencySelector!=null&&currencySelector!="")parameters+="/currency/"+currencySelector;
	if(document.getElementById('email').value!='')parameters+="/email/"+document.getElementById('email').value;
	if(document.getElementById('phoneField').value!='')parameters+="/phone/"+document.getElementById('phoneField').value;
	if(document.getElementById('arrivalSearch').value!='')parameters+="/arrivalSearch/"+document.getElementById('arrivalSearch').value.replace(/\//g, '-');
	if(document.getElementById('departureSearch').value!='')parameters+="/departureSearch/"+document.getElementById('departureSearch').value.replace(/\//g, '-');

	/*if (document.getElementById('email').value != '' && document.getElementById('phoneField').value == '')
	{
		//if (document.getElementById('email').value == 'apilaci@gmail.com')
		//{
			$jQ('#overlay').fadeIn('fast',function(){
				$jQ('#overlayBox').show();
				$jQ('#overlayBox').animate({'top':'160px'},500);
			});

			return false;
		//}
	}*/

	window.location.href=searchFormUrl+parameters;
}

var LRINamespace={
	register:function(_Name){
		var return_status=0;
		var chk=false;
		var cob="";
		var spc=_Name.split(".");
		for(var i=0;i<spc.length;i++){
			try{
				if(cob!=""){cob+=".";}
				cob+=spc[i];
				chk = this.exists(cob);
				if(!chk){this.create(cob);}
			}
			catch(err){alert(err);}
		}
	},
	create:function(_Src){eval("window."+_Src+"=new Object();");},
	exists:function(_Src){eval("var NE=false;try{if("+_Src+"){NE=true;}else{NE=false;}}catch(err){NE=false;}");return NE;}
};

function emptyvalidation(entered,alertbox){
	with (entered){
		if (value==null||value==""){
			if(alertbox!=""){
				alert(alertbox);
			}
			return false;
		}
		else{
			return true;
		}
	}
} 

function digitvalidation(entered,min,max,alertbox,datatype){
	with(entered){
		checkvalue=parseFloat(value);
		if(datatype){
			smalldatatype=datatype.toLowerCase();
			if(smalldatatype.charAt(0)=="i"){
				checkvalue=parseInt(value);
				if(value.indexOf(".")!=-1){
					checkvalue=checkvalue+1;
				}
			}
		}
		if((parseFloat(min)==min&&value.length<min)||(parseFloat(max)==max&&value.length>max)||value!=checkvalue){
			if(alertbox!=""){
				alert(alertbox);
			}
			return false;
		}
		else{
			return true;
		}
	}
} 

function valuevalidation(entered,min,max,alertbox,datatype){
	with(entered){
		checkvalue=parseFloat(value);
		if(datatype){
			smalldatatype=datatype.toLowerCase();
			if(smalldatatype.charAt(0)=="i"){
				checkvalue=parseInt(value);
			}
		}
		if((parseFloat(min)==min&&checkvalue<min)||(parseFloat(max)==max&&checkvalue>max)||value!=checkvalue){
			if(alertbox!=""){
				alert(alertbox);
			}return false;
		}
		else{
			return true;
		}
	}
}

function emailvalidation(entered,alertbox){
	with(entered){
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if(apos<1||dotpos-apos<2||lastpos-dotpos>3||lastpos-dotpos<2){
			if(alertbox){alert(alertbox);} return false;}
		else{
			return true;
		}
	}
}

function resetAllFields(id){
	for(var i=1;i<8;i++){
		var a=document.getElementById(id+i);
		a.className=a.className.replace('active','');

		for(var j=0;j<a.childNodes.length;j++){
			if(a.childNodes[j].className=='accordion_content'){
				a.childNodes[j].style.display='none';
			}
		}
	}
}

function select_bestemmingsBlindDown(id, number){
	resetAllFields(id);
	var a=document.getElementById(id+number);
	a.className=a.className+('active');
	for(var j=0;j<a.childNodes.length;j++){
		if(a.childNodes[j].className=='accordion_content'){
			a.childNodes[j].style.display='';
		}
	}
}

function questionEmailvalidation2(entered, alertbox){
	with(entered){
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if(apos<1||dotpos-apos<2||lastpos-dotpos>3||lastpos-dotpos<2){
			if(alertbox){alert(alertbox);}
			return false;
		}
		else{
			return true;
		}
	}
} 
		
function questionEmptyvalidation2(entered, alertbox){
	if(entered==''){
		alert(alertbox);
		return false;
	}else{
		return true;
	}
}

function questionFormvalidation(thisform){
	with(thisform){
		if(questionVraag.value=='Type your question'){questionVraag.value='';}
		if(questionEmailvalidation2(questionEmail,"No valid emailaddress")==false){questionEmail.focus();return false;}
		if(questionEmptyvalidation2(questionVraag.value,"No question entered")==false){questionVraag.focus();return false;}

		var i = document.createElement('input');
		i.style.display = 'none';
		i.value = 'stupid bot';
		i.name = 'bot';
		thisform.appendChild(i);
	}
}

function formValidation(thisform){
	with(thisform){
		if(emptyvalidation(title,trTitleIsRequired)==false) {title.focus(); return false;};
		if(emptyvalidation(first_name,trFirstnameIsRequired)==false) {first_name.focus(); return false;};
		if(emptyvalidation(last_name,trSurnameIsRequired)==false) {last_name.focus(); return false;};
		if(emptyvalidation(adults,trNumberOfAdults)==false) {adults.focus(); return false;};
		if(emptyvalidation(children,trNumberOfChildren)==false) {children.focus(); return false;};
		if(emailvalidation(email,trInvalidEmail)==false) {email.focus(); return false;};

		var i = document.createElement('input');
		i.style.display = 'none';
		i.value = 'stupid bot';
		i.name = 'bot';
		thisform.appendChild(i);
	}

	return true;
}

function MM_jumpMenu(targ,selObj,restore,link){
	eval(targ+".location='"+link+selObj.options[selObj.selectedIndex].value+"'");
	if(restore)selObj.selectedIndex=0;
}

function MM_jumpMenu2(targ,selObj,restore,linkAddon){
	eval(targ+".location='"+linkAddon+selObj.options[selObj.selectedIndex].value+"'");
	if(restore)selObj.selectedIndex=0;
}

function MM_jumpMenu3(targ,selObj,restore,linkPrefix,linkSufix){
	eval(targ+".location='"+linkPrefix+selObj.options[selObj.selectedIndex].value+linkSufix+"'");
	if(restore)selObj.selectedIndex=0;
}

jQuery.cookie=function(name,value,options){
	if(typeof value!='undefined'){
		options=options||{};
		if(value===null){
			value='';
			options.expires=-1;
		}
		var expires='';
		if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){
			var date;
			if(typeof options.expires=='number'){
				date=new Date();
				date.setTime(date.getTime()+(options.expires*24*60*60*1000));
			}else{
				date=options.expires;
			}
			expires='; expires='+date.toUTCString();
		}
		var path=options.path?'; path='+(options.path):'';
		var domain=options.domain?'; domain='+(options.domain):'';
		var secure=options.secure?'; secure':'';
		document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');
	}
	else{
		var cookieValue=null;
		if(document.cookie&&document.cookie!=''){
			var cookies=document.cookie.split(';');
			for(var i=0;i<cookies.length;i++){
				var cookie=jQuery.trim(cookies[i]);
				if(cookie.substring(0,name.length+1)==(name+'=')){
					cookieValue=decodeURIComponent(cookie.substring(name.length+1));
					break;
				}
			}
		}
		return cookieValue;
	}
};

LRINamespace.register("LRI.WEB.SS");
LRI.WEB.SS.indexOf=function(List,Value){
	if(List.length>0){
		for(i=0;i<List.length;i++){
			if(List[i]==Value)return i;
		}
	}
	return-1;
};
LRI.WEB.SS.FLAG__DEST_OPEN=false;
LRI.WEB.SS.FLAG__DEST_MOUSEOUT=false;
LRI.WEB.SS.FLAG__REG_OPEN=false;
LRI.WEB.SS.FLAG__REG_MOUSEOUT=false;
LRI.WEB.SS.FLAG__LOC_OPEN=false;
LRI.WEB.SS.FLAG__LOC_MOUSEOUT=false;
LRI.WEB.SS.FLAG__FT_OPEN=false;
LRI.WEB.SS.FLAG__FT_MOUSEOUT=false;
LRI.WEB.SS.handler__bodyClick=function(){
	if(LRI.WEB.SS.FLAG__DEST_OPEN==true&&LRI.WEB.SS.FLAG__DEST_MOUSEOUT==true)Destinations_Close();
	if(LRI.WEB.SS.FLAG__REG_OPEN==true&&LRI.WEB.SS.FLAG__REG_MOUSEOUT==true)Regions_Close();
	if(LRI.WEB.SS.FLAG__LOC_OPEN==true&&LRI.WEB.SS.FLAG__LOC_MOUSEOUT==true)Locations_Close();
	if(LRI.WEB.SS.FLAG__FT_OPEN==true&&LRI.WEB.SS.FLAG__FT_MOUSEOUT==true)LRI.WEB.SS.Features_Close();
};

LRI.WEB.SS.DestinationsNum=0;
LRI.WEB.SS.RegionsNum=0;
LRI.WEB.SS.LocationsNum=0;
LRI.WEB.SS.ExchFactor=1;
LRI.WEB.SS.FeaturesNum=0;
LRI.WEB.SS.VacationIdeasNum=0;
LRI.WEB.SS.SelectedDestinations=[];
LRI.WEB.SS.SelectedRegions=[];
LRI.WEB.SS.SelectedLocations=[];
LRI.WEB.SS.SelectedBedrooms=[];
LRI.WEB.SS.SelectedCurrency=1;
LRI.WEB.SS.SelectedPrices=[];
LRI.WEB.SS.SelectedFeatures=[];
LRI.WEB.SS.TXT_BedroomsSC='';
LRI.WEB.SS.TXT_PriceSC='';
LRI.WEB.SS.TXT_DestinationsSC='';
LRI.WEB.SS.TXT_LocationsSC='';
LRI.WEB.SS.TXT_RegionsSC='';
LRI.WEB.SS.TXT_FeaturesSC='';
LRI.WEB.SS.TXT_VacationIdeasSC='';
LRI.WEB.SS.DESTINATION_OPEN=false;

LRI.WEB.SS.form__reset=function(){
	LRI.WEB.SS.form__initializeParameters();
	LRI.WEB.SS.form__clearComponents();
	LRI.WEB.SS.form__populateComponents();
};

LRI.WEB.SS.form__initializeParameters=function(){
	LRI.WEB.SS.SelectedDestinations=[];
	LRI.WEB.SS.SelectedRegions=[];
	LRI.WEB.SS.SelectedLocations=[];
	LRI.WEB.SS.SelectedBedrooms=[];
	LRI.WEB.SS.SelectedCurrency=1;
	LRI.WEB.SS.SelectedPrices=[];
	LRI.WEB.SS.SelectedFeatures=[];

	var i;
	if(default_destinationId!=null){
		var arr=default_destinationId.split(",");
		for(i in arr){
			LRI.WEB.SS.SelectedDestinations.push(arr[i]);
		}
	}
};

LRI.WEB.SS.headerClick=function(){
	$jQ("#pnlsearchparam").slideToggle("fast");
	var url=window.location.href;
	if(url.search(/TopPromotions_2.aspx/)>-1)
	{
		if($jQ("#sideSrchHeader").hasClass("sprite-Collapsed")==true){$jQ("#sideSrchHeader").removeClass("sprite-Collapsed");$jQ("#sideSrchHeader").addClass("sprite-Expanded");}
		else{$jQ("#sideSrchHeader").removeClass("sprite-Expanded");$jQ("#sideSrchHeader").addClass("sprite-Collapsed");}
	}
	else{$jQ("#sideSrchHeader").toggleClass("sprite-Collapsed");}
};

LRI.WEB.SS.miniSrchResultsHeaderClick=function(){
	$jQ("#divMiniSearchResults").slideToggle("fast");
	$jQ("#miniSrchResultsHeader").toggleClass("sprite-Collapsed");
};

LRI.WEB.SS.LocationsCount=function(){
	LRI.WEB.SS.LocationsNum=$jQ("#LocationsCHK :checkbox:checked").filter(":not([count='0'])").length;
	var txt;
	if(LRI.WEB.SS.LocationsNum==0){txt=trAllLocations;LRI.WEB.SS.TXT_LocationsSC=txt;}
	if(LRI.WEB.SS.LocationsNum>0)
	{
		txt="";
		$jQ("#LocationsCHK :checkbox:checked").filter(":not([count='0'])").each(function(){txt+=", "+Destinations[$jQ(this).attr("ID").split("|")[0].substr(1)][2][$jQ(this).attr("ID").split("|")[1].substr(1)][2][$jQ(this).attr("ID").split("|")[2].substr(1)][1];});
		txt=txt.substr(2);
		LRI.WEB.SS.TXT_LocationsSC=txt;
	}
	$jQ("#LocationsDrop").children().eq(0).text(ss_trim(txt));
};

function Locations_Close(){
	LRI.WEB.SS.FLAG__LOC_OPEN=false;
	$jQ("#LocationsBody").hide();
	LRI.WEB.SS.form__listboxes__display();
	LRI.WEB.SS.SelectedLocations=[];
	if(LRI.WEB.SS.LocationsNum>0)$jQ("#LocationsCHK :checkbox:checked").filter(":not([count='0'])").each(function(){LRI.WEB.SS.SelectedLocations.push(Destinations[$jQ(this).attr("ID").split("|")[0].substr(1)][2][$jQ(this).attr("ID").split("|")[1].substr(1)][2][$jQ(this).attr("ID").split("|")[2].substr(1)][0]);});
}

function Locations_Populate(){
	var LL="";
	var RegionsToUncheck=[];
	$jQ("#RegionsCHK :checkbox:checked").filter(":not([count='0'])").each(function(){
		var i=$jQ(this).attr("ID").split("|");
		i[0]=i[0].substr(1);
		i[1]=i[1].substr(1);
		var RegionCheck=true;
		LL+="<INPUT TYPE='CHECKBOX' class='LRI_SS_listboxRowCheckbox' count='0' ID='LL"+i[0]+"R"+i[1]+"' Checked><LABEL class='LRI_SS_listboxRow' for='LL"+i[0]+"R"+i[1]+"'> All "+Destinations[$jQ(this).attr("ID").split("|")[0].substr(1)][2][$jQ(this).attr("ID").split("|")[1].substr(1)][1]+"</LABEL><BR/>";
		for(var j in Destinations[i[0]][2][i[1]][2])
		{
			RegionCheck=RegionCheck&&!(LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedLocations,Destinations[i[0]][2][i[1]][2][j][0])>=0);
			LL+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE='CHECKBOX' class='LRI_SS_listboxRowCheckbox' ID='D"+i[0]+"|R"+i[1]+"|L"+j+"'"+((LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedLocations,Destinations[i[0]][2][i[1]][2][j][0])>=0)?"Checked":"")+"><LABEL class='LRI_SS_listboxRow' for='D"+i[0]+"|R"+i[1]+"|L"+j+"'>"+Destinations[i[0]][2][i[1]][2][j][1]+"</LABEL><BR/>";
		}
		if(!RegionCheck){RegionsToUncheck.push("#LL"+i[0]+"R"+i[1]);}
	});
	$jQ("#LocationsCHK").html(LL);
	for(i in RegionsToUncheck){$jQ(RegionsToUncheck[i]).removeAttr("checked");}
	LRI.WEB.SS.LocationsCount();
	Locations_Close();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Loc__inner();
}

function RegionsCount(){
	LRI.WEB.SS.RegionsNum=$jQ("#RegionsCHK :checkbox:checked").filter(":not([count='0'])").length;
	var txt;
	if(LRI.WEB.SS.RegionsNum==0)
	{
		txt=trAllRegions;
		LRI.WEB.SS.TXT_RegionsSC=txt;
		LRI.WEB.SS.TXT_LocationsSC=trAllLocations;
	}
	if(LRI.WEB.SS.RegionsNum>0)
	{
		txt="";
		$jQ("#RegionsCHK :checkbox:checked").filter(":not([count='0'])").each(function()
		{
			txt+=", "+Destinations[$jQ(this).attr("ID").split("|")[0].substr(1)][2][$jQ(this).attr("ID").split("|")[1].substr(1)][1];
		});
		txt=txt.substr(2);
		LRI.WEB.SS.TXT_RegionsSC=txt;
	}
	$jQ("#RegionsDrop").children().eq(0).text(ss_trim(txt));
}

function Regions_Close(){
	LRI.WEB.SS.FLAG__REG_OPEN=false;
	$jQ("#RegionsBody").hide();
	LRI.WEB.SS.form__listboxes__display();
	$jQ("#LocationsCHK").html("");
	LRI.WEB.SS.SelectedRegions=[];
	if(LRI.WEB.SS.RegionsNum>0)
	{
		$jQ("#RegionsCHK :checkbox:checked").filter(":not([count='0'])").each(function()
		{
			LRI.WEB.SS.SelectedRegions.push(Destinations[$jQ(this).attr("ID").split("|")[0].substr(1)][2][$jQ(this).attr("ID").split("|")[1].substr(1)][0]);
		});Locations_Populate();
	}
	else
	LRI.WEB.SS.SelectedLocations=[];
}

function Regions_Populate(){
	var RR="";
	var DestToUncheck=[];
	$jQ("#DestinationsCHK :checkbox:checked").filter(":not([count='0'])").each(function(){
		var i=$jQ(this).attr("ID").substr(1);
		var DestCheck=true;
		RR+="<INPUT TYPE='CHECKBOX' class='LRI_SS_listboxRowCheckbox' count='0' ID='RR"+i+"' Checked><LABEL class='LRI_SS_listboxRow' for='RR"+i+"'>"+Destinations[$jQ(this).attr("ID").substr(1)][1]+"</LABEL><BR/>";
		for(var j in Destinations[i][2])
		{
			DestCheck=DestCheck&&!(LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedRegions,Destinations[i][2][j][0])>=0);
			RR+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE='CHECKBOX' class='LRI_SS_listboxRowCheckbox' ID='D"+i+"|R"+j+"'"+((LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedRegions,Destinations[i][2][j][0])>=0)?"Checked":"")+"><LABEL class='LRI_SS_listboxRow' for='D"+i+"|R"+j+"'>"+Destinations[i][2][j][1]+"</LABEL><BR/>";
		}
		if(!DestCheck){DestToUncheck.push("#RR"+i);}
	});
	$jQ("#RegionsCHK").html(RR);
	for(i in DestToUncheck){$jQ(DestToUncheck[i]).removeAttr("checked");}
	RegionsCount();
	Regions_Close();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Reg__inner();
}

function ss_trim(txt){
	var limit=30;
	if(txt.length>limit){txt=txt.substr(0,limit)+"...";}
	return txt;
}

function DestinationsCount(){
	LRI.WEB.SS.DestinationsNum=$jQ("#DestinationsCHK :checkbox:checked").filter(":not([count='0'])").length;
	var txt;
	if(LRI.WEB.SS.DestinationsNum==0){
		txt=trAllCountries;
		LRI.WEB.SS.TXT_RegionsSC=trAllRegions;
		LRI.WEB.SS.TXT_LocationsSC=trAllLocations;
	}
	if(LRI.WEB.SS.DestinationsNum>0){
		txt="";
		$jQ("#DestinationsCHK :checkbox:checked").filter(":not([count='0'])").each(function(){
			txt+=", "+Destinations[$jQ(this).attr("ID").substr(1)][1];
		});
		txt=txt.substr(2);
	}
	$jQ("#DestinationsDrop").children().eq(0).text(ss_trim(txt));
	LRI.WEB.SS.TXT_DestinationsSC=txt;
}

function Destinations_Close(){
	LRI.WEB.SS.FLAG__DEST_OPEN=false;
	$jQ("#DestinationsBody").hide();
	LRI.WEB.SS.form__listboxes__display();
	$jQ("#RegionsCHK").html("");
	$jQ("#LocationsCHK").html("");
	LRI.WEB.SS.SelectedDestinations=[];
	if(LRI.WEB.SS.DestinationsNum>0){
		$jQ("#DestinationsCHK :checkbox:checked").filter(":not([count='0'])").each(function(){
			LRI.WEB.SS.SelectedDestinations.push(Destinations[$jQ(this).attr("ID").substr(1)][0]);
		});
		Regions_Populate();
		$jQ("#Regions").show();
		$jQ("#RegionsCHK :checkbox").filter(":not([count='0'])").click(function(){
			$jQ("#RR"+$jQ(this).attr("ID").split("|")[0].substr(1)).removeAttr("checked");
			RegionsCount();
		});
		$jQ("#RegionsCHK label").hover(function(){
			$jQ(this).css("backgroundColor","#CCCCCC");
		},function(){
			$jQ(this).css("backgroundColor","#FFFFFF");
		});
	}
	else{
		LRI.WEB.SS.SelectedRegions=[];
		LRI.WEB.SS.SelectedLocations=[];
	}
}

function Destinations_Populate(){
	var DD="";
	DD+="<INPUT TYPE='CHECKBOX' class='LRI_SS_listboxRowCheckbox' count='0' ID='DD' Checked><LABEL class='LRI_SS_listboxRow' for='DD'>"+trAllCountries+"</LABEL><br>";
	var DestCheck=true;
	for(var i in Destinations){
		DestCheck=DestCheck&&!(LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedDestinations,Destinations[i][0])>=0);
		DD+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE='CHECKBOX' class='LRI_SS_listboxRowCheckbox' ID='D"+i+"'"+((LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedDestinations,Destinations[i][0])>=0)?"Checked":"")+"><LABEL class='LRI_SS_listboxRow' for='D"+i+"'>"+Destinations[i][1]+"</LABEL><BR/>";
	}
	$jQ("#DestinationsCHK").html(DD);
	if(!DestCheck){
		$jQ("#DD").removeAttr("checked");
	}
	DestinationsCount();
	Destinations_Close();
}

function Prices_Populate(){
	$jQ("#PriceMin").html("");
	$jQ("#PriceMax").html("");
	sel="";
	if(LRI.WEB.SS.SelectedPrices[0]==null||LRI.WEB.SS.SelectedPrices[0]==''||LRI.WEB.SS.SelectedPrices[0]=='0'){
		sel="selected";
	}
	$jQ("#PriceMin").append('<option '+sel+' value="'+PriceMinUS[0][0]+'">'+PriceMinUS[0][1]+'</option>');
	for(var i=1;i<PriceMinUS.length;i++){
		var sel="";
		if(LRI.WEB.SS.SelectedPrices.length>0){
			if(Math.round(PriceMinUS[i][0]*LRI.WEB.SS.ExchFactor)==LRI.WEB.SS.SelectedPrices[0]){
				sel="selected";
			}
		}
		$jQ("#PriceMin").append('<option '+sel+' value="'+Math.round(PriceMinUS[i][0]*LRI.WEB.SS.ExchFactor)+'">'+Math.round(PriceMinUS[i][1]*LRI.WEB.SS.ExchFactor)+'</option>');
	}
	sel="";
	for(var i=0;i<PriceMaxUS.length-1;i++){
		var sel="";
		if(LRI.WEB.SS.SelectedPrices.length>1){
			if(Math.round(PriceMaxUS[i][0]*LRI.WEB.SS.ExchFactor)==LRI.WEB.SS.SelectedPrices[1]){
				sel="selected";
			}
		}
		$jQ("#PriceMax").append('<option '+sel+' value="'+Math.round(PriceMaxUS[i][0]*LRI.WEB.SS.ExchFactor)+'">'+Math.round(PriceMaxUS[i][1]*LRI.WEB.SS.ExchFactor)+'</option>');
	}
	sel="";
	if(LRI.WEB.SS.SelectedPrices[1]==null||LRI.WEB.SS.SelectedPrices[1]==''||LRI.WEB.SS.SelectedPrices[1]=='999999999'){
		sel="selected";
	}
	$jQ("#PriceMax").append('<option '+sel+' value="'+PriceMaxUS[i][0]+'">'+PriceMaxUS[i][1]+'</option>');
	LRI.WEB.SS.TXT_PriceSC=$jQ("#PriceMin option:selected").text()+" to "+$jQ("#PriceMax option:selected").text()+'';
}

function FeaturesCount(){
	LRI.WEB.SS.FeaturesNum=$jQ("#FeaturesCHK :checkbox:checked").filter(":not([count='0'])").length;
	var txt;
	if(LRI.WEB.SS.FeaturesNum==0){
		txt=trAllFeatures;
		LRI.WEB.SS.TXT_FeaturesSC=txt;
		LRI.WEB.SS.SelectedFeatures=[];
	}
	if(LRI.WEB.SS.FeaturesNum>0){
		txt="";
		$jQ("#FeaturesCHK :checkbox:checked").filter(":not([count='0'])").each(function(){
			txt+=", "+Features[$jQ(this).attr("ID").substr(1)][1];
		});
		txt=txt.substr(2);
	}
	else{
		txt=trSelectFeatures;
	}
	$jQ("#FeaturesDrop").children().eq(0).text(ss_trim(txt));
	LRI.WEB.SS.TXT_FeaturesSC=txt;
}

LRI.WEB.SS.Features_Close=function(){
	LRI.WEB.SS.FLAG__FT_OPEN=false;
	$jQ("#FeaturesBody").hide();
	LRI.WEB.SS.SelectedFeatures=[];
	if(LRI.WEB.SS.FeaturesNum>0){
		$jQ("#FeaturesCHK :checkbox:checked").filter(":not([count='0'])").each(function(){
			LRI.WEB.SS.SelectedFeatures.push(Features[$jQ(this).attr("ID").substr(1)][0]);
		});
	}
};

function Features_Populate(){
	var FF="";
	var FeatCheck=true;
	FF+="<INPUT TYPE='checkbox' class='LRI_SS_listboxRowCheckbox' count='0' ID='FF' Checked><LABEL class='LRI_SS_listboxRow' for='FF'>"+trAllFeatures+"</LABEL><br>";
	for(var i in Features){
		FeatCheck=FeatCheck&&!(LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedFeatures,Features[i][0])>=0);
		FF+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE='checkbox' class='LRI_SS_listboxRowCheckbox' ID='F"+i+"' "+((LRI.WEB.SS.indexOf(LRI.WEB.SS.SelectedFeatures,Features[i][0])>=0)?"Checked":"")+"  >"+"<LABEL for='F"+i+"' class='LRI_SS_listboxRow'>"+Features[i][1]+"</LABEL><BR/>";
	}
	$jQ("#FeaturesCHK").html(FF);
	if(!FeatCheck){
		$jQ("#FF").removeAttr("checked");
	}
	FeaturesCount();
	LRI.WEB.SS.Features_Close();
}

LRI.WEB.SS.Bedrooms_Populate=function(){
	for(var i in BedroomMin){
		var sel="";
		if(LRI.WEB.SS.SelectedBedrooms.length>0){
			if(BedroomMin[i][0]==LRI.WEB.SS.SelectedBedrooms[0]){
				sel="selected";
			}
		}
		$jQ("#BedMin").append('<option '+sel+' value="'+BedroomMin[i][0]+'">'+BedroomMin[i][1]+'</option>');
	}
	for(var i in BedroomMax){
		var sel="";
		if(LRI.WEB.SS.SelectedBedrooms.length>1){
			if(BedroomMax[i][0]==LRI.WEB.SS.SelectedBedrooms[1]){
				sel="selected";
			}
		}
		else if(i==8){
			sel="selected";
		}
		$jQ("#BedMax").append('<option '+sel+' value="'+BedroomMax[i][0]+'">'+BedroomMax[i][1]+'</option>');
	}
	LRI.WEB.SS.TXT_BedroomsSC=$jQ("#BedMin option:selected").text()+" "+trTo+" "+$jQ("#BedMax option:selected").text()+'';
};

LRI.WEB.SS.Currency_Populate=function(){
	var SelectedCurrencyIndex=-1;
	var sel='';
	for(var i in Currencies){
		sel='';
		if(LRI.WEB.SS.SelectedCurrency==Currencies[i][0]){
			sel='selected';
		}
		if(LRI.WEB.SS.SelectedCurrency==Currencies[i][0]){
			SelectedCurrencyIndex=i;
		}
		$jQ("#CurrencySelector").append('<option '+sel+' value="'+Currencies[i][0]+'">'+Currencies[i][2]+' '+Currencies[i][1]+'</option>');
	}
	var tmpvarIndexCurrency=0;
	for(var i in Currencies){
		if(Currencies[i][0]==Number($jQ("#CurrencySelector option:selected").val())){
			tmpvarIndexCurrency=i;
		}
	}
	LRI.WEB.SS.ExchFactor=Currencies[tmpvarIndexCurrency][3];
};

LRI.WEB.SS.readyJQ=function(){
	var i;
	if(default_destinationId!=null){
		var arr=default_destinationId.split(",");
		for(i in arr){
			LRI.WEB.SS.SelectedDestinations.push(arr[i]);
		}
	}
	if(default_regionId!=null){
		var arr=default_regionId.split(",");
		for(i in arr){
			LRI.WEB.SS.SelectedRegions.push(arr[i]);
		}
	}
	if(default_locationId!=null)
	{
		var arr=default_locationId.split(",");
		for(i in arr){
			LRI.WEB.SS.SelectedLocations.push(arr[i]);
		}
	}
	if(default_bedMin!='') LRI.WEB.SS.SelectedBedrooms.push(default_bedMin);
	if(default_bedMax!='') LRI.WEB.SS.SelectedBedrooms.push(default_bedMax);
	if(default_priceMin!='') LRI.WEB.SS.SelectedPrices.push(default_priceMin);
	if(default_priceMax!='') LRI.WEB.SS.SelectedPrices.push(default_priceMax);
	if(default_featureId!=null){
		var arr=default_featureId.split(",");
		for(i in arr){
			LRI.WEB.SS.SelectedFeatures.push(arr[i]);
		}
	}
	if(default_currencyId!=null){
		LRI.WEB.SS.SelectedCurrency=default_currencyId;
	}
	LRI.WEB.SS.ref__BedMin=document.getElementById("BedMin");
	LRI.WEB.SS.ref__BedMax=document.getElementById("BedMax");
	LRI.WEB.SS.ref__PriceMin=document.getElementById("PriceMin");
	LRI.WEB.SS.ref__PriceMax=document.getElementById("PriceMax");
	LRI.WEB.SS.ref__CurrencySelector=document.getElementById("CurrencySelector");
	LRI.WEB.SS.form__intializeComponents();
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Features=function(){
	$jQ("#FeaturesDrop").click(function(){
		//$jQ("#FeaturesBody").toggle();
		if($jQ("#FeaturesBody").is(':visible')){
			LRI.WEB.SS.Features_Close();
			LRI.WEB.SS.FLAG__FT_OPEN=true;
		}
		else{
			Destinations_Close();
			Locations_Close();
			Regions_Close();
			$jQ("#FeaturesBody").show();
			LRI.WEB.SS.FLAG__FT_OPEN=false;
		}
	});
	$jQ("#FeaturesDrop").mouseout(function(){LRI.WEB.SS.FLAG__FT_MOUSEOUT=true;});
	$jQ("#FeaturesDrop").mouseover(function(){LRI.WEB.SS.FLAG__FT_MOUSEOUT=false;});
	$jQ("#FeaturesBody").mouseout(function(){LRI.WEB.SS.FLAG__FT_MOUSEOUT=true;});
	$jQ("#FeaturesBody").mouseover(function(){LRI.WEB.SS.FLAG__FT_MOUSEOUT=false;});
	LRI.WEB.SS.form__intializeComponents_linkEvents__Features_innerChkBoxes();

	$jQ("#FeaturesFooter div").eq(1).click(function(){
		LRI.WEB.SS.Features_Close();
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Features_innerChkBoxes=function(){
	$jQ("#FeaturesCHK :checkbox").click(function(){
		$jQ("#FF").get(0).checked="";
		FeaturesCount();
	});
	$jQ("#FeaturesCHK label").hover(function(){
		$jQ(this).css("backgroundColor","#CCCCCC");
	},function(){
		$jQ(this).css("backgroundColor","#FFFFFF");
	});

	$jQ("#FeaturesFooter div").eq(0).click(function(){
		$jQ("#FeaturesCHK > *:checkbox").removeAttr("checked");
		$jQ("#FeaturesCHK > *:checkbox[count='0']").attr("checked","checked");
		FeaturesCount();
	});
	$jQ("#FeaturesCHK :checkbox[count='0']:checked").click(function(){
		$jQ("#FeaturesCHK :checkbox:not([count='0'])").removeAttr("checked");
		$jQ(this).attr("checked","checked");
		FeaturesCount();
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Dest=function(){
	$jQ("#DestinationsDrop").click(function(){
		if($jQ("#DestinationsBody").is(':visible')){
			Destinations_Close();
			LRI.WEB.SS.DESTINATION_OPEN=false;
		}
		else{
			Locations_Close();
			Regions_Close();
			LRI.WEB.SS.Features_Close();
			$jQ("#DestinationsBody").show();
			LRI.WEB.SS.DESTINATION_OPEN=true;
			LRI.WEB.SS.FLAG__DEST_OPEN=true;
			LRI.WEB.SS.ref__PriceMin.style.visibility='hidden';
			LRI.WEB.SS.ref__PriceMax.style.visibility='hidden';
			LRI.WEB.SS.ref__CurrencySelector.style.visibility='hidden';
			LRI.WEB.SS.ref__BedMin.style.visibility='hidden';
			LRI.WEB.SS.ref__BedMax.style.visibility='hidden';
		}
	});

	$jQ("#DestinationsCHK :checkbox[count='0']:not(checked)").click(function(){
		$jQ("#DestinationsCHK :checkbox:not([count='0'])").removeAttr("checked");
		$jQ(this).attr("checked","checked");
		DestinationsCount();
	});

	$jQ("#DestinationsDrop").mouseout(function(){LRI.WEB.SS.FLAG__DEST_MOUSEOUT=true;});
	$jQ("#DestinationsDrop").mouseover(function(){LRI.WEB.SS.FLAG__DEST_MOUSEOUT=false;});
	$jQ("#DestinationsBody").mouseout(function(){LRI.WEB.SS.FLAG__DEST_MOUSEOUT=true;});
	$jQ("#DestinationsBody").mouseover(function(){LRI.WEB.SS.FLAG__DEST_MOUSEOUT=false;});
	LRI.WEB.SS.form__intializeComponents_linkEvents__Dest_innerChkBoxes();
	$jQ("#DestinationsFooter div").eq(1).click(function(){
		Destinations_Close();
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Dest_innerChkBoxes=function(){
	$jQ("#DestinationsCHK :checkbox").filter(":not([count='0'])").click(function(){
		$jQ("#DD").get(0).checked="";
		DestinationsCount();
	});
	$jQ("#DestinationsCHK label").hover(function(){
		$jQ(this).css("backgroundColor","#CCCCCC");
	},function(){
		$jQ(this).css("backgroundColor","#FFFFFF");
	});
	$jQ("#DestinationsFooter div").eq(0).click(function(){
		$jQ("#DestinationsCHK > *:checkbox").removeAttr("checked");
		$jQ("#DestinationsCHK > *:checkbox[count='0']").attr("checked","checked");
		DestinationsCount();
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Reg=function(){
	$jQ("#RegionsDrop").click(function(){
		if($jQ("#RegionsBody").is(":visible")){
			Regions_Close();
			LRI.WEB.SS.FLAG__REG_OPEN=false;
		}
		else{
			Locations_Close();
			Destinations_Close();
			LRI.WEB.SS.Features_Close();
			var height=$jQ("#RegionsBody").height();
			$jQ("#RegionsBody").show();
			LRI.WEB.SS.FLAG__REG_OPEN=true;
			LRI.WEB.SS.ref__PriceMin.style.visibility='hidden';
			LRI.WEB.SS.ref__PriceMax.style.visibility='hidden';
			LRI.WEB.SS.ref__CurrencySelector.style.visibility='hidden';
			LRI.WEB.SS.ref__BedMin.style.visibility='hidden';
			LRI.WEB.SS.ref__BedMax.style.visibility='hidden';
		}
	});
	$jQ("#RegionsFooter div").eq(0).click(function(){
		$jQ("#RegionsCHK > *:checkbox").removeAttr("checked");
		$jQ("#RegionsCHK > *:checkbox[count='0']").attr("checked","checked");
		RegionsCount();
	});
	$jQ("#RegionsFooter div").eq(1).click(function(){
		Regions_Close();
	});
	$jQ("#RegionsDrop").mouseout(function(){LRI.WEB.SS.FLAG__REG_MOUSEOUT=true;});
	$jQ("#RegionsDrop").mouseover(function(){LRI.WEB.SS.FLAG__REG_MOUSEOUT=false;});
	$jQ("#RegionsBody").mouseout(function(){LRI.WEB.SS.FLAG__REG_MOUSEOUT=true;});
	$jQ("#RegionsBody").mouseover(function(){LRI.WEB.SS.FLAG__REG_MOUSEOUT=false;});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Reg__inner=function(){
	$jQ("#RegionsCHK :checkbox").filter(":not([count='0'])").click(function(){
		$jQ("#RR"+$jQ(this).attr("ID").split("|")[0].substr(1)).removeAttr("checked");
		RegionsCount();
	});
	$jQ("#RegionsCHK :checkbox[count='0']:checked").click(function(){
		id_Dest=$jQ(this).attr("ID").substr(2);
		$jQ("#RegionsCHK :checkbox:not([count='0'])").filter(function(index){
			return $jQ(this).attr("ID").split("|")[0].substr(1)==id_Dest;
		}).removeAttr("checked");
		$jQ(this).attr("checked","checked");
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Loc=function(){
	$jQ("#LocationsDrop").click(function(){
		if($jQ("#LocationsBody").is(':visible')){
			Locations_Close();
			LRI.WEB.SS.FLAG__LOC_OPEN=false;
		}
		else{
			Destinations_Close();
			Regions_Close();
			LRI.WEB.SS.Features_Close();
			$jQ("#LocationsBody").show();
			LRI.WEB.SS.FLAG__LOC_OPEN=true;
			var height=$jQ("#LocationsBody").height();
			$jQ("#LocationsBody").show();
			if(height>=90){
				LRI.WEB.SS.ref__PriceMin.style.visibility='hidden';
				LRI.WEB.SS.ref__PriceMax.style.visibility='hidden';
				LRI.WEB.SS.ref__CurrencySelector.style.visibility='hidden';
				LRI.WEB.SS.ref__BedMin.style.visibility='hidden';
				LRI.WEB.SS.ref__BedMax.style.visibility='hidden';
			}else if(height>=40){
				LRI.WEB.SS.ref__BedMin.style.visibility='hidden';
				LRI.WEB.SS.ref__BedMax.style.visibility='hidden';
				LRI.WEB.SS.ref__CurrencySelector.style.visibility='hidden';
			}
			else if(height>=18){
				LRI.WEB.SS.ref__BedMin.style.visibility='hidden';
				LRI.WEB.SS.ref__BedMax.style.visibility='hidden';
			}
		}
	});
	$jQ("#LocationsFooter div").eq(0).click(function(){
		$jQ("#LocationsCHK > *:checkbox").removeAttr("checked");
		$jQ("#LocationsCHK > *:checkbox[count='0']").attr("checked","checked");
		LRI.WEB.SS.LocationsCount();
	});
	$jQ("#LocationsFooter div").eq(1).click(function(){
		Locations_Close();
	});
	$jQ("#LocationsDrop").mouseout(function(){LRI.WEB.SS.FLAG__LOC_MOUSEOUT=true;});
	$jQ("#LocationsDrop").mouseover(function(){LRI.WEB.SS.FLAG__LOC_MOUSEOUT=false;});
	$jQ("#LocationsBody").mouseout(function(){LRI.WEB.SS.FLAG__LOC_MOUSEOUT=true;});
	$jQ("#LocationsBody").mouseover(function(){LRI.WEB.SS.FLAG__LOC_MOUSEOUT=false;});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Loc__inner=function(){
	$jQ("#LocationsCHK :checkbox").filter(":not([count='0'])").click(function(){
		$jQ("#LL"+$jQ(this).attr("ID").split("|")[0].substr(1)+"R"+$jQ(this).attr("ID").split("|")[1].substr(1)).removeAttr("checked");
		LRI.WEB.SS.LocationsCount();
	});
	$jQ("#LocationsCHK label").hover(function(){
		$jQ(this).css("backgroundColor","#CCCCCC");
	},function(){
		$jQ(this).css("backgroundColor","#FFFFFF");
	});
	$jQ("#LocationsCHK :checkbox[count='0']:checked").click(function(){
		id_Reg="D"+$jQ(this).attr("ID").substr(2).split("R")[0]+"|R"+$jQ(this).attr("ID").substr(2).split("R")[1]+"|";
		$jQ("#LocationsCHK :checkbox:not([count='0'])").filter(function(index){
			return $jQ(this).attr("ID").split("L")[0]==id_Reg;
		}).removeAttr("checked");
		$jQ(this).attr("checked","checked");
		LRI.WEB.SS.LocationsCount();
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Bed=function(){
	$jQ("#BedroomRange :input").change(function(){
		if(Number($jQ("#BedMin option:selected").val())>Number($jQ("#BedMax option:selected").val())){
			tmp=$jQ("#BedMin option:selected").val();
			$jQ("#BedMin option[value='"+$jQ("#BedMax option:selected").val()+"']").get(0).selected="selected";
			$jQ("#BedMax option[value='"+tmp+"']").get(0).selected="selected";
		}
		LRI.WEB.SS.TXT_BedroomsSC=$jQ("#BedMin option:selected").text()+" "+trTo+" "+$jQ("#BedMax option:selected").text()+'';
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Currency=function(){
	$jQ("#CurrencySelector").change(function(){
		var tmpvarIndexCurrency=0;
		for(var i in Currencies){
			if(Currencies[i][0]==Number($jQ("#CurrencySelector option:selected").val())){
				tmpvarIndexCurrency=i;
			}
		}
		LRI.WEB.SS.ExchFactor=Currencies[tmpvarIndexCurrency][3];
		var TmpMaxPriceIndex=document.getElementById("PriceMax").selectedIndex;
		var TmpMinPriceIndex=document.getElementById("PriceMin").selectedIndex;
		Prices_Populate();document.getElementById("PriceMax").selectedIndex=TmpMaxPriceIndex;
		document.getElementById("PriceMin").selectedIndex=TmpMinPriceIndex;
	});
};

LRI.WEB.SS.form__intializeComponents_linkEvents__Prices=function(){
	$jQ("#PriceRange :input").change(function(){
		if(Number($jQ("#PriceMin option:selected").val())>Number($jQ("#PriceMax option:selected").val())){
			tmp=$jQ("#PriceMin option:selected").val();
			$jQ("#PriceMin option[value='"+$jQ("#PriceMax option:selected").val()+"']").get(0).selected="selected";
			$jQ("#PriceMax option[value='"+tmp+"']").get(0).selected="selected";
		}
		LRI.WEB.SS.TXT_PriceSC=$jQ("#PriceMin option:selected").text()+" to "+$jQ("#PriceMax option:selected").text()+'';
		LRI.WEB.SS.SelectedPrices[0]=$jQ("#PriceMin option:selected").val();
	});
};

LRI.WEB.SS.form__intializeComponents=function(){
	Destinations_Populate();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Dest();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Reg();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Loc();
	LRI.WEB.SS.Bedrooms_Populate();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Bed();
	LRI.WEB.SS.Currency_Populate();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Currency();
	Prices_Populate();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Prices();
	Features_Populate();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Features();
};

LRI.WEB.SS.form__listboxes__display=function(){
	LRI.WEB.SS.ref__PriceMin.style.visibility='';
	LRI.WEB.SS.ref__PriceMax.style.visibility='';
	LRI.WEB.SS.ref__CurrencySelector.style.visibility='';
	LRI.WEB.SS.ref__BedMin.style.visibility='';
	LRI.WEB.SS.ref__BedMax.style.visibility='';
};

LRI.WEB.SS.form__populateComponents=function(){
	Destinations_Populate();
	RegionsCount();
	LRI.WEB.SS.LocationsCount();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Dest_innerChkBoxes();
	LRI.WEB.SS.Bedrooms_Populate();
	LRI.WEB.SS.Currency_Populate();
	Prices_Populate();
	Features_Populate();
	LRI.WEB.SS.form__intializeComponents_linkEvents__Features_innerChkBoxes();
};

LRI.WEB.SS.form__clearComponents=function(){
	$jQ("#DestinationsCHK").html("");
	$jQ("#BedMin").html("");
	$jQ("#BedMax").html("");
	$jQ("#CurrencySelector").html("");
	$jQ("#PriceMin").html("");
	$jQ("#PriceMax").html("");
	$jQ("#FeaturesCHK").html("");
};

var d=new Date();
var start=d.getTime();
$jQ(document).ready(function(){
	jQuery.noConflict(); 
	jQuery('#featured_img').attr("src",jQuery('#image1').val());
	jQuery('#featured_link').attr("href",jQuery('#link1').val());
	jQuery('.featured_villa_content_items .active').addClass('silent');
	jQuery('.featured_villa_content_items .silent').removeClass('active');
	jQuery('.featured_villa_content_items .silent').addClass('first');
	jQuery('.featured_villa_content_items td').mouseover(function(){
		if(jQuery(this).attr("class")!='active'){
			jQuery('.featured_villa_content_items .active').removeClass('active');
			jQuery('.featured_villa_content_items .first').removeClass('first');
			jQuery('.featured_villa_content_items .absfirst').removeClass('absfirst');
			jQuery(this).addClass('active');
			jQuery(this).next().addClass('first');
			if(jQuery('.featured_villa_content_items td:first-child').attr('class')!='active'){
				jQuery('.featured_villa_content_items td:first-child').addClass('first');
			}
			if(jQuery('#villa1').attr("class")!='active'){
				jQuery('#villa1').removeClass('first');
				jQuery('#villa1').addClass('absfirst');
			}
			var message=jQuery(this).attr("id");
			var image_id="image"+message.replace("villa","");
			var link_id="link"+message.replace("villa","");
			jQuery('#featured_img').attr("src",jQuery('#'+image_id).val());
			jQuery('#featured_link').attr("href",jQuery('#'+link_id).val());
			jQuery("#anchor"+message.replace("villa","")).attr("href",jQuery("#link"+message.replace("villa","")).val());
			return false;
		}
		else{
			return true;
		}
	});
	jQuery('.featured_villa_content_items .silent').removeClass('first');    
	jQuery('.featured_villa_content_items .silent').addClass('active');
	jQuery('.featured_villa_content_items .active').removeClass('silent');
	LRI.WEB.SS.readyJQ();
});

$jQ.cookie('LRI-Cookie','testing',{ 
	expires:7
});

init_slideshow = function()
{
	jQuery('#home_slides').cycle({
		fx:'fade',
		timeout:8000,
		pager:'#slide_navigation',
		after:update_slide_caption,
		before:fade_slide_caption
	})
}

fade_slide_caption = function(next, previous)
{
	caption_container = jQuery('#project_caption')
	caption_container.fadeOut('fast')
}

update_slide_caption = function(next, previous)
{
	caption_container = jQuery('#project_caption')
	caption = jQuery('span.slide_caption', previous)
	caption_container.fadeIn('fast')
	caption_container.html(caption.html())
}

jQuery(document).ready(function(){
	init_slideshow();

	jQuery('#arrival').change(function(){
		jQuery('#departure').datepicker('option','minDate',jQuery('#arrival').datepicker('getDate'));
	});
	jQuery('#departure').change(function(){});

	jQuery('#arrival').focus(function(){
		jQuery('#arrival ~ .dp-choose-date').trigger('click');
	});

	jQuery('#departure').focus(function(){
		jQuery('#departure ~ .dp-choose-date').trigger('click');
	});

	jQuery('#arrival').datepicker({minDate: 0});
	jQuery('#departure').datepicker({minDate: 0});


	jQuery('#arrivalSearch').change(function(){
		jQuery('#departureSearch').datepicker('option','minDate',jQuery('#arrivalSearch').datepicker('getDate'));
	});
	jQuery('#departureSearch').change(function(){});

	jQuery('#arrivalSearch').focus(function(){
		jQuery('#arrivalSearch ~ .dp-choose-date').trigger('click');
	});

	jQuery('#departureSearch').focus(function(){
		jQuery('#departureSearch ~ .dp-choose-date').trigger('click');
	});

	jQuery('#arrivalSearch').datepicker({minDate: 0});
	jQuery('#departureSearch').datepicker({minDate: 0});
});
