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)
{
	// alert(key);
	
	hbDebug(key);

	switch(key)
	{
	case "HOME": //getURL("javascript:track('HOME');");
		hitbox.Set_hbPageView("main+home+page","/meet+the+robinsons/information/home+page");
		break;
	
	case "Non flash page": //getURL("javascript:track('Non flash page');");
		hitbox.Set_hbPageView("no+flash","/meet+the+robinsons/information/no+flash");
		break;
	
	case "TRAILER": //getURL("javascript:track('TRAILER');");
		hitbox.Set_hbPageView("trailer","/meet+the+robinsons/multimedia/trailers");
		break;
		
	case "POLICY": //getURL("javascript:track('POLICY');");
		hitbox.Set_hbPageView("policy","/meet+the+robinsons/multimedia/trailers");
		break;	
		
	
	case "ABOUT": //getURL("javascript:track('ABOUT');");
		hitbox.Set_hbPageView("about+movie","/meet+the+robinsons/about");
		break;
		
	case "SYNOPSIS": //getURL("javascript:track('SYNOPSIS');");
		hitbox.Set_hbPageView("story","/meet+the+robinsons/about/story");
		break;	
		
	case "ECARD": //getURL("javascript:track('ECARD');");
		hitbox.Set_hbPageView("send+main","/meet+the+robinsons/send+friend");
		break;	
		
	case "VDAY": //getURL("javascript:track('ECARD');");
		hitbox.Set_hbPageView("send+main","/meet+the+robinsons/send+friend+vday");
		break;	
		
	case "ECARDSEND": //getURL("javascript:track('ECARDSEND');");
		hitbox.Set_hbPageView("send+button","/meet+the+robinsons/send+friend");
		break;	
		
	case "SUPERBOWL": //getURL("javascript:track('HOMEVIDEO');");
		hitbox.Set_hbPageView("superbowl+trailer","/meet+the+robinsons/multimedia/trailers");
		break;	
		
	case "VIDEOS": //getURL("javascript:track('VIDEOPAGE');");
		hitbox.Set_hbPageView("video+main","/meet+the+robinsons/multimedia");
		break;		
		
	case "Trailer5": //getURL("javascript:track('Trailer5');");
		hitbox.Set_hbPageView("Trailer5","/meet+the+robinsons/multimedia/trailers");
		break;	
		
		
	case "GenericPolicy": //getURL("javascript:track('GenericPolicy');");
		hitbox.Set_hbPageView("GenericPolicy","/meet+the+robinsons/multimedia/trailers");
		break;	
		
		case "MURALMANIA": //getURL("javascript:track('MURALMANIA');");
		hitbox.Set_hbPageView("mural+mania","/meet+the+robinsons/interactive+content/games");
		break;	
		
		
	case "TIMETRAVELER": //getURL("javascript:track('TIMETRAVELER');");
		hitbox.Set_hbPageView("time+traveler","/meet+the+robinsons/interactive+content/games");
		break;	
		
	case "SUDOKU": //getURL("javascript:track('SUDOKU');");
		hitbox.Set_hbPageView("sudoku","/meet+the+robinsons/interactive+content/games");
		break;	
			
	case "QUIZ": //getURL("javascript:track('PERSONALITYQUIZ');");
		hitbox.Set_hbPageView("personality+quiz","/meet+the+robinsons/interactive+content/games");
		break;				

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