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);

	switch(key)
	{
	case "Enchanted+Video+Game+index":
		_hbPageView("Home",key);
		break;

	case "UK":
		_hbPageView("UK+Home",key);
		break;

	case "FRANCE":
		_hbPageView("FRANCE+Home",key);
		break;

	case "ITALIA":
		_hbPageView("ITALIA+Home",key);
		break;

	case "DEUTSCHLAND":
		_hbPageView("DEUTSCHLAND+Home",key);
		break;

	case "ESPANIA":
		_hbPageView("ESPANIA+Home",key);
		break;

	case "NEDERLANDS":
		_hbPageView("NEDERLANDS+Home",key);
		break;
	
	case "Enchanted+Video+Game+Trailer+index": 
		_hbPageView("View+Game+Trailer",key);
		break;

	case "Enchanted+Video+Game+Available+Now+index": 
		_hbPageView("Available+Now",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+index": 
		_hbPageView("Get+Enchanted",key);
		break;

	case "Enchanted+Video+Game+Giselles+Room+index": 
		_hbPageView("Decorate+Giselle's+Room",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+index": 
		_hbPageView("Wireless+Trading+Party",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Hints+Tips+index": 
		_hbPageView("Hints+and+Tips",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Hints+Tips+Tips+1+index": 
		_hbPageView("Tip+1",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Hints+Tips+Tips+2+index": 
		_hbPageView("Tip+2",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Hints+Tips+Tips+3+index": 
		_hbPageView("Tip+3",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Hints+Tips+Tips+4+index": 
		_hbPageView("Tip+4",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Hints+Tips+Tips+5+index": 
		_hbPageView("Tip+5",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Hints+Tips+Tips+6+index": 
		_hbPageView("Tip+6",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+index": 
		_hbPageView("Gallery",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+1+index": 
		_hbPageView("Screenshot+1",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+2+index": 
		_hbPageView("Screenshot+2",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+3+index": 
		_hbPageView("Screenshot+3",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+4+index": 
		_hbPageView("Screenshot+4",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+5+index": 
		_hbPageView("Screenshot+5",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+6+index": 
		_hbPageView("Screenshot+6",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+7+index": 
		_hbPageView("Screenshot+7",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+8+index": 
		_hbPageView("Screenshot+8",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+9+index": 
		_hbPageView("Screenshot+9",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Gallery+Screenshot+10+index": 
		_hbPageView("Screenshot+10",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Trailers+index": 
		_hbPageView("Trailers",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Trailers+Game+Trailer+index": 
		_hbPageView("Game+Trailer",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Trailers+Gameplay+Trailer+index": 
		_hbPageView("Gameplay+Trailer",key);
		break;

	case "Enchanted+Video+Game+Get+Enchanted+Trailers+Movie+Trailer+index": 
		_hbPageView("Movie+Trailer",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+index": 
		_hbPageView("Downloads",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+How+To+WT+Party+index": 
		_hbPageView("How+To+Wireless+Trading+Party",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+How+To+Wireless+Trade+index": 
		_hbPageView("How+To+Wireless+Trading",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+Wireless+Trade+Sign+index": 
		_hbPageView("Wireless+Trading+Sign",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+Party+Favor+Animated+Giselle+index": 
		_hbPageView("Party+Favor+Animated+Giselle",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+Party+Favor+Live+Action+Giselle+index": 
		_hbPageView("Party+Favor+Live+Action+Giselle",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+Party+Favor+Enchanted+Images+index": 
		_hbPageView("Party+Favor+Enchanted+Images",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Downloads+Party+Favor+Cheat+Code+index": 
		_hbPageView("Party+Favor+Cheat+Code",key);
		break;

	case "Enchanted+Video+Game+Wireless+Trade+Party+Invitation+index": 
		_hbPageView("Invitation",key);
		break;

	default:
		hbDebug('not tracking properly: [' + key + ']');
		break;
	}
}
