function showPhone ()
	{
	  document.getElementById('popupbg').style.display = "block";
		document.getElementById('mobile-waldo').style.display = "block";
		t1 = new Tween(document.getElementById('mobile-waldo').style,'bottom',Tween.regularEaseOut,-300,-125,1,'px');	
		t1.addListener(c);
		t1.start();
		
	}
	
	function doStartup()
	{
		var cookieId = "dispatch-071408";
		var showDis = getCookie(cookieId);

		if (showDis != "shown")
		showEmail();	

		//setTimeout(2000,"showLeftMenu()");
		setCookie(cookieId,"shown",15);
	}
	
	function showLeftMenu ()
	{	    
		var t1 = new Tween(document.getElementById('box-menu').style,'bottom',Tween.regularEaseOut,-300,-125,1,'px');	
		t1.start();
	}
	
	var c = new Object();
	c.onMotionFinished = function(){
	 
	  var showPhoneTime = 10000;//((Math.random()*1000)*10)+5;
	  
	  setTimeout("hidePhone()",showPhoneTime);
	  
		  
	};
	
	function hidePhone ()
	{
		t1 = new Tween(document.getElementById('mobile-waldo').style,'bottom',Tween.regularEaseOut,-125,-300,1,'px');	
		t1.addListener(d);
		t1.start();
	}
	
        var chatAlertShown = false;
    
    function showChatAlert ()
    {
    
    	if (!chatAlertShown)
    	{
    	//Dialog.alert("You've received an IM from Waldo", {className: winClassName, id: "chat-alert", width:300, height:100, okLabel: "OK", ok:function(win) {showChat(); return true;}}); 
    
    document.getElementById('chat-alert').style.display = "block";
		t1 = new Tween(document.getElementById('chat-alert').style,'bottom',Tween.elasticEaseInOut,-100,15,5,'px');	
		
		t1.start();
			chatAlertShown = true;
		}
    }
    
     function hideChatAlert ()
    {
		t1 = new Tween(document.getElementById('chat-alert').style,'bottom',Tween.elasticEaseInOut,15,-100,5,'px');	
		
		t1.start();
    }
    
    var lastmenuid = 0;
    var lastmenu = "box-content-main-0";
    
    function showMenu (menuid)
    {
		lastmenuimg = "box-menu-all";// + menuid;
     	lastmenupath = "img/menu/menu-" + menuid + ".gif";
     	document.getElementById(lastmenuimg).src = lastmenupath;
     	
    }
    
    function switchContent (menuid)
    {
    
    
    	document.getElementById("box-content").style.display = "block";
    
    	document.getElementById("popupbg").style.display = "none";
    	
    	if (lastmenu)
        	document.getElementById(lastmenu).style.display = "none"; 
        
        document.getElementById("box-content-main-" + lastmenuid).style.display = "none"; 
        document.getElementById("box-title-" + lastmenuid).style.display = "none"; 
        
      
        lastmenuid = menuid;
      
     	document.getElementById("box-content-main-" + lastmenuid).style.display = "block";
     	document.getElementById("box-title-" + lastmenuid).style.display = "block";
     	
     	
    }
    
    
    function hideLastContent ()
    {
    	document.getElementById(lastpopup).style.display = "none";
    	document.getElementById("popupbg").style.display = "none";
    	
    }
    
    var lastpopup;
    
    function showPopupById (menuid)
    {
    
    	if (lastpopup)
        	document.getElementById(lastpopup).style.display = "none"; 
        	
		lastpopup = menuid;
		document.getElementById("popupbg").style.display = "block";		
 	     	document.getElementById(lastpopup).style.display = "block";

        if (menuid == "box-map")
        {
        	document.getElementById("box-map").innerHTML = '<div class="stripes-rule">&nbsp;</div><iframe width="600" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=117466190200698039569.00044d43c43bc5e63b662&amp;ll=51.500152,-0.126236&amp;spn=18.316648,175.693354&amp;output=embed&amp;s=AARTsJpB0QrsHwlMlYsO375LB63vx6WOwA"></iframe><br /><small><a href="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=117466190200698039569.00044d43c43bc5e63b662&amp;ll=51.500152,-0.126236&amp;spn=18.316648,175.693354&amp;source=embed" style="color:#0000FF;text-align:left" target="_new">View Larger Map and Add Your Sightings!</a></small><div class="stripes-rule">&nbsp;</div>';
        }
        

    }
    
    
    var lastGameScene = "box-game-gluttons";

    function showGameScene(gameScene,tab)
    {
    	document.getElementById(lastGameScene).style.display = "none";
    	document.getElementById(gameScene).style.display = "block";
    	lastGameScene = gameScene;

	document.getElementById("game-header-tab").src="classic/header" + tab + ".png";
    }
    
    function lightMenu (menuid)
    {
    
    }
    
    function showGame ()
    {
    	
    	showPopupById("box-game");
    	
    
    }
    
    
    
      function showEmail ()
    {
    	
    	
    	showPopupById("box-email-content");
    	
    }
    
    function hideEmail ()
    {
    	
    	document.getElementById("box-email-content").style.display = "none";
    	document.getElementById("box-email").style.display = "none";
    	document.getElementById("popupbg").style.display = "none";
    
    }
    
    
    
      function hideGame ()
    {
    	document.getElementById("box-content").style.display = "block";
    	document.getElementById("box-menu").style.display = "block";
    	document.getElementById("box-game").style.display = "none";
    
    	document.getElementById("popupbg").style.display = "none";
    
    }
    

function setCookie(NameOfCookie, value, expiredays) 
{

// Three variables are used to set the new cookie. 
// The name of the cookie, the value to be stored,
// and finally the number of days until the cookie expires.
// The first lines in the function convert 
// the number of days to a valid date.

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

// The next line stores the cookie, simply by assigning 
// the values to the "document.cookie" object.
// Note the date is converted to Greenwich Mean time using
// the "toGMTstring()" function.

document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0) 
{ 

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 

// Our cookie was set. 
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 

// Our cookie was not set. 
// The value "null" is returned from the function.

}
