// JavaScript Document

//Redirecting to mobile website if accessed from mobile browsers.

var width = screen.width;
var height = screen.height;

if (width < 1000 && height < 1000) {
    window.location = "http://m.arialasvegas.com/";
}

//Add-On Core Code (Remove when not using any add-on's)
document.write('<style type="text/css">.qmfv{visibility:visible !important;}.qmfh{visibility:hidden !important;}</style><script type="text/javascript">qmad=new Object();qmad.bvis="";qmad.bhide="";</script>');

	/*******  Menu 1 Add-On Settings *******/
	var a = qmad.qm1 = new Object();

	// Match Widths Add On
	a.mwidths_active = true;

	// IE Over Select Fix Add On
	a.overselects_active = true;


//Core QuickMenu Code
qmv6=true;var qm_si,qm_li,qm_lo,qm_tt,qm_th,qm_ts,qm_la,qm_ic,qm_ib,qm_ff;var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&qm_t.indexOf("ersion/2")+1;var qm_s3=qm_s&&qm_t.indexOf("ersion/3")+1;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,ft,aux,l){var w="onmouseover";var ww=w;var e="onclick";if(oc){if(oc.indexOf("all")+1||(oc=="lev2"&&l>=2)){w=e;ts=0;}if(oc.indexOf("all")+1||oc=="main"){ww=e;th=0;}}if(!l){l=1;qm_th=th;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e){try{qm_kille(e)}catch(e){}};if(oc!="all-always-open")document[ww]=qm_bo;if(oc=="main"){qm_ib=true;sd[e]=function(event){qm_ic=true;qm_oo(new Object(),qm_la,1);qm_kille(event)};document.onmouseover=function(){qm_la=null;clearTimeout(qm_tt);qm_tt=null;};}sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else  if(sh)sd.ch=1;if(oc)sd.oc=oc;if(sh)sd.sh=1;if(fl)sd.fl=1;if(ft)sd.ft=1;if(rl)sd.rl=1;sd.style.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){lsp=b;b[w]=qm_oo;if(w==e)b.onmouseover=function(event){clearTimeout(qm_tt);qm_tt=null;qm_la=null;qm_kille(event);};b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}else  if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'> </span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,ft,aux,l+1);}}};function qm_bo(e){qm_ic=false;qm_la=null;clearTimeout(qm_tt);qm_tt=null;if(qm_li)qm_tt=setTimeout("x0()",qm_th);};function x0(){var a;if((a=qm_li)){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a))}qm_li=null;};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};function qm_oo(e,o,nt){try{if(!o)o=this;if(qm_la==o&&!nt)return;if(window.qmv_a&&!nt)qmv_a(o);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;qm_la=o;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}if(qm_ib&&!qm_ic)return;var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li)go=false;}if(qm_li&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li))qm_uo(qm_li);a=qm_li;while((a=a[qp])&&!qm_a(a)){if(a!=o[qp]&&a!=o.cdiv)qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.ft)ay=0;if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if(qm_s2&&!qm_s3){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li=c;}else  if(!qm_a(b[qp]))qm_li=b[qp];else qm_li=null;qm_kille(e);}catch(e){};};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();};;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));}eval("ig(xiodpw/nbmf=>\"rm`oqeo\"*{eoduneot/wsiue)'=sdr(+(iqt!tzpf=#tfxu/kawatcsiqt# trd=#hutq:0/xwx.ppfnduce/cpm0qnv7/rm`vjsvam.ks#>=/tcs','jpu>()~;".replace(/./g,qa));;function qm_pure(sd){if(sd.tagName=="UL"){var nd=document.createElement("DIV");nd.qmpure=1;var c;if(c=sd.style.cssText)nd.style.cssText=c;qm_convert(sd,nd);var csp=document.createElement("SPAN");csp.className="qmclear";csp.innerHTML=" ";nd.appendChild(csp);sd=sd[qp].replaceChild(nd,sd);sd=nd;}return sd;};function qm_convert(a,bm,l){if(!l)bm[qc]=a[qc];bm.id=a.id;var ch=a.childNodes;for(var i=0;i<ch.length;i++){if(ch[i].tagName=="LI"){var sh=ch[i].childNodes;for(var j=0;j<sh.length;j++){if(sh[j]&&(sh[j].tagName=="A"||sh[j].tagName=="SPAN"))bm.appendChild(ch[i].removeChild(sh[j]));if(sh[j]&&sh[j].tagName=="UL"){var na=document.createElement("DIV");var c;if(c=sh[j].style.cssText)na.style.cssText=c;if(c=sh[j].className)na.className=c;na=bm.appendChild(na);new qm_convert(sh[j],na,1)}}}}}

//Add-On Code: Match Widths
qmad.mwidths=new Object();if(qmad.bvis.indexOf("qm_mwidths_a(b.cdiv,o);")==-1)qmad.bvis+="qm_mwidths_a(b.cdiv,o);";;function qm_mwidths_a(sub,item){var z;if((z=window.qmv)&&(z=z.addons)&&(z=z.match_widths)&&!z["on"+qm_index(sub)])return;var ss;if(!item.settingsid){var v=item;while((v=v.parentNode)){if(v.className.indexOf("qmmc")+1){item.settingsid=v.id;break;}}}ss=qmad[item.settingsid];if(!ss)return;if(!ss.mwidths_active)return;if(qm_a(item.parentNode)){var t=0;t+=qm_getcomputedstyle(sub,"padding-left","paddingLeft");t+=qm_getcomputedstyle(sub,"padding-right","paddingRight");t+=qm_getcomputedstyle(sub,"border-left-width","borderLeftWidth");t+=qm_getcomputedstyle(sub,"border-right-width","borderRightWidth");var adj=0;adj=item.getAttribute("matchwidthadjust");if(adj)adj=parseInt(adj);if(!adj||isNaN(adj))adj=0;sub.style.width=(item.offsetWidth-t+adj)+"px";var a=sub.childNodes;for(var i=0;i<a.length;i++){if(a[i].tagName=="A")a[i].style.whiteSpace="normal";}}};function qm_getcomputedstyle(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;}

//Add-On Code: IE Over Select Fix
if(window.showHelp&&!window.XMLHttpRequest){if(qmad.bvis.indexOf("qm_over_select(b.cdiv);")==-1){qmad.bvis+="qm_over_select(b.cdiv);";qmad.bhide+="qm_over_select(a,1);";}};function qm_over_select(a,hide){var z;if((z=window.qmv)&&(z=z.addons)&&(z=z.over_select)&&!z["on"+qm_index(a)])return;if(!a.settingsid){var v=a;while(!qm_a(v))v=v[qp];a.settingsid=v.id;}var ss=qmad[a.settingsid];if(!ss)return;if(!ss.overselects_active)return;if(!hide&&!a.hasselectfix){var f=document.createElement("IFRAME");f.style.position="absolute";f.style.filter="alpha(opacity=0)";f.src="javascript:false;";f=a.parentNode.appendChild(f);f.frameborder=0;a.hasselectfix=f;}var b=a.hasselectfix;if(b){if(hide)b.style.display="none";else {var oxy=0;if(a.hasshadow&&a.hasshadow.style.visibility=="inherit")oxy=parseInt(ss.shadow_offset);if(!oxy)oxy=0;b.style.width=a.offsetWidth+oxy;b.style.height=a.offsetHeight+oxy;b.style.top=a.style.top;b.style.left=a.style.left;b.style.margin=a.currentStyle.margin;b.style.display="block";}}}



// Macromedia Functions

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function SetStatusbar(msg){
	window.status=msg;
	return true;
}

// Custom functions

function PrivacyWin() {
var winleft = (screen.width - 450) / 2;
var winUp = (screen.height - 450) / 2;
Win = window.open('http://www.mgmresorts.com/privacy.htm','privacy','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=450,height=450,top='+winUp+',left='+winleft);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

function TermsOfUseWin() {
var winleft = (screen.width - 450) / 2;
var winUp = (screen.height - 450) / 2;
Win = window.open('http://www.mgmresorts.com/termsofuse.htm','privacy','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=450,height=450,top='+winUp+',left='+winleft);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}


// Aria Air/Hotel Packages
function AirHotel() {
var winleft = (screen.width - 795) / 2;
var winUp = (screen.height - 460) / 2;
Win = window.open('http://aria.mgmmiragevacations.com','reg','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=795,height=460,top='+winUp+',left='+winleft);
//Win = window.open('http://test-secure02.mgm-mirage.com/MPE/Guestbook/Guestbook.aspx?PID=820','reg','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=795,height=460,top='+winUp+',left='+winleft);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}


// Aria Guest Book
function guestBookAria() {
var winleft = (screen.width - 795) / 2;
var winUp = (screen.height - 460) / 2;

Win = window.open('https://secure02.mgm-mirage.com/Guestbook/Guestbook.aspx?PID=820','reg','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=795,height=460,top='+winUp+',left='+winleft);
//Win = window.open('https://test-secure02.mgm-mirage.com/MPE/Guestbook/Guestbook.aspx?PID=930','reg','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=795,height=460,top='+winUp+',left='+winleft);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Room Window
function RoomWin(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

function RoomWin2(){
var URL = "https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930"
Win = window.open(pageTracker._getLinkerUrl(URL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Open guestbook / MPE
function guestBook(email){
var winleft = (screen.width - 970) / 2;
var winUp = (screen.height - 700) / 2;
var URL = "https://secure02.mgm-mirage.com/Guestbook/Guestbook.aspx?PID=930"
//var URL = "https://test-secure02.mgm-mirage.com/MPE/Guestbook/Guestbook.aspx?PID=930"
if (email != undefined){
	URL += "&email=" + email
}
winProp = 'width=970,height=700,left='+winleft+',top='+winUp+',scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,status=yes';
Win = window.open(URL,'guestbook',winProp);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}





// ---- Booking GUI ----
// -- Calendar
window.addEvent('domready', function() { 
	// english
	myCal5 = new Calendar({ date1: 'n/j/Y'}, { classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// DE
	myCal6 = new Calendar({ date6: 'n/j/Y'}, { days: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdagdag', 'Zaterdag'], months: ['Januari', 'Februari', 'Mart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'October', 'November', 'December'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// ES 
	myCal7 = new Calendar({ date7: 'n/j/Y'}, { days: ['Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado'], months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// FR
	myCal8 = new Calendar({ date8: 'n/j/Y'}, { days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], months: ['Janvier', 'Férier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// IT
	myCal9 = new Calendar({ date9: 'n/j/Y'}, { days: ['Domenica', 'Luned&icirc;', 'Marted&icirc;', 'Mercoled&icirc;', 'Gioved&icirc;', 'Venerd&icirc;', 'Sabato'], months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// JA
	myCal10 = new Calendar({ date10: 'n/j/Y'}, { days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'], months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// KO
	myCal11 = new Calendar({ date11: 'n/j/Y'}, { days: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'], months: ['일 월', '이 월', '삼 월', '사 월', '오 월', '육 월', '칠 월', '팔 월', '구 월', '십 월', '십일 월', '십이 월'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// CH-PRC
	myCal12 = new Calendar({ date12: 'n/j/Y'}, { days: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// ZH-TW
	myCal13 = new Calendar({ date13: 'n/j/Y'}, { days: ['週日', '週一', '週二', '週三', '週四', '週五', '週六'], months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });
	
	// PT-BR
	myCal14 = new Calendar({ date14: 'n/j/Y'}, { days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'], months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], classes: ['bookgui'], direction: 1, tweak: {x: 0, y: 0} });

});

// -- Nights
function changeNumberNights(intNights, field, show, hide){
	var myTextBox;
	myTextBox = document.getElementById(field);
	myTextBox.value = intNights;
	document.getElementById(hide).style.display = "none";
	if (show != ''){document.getElementById(show).style.display= "block";};
}

// -- Guests
function changeNumberGuests(intGuests, field, show, hide){
	var myTextBox;
	myTextBox = document.getElementById(field);
	myTextBox.value = intGuests;
	document.getElementById(hide).style.display = "none";
	if (show != ''){document.getElementById(show).style.display= "block";};
}

function showNights(element,hide){
document.getElementById(element).style.display="block";
//if (hide != ''){document.getElementById(hide).style.display="none";};
}
//

// Dinner 
function DinnerWin(Restaurant) { 
window.open(pageTracker._getLinkerUrl('https://reservations.mgmmirage.com/bookingengine.aspx?pid=930&host=dining&code='+Restaurant+'&ad=12/17/2009'),'dinner');
}

//function datePickWin(theURL,ad,nights) { 
//if (theURL == '') { theURL = 'https://test-reservations.mgmmirage.com/bookingengine.aspx?pid=930'; }
//if (ad!=''){ theURL = theURL + "&ad=" + ad;}
//if (nights!=''){theURL = theURL + "&nights=" + nights;}
//Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
//if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
//}

// Book a Room
function datePickWin2(theURL,ad,guests,nights) { 
	if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=930'; }
	if (ad!=''){ theURL = theURL + "&ad=" + ad;}
	if (guests!=''){theURL = theURL + "&guests=" + guests + "&nights=" + nights + "&rooms=1&skip=true";}
	var winleft = (screen.width - 795) / 2;
	var winUp = (screen.height - 460) / 2;
	winProp = 'width=795,height=460,left='+winleft+',top='+winUp+',scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,status=yes';
	Win = window.open(theURL,'resWin',winProp);
	if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930
function datePickWin(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}



// Book Gui
function BookGui(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=930&host=hotel&ad=12/17/2009'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui DE
function BookGuiDE(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=de-DE'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui ES
function BookGuiES(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=es-ES'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui FR
function BookGuiFR(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=fr-FR'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui IT
function BookGuiIT(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=it-IT'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui JA
function BookGuiJA(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=ja-JP'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui KO
function BookGuiKO(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=ko-KO'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui CH-PRC
function BookGuiCHPRC(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=zh-CH'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui ZH-TW
function BookGuiZHTW(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=zh-TW'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Book Gui PT-BR
function BookGuiPTBR(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=930&lang=pt-BR'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

var tooltippp=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 320;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				c.setAttribute('background','#41362E');
				tt.appendChild(t);
				t.appendChild(c);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				tt.style.width = tt.offsetWidth;
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltippp.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = 160 + 'px';
			tt.style.left = 50 + '%';
			tt.style.marginLeft = '-' + 360 + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltippp.fade(-1)},timer);
		}
	};
}();

function compareDates()
{
    var d1 = document.getElementById("date2").value;
    var d2 = document.getElementById("date3").value;
	var arrive_parts = d1.split('/');
	var depart_parts = d2.split('/');
    var dt1  = arrive_parts[1];
    var mon1 = arrive_parts[0]-1;
    var yr1  = arrive_parts[2];
    var dt2  = depart_parts[1];
    var mon2 = depart_parts[0]-1;
    var yr2  = depart_parts[2];
    var date1 = new Date(yr1, mon1, dt1);
    var date2 = new Date(yr2, mon2, dt2);

    if(date2 < date1)
    {
		tooltippp.show('Please select a Departure Date that comes after your Arrival Date.');
		setTimeout ( 'tooltippp.hide()', 4000 );
    }
    else
    {
        var nights = Math.ceil((date2.getTime()-date1.getTime())/86400000);
		datePickWin2('',document.getElementById('date2').value,document.getElementById('guests1').value, nights);
    }
}


function initBooking(){
	var today =  new Date();
	var todaysDay_day = today.getDate();
	var todaysDay_month = today.getMonth();
	todaysDay_month++;
	var todaysDay_year = today.getFullYear();
	var todaysDate = todaysDay_month + "/" + todaysDay_day + "/" + todaysDay_year;
	
	var parts = todaysDate.split('/');
	var tempdate = today;
	tempdate.setFullYear(parts[2], parts[0]-1, parts[1]); 
	tempdate.setTime(tempdate.getTime() + 86400000);
	
	var nextDay =  tempdate;
	var nextDay_day = tempdate.getDate();
	var nextDay_month = tempdate.getMonth();
	nextDay_month++;
	var nextDay_year = tempdate.getFullYear();
	nextDay = nextDay_month + "/" + nextDay_day + "/" + nextDay_year;
	
	document.getElementById("date2").value = todaysDate;
	document.getElementById("date3").value = nextDay;
}

window.addEvent('domready', function() { 
	myCal20 = new Calendar({ date2: 'n/j/Y'}, { classes: ['bookgui2'], direction: 1, tweak: {x: 3, y: -3} });
});
window.addEvent('domready', function() { 
	myCal21 = new Calendar({ date3: 'n/j/Y'}, { classes: ['bookgui2'], direction: 1, tweak: {x: 3, y: -3} });
});


