
try{document.execCommand("BackgroundImageCache",false,true);}catch(err){}
var isopera=0;var issafari=0;var isexploder=0;var isexplodersix=0;if(navigator.userAgent.toLowerCase().indexOf("safari")>0)issafari=1;if(navigator.userAgent.toLowerCase().indexOf("msie")>0)isexploder=1;if(navigator.userAgent.toLowerCase().indexOf("msie 6")>0)isexplodersix=1;if(navigator.userAgent.toLowerCase().indexOf("pera")>0)isopera=1;function replaceHtml(el,html){var oldEl=(typeof el==="string"?document.getElementById(el):el);if(isexploder){oldEl.innerHTML=html;return oldEl;}
var newEl=oldEl.cloneNode(false);newEl.innerHTML=html;oldEl.parentNode.replaceChild(newEl,oldEl);return newEl;};function disableEnterKey(e)
{var key;if(window.event)
key=window.event.keyCode;else
key=e.which;if(key==13)
return false;else
return true;}
function captureReturns(e){var key;if(window.event)
key=window.event.keyCode;else
key=e.which;if(key==13)
return false;else
return true;}
var locationHold=false;var signupAfterAutocomplete=function(input,locationli)
{if(locationli.lastChild.value=='NONE'){input.value='';return true;}
input.value=locationli.lastChild.value;$('destinationlocationid').value=locationli.lastChild.id.replace(/locln/,'');if($('locbuffer')){$('locbuffer').style.display='none';}
if($('hotelname')){$('hotelname').disabled=false;$('hotelname').value='Enter your hotel here';if($('hotelname_default')){$('hotelname_default').value='Enter your hotel here';}}
locationHold=true;}
var countryAutocomplete=function(input,locationli)
{try{if(locationli.lastChild.value=='NONE'){input.value='';return true;}
input.value=locationli.lastChild.value;$('countryId').value=locationli.lastChild.id.replace(/countryln/,'');if($('countrybuffer')){$('countrybuffer').style.display='none';}}catch(e){}}
function resetHotelName(){if($('hotelname')){$('hotelname').disabled=true;$('hotelname').value='Enter destination first';if($('hotelname_default')){$('hotelname_default').value='Enter destination first';}}}
function enableHotelName(){$('hotelname').disabled=false;if($('hotelname').value==$('hotelname_default').value){$('hotelname').value='Enter your hotel here';}
if($('hotelname_default')){$('hotelname_default').value='Enter your hotel here';}}
var signupAfterAutocompleteHotel=function(input,locationli)
{try{if(locationli.lastChild.value=='NONE'){input.value='';return true;}
input.value=locationli.lastChild.value;$('hotelId').value=locationli.lastChild.id.replace(/hotelln/,'');if($('hotelbuffer')){$('hotelbuffer').style.display='none';}
$('mainsearchtype').value='hotel';}catch(e){}}
function getIframeDocument(iframeNode){var doc=iframeNode.contentDocument||((iframeNode.contentWindow)&&(iframeNode.contentWindow.document))||((iframeNode.name)&&(document.frames[iframeNode.name])&&(document.frames[iframeNode.name].document))||null;return doc;}
function hideselects(divs){if(divs&&divs.length){selects=divs;}
else{selects=document.body.getElementsByTagName('SELECT');}
numsels=selects.length;for(a=0;a<numsels;a++){selectObj=$(selects[a]);if(selectObj){if(selectObj.className!='replaced'){selectObj.style.visibility="hidden";}}}}
function showselects(divs){if(divs&&divs.length){selects=divs;}
else{selects=document.body.getElementsByTagName('SELECT');}
numsels=selects.length;for(a=0;a<numsels;a++){selectObj=$(selects[a]);if(selectObj.className!='replaced'){selectObj.style.visibility="visible";}}}
function contactus(){new Ajax.Updater('messages','contactsubmit',{asynchronous:true,evalScripts:true,postBody:Form.serialize('contactusform')});}
function setparentloc(input,locationli){if(locationli.lastChild.value=='NONE'){input.value='';return true;}
input.value=locationli.lastChild.value;$('destinationlocationid').value=locationli.lastChild.id.replace(/locln/,'');try{hotelautocomp.url="hotelautocomplete?location="+$('destinationlocationid').value;}catch(e){}
var winloc=String(window.location).replace(/#.*$/,"")+'str';}
function setparentloca(input,locationli){if(locationli.lastChild.value=='NONE'){input.value='';return true;}
input.value=locationli.lastChild.value;$('destinationlocationid').value=locationli.lastChild.id.replace(/locln/,'');try{hotelautocomp.url="adminhotelautocomplete?location="+$('destinationlocationid').value;}catch(e){}}
function setparentcountry(input,locationli){if(locationli.lastChild.value=='NONE'){input.value='';return true;}
input.value=locationli.lastChild.value;$('countryid').value=locationli.lastChild.id.replace(/countryln/,'');try{locautocomp.url="locationautocomplete?location="+$('countryid').value;}catch(e){}}
function setparentcity(input,locationli){if(locationli.lastChild.value=='NONE'){input.value='';return true;}
input.value=locationli.lastChild.value;$('cityid').value=locationli.lastChild.id.replace(/locln/,'');}
function setparenthot(input,hotelli){input.value=hotelli.lastChild.value;if(hotelli.lastChild.id.match('NONE')){$('hotellocationid').value='';return true;}
$('hotellocationid').value=hotelli.lastChild.id.replace(/hotelln/,'');}
handleFieldFocus=function(fieldname){if(typeof fieldname!='string'){fieldname=this.id;}
$(fieldname).style.color='#4f4f4f';if($(fieldname).value==$F(fieldname+'_default')){$(fieldname).value='';}}
handleFieldBlur=function(fieldname){if(typeof fieldname!='string'){fieldname=this.id;}
if($(fieldname).value==''||($(fieldname+'_default')&&$(fieldname).value==$F(fieldname+'_default'))){if($(fieldname+'_default')){$(fieldname).value=$F(fieldname+'_default');}
$(fieldname).style.color='#a8a8a8';}else{$(fieldname).style.color='#4f4f4f';}}
handleDestinationFocus=function(){handleFieldFocus('destination');closeallcals();}
handleDestinationBlur=function(){handleFieldBlur('destination');if($('destination').value==''||$('destination').value==$F('destination_default')){$('destinationlocationid').value='';if($('hotelname')){resetHotelName();}}}
function toggle_element_display(element){if($(element).style.display=='none'){$(element).style.display='block';}else{$(element).style.display='none';}}
function toggle_class_name(element,compareClassName,stickyAction){var currentCSSClasses=$(element).classNames();var classFound=false;currentCSSClasses.each(function(s){if(s==compareClassName){if(stickyAction!='add'){$(element).removeClassName(s);}
classFound=true;}});if(!classFound){if(stickyAction!='remove'){$(element).addClassName(compareClassName);}}}
function getElementLeft(elem)
{xPos=eval(elem).offsetLeft;tempEl=eval(elem).offsetParent;while(tempEl!=null){xPos+=tempEl.offsetLeft;tempEl=tempEl.offsetParent;}
return xPos;}
function getElementTop(elem){yPos=eval(elem).offsetTop;tempEl=eval(elem).offsetParent;while(tempEl!=null){yPos+=tempEl.offsetTop;tempEl=tempEl.offsetParent;}
return yPos;}
img=new Image();imgarr=new Array('/images/dialog/arrow-left.png','/images/dialog/arrow-right.png','/images/dialog/bottom-left.png','/images/dialog/bottom-right.png','/images/dialog/bottom.png','/images/dialog/left.png','/images/dialog/right.png','/images/dialog/top-left.png','/images/dialog/top-right.png','/images/dialog/top.png');for(i=0;i<imgarr.length;i++){img.src=imgarr[i];}
var Dialog={};Dialog.Box=Class.create();Object.extend(Dialog.Box.prototype,{initialize:function(triggerel,contentsid,dwidth,dheight,hideSelects,dialogid,arrowpos,dialogtitle){this.dpadding=40;this.dborders=22;this.darrowwidth=27;this.dwidth=dwidth;this.dheight=dheight;this.dfullwidth=dwidth+this.dpadding+this.dborders+this.darrowwidth;this.dfullheight=dheight+this.dpadding+this.dborders;this.dialogid=dialogid;this.arrowpos=arrowpos;this.dialogtitle=dialogtitle;this.contentsid=contentsid;if(this.arrowpos=='left'){this.dleft=(getElementLeft(triggerel)+$(triggerel).getWidth())+10;}
else if(this.arrowpos=='right'){this.dleft=(getElementLeft(triggerel)-this.dfullwidth)-10;}
this.dtop=(getElementTop(triggerel)-78)+(triggerel.getHeight()/2);this.createOverlay();this.createDialog();this.dialog_box=$(dialogid);this.hideSelects=hideSelects;this.parent_element=this.dialog_box.parentNode;this.dialog_box.style.position="absolute";this.dialog_box.style.left=this.dleft+'px';this.dialog_box.style.top=this.dtop+'px';this.dialog_box.style.zIndex=this.overlay.style.zIndex+1;},createOverlay:function(){if($('dialog_overlay')){this.overlay=$('dialog_overlay');}else{this.overlay=document.createElement('div');this.overlay.id='dialog_overlay';$(this.overlay).setOpacity(0.25);Object.extend(this.overlay.style,{position:'absolute',top:0,left:0,zIndex:100000,width:'100%',backgroundColor:'#000',display:'none'});$(document.body).insert(this.overlay);}},createDialog:function(){if(!$(this.dialogid))
{var div_dialog=new Element('div',{id:this.dialogid,style:'display:none;width:'+this.dfullwidth+'px;height:'+this.dfullheight+'px;'}).addClassName('modal-dialog');$(document.body).insert(div_dialog);if(this.arrowpos=='left'){var div_arrow_left=new Element('div').addClassName('dialog-arrow-left');div_dialog.insert(div_arrow_left);}
var div_container=new Element('div').addClassName('dialog-container');div_dialog.insert(div_container);var div_topleft=new Element('div').addClassName('dialog-top-left');div_container.insert(div_topleft);var div_top=new Element('div',{'style':'width:'+(this.dwidth+this.dpadding)+'px'}).addClassName('dialog-top');div_container.insert(div_top);var div_topright=new Element('div').addClassName('dialog-top-right');div_container.insert(div_topright);var div_left=new Element('div',{'style':'height:'+(this.dheight+this.dpadding)+'px'}).addClassName('dialog-left');div_container.insert(div_left);var div_content=new Element('div',{id:this.dialogid+'-content','style':'width:'+this.dwidth+'px;height:'+this.dheight+'px;'}).addClassName('dialog-content');div_container.insert(div_content);var div_right=new Element('div',{'style':'height:'+(this.dheight+this.dpadding)+'px'}).addClassName('dialog-right');div_container.insert(div_right);var div_bottomleft=new Element('div').addClassName('dialog-bottom-left');div_container.insert(div_bottomleft);var div_bottom=new Element('div',{'style':'width:'+(this.dwidth+this.dpadding)+'px'}).addClassName('dialog-bottom');div_container.insert(div_bottom);var div_bottomright=new Element('div').addClassName('dialog-bottom-right');div_container.insert(div_bottomright);var div_clear=new Element('div').addClassName('clear');div_container.insert(div_clear);if(this.arrowpos=='right'){var div_arrow_right=new Element('div').addClassName('dialog-arrow-right');div_dialog.insert(div_arrow_right);}
var div_clear=new Element('div').addClassName('clear');div_dialog.insert(div_clear);var div_titlebar=new Element('div').addClassName('dialog-title');div_content.insert(div_titlebar);var div_title_left=new Element('div').update(this.dialogtitle).addClassName('dialog-title-floatleft');div_titlebar.insert(div_title_left);var div_title_right=new Element('div').addClassName('dialog-title-floatright');div_titlebar.insert(div_title_right);var div_clear=new Element('div').addClassName('clear');div_titlebar.insert(div_clear);var a_close=new Element('a',{href:'#'}).update('Cancel and close');div_title_right.insert(a_close);a_close.observe('click',function(e){e.stop();this.hide();}.bind(this));div_content.insert($(this.contentsid));$(this.contentsid).setStyle({display:'block'});}},show:function(){this.overlay.style.height=this.winHeight()+'px';this.selectBoxes('hide');this.overlay.show();if(Prototype.Browser.IE){this.dialog_box.show();}
else{new Effect.Appear(this.dialog_box,{duration:0.3,from:0.0,to:1});}
this.dialog_box.style.left=this.dleft+'px';},hide:function(){this.selectBoxes('show');this.overlay.hide();this.dialog_box.style.display='none';},fade:function(){this.dialog_box.fade({duration:1.0});this.selectBoxes.delay(1.2,'show');this.overlay.hide();},selectBoxes:function(what){if(this.hideSelects)
{$A(document.getElementsByTagName('select')).each(function(select){Element[what](select);});if(what=='hide')
$A(this.dialog_box.getElementsByTagName('select')).each(function(select){Element.show(select)})}},winWidth:function(){return document.body.offsetWidth||window.innerWidth||document.documentElement.clientWidth||0;},winHeight:function(){return document.body.offsetHeight||window.innerHeight||document.documentElement.clientHeight||0;}});