if (document.images)
{

	wifi_button_on = new Image();
	wifi_button_on.src = "images/buttons/on/wifi.png";

	yelp_button_on = new Image();
	yelp_button_on.src = "images/buttons/on/yelp.png";

	facebook_button_on = new Image();
	facebook_button_on.src = "images/buttons/on/facebook.png";
	
	youtube_button_on = new Image();
	youtube_button_on.src = "images/buttons/on/youtube.png";

	twitter_button_on = new Image();
	twitter_button_on.src = "images/buttons/on/twitter.png";

	no_food_button_on = new Image();
	no_food_button_on.src = "images/buttons/on/no_food.png";
	
	socks_button_on = new Image();
	socks_button_on.src = "images/buttons/on/socks.png";

}


function changer(name, state) {
	document.images[name].src = "images/buttons/" + state + "/" + name + ".png";
}


// configuration
var IMG_FRAME_WIDTH = 117;	// width of each frame
var IMG_FRAME_HEIGHT = 110;	// height of each frame
var IMG_FRAME_COUNT = 6;	// # of frames
var IMG_SHOW_SPEED = 80;	// show speed
var IMG_HIDE_SPEED = 70;	// hide speed

// do not configure
var IMG_FIRST_FRAME_X = 0;
var	IMG_LAST_FRAME_X = -IMG_FRAME_WIDTH * (IMG_FRAME_COUNT-1);

var imgShowTimer = new Array();
var imgHideTimer = new Array();	
var imgFirstFrameX = new Array();
var imgLastFrameX  = new Array();
var imgDiv = new Array();
var imgFrameY = new Array();

for(i=0; i<IMG_FRAME_COUNT; i++){
	imgLastFrameX[i] = IMG_LAST_FRAME_X;
}

function showImage(id) {
	imgFirstFrameX[id] = imgFirstFrameX[id] - IMG_FRAME_WIDTH;
	imgDiv[id].style.backgroundPosition = '' + imgFirstFrameX[id] + 'px ' + imgFrameY[id] + 'px';

	if(imgFirstFrameX[id] <= -IMG_FRAME_WIDTH * (IMG_FRAME_COUNT-1)){
		window.clearInterval(imgShowTimer[id]);
	}

}

function hideImage(id) {
	imgLastFrameX[id] = imgLastFrameX[id] + IMG_FRAME_WIDTH;
	imgDiv[id].style.backgroundPosition = ''+imgLastFrameX[id]+'px ' + imgFrameY[id] + 'px';
	
	if(imgLastFrameX[id] >= 0){
		window.clearInterval(imgHideTimer[id]);
	}

}


function showImageTimerFunct(imgID, imgFramePositionY, id) {
	imgDiv[id]=document.getElementById(imgID);
	imgFrameY[id]=imgFramePositionY;
	window.clearInterval(imgHideTimer[id]);
	imgFirstFrameX[id] = IMG_FIRST_FRAME_X;
	imgShowTimer[id] = window.setInterval(function() { showImage(id); },IMG_SHOW_SPEED);
  ballSound.play()
}

function hideImageTimerFunct(imgID, imgFramePositionY, id) {
	imgDiv[id]=document.getElementById(imgID);
	imgFrameY[id]=imgFramePositionY;
	window.clearInterval(imgShowTimer[id]);
	imgLastFrameX[id] = -IMG_FRAME_WIDTH * (IMG_FRAME_COUNT-1);
	imgHideTimer[id] = window.setInterval(function() { hideImage(id); },IMG_HIDE_SPEED);
}



var ballSound = null;
var ballPopSound = null;

function init() {
  ballSound = soundManager.createSound({
   id: 'ballSound',
   url: 'audio/fingerplop.mp3',
   volume: 50,
   multiShot: true,
   autoLoad: true
  });
    
  ballPopSound = soundManager.createSound({
   id: 'ballPopSound',
   url: 'audio/fingerplop2.mp3',
   volume: 50,
   multiShot: true,
   autoLoad: true
  });

}

soundManager.waitForWindowLoad = true; //avm
soundManager.flashVersion = 9;
soundManager.url = 'swf/';
soundManager.useHighPerformance = true;
soundManager.debugMode = false; // disable debug mode
soundManager.defaultOptions.multiShot = true;

soundManager.onload = function() {
  // soundManager is ready to use (create sounds and so on)
  init();
}







///////
// menu
///////

// contents for menu2
var menu1=new Array();
menu1[0]='<a class="dropmenu" href="index.php?page=party_group_packages_faqs" onmouseover="changer(\'faqs\', \'on\')" onmouseout="changer(\'faqs\', \'off\')"><img border="0" src="images/buttons/off/faqs.png" width="167" height="21" name="faqs" alt="Party & Group Packages FAQs"></a>';
menu1[1]='<a class="dropmenu" href="index.php?page=party_group_packages_rules" onmouseover="changer(\'rules\', \'on\')" onmouseout="changer(\'rules\', \'off\')"><img border="0" src="images/buttons/off/rules.png" width="167" height="21" name="rules" alt="Party & Group Packages Rules"></a>';
menu1[2]='<a class="dropmenu" href="index.php?page=party_group_packages_prices" onmouseover="changer(\'prices\', \'on\')" onmouseout="changer(\'prices\', \'off\')"><img border="0" src="images/buttons/off/prices.png" width="167" height="21" name="prices" alt="Party & Group Packages Prices"></a>';
menu1[3]='<a class="dropmenu" href="index.php?page=printable_invitations" onmouseover="changer(\'printable_invitations\', \'on\')" onmouseout="changer(\'printable_invitations\', \'off\')"><img border="0" src="images/buttons/off/printable_invitations.png" width="167" height="21" name="printable_invitations" alt="Printable Invitations"></a>';

// contents for menu7
var menu7=new Array();
menu7[0]='<a class="dropmenu" href="index.php?page=waiver" onmouseover="changer(\'waiver\', \'on\')" onmouseout="changer(\'waiver\', \'off\')"><img border="0" src="images/buttons/off/waiver.png" width="167" height="21" name="waiver" alt="Waiver"></a>';
menu7[0]='<a class="dropmenu" href="index.php?page=safety_information" onmouseover="changer(\'safety_information\', \'on\')" onmouseout="changer(\'safety_information\', \'off\')"><img border="0" src="images/buttons/off/safety_information.png" width="167" height="21" name="safety_information" alt="Safety Information"></a>';

// contents for menu9
var menu9=new Array();
menu9[0]='<a class="dropmenu" href="index.php?page=about_our_product" onmouseover="changer(\'about_our_product\', \'on\')" onmouseout="changer(\'about_our_product\', \'off\')"><img border="0" src="images/buttons/off/about_our_product.png" width="167" height="21" name="about_our_product" alt="About Our Product"></a>';
menu9[1]='<a class="dropmenu" href="index.php?page=our_playground" onmouseover="changer(\'our_playground\', \'on\')" onmouseout="changer(\'our_playground\', \'off\')"><img border="0" src="images/buttons/off/our_playground.png" width="167" height="21" name="our_playground" alt="Our Playground"></a>';

// contents for menu10
var menu10=new Array();
menu10[0]='<a class="dropmenu" href="index.php?page=hours_directions" onmouseover="changer(\'hours_directions\', \'on\')" onmouseout="changer(\'hours_directions\', \'off\')"><img border="0" src="images/buttons/off/hours_directions.png" width="167" height="21" name="hours_directions" alt="Hours & Driving Directions"></a>';
menu10[1]='<a class="dropmenu" href="index.php?page=investors_opportunities" onmouseover="changer(\'investors_opportunities\', \'on\')" onmouseout="changer(\'investors_opportunities\', \'off\')"><img border="0" src="images/buttons/off/investors_opportunities.png" width="167" height="21" name="investors_opportunities" alt="Investors Opportunities"></a>';
menu10[2]='<a class="dropmenu" href="index.php?page=employment" onmouseover="changer(\'employment\', \'on\')" onmouseout="changer(\'employment\', \'off\')"><img border="0" src="images/buttons/off/employment.png" width="167" height="21" name="employment" alt="Employment"></a>';
		
var menuwidth='167px'; //default menu width
var menubgcolor='#d9edf6';  //menu bgcolor
var disappeardelay=250;  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes"; //hide menu when user clicks within menu?

// no further editting needed
var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if (ie4||ns6)
	document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';" onmouseover="clearhidemenu()" onmouseout="dynamichide(event)"></div>');

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){

	if (ie4||ns6){
		dropmenuobj.style.left=dropmenuobj.style.top="-500px";
	}
	
	if (menuwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style;
		dropmenuobj.widthobj.width=menuwidth;
	}
	
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
		obj.visibility=visible;
	}
	else if (e.type=="click"){
		obj.visibility=hidden;
	}

}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge){

	var edgeoffset=0;

	if (whichedge=="rightedge"){
	var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
	dropmenuobj.contentmeasure=dropmenuobj.offsetWidth;

	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth;
}
else{
	var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset;
	var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
	dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
	
	return clickreturnvalue()
}
	
function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
	document.onclick=hidemenu
