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("About+Movie+Main","/"+country+"/Oceans13/Home");
		break;
	
	case "ABOUT": //getURL("javascript:track('ABOUT');");
		_hbPageView("About+Movie+Main","/"+country+"/Oceans13/About");
		break;
		
	case "SYNOPSIS": //getURL("javascript:track('SYNOPSIS');");
		_hbPageView("Synopsis","/"+country+"/Oceans13/About/Story");
		break;	
		
	case "PRODNOTES": //getURL("javascript:track('PRODNOTES');");
		_hbPageView("Production","/"+country+"/Oceans13/About/Production+Notes");
		break;		

	case "MEDIA": //getURL("javascript:track('MEDIA');");
		_hbPageView("Trailer","/"+country+"/Oceans13/Multimedia/Trailers");
		break;
	
	case "TRAILER": //getURL("javascript:track('TRAILER');");
		_hbPageView("trailer","/"+country+"/Oceans13/Multimedia/Trailers");
		break;
		
		
	case "TVSPOTS": //getURL("javascript:track('TVSPOTS');");
		_hbPageView("Tv+Spots","/"+country+"/Oceans13/Multimedia/Trailers");
		break;	

	case "CAST": //getURL("javascript:track('CAST');");
		_hbPageView("Cast+Page","/"+country+"/Oceans13/Cast");
		break;	
		
	case "FILMMAKERS": //getURL("javascript:track('FILMMAKERS');");
		_hbPageView("Crew+Page","/"+country+"/Oceans13/Crew");
		break;				
	
	case "PHOTOS": //getURL("javascript:track('PHOTOS');");
		_hbPageView("Photos+Main","/"+country+"/Oceans13/Multimedia/Photo+Gallery");
		break;
	
	case "DOWNLOADS": //getURL("javascript:track('DOWNLOADS');");
		_hbPageView("Downloads+Main","/"+country+"/Oceans13/Downloads");
		break;
		
	case "wallpapers": //getURL("javascript:track('wallpapers');");
		_hbPageView("Wallpapers+Main","/"+country+"/Oceans13/Downloads/Wallpapers");
		break;
	
	
	case "screen saver": //getURL("javascript:track('screen saver');");
		_hbPageView("Screensaver+Main","/"+country+"/Oceans13/Downloads/Screensavers");
		break;
	
	
	case "ICONS": //getURL("javascript:track('ICONS');");
		_hbPageView("Icons+Main","/"+country+"/Oceans13/Downloads/Buddy+Icons");
		break;
		
	case "POSTER": //getURL("javascript:track('POSTER');");
		_hbPageView("Poster","/"+country+"/Oceans13/Downloads/Poster");
		break;
	
	case "REGISTER FOR UPDATES": //getURL("javascript:track('REGISTER FOR UPDATES');");
		_hbPageView("Registration+Main","/"+country+"/Oceans13/Registration");
		break;

	case "PROMOTIONS":;
		_hbPageView("Promotions","/"+country+"/Oceans13/Promotions");
		break;

	case "SHOWTIMES": //getURL("javascript:track('SHOWTIMES');");
		_hbPageView("Showtimes+Tickets","/"+country+"/Oceans13/Showtimes+Tickets");
		break;
		
	case "PARTNERS": //getURL("javascript:track('PARTNERS');");
		_hbPageView("Partners","/"+country+"/Oceans13/Partners");
		break;	

	case "MYSPACE": //getURL("javascript:track('MYSPACE');");
		_hbPageView("MySpace","/"+country+"/Oceans13/MySpace");
		break;
		
	case "SOUNDTRACK": //getURL("javascript:track('SOUNDTRACK');");
		_hbPageView("Soundtrack","/"+country+"/Oceans13/Soundtrack");
		break;	
		
		//*************************CHARACTERS*******************
	case "RUSTY":
		_hbPageView("Rusty+Ryan","/"+country+"/Oceans13/Character/Rusty+Ryan");
		break;	

	case "DANNY":
		_hbPageView("Danny+Ocean","/"+country+"/Oceans13/Character/Danny+Ocean");
		break;

	case "YEN":
		_hbPageView("Yen","/"+country+"/Oceans13/Character/Yen");
		break;

	case "FRANK":
		_hbPageView("Frank+Catton","/"+country+"/Oceans13/Character/Frank+Catton");
		break;

	case "BASHER":
		_hbPageView("Basher+Tarr","/"+country+"/Oceans13/Character/Basher+Tarr");
		break;

	case "ABIGAIL":
			_hbPageView("Abigail+Sponder","/"+country+"/Oceans13/Character/Abigail+Sponder");
			break;

	case "TERRY":
			_hbPageView("Terry+Benedict","/"+country+"/Oceans13/Character/Terry+Benedict");
			break;

	case "SAUL":
		_hbPageView("Saul+Bloom","/"+country+"/Oceans13/Character/Saul+Bloom");
		break;

	case "WILLIE":
		_hbPageView("Willie+Banks","/"+country+"/Oceans13/Character/Willie+Banks");
		break;
		
	case "REUBEN":
		_hbPageView("Reuben+Tishkoff","/"+country+"/Oceans13/Character/Reuben+Tishkoff");
		break;	
		
	case "LINUS":
		_hbPageView("Linus+Caldwell","/"+country+"/Oceans13/Character/Linus+Caldwell");
		break;	
		
	case "VIRGILTURK":
		_hbPageView("Virgil+Turk","/"+country+"/Oceans13/Character/Virgil+Turk");
		break;	
		
	case "LIVINGSTON":
		_hbPageView("Livingston+Dell","/"+country+"/Oceans13/Character/Livingston+Dell");
		break;	

	default:
		hbDebug('not tracking properly: [' + key + ']');
		break;
	}
}

