function popWindow( url, width, height, windowName ){
    //get center coords
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	
	if (screen.height <= 600) {
		paramStr = 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=520,left=' + left + ',top=' + top;
	 } else {
		paramStr = 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
	 }
	 
	 window.open(url, windowName, paramStr);
}

function loadImg(imgName, imgSrc) {
    if (!loadFlag) {
        eval(imgName + ' = new Image()');
        eval(imgName + '.src = "' + imgSrc + '"');
        return imgName;
    }
}

function swapImg(imgName, imgObject) {
    if (loadFlag) {
        document.getElementById(imgName).src = eval(imgObject + '.src');
    }
}

///////////////////////////////////////////
// hitbox stuff
///////////////////////////////////////////

// how to turn on debug messages:
// run the site in a browser and paste this into the location bar:
// javascript:alert(debugFlag=true);
// you should see a popup that says "true"
var debugFlag = false;
function hbDebug(message)
{
	if (debugFlag == true)
	{
		alert(message);
	}
}

// this function gets called from flash to do hitbox and any other tracking.
// basically if you want to track any of these sections from flash you can just
// copy paste the getURL() call from any of these right into the on(release) of 
// the flash button that's linking to that section.
// the strings were all taken directly from Meet the Robinsons HBX strings v1(teaser).xls
function track(key,country)
{
	 //alert(country);
	
	hbDebug(key + " " + country);

	switch(key)
	{
	case "HOME": //getURL("javascript:track('HOME');");
		_hbPageView("Home","/"+country+"/The+Bucket+List/Home");
		break;
	
	case "ABOUT": //getURL("javascript:track('ABOUT');");
		_hbPageView("About+Movie+Main","/"+country+"/The+Bucket+List/About");
		break;
		
	case "SYNOPSIS": //getURL("javascript:track('SYNOPSIS');");
		_hbPageView("Synopsis","/"+country+"/The+Bucket+List/About/Story");
		break;	
		
	case "PNOTES": //getURL("javascript:track('PNOTES');");
		_hbPageView("Production","/"+country+"/The+Bucket+List/About/Production+Notes");
		break;		

	case "VIDEOS": //getURL("javascript:track('VIDEOS');");
		_hbPageView("Multimedia","/"+country+"/The+Bucket+List/Multimedia/");
		break;
	
	case "TRAILER": //getURL("javascript:track('TRAILER');");
		_hbPageView("trailer","/"+country+"/The+Bucket+List/Multimedia/Trailers");
		break;
		
		
	case "TVSPOTS": //getURL("javascript:track('TVSPOTS');");
		_hbPageView("Tv+Spots","/"+country+"/The+Bucket+List/Multimedia/Trailers");
		break;	

	case "CAST": //getURL("javascript:track('CAST');");
		_hbPageView("Cast+Page","/"+country+"/The+Bucket+List/Cast");
		break;	
		
	case "CREW": //getURL("javascript:track('CREW');");
		_hbPageView("Crew+Page","/"+country+"/The+Bucket+List/Crew");
		break;				
	
	case "PHOTOS": //getURL("javascript:track('PHOTOS');");
		_hbPageView("Photos+Main","/"+country+"/The+Bucket+List/Multimedia/Photo+Gallery");
		break;
	
	case "DOWNLOADS": //getURL("javascript:track('DOWNLOADS');");
		_hbPageView("Downloads+Main","/"+country+"/The+Bucket+List/Downloads");
		break;
		
	case "WALLPAPERS": //getURL("javascript:track('WALLPAPERS');");
		_hbPageView("Wallpapers+Main","/"+country+"/The+Bucket+List/Downloads/Wallpapers");
		break;
	
	
	case "SCREENSAVER": //getURL("javascript:track('SCREENSAVER');");
		_hbPageView("Screensaver+Main","/"+country+"/The+Bucket+List/Downloads/Screensavers");
		break;
	
	
	case "AIMICONS": //getURL("javascript:track('AIMICONS');");
		_hbPageView("Icons+Main","/"+country+"/The+Bucket+List/Downloads/Buddy+Icons");
		break;
		
	case "POSTERS": //getURL("javascript:track('POSTERS');");
		_hbPageView("Poster","/"+country+"/The+Bucket+List/Downloads/Poster");
		break;
	
	case "REGISTER FOR UPDATES": //getURL("javascript:track('REGISTER FOR UPDATES');");
		_hbPageView("Registration+Main","/"+country+"/The+Bucket+List/Registration");
		break;

	case "PROMOTIONS":;
		_hbPageView("Promotions","/"+country+"/The+Bucket+List/Promotions");
		break;

	case "TICKETS": //getURL("javascript:track('TICKETS');");
		_hbPageView("Tickets+Showtimes","/"+country+"/The+Bucket+List/Tickets+Showtimes");
		break;

		
	
	default:
		hbDebug('not tracking properly: [' + key + ']');
		break;
	}
}
