
﻿function findPosX(obj)
{var curleft=0;if(obj.offsetParent)
while(1)
{curleft+=obj.offsetLeft;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.x)
curleft+=obj.x;return curleft;}
function findPosY(obj)
{var curtop=0;if(obj.offsetParent)
while(1)
{curtop+=obj.offsetTop;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.y)
curtop+=obj.y;return curtop;}
function hideInformation(o,id)
{document.body.removeChild(document.getElementById(id));}
function sstchur_SmartScroller_GetCoords()
{var scrollX,scrollY;if(document.all)
{if(!document.documentElement.scrollLeft)
scrollX=document.body.scrollLeft;else
scrollX=document.documentElement.scrollLeft;if(!document.documentElement.scrollTop)
scrollY=document.body.scrollTop;else
scrollY=document.documentElement.scrollTop;}
else
{scrollX=window.pageXOffset;scrollY=window.pageYOffset;}
document.getElementById('ctl00_xcord').value=scrollX;document.getElementById('ctl00_ycord').value=scrollY;}
function sstchur_SmartScroller_Scroll()
{var x=document.getElementById('ctl00_xcord').value;var y=document.getElementById('ctl00_ycord').value;window.scrollTo(x,y);}
window.onload=sstchur_SmartScroller_Scroll;window.onscroll=sstchur_SmartScroller_GetCoords;window.onkeypress=sstchur_SmartScroller_GetCoords;window.onclick=sstchur_SmartScroller_GetCoords;function getWindowHeight()
{var innerHeight;if(navigator.appVersion.indexOf('MSIE')>0){innerHeight=document.body.clientHeight;}else{innerHeight=window.innerHeight;}
return innerHeight;}
function getWindowWidth()
{var innerWidth;if(navigator.appVersion.indexOf('MSIE')>0){innerWidth=document.body.clientWidth;}else{innerWidth=window.innerWidth;}
return innerWidth;}
function showInformation(o,price,inclusions,event,id)
{var x=20+(event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)));var y=20+(event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop)));if((x+200)>getWindowWidth()){x=x-200;}
if(x&&y)
{var div=document.createElement("div");div.id=id;div.style.top=y+"px";div.style.left=x+"px";div.style.width="200px";div.style.position="absolute";div.innerHTML=unescape(inclusions).replace("\r\n","<br />");div.style.padding="2px";div.style.border="1px solid black";div.style.backgroundColor="orange";div.style.color="white";document.body.appendChild(div);}}
function showInformationWithoutWidth(o,price,inclusions,event,id){var x=20+(event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)));var y=20+(event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop)));if((x+200)>getWindowWidth()){x=x-200;}
if(x&&y){var div=document.createElement("div");div.id=id;div.style.top=y+"px";div.style.left=x+"px";div.style.position="absolute";div.innerHTML=unescape(inclusions).replace("\r\n","<br />");div.style.padding="2px";div.style.border="1px solid black";div.style.backgroundColor="orange";div.style.color="white";document.body.appendChild(div);}}
function rotateImages(img,imgList,current)
{document.getElementById(img).style.display='';var _current=parseInt(0);if(current!='undefined'&&current!=null){_current=parseInt(current);}
var imgs=imgList.split("|");if(_current==imgs.length){_current=parseInt(0);}
showImage(img,imgs[_current]);_current+=parseInt(1);setTimeout("rotateImages('"+img+"', '"+imgList+"', '"+_current+"')",7000);}
function showImage(o,img)
{document.getElementById(o).src="/ImageResizer.aspx?File="+img+"&Size=200";}
function showMap(img)
{window.open("/admin/common/images/"+img);}
function renderInitial(bookingId,start,roomId,hotelId,sp)
{showProcessing("selecteddates");DSRazor.HBS.Web.Book.AjaxRenderInitial(bookingId,start,roomId,hotelId,false,renderInitial_callback)}
function renderInitial_callback(res)
{if(res.value!=null)
{document.getElementById("selecteddates").innerHTML=res.value;}else{alert(res.error.Message);}}
function toggleWeeks(bookingId,start,roomId,hotelId)
{showProcessing("selecteddates");DSRazor.HBS.Web.Book.AjaxToggleWeeks(bookingId,start,roomId,hotelId,toggleWeeks_callback);}
function toggleWeeks_callback(res)
{if(res.value!=null)
{document.getElementById("selecteddates").innerHTML=res.value;}else{alert(res.error.Message);}}
function bookDate(o,bookingId,roomId,date,price,available,inclusions)
{showProcessing("chosendates");toggleControls(true);if(o.checked)
{DSRazor.HBS.Web.Book.CreateTemporaryBooking(bookingId,roomId,date,'1',unescape(inclusions),price,bookDate_callback);}else{DSRazor.HBS.Web.Book.DeleteTemporaryBooking(bookingId,roomId,date,bookDate_callback);}}
function bookDate_callback(res)
{if(res.value!=null)
{renderCheckout(res.value.split("|")[1],res.value.split("|")[0]);}}
function renderCheckout(bookingId,roomId)
{DSRazor.HBS.Web.Book.RenderAmount(bookingId,roomId,renderCheckout_callback);}
function renderCheckout_callback(res)
{if(res.value!=null)
{document.getElementById("chosendates").innerHTML=res.value;toggleControls(false);}}
function changeNumberOfRooms(o,bookingId,roomId,day)
{if(o.selectedIndex>0)
{var rooms="0";rooms=o.options[o.selectedIndex].value;showProcessing("chosendates");toggleControls(true);DSRazor.HBS.Web.Book.UpdateRooms(bookingId,roomId,day,rooms,renderCheckout_callback);}}
function showProcessing(id){document.getElementById(id).innerHTML="<img src=\"/common/images/animated_loading.gif\" />&nbsp;Please wait...";}
function toggleControls(dis)
{var controls=document.getElementsByTagName("input");for(var i=0;i<controls.length;i++)
{if(controls[i].id.indexOf("sd_cb_d")>-1)
{try{controls[i].disabled=dis;}catch(e){alert(e);}}}}
function slideText()
{var s1=document.getElementById("slide1");var s2=document.getElementById("slide2");if(s1!=null&&s2!=null)
{if(s1.className.indexOf("hide")>-1)
{s1.className="slide_text";s2.className="slide_text hide";}else{s1.className="slide_text hide";s2.className="slide_text";}
setTimeout("slideText()",5000);}}