var browser = navigator.appName;
var ie = "Microsoft Internet Explorer";
var netscape = "Netscape";
os = navigator.platform;
mac = "MacPPC";

/***********************************************************************
The following code declares variables for the on() and off() functions
***********************************************************************/
var browserOK = false;
var pics;
var NameString;
var objCount = 0;
NameString = navigator.appname + navigator.appCodeName + navigator.appVersion;
if (NameString.indexOf("Explorer") == -1)
{
	if (NameString.indexOf("2.0") == -1)
    {
		browserOK = true;
	    pics = new Array();
    }
}
/********************************************************************
preload:
This function will preload all of your rollover images into cache
Required parameters:
name - this is the name of your image
first - this is the location of the off image
second - this is the location of the on image
*********************************************************************/
function preload(name, first, second)
{
	if (browserOK)
    {
		pics[objCount] = new Array(3);
	    pics[objCount][0] = new Image();
	    pics[objCount][0].src = first;
	    pics[objCount][1] = new Image();
	    pics[objCount][1].src = second;
	    pics[objCount][2] = name;
	    objCount++;
    }
}

/********************************************************************
on:
This functions swaps the off image with the on image
Required parameters:
on - this is the name of the rollover image
*********************************************************************/
function on(name)
{
	if (browserOK)
    {
		for (i = 0; i < objCount; i++)
        {
			if (document.images[pics[i][2]] != null)
	        {
				if (name != pics[i][2])
		        {
					document.images[pics[i][2]].src = pics[i][0].src;
		        }
		        else
		       {
			   	document.images[pics[i][2]].src = pics[i][1].src;
		       }
	        }
    	}
     }
}


/********************************************************************
off:
This functions swaps the on image with the off image
Required parameters:
There are no required parameters for this function
*********************************************************************/
function off()
{
	if (browserOK)
    {
		for (i = 0; i < objCount; i++)
        {
			if (document.images[pics[i][2]] != null) document.images[pics[i][2]].src = pics[i][0].src;
      	}
    }
}

function preloadMain(){
// preload all of your images here

//nav
preload("hotel", "/images/nav_hotel_off.jpg", "/images/nav_hotel_on.jpg");
preload("casino", "/images/nav_casino_off.jpg", "/images/nav_casino_on.jpg");
preload("ent", "/images/nav_ent_off.jpg", "/images/nav_ent_on.jpg");
preload("dining", "/images/nav_dining_off.jpg", "/images/nav_dining_on.jpg");
preload("special", "/images/nav_special_off.jpg", "/images/nav_special_on.jpg");
preload("conv", "/images/nav_conv_off.jpg", "/images/nav_conv_on.jpg");
preload("backbutton","/images/back_off.gif","/images/back_on.gif");
preload("win1k","/images/win1k_off.jpg","/images/win1k_on.jpg");
preload("trophome","/images/trop_home_off.gif","/images/trop_home_on.gif");

//footer
preload("contact", "/images/footer_contact_off.jpg", "/images/footer_contact_on.jpg");
preload("press", "/images/footer_press_off.jpg", "/images/footer_press_on.jpg");
preload("location", "/images/footer_location_off.jpg", "/images/footer_location_on.jpg");
preload("jobs", "/images/footer_jobs_off.jpg", "/images/footer_jobs_on.jpg");
preload("corp", "/images/footer_corp_off.jpg", "/images/footer_corp_on.jpg");

preload("reserve", "/images/reserve_room_off.jpg", "/images/reserve_room_on.jpg");
preload("navreserve", "/images/nav_reserve_room_off.jpg", "/images/nav_reserve_room_on.jpg");
preload("guestbook", "/images/sign_email_off.gif", "/images/sign_email_on.gif");
preload("ipix", "/images/ipix_link_off.gif", "/images/ipix_link_on.gif");
preload("arrowback", "/images/arrow_back_off.gif", "/images/arrow_back_on.gif");
preload("arrownext", "/images/arrow_next_off.gif", "/images/arrow_next_on.gif");
preload("dinearound", "/images/dinearound_off.gif", "/images/dinearound_on.gif");
preload("nonflash", "/images/non_flash_home_off.gif", "/images/non_flash_home_on.gif");
preload("yesflash", "/images/flash_home_off.gif", "/images/flash_home_on.gif");

//buttons
preload("submit", "/images/submit_off.gif", "/images/submit_on.gif");
preload("reset", "/images/reset_off.gif", "/images/reset_on.gif");

}

/***********************************************************************
SetStatusbar:
This function sets the status bar message to the specified message
Parameters are as follows:
msg - this is the message you want displayed
***********************************************************************/
function SetStatusBar(msg)
{
	window.status=msg;
	return true;
}


/**********************************************************************
addFav:
This function adds this site to the users favorites list.  It also
checks to see if you are using netscape.  If you are, it pops up a message
telling you to hit CTRL-D to bookmark the site in netscape
**********************************************************************/
function addFav()
{
	if ((browser == "Netscape Navigator") && (version < 5))		
	{
			alert("Please use CTRL+D on your keyboard to bookmark this site in Netscape");
	}
	else
	{
		window.external.AddFavorite('http://www.Choice-Tickets.com','Vegas Choice Tickets')
	}
}

function GetImageX(ImageName) {
	ImageName = 'logo';
	var rv = 0;
	var Img = document.images[ImageName];
	if (document.layers)
	{			//netscape
		rv = Img.x;
	}
	else {			// IE
		while (Img.offsetParent){
			rv += Img.offsetLeft;
			Img = Img.offsetParent;
		}
	}

		
	return rv;
}

function GetImageY(ImageName){
	ImageName = 'logo';
	var rv = 0;
	var Img = document.images[ImageName];
	if (document.layers)
	{	//netscape
		rv = Img.y;
	}
	else
	{	//ie
		rv = Img.offsetTop;
	}
		
	return rv;
}

/***********************************************************************
popWin:
This function pops up a new window with the specified url.
Parameter are as follows:
url - this is the url that you want the user to be directed to
name - this is the name of the popup window
features - this is the width,height,scrollbars,etc...
***********************************************************************/
function popWin(url,name,features)
{
 	var the_win;
	the_win = window.open(url,name,features);
  	the_win.focus();
}

function SetStatusbar(msg){
	window.status=msg;
	return true;
}

function cookieVal(cookieName) {
		thisCookie = document.cookie.split("; ")
  	    for (i=0; i<thisCookie.length; i++) {
  	        if (cookieName == thisCookie[i].split("=")[0]) {
  	        	return thisCookie[i].split("=")[1]
  	        }
   	    }
		return 0
	}
	
function setCookie(name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}



//FLASH NAV TO GO TO FRAME 2 WHERE THE HOME LINK IS ACTIVE
fullurl = document.URL;
//split the url into an array of strings using "/" as the delimiter
arrurl = fullurl.split("/");
file = arrurl[3];

if (file == "" || file == "index.aspx"){

}else{

var movieName = "testcommand";

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}

function removehomelink() {
  thisMovie(movieName).GotoFrame(2);
}
}


function getArgs() {
	var args = new Object();
	var query = location.search.substring(1); // Get Query String
	var pairs = query.split("&"); // Split query at the comma
	// Begin loop through the querystring
	for(var i = 0; i < pairs.length; i++) {
		var pos = pairs[i].indexOf('='); // Look for "name=value"
		if (pos == -1) continue; // if not found, skip to next
		var argname = pairs[i].substring(0,pos); // Extract the name
		var value = pairs[i].substring(pos+1); // Extract the value
		args[argname] = unescape(value); // Store as a property
	}
	return args; // Return the Object
}
var args = getArgs(); //Get the querystring arguments

//son of suckerfish drop down menus
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);