//Redirecting to mobile website if accessed from mobile browsers.

var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) {
    window.location = "http://mobile.circuscircus.com/";
}

// Room Booking English
function datePickWin(theURL,ad,nights,children,adults,promocode) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=CCC&host=offer&code=XDISC40&utm_source=Hotel%2BOffer&utm_medium=Web&utm_content=40%25%2Boff%2Bsustaining%2B-%2BFeb&utm_campaign=CCLV%2BWeb'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){
	if (promocode!=''){
		theURL = theURL + "&host=offer&code=" +promocode+ "&nights=" + nights + "&guests=" + adults + "&children=" + children;
	}
	else {
		theURL = theURL + "&nights=" + nights + "&guests=" + adults + "&children=" + children;
	}	
}
Win = window.open((theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Room Booking English
function datePickWinPROMO(theURL,ad,nights,children,adults,promocode) { 
if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=CCC&host=offer&code=XLTDFB3&utm_source=Hotel%2BOffer&utm_medium=Web&utm_content=2%2F19%2BLimited%2BTime%2BOffer&utm_campaign=CCLV%2BWeb'; }
if (ad!=''){ theURL = theURL + "&ad=" + ad;}
if (nights!=''){
	if (promocode!=''){
		theURL = theURL + "&host=offer&code=" +promocode+ "&nights=" + nights + "&guests=" + adults + "&children=" + children;
	}
	else {
		theURL = theURL + "&nights=" + nights + "&guests=" + adults + "&children=" + children;
	}	
}
Win = window.open((theURL),'resWin');
if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}

// Reservations - Booking GUI
function ResWinGUI(theURL,ad,nights,guests,children,lang) { 
	if (theURL == '') { theURL = 'https://reservations.mgmmirage.com/bookingengine.aspx?pid=ccc'; }
	if (ad!=''){ theURL = theURL + "&ad=" + ad;}
	if (nights!=''){theURL = theURL + "&nights=" + nights;}
	if (guests!=''){theURL = theURL + "&guests=" + guests;}
	if (children!=''){theURL = theURL + "&children=" + children;}
	if (lang!=''){theURL = theURL + "&lang=" + lang;}
	Win = window.open(theURL,'resWin');
	if (parseInt(navigator.appVersion) >= 4) { Win.focus(); }
}



<!-- for Booking GUI Calendar-->

if (document.images)
{
  pic1= new Image(40,100); 
  pic1.src="/images/calendar/ui-bg_flat_75_ffffff_40x100.png"; 
}


<!--Slider Loader-->

$(window).load(function() {
    $('#slider').nivoSlider();
});



    
<!--Nav Bar Script-->

	$(document).ready(function(){
    generateSprites(".nav", "current-", true, 200, "fade");
});


<!--Sub-Nav Bar Script-->

function nav(item, height) {
  $('.nav li').hover(function () {
    $(this).find(item).show();
    $(this).find(item).stop().animate({
      height: height,
      opacity: '100'
    }, {
      queue: false,
      duration: 200,
      easing: 'easeInSine'
    })
  }, function () {
    $(this).find(item).stop().animate({
      height: '0px',
      opacity: '0'
    }, {
      queue: false,
      duration: 100,
      easing: 'easeInSine'
    })
  });
};

<!--For the vertical length of nav bar drop downs. add or subtract 30px for each line-->
$(document).ready(function () {
    nav('ul.hotel_sub', '170px');
	nav('ul.hotel_sub li a', '30px');
    nav('ul.casino_sub', '170px');
	nav('ul.casino_sub li a', '30px');
	nav('ul.entertainment_sub', '140px')
	nav('ul.entertainment_sub li a', '30px');;	
	nav('ul.amenities_sub', '140px');
	nav('ul.amenities_sub li a', '30px');
	nav('ul.dining_sub', '290px');
	nav('ul.dining_sub li a', '30px');
	nav('ul.weddings_sub', '110px');
	nav('ul.weddings_sub li a', '30px');
	nav('ul.meetings_sub', '230px');
	nav('ul.meetings_sub li a', '30px');
	nav('ul.adventuredome_sub', '170px');
	nav('ul.adventuredome_sub li a', '30px');
	nav('ul.promotions_sub', '50px');
	nav('ul.promotions_sub li a', '30px');
	nav('ul.rides_sub', '150px');
	nav('ul.rides_sub li a', '30px');
});


<!--DatePicker Select Dropdowns Script-->

	$(function(){			
		$('select#nights1').selectmenu({style:'popup'});
		$('select.field-nights').selectmenu({width: '300'});	
		$('select#adults1').selectmenu({style:'popup'});
		$('select#children1').selectmenu({style:'popup'});		
	});		

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];}
}

// Popup Window Functions ADVENTUREDOME

function RoomWin(theURL) { 
if (theURL == null) { theURL = ' http://reservations.mgmmirage.com/bookingengine.aspx?host=hotel&pid=ccc'; }
var winleft = (screen.width - 800) / 2;
var winUp = (screen.height - 540) / 2;
winProp = 'width=800,height=540,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(); }
}

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 winOpenSlide(url)
{
contentWin = window.open(url,"slideshow","resizable=yes,toolbar=no,location=no,width=501,height=425,directories=no,status=no,scroll=yes,scrollbars=yes,menubar=no,left=10,top=10");
contentWin.focus();
return;
}

function winOpenVideo(url) {
   contentWin = window.open(url,"video","toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=415,height=390");
   contentWin.focus();
   return;
}
