/*slideHotel.js jquery.form.js httprequest.js checkform.js ticketsFunctions.js ascript.js*/
var formXmlHTTP=new HttpRequest(window);var domen=window.location.host;var pc;pc=window.location.pathname;$(document).ready(function(){$("#full_info").click(function()
{$("#full_info").fadeOut("slow");formXmlHTTP.setMethodRequest('GET');formXmlHTTP.setEndPoint(domen+'/showPropertyHotel.php');formXmlHTTP.load('typeH='+$(this).attr("title")+'&pc='+pc,false);formXmlHTTP.getResponse();var xmlList=formXmlHTTP.getText();$("#main_hotel_content").html(xmlList);$("#main_hotel_content").animate({opacity:"show"},"slow");return false;});$("#get_more_images").click(function()
{$("#get_more_images").fadeOut("slow");formXmlHTTP.setMethodRequest('GET');formXmlHTTP.setEndPoint(domen+'/showImageBlock.php');formXmlHTTP.load('typeH='+$(this).attr("title")+'&pc='+pc,false);formXmlHTTP.getResponse();var xmlList=formXmlHTTP.getText();$("#more_images_content").html(xmlList);$("#more_images_content").animate({opacity:"show"},"slow");return false;});});(function($){$.fn.ajaxSubmit=function(options){if(typeof options=='function')
options={success:options};options=$.extend({url:this.attr('action')||window.location.toString(),type:this.attr('method')||'GET'},options||{});var veto={};this.trigger('form-pre-serialize',[this,options,veto]);if(veto.veto)return this;var a=this.formToArray(options.semantic);if(options.data){for(var n in options.data)
a.push({name:n,value:options.data[n]});}
if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false)return this;this.trigger('form-submit-validate',[a,this,options,veto]);if(veto.veto)return this;var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null;}
else
options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm();});if(options.clearForm)callbacks.push(function(){$form.clearForm();});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){$(options.target).html(data).each(oldSuccess,arguments);});}
else if(options.success)
callbacks.push(options.success);options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++)
callbacks[i](data,status,$form);};var files=$('input:file',this).fieldValue();var found=false;for(var j=0;j<files.length;j++)
if(files[j])
found=true;if(options.iframe||found){if($.browser.safari&&options.closeKeepAlive)
$.get(options.closeKeepAlive,fileUpload);else
fileUpload();}
else
$.ajax(options);this.trigger('form-submit-notify',[this,options]);return this;function fileUpload(){var form=$form[0];var opts=$.extend({},$.ajaxSettings,options);var id='jqFormIO'+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" />');var io=$io[0];var op8=$.browser.opera&&window.opera.version()<9;if($.browser.msie||op8)io.src='javascript:false;document.write("");';$io.css({position:'absolute',top:'-1000px',left:'-1000px'});var xhr={responseText:null,responseXML:null,status:0,statusText:'n/a',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){}};var g=opts.global;if(g&&!$.active++)$.event.trigger("ajaxStart");if(g)$.event.trigger("ajaxSend",[xhr,opts]);var cbInvoked=0;var timedOut=0;setTimeout(function(){var encAttr=form.encoding?'encoding':'enctype';var t=$form.attr('target'),a=$form.attr('action');$form.attr({target:id,method:'POST',action:opts.url});form[encAttr]='multipart/form-data';if(opts.timeout)
setTimeout(function(){timedOut=true;cb();},opts.timeout);$io.appendTo('body');io.attachEvent?io.attachEvent('onload',cb):io.addEventListener('load',cb,false);form.submit();$form.attr({action:a,target:t});},10);function cb(){if(cbInvoked++)return;io.detachEvent?io.detachEvent('onload',cb):io.removeEventListener('load',cb,false);var ok=true;try{if(timedOut)throw'timeout';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={'content-type':opts.dataType};return headers[header];};if(opts.dataType=='json'||opts.dataType=='script'){var ta=doc.getElementsByTagName('textarea')[0];xhr.responseText=ta?ta.value:xhr.responseText;}
else if(opts.dataType=='xml'&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText);}
data=$.httpData(xhr,opts.dataType);}
catch(e){ok=false;$.handleError(opts,xhr,'error',e);}
if(ok){opts.success(data,'success');if(g)$.event.trigger("ajaxSuccess",[xhr,opts]);}
if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g&&!--$.active)$.event.trigger("ajaxStop");if(opts.complete)opts.complete(xhr,ok?'success':'error');setTimeout(function(){$io.remove();xhr.responseXML=null;},100);};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(s);}
else
doc=(new DOMParser()).parseFromString(s,'text/xml');return(doc&&doc.documentElement&&doc.documentElement.tagName!='parsererror')?doc:null;};};};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind('submit.form-plugin',function(){$(this).ajaxSubmit(options);return false;}).each(function(){$(":submit,input:image",this).bind('click.form-plugin',function(e){var $form=this.form;$form.clk=this;if(this.type=='image'){if(e.offsetX!=undefined){$form.clk_x=e.offsetX;$form.clk_y=e.offsetY;}else if(typeof $.fn.offset=='function'){var offset=$(this).offset();$form.clk_x=e.pageX-offset.left;$form.clk_y=e.pageY-offset.top;}else{$form.clk_x=e.pageX-this.offsetLeft;$form.clk_y=e.pageY-this.offsetTop;}}
setTimeout(function(){$form.clk=$form.clk_x=$form.clk_y=null;},10);});});};$.fn.ajaxFormUnbind=function(){this.unbind('submit.form-plugin');return this.each(function(){$(":submit,input:image",this).unbind('click.form-plugin');});};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el)
a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});continue;}
var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)
a.push({name:n,value:v[j]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:n,value:v});}
if(!semantic&&form.clk){var inputs=form.getElementsByTagName("input");for(var i=0,max=inputs.length;i<max;i++){var input=inputs[i];var n=input.name;if(n&&!input.disabled&&input.type=="image"&&form.clk==input)
a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}}
return a;};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic));};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n)return;var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++)
a.push({name:n,value:v[i]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:this.name,value:v});});return $.param(a);};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))
continue;v.constructor==Array?$.merge(val,v):val.push(v);}
return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=$.browser.msie&&!(op.attributes['value'].specified)?op.text:op.value;if(one)return v;a.push(v);}}
return a;}
return el.value;};$.fn.clearForm=function(){return this.each(function(){$('input,select,textarea',this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=='text'||t=='password'||tag=='textarea')
this.value='';else if(t=='checkbox'||t=='radio')
this.checked=false;else if(tag=='select')
this.selectedIndex=-1;});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType))
this.reset();});};$.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b});};$.fn.select=function(select){if(select==undefined)select=true;return this.each(function(){var t=this.type;if(t=='checkbox'||t=='radio')
this.checked=select;else if(this.tagName.toLowerCase()=='option'){var $sel=$(this).parent('select');if(select&&$sel[0]&&$sel[0].type=='select-one'){$sel.find('option').select(false);}
this.selected=select;}});};})(jQuery);var reqParent=null;var req;function HttpRequest(window)
{this.responseText="empty";this.responseXML="";this.method="POST";this.endpoint=null;this.init=function InitHttpRequest()
{if(window.XMLHttpRequest)
req=new XMLHttpRequest();else
{var XmlHttpVersion=new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");for(var i_xml=0;i_xml<XmlHttpVersion.length;i_xml++)
{try
{req=new ActiveXObject(XmlHttpVersion[i_xml])}
catch(e)
{}}}
if(!req)
{alert('Cannot create XMLHTTP instance');return false;}
reqParent=this;req.onreadystatechange=processResponse;}
this.loadAsync=function LoadAsyncHttpRequest(body,callBackFunc)
{this.load(body,true);if(this.responseXML!="")
callBackFunc(this.responseXML);}
this.load=function LoadHttpRequest(body,async)
{this.endpoint=this.endpoint.replace('http://www.','');this.endpoint=this.endpoint.replace('http://','');if(async==null||async=='undefined')
async=false;if(this.method=="GET")
{try
{req.open(this.method,'http://'+this.endpoint+"?"+body,async);req.send(null);}
catch(e)
{req.open(this.method,'http://www.'+this.endpoint+"?"+body,async);req.send(null);}}
else
{try
{req.open(this.method,'http://'+this.endpoint,async);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; text/xml; charset=utf-8");req.setRequestHeader("Content-length",body.length);req.send(body);}
catch(e)
{req.open(this.method,'http://www.'+this.endpoint,async);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; text/xml; charset=utf-8");req.setRequestHeader("Content-length",body.length);req.send(body);}}
if(!async)this.getResponse();}
this.getResponse=function GetResponseHttpRequest()
{if(req.readyState==4)
if(req.status==200)
{this.responseText=req.responseText;this.responseXML=req.responseXML;req.abort();}}
this.getXML=function GetXMLHttpRequest()
{return this.responseXML;}
this.getText=function GetXMLHttpRequest()
{return this.responseText;}
this.setMethodRequest=function SetMethodRequestHttpRequest(method)
{this.method=method;}
this.setEndPoint=function SetEndPointHttpRequest(endpoint)
{this.endpoint=endpoint;}
this.init();}
function processResponse()
{if(req.readyState==4)
{if(req.status==200)
{reqParent.responseText=req.responseText;reqParent.responseXML=req.responseXML;}
else
reqParent.responseText="Error "+req.status+":"+req.statusText;}}
var statusDataForm=false;var statusAjax=false;var required=new Array();var required_show=new Array();var required_preg=new Array();var required_length=new Array();var cur_lang='en';function get_data_form(name_form)
{formXmlHTTP=new HttpRequest(window);formXmlHTTP.setMethodRequest('GET');formXmlHTTP.setEndPoint('http://www.parishotels-discount.com/forms.php');formXmlHTTP.load('name_form='+name_form,false);formXmlHTTP.getResponse();xmlData=formXmlHTTP.getXML();insert_data_form(xmlData);}
function insert_data_form(xml_data)
{xml_form=xml_data;elArray=xml_form.getElementsByTagName('element');count_element=elArray.length;if(count_element>0)
{for(var el=0;el<count_element;el++)
{current_el=elArray.item(el);nV=current_el.getAttribute('nameVar');nF=current_el.getAttribute('nameField');nP=current_el.getAttribute('preg');nL=current_el.getAttribute('length');required.push(nV);required_show.push(nF);required_preg.push(nP);required_length.push(nL);}
statusDataForm=true;}
else
{statusDataForm=false;}
statusAjax=true;}
function SendForm(form,lang)
{if(lang==null||lang=='undefined')
{cur_lan='en';}
else
{cur_lan=lang;}
if(!statusAjax)
{get_data_form(form.name);}
if(statusDataForm==true)
{var i,j;for(j=0;j<required.length;j++)
{for(i=0;i<form.length;i++)
{if(form.elements[i].name==required[j])
{fieldCheck=new checkField(form.elements[i],required_show[j],cur_lan)
if(fieldCheck.ch_len(required_length[j]))
{if(required_preg[j]=='word')
{if(!fieldCheck.ch_wor())
{form.elements[i].focus();return false;}}
else if(required_preg[j]=='wordAll')
{if(!fieldCheck.ch_wor_a())
{form.elements[i].focus();return false;}}
else if(required_preg[j]=='email')
{if(!fieldCheck.ch_mail())
{form.elements[i].focus();return false;}}
else if(required_preg[j]=='number')
{if(!fieldCheck.ch_num())
{form.elements[i].focus();return false;}}
else
{return false;}}
else
{return false;}}}}
return true;}
else
{return true;}}
function checkField(obj,name_field,lan)
{if(lan==null||lan=='undefined')
{this.curlan='en';}
else
{this.curlan=lan;}
if(obj.type=='textarea')
{this.obj=obj.value;}
if(obj.type=='select-one')
{this.obj=obj.selectedIndex;}
if(obj.type=='text')
{this.obj=obj.value;}
this.curlen=0;this.field=name_field;this.ch_len=check_length;this.ch_wor=check_wor;this.ch_wor_a=check_wor_all;this.ch_num=check_num;this.ch_mail=check_email;this.er_form=false;this.sms_lan=get_sms_lan;}
function get_sms_lan(num_str)
{if(this.curlan=='ru')
{if(num_str==1)
{return'Р’ РїРѕР»Рµ '+this.field+'\n Р”РѕРїСѓСЃС‚РёРјРѕ '+this.curlen+' СЃРёРјРІРѕР»РѕРІ, Сѓ Р’Р°СЃ '+this.obj.length;}
else if(num_str==2)
{return'РќРµРІРµСЂРЅРѕРµ РїРѕР»Рµ '+this.field+'\n Р”РѕРїСѓСЃРєР°СЋС‚СЃСЏ СЃРёРјРІРѕР»С‹: a-z A-Z Рђ-РЇ Р°-СЏ 0-9 РїСЂРѕР±РµР»';}
else if(num_str==3)
{return'РќРµРІРµСЂРЅРѕРµ РїРѕР»Рµ '+this.field+'\n Р”РѕРїСѓСЃРєР°СЋС‚СЃСЏ СЃРёРјРІРѕР»С‹: a-z A-Z Рђ-РЇ Р°-СЏ 0-9 РїСЂРѕР±РµР» . , ! ? : ( ) ;';}
else if(num_str==4)
{return'РќРµРІРµСЂРЅРѕРµ РїРѕР»Рµ '+this.field;}
else if(num_str==5)
{return'РќРµРІРµСЂРЅРѕРµ РїРѕР»Рµ '+this.field+'\n Р”РѕРїСѓСЃРєР°СЋС‚СЃСЏ СЃРёРјРІРѕР»С‹: 0-9';}
else
{return'Error: '+this.field;}}
else
{if(num_str==1)
{return'In field '+this.field+'\n Possible '+this.curlen+'symbols, beside You '+this.obj.length;}
else if(num_str==2)
{return'Invalid field '+this.field+'\n Are Allowed symbols: a-z A-Z But-I but-I 0-9 gaps';}
else if(num_str==3)
{return'The Invalid field '+this.field+'\n Are Allowed the symbols: a-z A-Z But-I but-I 0-9 gaps . , - _! ? : ( )';}
else if(num_str==4)
{return'Invalid field '+this.field;}
else if(num_str==5)
{return'Invalid field '+this.field+'\n Are Allowed symbols: 0-9';}
else
{return'Error: '+this.field;}}}
function check_length(count)
{this.curlen=count;if(this.obj.length>count)
{alert(this.sms_lan(1));return false;}
else
{return true;}}
function check_wor()
{valid_val=this.obj.match(/^[^\u0021-\u002f\u003a-\u0040\u005b-\u0060]+$/);if(valid_val)
{return true;}
else
{alert(this.sms_lan(2));this.er_form=true;return false;}}
function check_wor_all()
{valid_val=this.obj.match(/^[^\u0022-\u0027\u002a-\u002b\u003c-\u003e\u005b-\u0060\u007c-\u007f\u002f\u002d]+$/);if(valid_val)
{return true;}
else
{alert(this.sms_lan(3));this.er_form=true;return false;}}
function check_email()
{valid_val=this.obj.match(/^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}/);if(valid_val)
{return true;}
else
{alert(this.sms_lan(4));this.er_form=true;return false;}}
function check_num()
{valid_val=this.obj.match(/^[0-9]+$/);if(valid_val)
{return true;}
else
{alert(this.sms_lan(5));return false;}}
String.prototype.ellipsisString=function(length){var result=this;if(this.length>length+1){result=result.substring(0,length);result=result.substring(0,result.lastIndexOf(' '));var lastChar=result.charAt(result.length-1);if(lastChar=="."||lastChar==","||lastChar=="-"){if(result.length>1){result=result.substring(0,result.length-1);}}
return result+"...";}else{return this;}
return this+length;}
function slideDate()
{}
function isDate(dateStr){var datePat=/^(\d{4})(\-)(\d{1,2})(\-)(\d{1,2})$/;var matchArray=dateStr.match(datePat);if(matchArray==null){return false;}
year=matchArray[1];month=matchArray[3];day=matchArray[5];if(month<1||month>12){return false;}
if(day<1||day>31){return false;}
if((month==4||month==6||month==9||month==11)&&day==31){return false;}
if(month==2){var isleap=(year%4==0&&(year%100!=0||year%400==0));if(day>29||(day==29&&!isleap)){return false;}}
return true;}
function setupCal(checkin,checkout,checkinId,checkoutId,checkinCalId,checkoutCalId,numOfCal)
{var theMindate=new Date();var min_date=theMindate.getDate();var min_month=theMindate.getMonth();min_month++;var min_year=theMindate.getFullYear();theMindate=min_month+"/"+min_date+"/"+min_year;var theMaxdate=min_month+"/"+min_date+"/"+(min_year+1);var earlyMindate=new Date();earlyMindate.setDate(min_date-1);var early_month=earlyMindate.getMonth();early_month++;earlyMindate=early_month+"/"+earlyMindate.getDate()+"/"+earlyMindate.getFullYear();if(checkin==null||checkout==null)
{checkin=dateFormat(min_month)+"/"+dateFormat(min_date)+"/"+min_year;checkout=checkin;}
var checkinSelection=document.getElementById(checkinId).value==0?checkout:reFormatDate(document.getElementById(checkinId).value);var checkoutSelection=document.getElementById(checkoutId).value==0?checkout:reFormatDate(document.getElementById(checkoutId).value);var checkinCalPage=checkin.substr(0,2)+checkin.substr(5,5);var checkoutCalPage=checkout.substr(0,2)+checkout.substr(5,5);var checkinCal=new YAHOO.widget.CalendarGroup("checkinCal",checkinCalId,{pages:numOfCal,mindate:earlyMindate,maxdate:theMaxdate,navigator:true});checkinCal.cfg.setProperty("pagedate",checkinCalPage,false);checkinCal.cfg.setProperty("selected",checkinSelection+", "+checkoutSelection,false);checkinCal.cfg.setProperty("MONTHS_LONG",monthsLong);checkinCal.cfg.setProperty("WEEKDAYS_SHORT",weekdaysShort);checkinCal.cfg.setProperty("MY_LABEL_YEAR_POSITION",myLabelYearPosition);checkinCal.cfg.setProperty("MY_LABEL_MONTH_POSITION",myLabelMonthPosition);checkinCal.cfg.setProperty("MY_LABEL_YEAR_SUFFIX",myLabelYearSuffix);checkinCal.cfg.setProperty("MY_LABEL_MONTH_SUFFIX",myLabelMonthSuffix);checkinCal.render();var checkinShow=document.getElementById(checkinId);YAHOO.util.Event.addListener(checkinShow,"click",checkinCal.show,checkinCal,true);checkinCal.selectEvent.subscribe(checkinHandleSelect,checkinCal,true);checkinCal.hide();function checkinHandleSelect(type,args,obj){var dates=args[0];var date=dates[0];var year=date[0],month=dateFormat(date[1]),day=dateFormat(date[2]);var checkinDate=year+"-"+month+"-"+day;checkinSelection=month+"/"+day+"/"+year;document.getElementById(checkinId).value=checkinDate;document.getElementById("checkinValue").value=checkinDate;document.getElementById("checkoutValue").value=document.getElementById(checkoutId).value;checkinCal.hide();checkinCalPage=date[1]+"/"+year;checkoutCal.cfg.setProperty("pagedate",checkinCalPage,false);if(document.getElementById(checkoutId).value!=0)
{checkoutSelection=reFormatDate(document.getElementById(checkoutId).value);}
checkinCal.cfg.setProperty("selected",checkinSelection+", "+checkoutSelection,false);checkoutCal.cfg.setProperty("selected",checkinSelection+", "+checkoutSelection,false);checkinCal.render();checkoutCal.render();}
var checkoutCal=new YAHOO.widget.CalendarGroup("checkoutCal",checkoutCalId,{pages:numOfCal,mindate:theMindate,maxdate:theMaxdate,navigator:true});checkoutCal.cfg.setProperty("pagedate",checkoutCalPage,false);checkoutCal.cfg.setProperty("selected",checkinSelection+", "+checkoutSelection,false);checkoutCal.cfg.setProperty("MONTHS_LONG",monthsLong);checkoutCal.cfg.setProperty("WEEKDAYS_SHORT",weekdaysShort);checkoutCal.cfg.setProperty("MY_LABEL_YEAR_POSITION",myLabelYearPosition);checkoutCal.cfg.setProperty("MY_LABEL_MONTH_POSITION",myLabelMonthPosition);checkoutCal.cfg.setProperty("MY_LABEL_YEAR_SUFFIX",myLabelYearSuffix);checkoutCal.cfg.setProperty("MY_LABEL_MONTH_SUFFIX",myLabelMonthSuffix);checkoutCal.render();var checkoutShow=document.getElementById(checkoutId);YAHOO.util.Event.addListener(checkoutShow,"click",checkoutCal.show,checkoutCal,true);checkoutCal.selectEvent.subscribe(checkoutHandleSelect,checkoutCal,true);checkoutCal.hide();function checkoutHandleSelect(type,args,obj){var dates=args[0];var date=dates[0];var year=date[0],month=dateFormat(date[1]),day=dateFormat(date[2]);var checkoutDate=year+"-"+month+"-"+day;checkoutSelection=month+"/"+day+"/"+year;document.getElementById(checkoutId).value=checkoutDate;document.getElementById("checkinValue").value=document.getElementById(checkinId).value;document.getElementById("checkoutValue").value=checkoutDate;if(document.getElementById(checkinId).value!=0)
{checkinSelection=reFormatDate(document.getElementById(checkinId).value);}
checkinCal.cfg.setProperty("selected",checkinSelection+", "+checkoutSelection,false);checkoutCal.cfg.setProperty("selected",checkinSelection+", "+checkoutSelection,false);checkinCal.render();checkoutCal.render();checkoutCal.hide();}
function hideDiv(e){var target=(e?e.target:event.srcElement);var checkinCalDiv=document.getElementById(checkinCalId);var checkinDiv=document.getElementById(checkinId);var checkoutCalDiv=document.getElementById(checkoutCalId);var checkoutDiv=document.getElementById(checkoutId);if(checkinCalDiv!=null&&checkinDiv!=null&&checkoutCalDiv!=null&&checkoutDiv!=null)
{(isChild(target,checkinCalDiv)||target==checkinDiv)?null:checkinCalDiv.style.display='none';(isChild(target,checkoutCalDiv)||target==checkoutDiv)?null:checkoutCalDiv.style.display='none';}
if(document.getElementById("detailTabCheckin")!=null||document.getElementById("rateTabCheckin")!=null)
{hideHotelDiv(e)
hideRateDiv(e)}}
document.onclick=hideDiv}
function reFormatDate(date)
{var year=date.substr(0,4);var month=date.substr(5,2);var day=date.substr(8,2);return month+"/"+day+"/"+year;}
function dateFormat(date)
{return date.toString().length==1?"0"+date:date;}
function isChild(child,parent){while(child){if(child==parent)
return true;child=child.parentNode;}
return false;}
function hideHotelDiv(e){var target=(e?e.target:event.srcElement);var checkinCalDiv=document.getElementById("CheckinCalContainer");var checkinDiv=document.getElementById("hotelCheckin");var checkoutCalDiv=document.getElementById("CheckoutCalContainer");var checkoutDiv=document.getElementById("hotelCheckout");if(checkinCalDiv!=null&&checkinDiv!=null&&checkoutCalDiv!=null&&checkoutDiv!=null)
{(isChild(target,checkinCalDiv)||target==checkinDiv)?null:checkinCalDiv.style.display='none';(isChild(target,checkoutCalDiv)||target==checkoutDiv)?null:checkoutCalDiv.style.display='none';}}
function hideRateDiv(e){var target=(e?e.target:event.srcElement);var checkinCalDiv=document.getElementById("rateTabCheckinCalContainer");var checkinDiv=document.getElementById("rateTabCheckin");var checkoutCalDiv=document.getElementById("rateTabCheckoutCalContainer");var checkoutDiv=document.getElementById("rateTabCheckout");if(checkinCalDiv!=null&&checkinDiv!=null&&checkoutCalDiv!=null&&checkoutDiv!=null)
{(isChild(target,checkinCalDiv)||target==checkinDiv)?null:checkinCalDiv.style.display='none';(isChild(target,checkoutCalDiv)||target==checkoutDiv)?null:checkoutCalDiv.style.display='none';}}
function DoSearch(languageCode,target,affiliateId,city,domain,brandId,customData){var redirection;var affiliateParam;var brandParam;var host;if(document.getElementById("defaultCityName")!=null){city=document.getElementById("defaultCityName").value;}
if(document.getElementById('hotelCheckin')!=null)
{if(document.getElementById('hotelCheckin').value==0||document.getElementById('hotelCheckout').value==0||document.getElementById('hotelCheckin').value=='Check-in'||document.getElementById('hotelCheckout').value=='Check-out'||document.getElementById('hotelCheckin').value=='Check in'||document.getElementById('hotelCheckout').value=='Check out')
{alert(typeof(JavaScriptEnterCheckinCheckout)=='undefined'?'Please enter your checkin and checkout date.':JavaScriptEnterCheckinCheckout)
return false}
else
{document.getElementById("checkinValue").value=document.getElementById("hotelCheckin").value;document.getElementById("checkoutValue").value=document.getElementById("hotelCheckout").value;}}
document.getElementById("checkinValue").value=document.getElementById("hotelCheckin").value;document.getElementById("checkoutValue").value=document.getElementById("hotelCheckout").value;if(!ValidateDates()){return false;}
city=escape(city);if(typeof(brandId)=='undefined'||brandId=="0"||brandId=="")
{brandParam='';}
else
{brandParam='&brandId='+brandId;}
if(affiliateId==null||affiliateId=='')
{affiliateParam='';host='';}
else
{affiliateParam='&a_aid='+affiliateId;}
if(typeof(domain)=='undefined'||domain=='')
{host=''}
else
{host='http://'+domain;}
var defaultSort=GetQSVal("sort");if(defaultSort.length>0)
{defaultSort="&sort="+defaultSort;}
if(document.getElementById("selectedFileName").value==null||document.getElementById("selectedFileName").value==""){if(city==null||city.length<3||city.toLowerCase().indexOf(escape('city name'))>=0){alert(typeof(JavaScriptEnterCityName)=='undefined'?'Please enter a city name that is at least 3 characters in length':JavaScriptEnterCityName);return false;}
redirection="/Search.aspx?search="+city+"&checkin="+document.getElementById("checkinValue").value+"&checkout="+document.getElementById("checkoutValue").value+"&languageCode="+languageCode+affiliateParam+brandParam+defaultSort;if(document.getElementById("M_C_SearchResultCity")!=null)
{var currency=document.getElementById("M_C_currencies");redirection+=currency==null?"":"&currencyCode="+currency.options[currency.selectedIndex].id;if(document.getElementById("M_C_LowRate")!=null)
{if(document.getElementById("M_C_LowRate").value!=null&&document.getElementById("M_C_LowRate").value!=0)
{redirection+="&lowRate="+escape(document.getElementById("M_C_LowRate").value);}}
if(document.getElementById("M_C_HighRate")!=null)
{if(document.getElementById("M_C_HighRate").value!=null&&document.getElementById("M_C_HighRate").value!=0)
{redirection+="&highRate="+escape(document.getElementById("M_C_HighRate").value);}}
redirection+=GetStarValue(redirection,document.getElementById("M_C_Star5"),"star5");redirection+=GetStarValue(redirection,document.getElementById("M_C_Star4"),"star4");redirection+=GetStarValue(redirection,document.getElementById("M_C_Star3"),"star3");redirection+=GetStarValue(redirection,document.getElementById("M_C_Star2"),"star2");redirection+=GetStarValue(redirection,document.getElementById("M_C_Star1"),"star1");redirection+="&cityName="+city;if(document.getElementById("M_C_HotelName")!=null)
{if(document.getElementById("M_C_HotelName").value!=null&&document.getElementById("M_C_HotelName").value!=0)
{redirection+="&hotelName="+escape(document.getElementById("M_C_HotelName").value);}}
if(document.getElementById("M_C_ShowSoldOut")!=null){redirection+=document.getElementById("M_C_ShowSoldOut").checked?"":"&showSoldOut=false";}
if(document.getElementById("M_C_ShowOnRequest")!=null){redirection+=document.getElementById("M_C_ShowOnRequest").checked?"":"&showOnRequest=false";}}}else{redirection="/SearchResults.aspx?fileName="+document.getElementById("selectedFileName").value+"&checkin="+document.getElementById("checkinValue").value+"&checkout="+document.getElementById("checkoutValue").value+"&languageCode="+languageCode+affiliateParam+brandParam+defaultSort;}
redirection+=document.getElementById("guestValue")==null?"":"&Adults="+document.getElementById("guestValue").value;redirection+=document.getElementById("roomValue")==null?"":"&Rooms="+document.getElementById("roomValue").value;redirection+=document.getElementById("searchCountryCode")==null?"":"&countryCode="+document.getElementById("searchCountryCode").value;redirection+=document.getElementById("searchStateCode")==null?"":"&stateCode="+document.getElementById("searchStateCode").value;if(document.getElementById("M_C_HotelFacility1")!=null){var facility="";for(var i=1;i<=11;i++){if(document.getElementById("M_C_HotelFacility"+i).checked){facility+=i+',';}}
if(facility!=""){var strLen=facility.length;facility=facility.slice(0,strLen-1);redirection+="&facilities="+facility;}}
if(customData!=""){if(customData.indexOf("label=")>=0){customData=customData.replace("?label=","&label=");}
else{customData="&label="+customData;}}
redirection=host+redirection+customData;switch(target)
{case"_blank":window.open(redirection).focus();break;case"_parent":window.parent.location=redirection;break;case"_top":window.top.location=redirection;break;default:window.location=redirection;}
return false;}
function DoHotelSearch(languageCode,target,affiliateId,hotelFileName,domain,brandId,customData){var affiliateParam;var host;var brandParam;if(document.getElementById('hotelCheckin')!=null)
{if(document.getElementById('hotelCheckin').value==0||document.getElementById('hotelCheckout').value==0)
{alert(typeof(JavaScriptEnterCheckinCheckout)=='undefined'?'Please enter your checkin and checkout date.':JavaScriptEnterCheckinCheckout)
return false}
else
{document.getElementById("checkinValue").value=document.getElementById("hotelCheckin").value;document.getElementById("checkoutValue").value=document.getElementById("hotelCheckout").value;}}
if(typeof(brandId)=='undefined'||brandId=="0"||brandId=="")
{brandParam='';}
else
{brandParam='&brandId='+brandId}
if(customData!=""){customData="&label="+customData;}
if(affiliateId==null||affiliateId=='')
{affiliateParam='';host='';}
else
{affiliateParam='&a_aid='+affiliateId;}
if(typeof(domain)=='undefined'||domain==''){host=''}
else{host='http://'+domain;}
var guest=document.getElementById('guestValue')==null?"":"&Adults="+document.getElementById("guestValue").value;var room=document.getElementById('roomValue')==null?"":"&Rooms="+document.getElementById('roomValue').value;var redirection=host+"/Hotel.aspx?tabId=Rates&fileName="+hotelFileName+"&checkin="+document.getElementById("checkinValue").value+"&checkout="+document.getElementById("checkoutValue").value+"&languageCode="+languageCode+affiliateParam+brandParam+guest+room+customData;switch(target)
{case"_blank":window.open(redirection).focus();break;case"_parent":window.parent.location=redirection;break;case"_top":window.top.location=redirection;break;default:window.location=redirection;}
return false;}
function GetStarValue(qString,starElement,starName)
{if(starElement==null||starElement.checked)
{return"";}else
{return"&"+starName+"=false";}}
function ValidateDates(){var inDate=getDate(document.getElementById("checkinValue").value);var outDate=getDate(document.getElementById("checkoutValue").value);var currentDate=new Date();if((outDate-inDate)/86400000>=31){alert(typeof(JavaScriptPeriodOfStay)=='undefined'?'Your period of stay should be no longer than 30 nights.':JavaScriptPeriodOfStay)
return false}
if(outDate-inDate<=0){alert(typeof(JavaScriptEnsureCheckoutAfterCheckin)=='undefined'?'Please ensure that the check-out date is after the check-in date.':JavaScriptEnsureCheckoutAfterCheckin)
return false}
if((outDate-currentDate)/86400000>=363){alert(typeof(JavaScriptBookWithinOneYear)=='undefined'?'You cannot book more than 1 year in advance.':JavaScriptBookWithinOneYear)
return false;}
return true}
function getDate(dateString){var year=dateString.substr(0,4)
var month=dateString.substr(5,2)-1
var day=dateString.substr(8,2)
return new Date(year,month,day)}
function GetQSVal(qsName){try
{var qsPair
var i
var qString=location.search.substr(1)
if(qString==null||qString.length==0)
qString=query;var arrNameVal=qString.split('&')
for(i=0;i<arrNameVal.length;i++){qsPair=arrNameVal[i].split('=')
if(URLDecode(qsPair[0]).toLowerCase()==qsName.toLowerCase())return URLDecode(qsPair[1])}}
catch(e)
{}
return""}
function setRoomValue(select,isAffiliate)
{if(select.value=="5"&&isAffiliate==false)
{select.selectedIndex=0;var r=confirm(typeof(JavaScriptSearchMoreRoom)=='undefined'?'We only support searching for up to four rooms at once, would you like to use our partner site Hotelplanner.com to search for more rooms?':JavaScriptSearchMoreRoom);if(r==true)
{var qString="?sc=HotelsCombined";city="",checkin="",checkout="";if(document.getElementById("M_C_SearchResultCity")!=null&&document.getElementById("M_C_SearchResultCity").value!=0)
{city=document.getElementById("M_C_SearchResultCity").value;}
else
{if(document.getElementById("cityNameValue")!=null&&document.getElementById("cityNameValue").value!=0)
{city=document.getElementById("cityNameValue").value;}}
if((document.getElementById("hotelCheckin")!=null&&document.getElementById("hotelCheckin").value!=0)||(document.getElementById("detailTabCheckin")!=null&&document.getElementById("detailTabCheckin").value!=0)||(document.getElementById("rateTabCheckin")!=null&&document.getElementById("rateTabCheckin").value!=0))
{var checkinDom=document.getElementById("checkinValue");checkin=checkinDom==null?"":checkinDom.value==0?"":reFormatDate(checkinDom.value);}
if((document.getElementById("hotelCheckout")!=null&&document.getElementById("hotelCheckout").value!=0)||(document.getElementById("detailTabCheckout")!=null&&document.getElementById("detailTabCheckout").value!=0)||(document.getElementById("rateTabCheckout")!=null&&document.getElementById("rateTabCheckout").value!=0))
{var checkoutDom=document.getElementById("checkoutValue");checkout=checkoutDom==null?"":checkoutDom.value==0?"":reFormatDate(checkoutDom.value);}
qString+=city==""?"":"&City="+city;qString+=checkin==""?"":"&Checkin="+checkin;qString+=checkout==""?"":"&Checkout="+checkout;window.open("/ProviderRedirect.aspx?key=2.HPL.EN.USD.0.0.0&url="+escape("http://www.hotelplanner.com"+qString),"_self");return false;}}
else
{document.getElementById('roomValue').value=select.options[select.selectedIndex].value;}
return false;}
function setGuestValue(select)
{document.getElementById('guestValue').value=select.options[select.selectedIndex].value;return false;}
var seperator='-';var enableDateFrom=new Date();var enableDateTo=new Date();enableDateFrom.setDate(enableDateFrom.getDate()-1);enableDateTo.setFullYear(enableDateTo.getFullYear()+1);function getObj(objID)
{if(document.getElementById){return document.getElementById(objID);}
else if(document.all){return document.all[objID];}
else if(document.layers){return document.layers[objID];}}
function checkClick(e){e?evt=e:evt=event;CSE=evt.target?evt.target:evt.srcElement;if(getObj('fc'))
if(!isChild(CSE,getObj('fc')))
getObj('fc').style.display='none';}
function isChild(s,d){while(s){if(s==d)
return true;s=s.parentNode;}
return false;}
function Left(obj)
{var curleft=0;if(obj.offsetParent)
{while(obj.offsetParent)
{curleft+=obj.offsetLeft
obj=obj.offsetParent;}}
else if(obj.x)
curleft+=obj.x;return curleft;}
function Top(obj)
{var curtop=0;if(obj.offsetParent)
{while(obj.offsetParent)
{curtop+=obj.offsetTop
obj=obj.offsetParent;}}
else if(obj.y)
curtop+=obj.y;return curtop;}
document.write('<table id="fc" style="position:absolute;top:10px;left:100px;border-collapse:collapse;background:#FFFFFF;border:1px solid #ABABAB;z-index:99999;display:none" cellpadding=2>');document.write('<tr><td style="cursor:pointer" onclick="csubm()"><img src="/img/arrowleftmonth.gif"></td><td colspan=5 id="mns" align="center" style="font:bold 13px Arial"></td><td align="right" style="cursor:pointer" onclick="caddm()"><img src="/img/arrowrightmonth.gif"></td></tr>');document.write('<tr><td align=center style="background:#ABABAB;font:12px Arial">S</td><td align=center style="background:#ABABAB;font:12px Arial">M</td><td align=center style="background:#ABABAB;font:12px Arial">T</td><td align=center style="background:#ABABAB;font:12px Arial">W</td><td align=center style="background:#ABABAB;font:12px Arial">T</td><td align=center style="background:#ABABAB;font:12px Arial">F</td><td align=center style="background:#ABABAB;font:12px Arial">S</td></tr>');for(var kk=1;kk<=6;kk++){document.write('<tr>');for(var tt=1;tt<=7;tt++){num=7*(kk-1)-(-tt);document.write('<td id="v'+num+'" style="width:18px;height:18px">&nbsp;</td>');}
document.write('</tr>');}
document.write('</table>');document.all?document.attachEvent('onclick',checkClick):document.addEventListener('click',checkClick,false);var now=new Date;var sccm=now.getMonth();var sccy=now.getFullYear();var ccm=now.getMonth();var ccy=now.getFullYear();var updobj;function lcs(ielem){updobj=ielem;var calendarTable=document.getElementById("fc");calendarTable.style.top=parseInt((Top(ielem)+22))+"px";calendarTable.style.left=Left(ielem)+"px";getObj('fc').style.left=Left(ielem);getObj('fc').style.top=Top(ielem)+ielem.offsetHeight;getObj('fc').style.display='';curdt=ielem.value;curdtarr=curdt.split(seperator);isdt=true;for(var k=0;k<curdtarr.length;k++){if(isNaN(curdtarr[k]))
isdt=false;}
if(isdt&(curdtarr.length==3)){ccm=curdtarr[1]-1;ccy=curdtarr[0];prepcalendar(curdtarr[2],curdtarr[1]-1,curdtarr[0]);}}
function evtTgt(e)
{var el;if(e.target)el=e.target;else if(e.srcElement)el=e.srcElement;if(el.nodeType==3)el=el.parentNode;return el;}
function EvtObj(e){if(!e)e=window.event;return e;}
function cs_over(e){evtTgt(EvtObj(e)).style.background='#FFCC66';}
function cs_out(e){evtTgt(EvtObj(e)).style.background='#C4D3EA';}
function cs_click(e){updobj.value=calvalarr[evtTgt(EvtObj(e)).id.substring(1,evtTgt(EvtObj(e)).id.length)];getObj('fc').style.display='none';}
var mn=new Array('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC');var mnn=new Array('31','28','31','30','31','30','31','31','30','31','30','31');var mnl=new Array('31','29','31','30','31','30','31','31','30','31','30','31');var calvalarr=new Array(42);function f_cps(obj){obj.style.background='#C4D3EA';obj.style.font='10px Arial';obj.style.color='#333333';obj.style.textAlign='center';obj.style.textDecoration='none';obj.style.border='1px solid #6487AE';obj.style.cursor='pointer';}
function f_cpps(obj){obj.style.background='#C4D3EA';obj.style.font='10px Arial';obj.style.color='#ABABAB';obj.style.textAlign='center';obj.style.textDecoration='line-through';obj.style.border='1px solid #6487AE';obj.style.cursor='default';}
function f_hds(obj){obj.style.background='#FFF799';obj.style.font='bold 10px Arial';obj.style.color='#333333';obj.style.textAlign='center';obj.style.border='1px solid #6487AE';obj.style.cursor='pointer';}
function prepcalendar(hd,cm,cy){now=new Date();sd=now.getDate();td=new Date();td.setDate(1);td.setFullYear(cy);td.setMonth(cm);cd=td.getDay();getObj('mns').innerHTML=mn[cm]+' '+cy;marr=((cy%4)==0)?mnl:mnn;for(var d=1;d<=calvalarr.length;d++){f_cps(getObj('v'+parseInt(d)));if((d>=(cd-(-1)))&&(d<=cd-(-marr[cm]))){var currentDate=new Date(cy,cm,d-cd);dip=!((currentDate>=enableDateFrom)&&(currentDate<=enableDateTo));htd=((hd!='')&&(d-cd==hd));if(dip)
{f_cpps(getObj('v'+parseInt(d)));}
else if(htd)
{f_hds(getObj('v'+parseInt(d)));}
else
{f_cps(getObj('v'+parseInt(d)));}
getObj('v'+parseInt(d)).onmouseover=(dip)?null:cs_over;getObj('v'+parseInt(d)).onmouseout=(dip)?null:cs_out;getObj('v'+parseInt(d)).onclick=(dip)?null:cs_click;getObj('v'+parseInt(d)).innerHTML=d-cd;var currentMonth=(cm-(-1));var currentMonthString="";if(currentMonth<10){currentMonthString="0"+currentMonth;}
else{currentMonthString=currentMonth;}
calvalarr[d]=''+cy+seperator+currentMonthString+seperator+(d-cd);}
else{getObj('v'+d).innerHTML='&nbsp;';getObj('v'+parseInt(d)).onmouseover=null;getObj('v'+parseInt(d)).onmouseout=null;getObj('v'+parseInt(d)).style.cursor='default';}}}
prepcalendar('',ccm,ccy);function caddm(){marr=((ccy%4)==0)?mnl:mnn;ccm+=1;if(ccm>=12){ccm=0;ccy++;}
prepcalendar(0,ccm,ccy);}
function csubm(){marr=((ccy%4)==0)?mnl:mnn;ccm-=1;if(ccm<0){ccm=11;ccy--;}
prepcalendar(0,ccm,ccy);}
function cdayf(){if((ccy>sccy)|((ccy==sccy)&&(ccm>=sccm)))
return;else{ccy=sccy;ccm=sccm;cfd=scfd;}}
function setStaticTicket(){var msg=$('#ticketMessageStatic').val();if((jQuery.trim(msg)).length==0)
return;$("#sendTicketAdvStaticButton").animate({opacity:"hide"},"slow");setTimeout("setTicket('', 'ticketMessageStatic');",500);}
function setTicket(rid,messageBoxId){var msg=$('#'+messageBoxId).val();var href=window.location;if((jQuery.trim(msg)).length==0)
return;var dataToSend='rid='+rid+'&msg='+escape(msg)+'&href='+escape(href);$.ajax({type:"POST",url:'/checkForTicketsAdv.php',data:dataToSend,success:function(msg){if(msg!='')
window.parent.location=msg;}});}
(function($){$.fn.jsocial=function(options){var options=$.extend({twitter:null,facebook:null,flickr:null,friendfeed:null,delicious:null,digg:null,lastfm:null,linked:null,youtube:null,feed:null,newPage:null,center:false,inline:false,small:false},options);return this.each(function(){if(options.newPage){var target='target="_blank"';};var $this=$(this),total_links=0,list='<ul class = "social_links">';if(options.twitter){list+='<li><a href="http://twitter.com/'+options.twitter+'" class="twitter" '+target+'>Twitter</a></li>';total_links++;};if(options.facebook){list+='<li><a href="http://'+options.facebook+'" class="facebook" '+target+' >Facebook</a></li>';total_links++;};if(options.flickr){list+='<li><a href="http://flickr.com/'+options.flickr+'" class="flickr" '+target+' >Flickr</a></li>';total_links++;};if(options.friendfeed){list+='<li><a href="http://friendfeed.com/'+options.friendfeed+'" class="friendfeed" '+target+' >FriendFeed</a></li>';total_links++;};if(options.delicious){list+='<li><a href="http://delicious.com/'+options.delicious+'" class="delicious" '+target+' >Delicious</a></li>';total_links++;};if(options.digg){list+='<li><a href="http://digg.com/users/'+options.digg+'" class="digg" '+target+' >Digg</a></li>';total_links++;};if(options.lastfm){list+='<li><a href="http://www.last.fm/user/'+options.lastfm+'" class="lastfm" '+target+' >Last.FM</a></li>';total_links++;};if(options.linked){list+='<li><a href="http://'+options.linked+'" class="linked-in" '+target+' >Linked-In</a></li>';total_links++;};if(options.youtube){list+='<li><a href="http://'+options.youtube+'" class="youtube" '+target+' >YouTube</a></li>';total_links++;};if(options.feed){list+='<li><a href="http://feeds.feedburner.com/'+options.feed+'" class="feed" '+target+' >Feedburner</a></li>';total_links++;};list+='</ul>';$this.append(list);if(options.inline){$('ul.social_links li').css('float','left');};if(options.small){$(this).removeClass('social').addClass('social_small');};if(options.center){if(options.small){$('ul.social_links').css('width',total_links*26);}
else{$('ul.social_links').css('width',total_links*42);};};});}})(jQuery);