if (top != self){
	top.location.replace(self.location.href.toLowerCase());
}
function bookIt(argVal){
	var bookData = new Array();
	bookData = argVal.split("|");
	if (document.all)
		window.external.AddFavorite(bookData[0], bookData[1]);
	else
		alert("Sorry. You must bookmark the pages manually");
}
function hoverOverMenu(obj){
	obj.style.background='#999999';
}
function hoverOverOffMenu(obj){
	obj.style.background='url(../images/back_button.jpg)';
}
function hoverOver(obj){
	obj.style.background='#EEEEEE';
}
function hoverOff(obj){
	obj.style.background=''
}
// show calendar
var enableCal=false;
var cal_obj2 = null;
var format = '%d/%m/%y';
function show_cal(el) {
	if (cal_obj2) return;
	if (!enableCal) return;
	var text_field = document.getElementById("start_date");
	cal_obj2 = new RichCalendar();
	cal_obj2.start_week_day = 0;
	cal_obj2.show_time = false;
	cal_obj2.language = 'en';
	cal_obj2.user_onchange_handler = cal2_on_change;
	cal_obj2.user_onclose_handler = cal2_on_close;
	cal_obj2.user_onautoclose_handler = cal2_on_autoclose;
	cal_obj2.parse_date(text_field.value, format);
	cal_obj2.show_at_element(text_field, "right-bottom");
	//cal_obj2.change_skin('alt');
}
// user defined onchange handler
function cal2_on_change(cal, object_code) {
	if (object_code == 'day') {
		document.getElementById("start_date").value = cal.get_formatted_date(format);
		cal.hide();
		cal_obj2 = null;
	}
}
// user defined onclose handler (used in pop-up mode - when auto_close is true)
function cal2_on_close(cal) {
	//if (window.confirm('Are you sure to close the calendar?')) {
		cal.hide();
		cal_obj2 = null;
	//}
	changedDetails();
}
// user defined onautoclose handler
function cal2_on_autoclose(cal) {
	cal_obj2 = null;
}
function showHelp(param){
	if (param){
		document.all['search_help'].style.left=(200+((document.body.scrollWidth/2)-(950/2)));
		document.all['search_help'].style.visibility="visible";
	}else{
		document.all['search_help'].style.visibility="hidden";
	}
}
function bigGroups(isGroupPage){
	if (!isGroupPage){
		if (document.avail.people.value>8){
			showBigGroup(true);
		}
	}
}
function showBigGroup(param){
	if (param){
		document.all['big_group'].style.left=(200+((document.body.scrollWidth/2)-(950/2)));
		document.all['big_group'].style.visibility="visible";
	}else{
		document.all['big_group'].style.visibility="hidden";
	}
}
function clearStartDate(){
	document.avail.start_date.value='dd/mm/yy';
	document.avail.action='';
	document.avail.currentPage.value='0';
	document.avail.submit();
}
function setStartDate(param){
	document.avail.start_date.value=param;
	changedDetails();
}
function setPeople(param){
	changedDetails();
}
function setChildren(param){
	changedDetails();
}
function setDuration(param){
	changedDetails();
}
function changedDetails(){
	document.avail.go1.className="normalboldred";
}
function doRefOnFocus(){
	doOnFocus(document.avail.accom_id_direct, "ref:");
}
function doRefOnBlur(){
	doOnBlur(document.avail.accom_id_direct, "ref:");
}
function doOnFocus(myObject, myText){
	if (myObject.value==myText){
		myObject.value="";
		myObject.style.color="#000000";
	}
}
function doOnBlur(myObject, myText){
	if (myObject.value==""){
		myObject.value=myText;
		myObject.style.color="#AAAAAA";
	}
}
function setPage(p){
	document.avail.currentPage.value=p;
	document.avail.submit();
}
function setResultsPerPage(p){
	document.avail.currentPage.value=0;
	document.avail.resultsPerPage.value=p;
	document.avail.submit();
}
function sendEmailCheck(){
	if (document.avail.email.value==""){
		alert("Please enter your email address!");
		return;
	}
	if (document.avail.messageBody.value==""){
		alert("Please enter a message!");
		return;
	}
	document.avail.doAction.value='sendEmail';
	document.avail.action='';
	document.avail.submit();
}
function doRemoveFav(paramRemove, favId){
	if (!paramRemove){
		document.avail.removeFavs.value=favId;
		document.avail.submit();
	}else{
		document.avail.removeFavs.value='';
	}
}
function doAddFav(){
	document.avail.submit();
}
function doMyListEmail(){
	//check for valid email
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.avail.xyz.value)){
		document.avail.doAction.value="email";
		document.avail.submit();
	}else{
		alert("Invalid E-mail Address! Please re-enter.");
	}
}
function checkforMyListEmail(event){ 	
	var Key = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (Key==13){
		//13 is the enter key
		doMyListEmail();
	}
}
function doMyListEmailOnFocus(){
	if (document.avail.xyz.value=="Enter Your Email Address to Email This List"){
		document.avail.xyz.value="";
		document.avail.xyz.style.color="#000000";
	}
}
function doMyListEmailOnBlur(){
	if (document.avail.xyz.value==""){
		document.avail.xyz.value="Enter Your Email Address to Email This List";
		document.avail.xyz.style.color="#AAAAAA";
	}
}
function changeCurrency(currVal, baseCurrVal, price){
	if (currVal=="-"){
		x=window.open("http://www.xe.com/pca/input.php?AmountSet="+price+"&FromSelect="+baseCurrVal+"&ToSelect="+baseCurrVal);
	}else{
		document.avail.submit();
	}
}
function checkforsubmit(event, location){
	var Key = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (Key==13){
		//13 is the enter key
		document.avail.action=location+"-apartment-"+document.avail.accom_id_direct.value+".html";
		document.avail.submit();
	}
}
function checkGotoApt(location){
	if (document.avail.accom_id.value!=""){
		document.avail.action=location+"-apartment-"+document.avail.accom_id.value+".html";
	}
}
function doSofabeds(sofabedsGroupParam){
	if (!sofabedsGroupParam){
		document.avail.sofabedsGroup.value='false';
		document.avail.sofabedsGroupCheckBox.checked=sofabedsGroupParam;
	}else{
		document.avail.sofabedsGroup.value='true';
		document.avail.sofabedsGroupCheckBox.checked=sofabedsGroupParam;
	}
}
function doDoubleBeds(doubleBedsGroupParam){
	if (!doubleBedsGroupParam){
		document.avail.doubleBedsGroup.value='false';
		document.avail.doubleBedsCheckBox.checked=doubleBedsGroupParam;
	}else{
		document.avail.doubleBedsGroup.value='true';
		document.avail.doubleBedsCheckBox.checked=doubleBedsGroupParam;
	}
}
function findTheFocus(where){
	document.body.scrollTop=where;
}
function rollOverRow(currentRow, newColor){
	document.getElementById('id_'+currentRow+'_0').style.backgroundColor=newColor;
	document.getElementById('id_'+currentRow+'_2').style.backgroundColor=newColor;
	document.getElementById('id_'+currentRow+'_3').style.backgroundColor=newColor;
	document.getElementById('id_'+currentRow+'_4').style.backgroundColor=newColor;
	//document.getElementById(currentRow+'_5').style.backgroundColor=newColor;
}
function repositionFinder(ffTop, results_bannerTop){
	document.getElementById('ff').style.left=((document.body.scrollWidth/2)-(950/2));
	document.getElementById('ff').style.top=ffTop;
	document.getElementById('ff').style.visibility='visible';
	document.getElementById('results_banner').style.left=((document.body.scrollWidth/2)-(950/2)+210);
	document.getElementById('results_banner').style.top=results_bannerTop;
	document.getElementById('results_banner').style.visibility='visible';
}
function doListFav(obj, favId){
	if (obj.src.indexOf('images/addToMyList.png')!=-1){
		setListFavs(document.avail.addFavs, document.avail.removeFavs, favId);
		obj.src='images/removeFromMyList.png';
		obj.alt='Click To Remove From My List';
	}else{
		setListFavs(document.avail.removeFavs, document.avail.addFavs, favId);
		obj.src='images/addToMyList.png';
		obj.alt='Click To Add To My List';
	}
	if (document.avail.update_mylist!=null){
		document.avail.update_mylist.style.background='#FF0000';
	}else{
		document.avail.submit();
	}
}
function setListFavs(listObj, listObjCheck, favId){
	//Check to see if its on the add list
	var found=false;
	for (var i=0;i<listObjCheck.length&&!found;i++) {
		if (listObjCheck[i].value==favId) {
			listObjCheck.remove(i);
			found=true;
		}
	}
	if (!found){
		var elOptNew = document.createElement('option');
		elOptNew.text = favId;
		elOptNew.value = favId;
		elOptNew.selected='true';
		try {
			listObj.add(elOptNew, null); // standards compliant; doesn't work in IE
		}catch(ex) {
			listObj.add(elOptNew); // IE only
		}
	}
}  
function doOnlyLastMinute(lastMinuteOnly){
	if (!lastMinuteOnly){
		document.avail.lastMinuteOnly.value='0';
		document.avail.lastMinuteCheckBox.checked=lastMinuteOnly;
	}else{
		document.avail.lastMinuteOnly.value='1';
		document.avail.lastMinuteCheckBox.checked=lastMinuteOnly;
	}
	document.avail.currentPage.value='0';
	document.avail.submit();
}
function doOnlyPromotions(promotionsOnly){
	if (!promotionsOnly){
		document.avail.promotionsOnly.value='0';
		document.avail.promotionsCheckBox.checked=promotionsOnly;
	}else{
		document.avail.promotionsOnly.value='1';
		document.avail.promotionsCheckBox.checked=promotionsOnly;
	}
	document.avail.currentPage.value='0';
	document.avail.submit();
}
function doShowSimilarAndFind(id, count){
	document.avail.showSimilar.value='1';
	var resultsPerPage=document.avail.resultsPerPage.value;
	document.avail.currentPage.value=Math.floor(count/resultsPerPage);
	document.avail.action=document.avail.action+"#"+id;
	document.avail.submit();
}
function doShowSimilar(showSimilarParam){
	if (!showSimilarParam){
		document.avail.showSimilar.value='0';
		document.avail.showSimilarCheckBox.checked=showSimilarParam;
	}else{
		document.avail.showSimilar.value='1';
		document.avail.showSimilarCheckBox.checked=showSimilarParam;
	}
	document.avail.currentPage.value='0';
	document.avail.submit();
}
function doOnlyFavs(onlyFavsParam){
	if (!onlyFavsParam){
		document.avail.onlyFavs.value='false';
		document.avail.onlyFavsCheckBox.checked=onlyFavsParam;
	}else{
		document.avail.onlyFavs.value='true';
		document.avail.onlyFavsCheckBox.checked=onlyFavsParam;
	}
	document.avail.currentPage.value='0';
	document.avail.submit();
}
function doOnlyLuxury(onlyLuxury){
	if (!onlyLuxury){
		document.avail.rating.value='0';
		document.avail.ratingCheckBox.checked=onlyLuxury;
	}else{
		document.avail.rating.value='3';
		document.avail.ratingCheckBox.checked=onlyLuxury;
	}
	document.avail.currentPage.value='0';
	document.avail.submit();
}
function doOnlyHotDeals(hotDealsOnly){
	if (!hotDealsOnly){
		document.avail.hotDealsOnly.value='0';
		document.avail.hotdealsCheckBox.checked=hotDealsOnly;
	}else{
		document.avail.hotDealsOnly.value='1';
		document.avail.hotdealsCheckBox.checked=hotDealsOnly;
	}
	document.avail.currentPage.value='0';
	document.avail.submit();
}
function doOnlyFeaturesToShow(onlyFeaturesToShow, featuresToShow){
	if (featuresToShow){
		if (!onlyFeaturesToShow){
			document.avail.showFeatures.value='0';
			document.avail.featuresToShowCheckBox.checked=onlyFeaturesToShow;
		}else{
			document.avail.showFeatures.value='1';
			document.avail.featuresToShowCheckBox.checked=onlyFeaturesToShow;
		}
		document.avail.currentPage.value='0';
		document.avail.submit();
	}else{
		alert("Select apartment features in the side bar on the left to Refine Your Search");
	}
}
