//commoncode.js


//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;
}

function previewPic(sel) {
document.previewpic.src = "" + sel.options[sel.selectedIndex].value;
}

// Book Gui functions
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";};
}

function showNights(element,hide){
document.getElementById(element).style.display="block";
//if (hide != ''){document.getElementById(hide).style.display="none";};
}

// Center Pop Window - 10.13.03 RCS - v2.0
function winBRopen(theURL, Name, popW, popH, scroll, resize, menu, stat, tool) { 
var winleft = (screen.width - popW) / 2;
var winUp = (screen.height - popH) / 2;
winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+resize+',menubar='+menu+',status='+stat+',toolbar='+tool+''
Win = window.open(theURL, Name, winProp)
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Pop Window
function popWin(theURL, winName, popW, popH, features) { var winleft = (screen.width - popW) / 2;
var winUp = (screen.height - popH) / 2;
winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',resizable=yes,status=yes,'+features;
Win = window.open(theURL,winName,winProp);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// guestBook - MPE
function guestBook(email) { 
//var URL = "https://secure02.mgm-mirage.com/MPE/Guestbook/Guestbook.aspx?PID=MCH"
var URL = "https://secure02.mgm-mirage.com/Guestbook/Guestbook.aspx?PID=MCH"
if (email != undefined){URL += "&email=" + email}
var winleft = (screen.width - 795) / 2;
var winUp = (screen.height - 460) / 2;
winProp = 'width=780,height=510,left='+winleft+',top='+winUp+',scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,status=no';
Win = window.open(URL,'guestBook',winProp);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Room Window
function RoomWin(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&ad=2/15/2009'; }
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

function RoomWinFr(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&ad=2/15/2009&lang=fr-FR'; }
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

function RoomWinIt(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&ad=2/15/2009&lang=it-IT'; }
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Room Window
function RoomWinES(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&ad=2/15/2009&lang=es-ES'; }
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Room Window
function RoomWinDE(theURL,ad,nights) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&ad=2/15/2009&lang=de-DE'; }
if (nights!=''){theURL = theURL + "&nights=" + nights;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Room Window
function RoomWin2(theURL,ad,nights,promo) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
if (promo!=''){ theURL = theURL + "&host=promo&code=" + promo;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

function RoomWin2Fr(theURL,ad,nights,promo) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&host=hotel&lang=fr-FR'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
if (promo!=''){ theURL = theURL + "&host=promo&code=" + promo;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

function RoomWin2It(theURL,ad,nights,promo) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&host=hotel&lang=it-IT'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
if (promo!=''){ theURL = theURL + "&host=promo&code=" + promo;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Room Window
function RoomWin2ES(theURL,ad,nights,promo) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&lang=es-ES'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
if (promo!=''){ theURL = theURL + "&host=promo&code=" + promo;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Room Window
function RoomWin2DE(theURL,ad,nights,promo) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&lang=de-DE'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){theURL = theURL + "&nights=" + nights;}
if (promo!=''){ theURL = theURL + "&host=promo&code=" + promo;}
Win = window.open(pageTracker._getLinkerUrl(theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Guest Services Window
function GuestServicesWin(theURL) { 
if (theURL == null) { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?host=guestservices&pid=MCH'; }
var winleft = (screen.width - 795) / 2;
var winUp = (screen.height - 525) / 2;
winProp = 'width=795,height=525,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(); }
}

// Center Ticket Window
function TicketWin() { 
var winleft = (screen.width - 620) / 2;
var winUp = (screen.height - 500) / 2;
winProp = 'width=620,height=500,left='+winleft+',top='+winUp+',scrollbars=yes,resizable=yes,menubar=yes,toolbar=no,status=yes';
Win = window.open('http://mgm.admission.com','ticket',winProp);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}
function PrivacyWin() {
var winleft = (screen.width - 450) / 2;
var winUp = (screen.height - 450) / 2;
Win = window.open('http://www.mgmmirage.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.mgmmirage.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(); }
}

function ecardsWin(theURL) {
var winleft = (screen.width - 795) / 2;
var winUp = (screen.height - 460) / 2;
Win = window.open('https://secure02.mgm-mirage.com/ecards/'+theURL,'ecards','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=795,height=460,top='+winUp+',left='+winleft);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Golf Window
function golfWin() { 
var winleft = (screen.width - 795) / 2;
var winUp = (screen.height - 460) / 2;
winProp = 'width=620,height=450,left='+winleft+',top='+winUp+',scrollbars=yes,resizable=yes,menubar=no,toolbar=yes,status=yes';
Win = window.open('https://secure02.mgm-mirage.com/golf/primm/pg_online_res_date.asp?pid=MCH','golf',winProp);
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Center Guest Services Window
function virtualWin(theURL) { 
var winleft = (screen.width - 795) / 2;
var winUp = (screen.height - 525) / 2;
winProp = 'width=747,height=403,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(); }
}
// Center Dinner Window
function DinnerWin(Restaurant) { 
var winleft = (screen.width - 775) / 2;
var winUp = (screen.height - 525) / 2;
winProp = 'width=775,height=525,left='+winleft+',top='+winUp+',scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,status=yes';
window.open('https://reservations.mgmmirage.com/bookingengine.aspx?pid=mch&host=dining&code='+Restaurant,'dinner',winProp);
}

function openMobile(){
    var txtCode = document.getElementById("offerCode");
    
    Win = window.open('https://reservations.mgmmirage.com/bookingengine.aspx?pid=MCH&host=promo&code=' + txtCode.value,'mobile_signup','toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=800,height=350');

}