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);
	 //alert(key);
	
	hbDebug(key + " " + country);

	switch(key)
	{
	case "ABOUT":
		_hbPageView("About","/"+country+"/GetSmart/About");
		break;
		
	case "SYNOPSIS": 
		_hbPageView("Story","/"+country+"/GetSmart/About/Story");
		break;	
		
	case "PNOTES": 
		_hbPageView("Production","/"+country+"/GetSmart/About/Production+Notes");
		break;		

	case "CAST": 
		_hbPageView("Cast","/"+country+"/GetSmart/Cast");
		break;
	
	case "FILMMAKERS":
		_hbPageView("Filmmakers","/"+country+"/GetSmart/Filmmakers");
		break;
			
	case "DOWNLOADS":
		_hbPageView("Downloads","/"+country+"/GetSmart/Downloads");
		break;
			
	case "WALLPAPERS":
		_hbPageView("Wallpapers","/"+country+"/GetSmart/Downloads/Wallpapers");
		break;
		
	case "WALLPAPER_ONESHEET":
		_hbPageView("Wallpaper+Onesheet","/"+country+"/GetSmart/Downloads/Wallpapers/Onesheet");
		break;
		
	case "WALLPAPER_2":
		_hbPageView("Wallpaper+2","/"+country+"/GetSmart/Downloads/Wallpapers/2");
		break;
		
	case "WALLPAPER_3":
		_hbPageView("Wallpaper+3","/"+country+"/GetSmart/Downloads/Wallpapers/3");
		break;
		
	case "WALLPAPER_4":
		_hbPageView("Wallpaper+4","/"+country+"/GetSmart/Downloads/Wallpapers/4");
		break;
		
	case "WALLPAPER_5":
		_hbPageView("Wallpaper+5","/"+country+"/GetSmart/Downloads/Wallpapers/5");
		break;
		
	case "WALLPAPER_6":
		_hbPageView("Wallpaper+6","/"+country+"/GetSmart/Downloads/Wallpapers/6");
		break;
		
	case "WALLPAPER_7":
		_hbPageView("Wallpaper+7","/"+country+"/GetSmart/Downloads/Wallpapers/7");
		break;
		
	case "WALLPAPER_8":
		_hbPageView("Wallpaper+8","/"+country+"/GetSmart/Downloads/Wallpapers/8");
		break;
		
	case "WALLPAPER_9":
		_hbPageView("Wallpaper+9","/"+country+"/GetSmart/Downloads/Wallpapers/9");
		break;
		
	case "WALLPAPER_10":
		_hbPageView("Wallpaper+10","/"+country+"/GetSmart/Downloads/Wallpapers/10");
		break;
		
	case "AIMICONS":
		_hbPageView("Aim+Icons","/"+country+"/GetSmart/Downloads/AimIcons");
		break;
		
	case "AIM_1":
		_hbPageView("Aim+1","/"+country+"/GetSmart/Downloads/AimIcons/1");
		break;
		
	case "AIM_2":
		_hbPageView("Aim+2","/"+country+"/GetSmart/Downloads/AimIcons/2");
		break;
		
	case "AIM_3":
		_hbPageView("Aim+3","/"+country+"/GetSmart/Downloads/AimIcons/3");
		break;
		
	case "AIM_4":
		_hbPageView("Aim+4","/"+country+"/GetSmart/Downloads/AimIcons/4");
		break;
		
	case "AIM_5":
		_hbPageView("Aim+5","/"+country+"/GetSmart/Downloads/AimIcons/5");
		break;
		
	case "AIM_6":
		_hbPageView("Aim+6","/"+country+"/GetSmart/Downloads/AimIcons/6");
		break;
		
	case "AIM_7":
		_hbPageView("Aim+7","/"+country+"/GetSmart/Downloads/AimIcons/7");
		break;
		
	case "AIM_8":
		_hbPageView("Aim+8","/"+country+"/GetSmart/Downloads/AimIcons/8");
		break;
		
	case "POSTERS":
		_hbPageView("Posters","/"+country+"/GetSmart/Downloads/Posters");
		break;
		
	case "POSTER_1":
		_hbPageView("Poster+1","/"+country+"/GetSmart/Downloads/Posters/1");
		break;
	
	case "POSTER_2":
		_hbPageView("Poster+2","/"+country+"/GetSmart/Downloads/Posters/2");
		break;
			
	case "VIDEOS":
		_hbPageView("Videos","/"+country+"/GetSmart/Videos");
		break;
		
	case "TRAILER":
		_hbPageView("Trailer","/"+country+"/GetSmart/Videos/Trailer");
		break;
			
	case "PHOTOS":
		_hbPageView("Photos","/"+country+"/GetSmart/Photos");
		break;
			
	case "PROMOTIONSPARTNERS":
		_hbPageView("Promotional+Partners","/"+country+"/GetSmart/PromotionalPartners");
		break;
			
	case "AGENTNETWORKS":
		_hbPageView("Become+Agent","/"+country+"/GetSmart/BecomeAgent");
		break;
			
	case "MOBILE":
		_hbPageView("Mobile","/"+country+"/GetSmart/Mobile");
		break;
			
	case "TICKETS":
		_hbPageView("Tickets","/"+country+"/GetSmart/Tickets");
		break;
		
	case "SHOEPHONE":
		_hbPageView("Shoephone","/"+country+"/GetSmart/Shoephone");
		break;
		
	case "FACEBOOK":
		_hbPageView("Facebook","/"+country+"/GetSmart/Facebook");
		break;
		
	case "TICKETSPOPUP":
		_hbPageView("Tickets+Popup","/"+country+"/GetSmart/TicketsPopup");
		break;
		
	case "REGISTER":
		_hbPageView("Register","/"+country+"/GetSmart/Register");
		break;
		
	case "WORLDWIDERELEASE":
		_hbPageView("Worldwide+Release+Dates","/"+country+"/GetSmart/WorldwideReleaseDates");
		break;
				
	default:
		hbDebug('not tracking properly: [' + key + ']');
		break;
	}
}
