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.
function track(key)
{
	hbDebug(key);

	switch(key)
	{
	case "HOME": //getURL("javascript:track('HOME');");
		hitbox.Set_hbPageView("home","/tmnt/information/home+page");
		break;
	
	case "Non flash page": //getURL("javascript:track('Non flash page');");
		hitbox.Set_hbPageView("no+flash","/tmnt/information/no+flash");
		break;
	
	case "View TEASER TRAILER": //getURL("javascript:track('View TEASER TRAILER');");
		hitbox.Set_hbPageView("teaser+trailer","/tmnt/multimedia/trailers");
		break;
		
	case "MEDIA": //getURL("javascript:track('MEDIA');");
		hitbox.Set_hbPageView("trailer","/tmnt/multimedia/trailers");
		break;
	
	case "TRAILER": //getURL("javascript:track('TRAILER');");
		hitbox.Set_hbPageView("trailer","/tmnt/multimedia/trailers");
		break;
		
		
	case "FILM CLIPS": //getURL("javascript:track('FILM CLIPS');");
		hitbox.Set_hbPageView("film+clips","/tmnt/multimedia/trailers");
		break;	
	
	case "ABOUT": //getURL("javascript:track('ABOUT');");
		hitbox.Set_hbPageView("about+movie+main","/tmnt/about");
		break;
		
	case "SYNOPSIS": //getURL("javascript:track('SYNOPSIS');");
		hitbox.Set_hbPageView("synopsis","/tmnt/about/story");
		break;	
		
	case "PRODNOTES": //getURL("javascript:track('PRODNOTES');");
		hitbox.Set_hbPageView("production","/tmnt/about/prod+notes");
		break;	
		
		
	case "CAST": //getURL("javascript:track('CAST');");
		hitbox.Set_hbPageView("cast+page","/tmnt/about/cast");
		break;	
		
	case "CREW": //getURL("javascript:track('CREW');");
		hitbox.Set_hbPageView("crew+page","/tmnt/about/crew");
		break;				
	
	case "PHOTOS": //getURL("javascript:track('PHOTOS');");
		hitbox.Set_hbPageView("photos+main","/tmnt/multimedia/photo+galleries");
		break;
	
	case "DOWNLOADS": //getURL("javascript:track('DOWNLOADS');");
		hitbox.Set_hbPageView("downloads+main","/tmnt/downloads");
		break;
		
	case "wallpapers": //getURL("javascript:track('wallpapers');");
		hitbox.Set_hbPageView("wallpapers+page","/tmnt/downloads/wallpapers");
		break;
	
	case "> wp 1 (all sizes)": //getURL("javascript:track('> wp 1 (all sizes)');");
		hitbox.Set_hbPageView("wp1","/tmnt/downloads/wallpapers");
		break;
	
	case "> wp 2 (all sizes)": //getURL("javascript:track('> wp 2 (all sizes)');");
		hitbox.Set_hbPageView("wp2","/tmnt/downloads/wallpapers");
		break;
	
	case "> wp 3 (all sizes)": //getURL("javascript:track('> wp 3 (all sizes)');");
		hitbox.Set_hbPageView("wp3","/tmnt/downloads/wallpapers");
		break;
	
	case "> wp 4 (all sizes)": //getURL("javascript:track('> wp 4 (all sizes)');");
		hitbox.Set_hbPageView("wp4","/tmnt/downloads/wallpapers");
		break;
	
	case "> wp 5 (all sizes)": //getURL("javascript:track('> wp 5 (all sizes)');");
		hitbox.Set_hbPageView("wp5","/tmnt/downloads/wallpapers");
		break;
	
	case "> wp 6 (all sizes)": //getURL("javascript:track('> wp 6 (all sizes)');");
		hitbox.Set_hbPageView("wp6","/tmnt/downloads/wallpapers");
		break;
	
	case "screen saver": //getURL("javascript:track('screen saver');");
		hitbox.Set_hbPageView("screensaver+main","/tmnt/downloads/screensavers");
		break;
	
	case "> download screensaver": //getURL("javascript:track('> download screensaver');");
		hitbox.Set_hbPageView("download+ss","/tmnt/downloads/screensavers");
		break;
	
	case "Icons": //getURL("javascript:track('Icons');");
		hitbox.Set_hbPageView("icons+page","/tmnt/downloads/icons");
		break;
	
	case "> download icons": //getURL("javascript:track('> download icons');");
		hitbox.Set_hbPageView("download+icons","/tmnt/downloads/icons");
		break;
	
	case "REGISTER FOR UPDATES": //getURL("javascript:track('REGISTER FOR UPDATES');");
		hitbox.Set_hbPageView("registration+main","/tmnt/registration");
		break;
	
	case "RSS Feed": //getURL("javascript:track('RSS Feed');");
		hitbox.Set_hbPageView("rss+feed","/tmnt/information/rss");
		break;
	
	case "WORLDWIDE REL DATES": //getURL("javascript:track('WORLDWIDE REL DATES');");
		hitbox.Set_hbPageView("worldwide+dates","/tmnt/information/release+dates");
		break;
		
	case "Ipod": //getURL("javascript:track('Ipod');");
		hitbox.Set_hbPageView("ipod+download","/tmnt/multimedia/trailers/ipod");	
		
	case "hd480": //getURL("javascript:track('hd480');");
		hitbox.Set_hbPageView("hd+480","/tmnt/multimedia/trailers/hi+def");
		
	case "hd720": //getURL("javascript:track('hd720');");
		hitbox.Set_hbPageView("hd+720","/tmnt/multimedia/trailers/hi+def");	
		
	case "hd1080": //getURL("javascript:track('hd1080');");
		hitbox.Set_hbPageView("hd+1080","/tmnt/multimedia/trailers/hi+def");

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