var siteRoot = "";

function popWindow( url, width, height, windowName )
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    return window.open(url, windowName, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
}
function popScrollingWindow(url, width, height, windowName)
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    return window.open(url, windowName, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
}
function openWindow(url)
{
    var rand = "_blank";
    return window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}
function openWindowNoControls(url)
{
    return window.open(url,"_blank","directories=0,location=0,menubar=0,scrollbars=yes,status=0,toolbar=0,resizable=yes");
}

function downloadFile(theFile)
{
    popWindow("download.html?theFile="+theFile, 300, 100, "downloadWindow");
}

var debugFlag=false;
function debug(string)
{
    if (debugFlag == true)
	{
		alert(string);
	}
}

function popDisneyTrailer(clipCode)
{
    popWindow("http://www.totaleclips.com/player/splash.aspx?playerid=2&custid=3&clipid="+clipCode,340,480,"disneytrailer");
    //popWindow("http://www.totaleclips.com/disney/player/splash.asp?clipid="+clipCode,340,470,"disneytrailer");
}
function popClip(clip)
{
	track("clip"+(clip-1) );
	switch(clip)
	{
	case 1:
		popDisneyTrailer("e23547");
		break;
	case 2:
		popDisneyTrailer("e23553");
		break;
	case 3:
		popDisneyTrailer("e23555");
		break;
	case 4:
		popDisneyTrailer("e23565");
		break;
	case 5:
		popDisneyTrailer("e23567");
		break;
	case 6:
		popDisneyTrailer("e23548");
		break;
	default:
		debug("["+clip+"]");
		break;
	}
}

function popAIM()
{
    popWindow(siteRoot + "aim/aim.html", 500, 416, "aim_icons");
}

function popWallpaper(number, size)
{
	track("wp"+(number-1)+"+"+size);
	openWindowNoControls(siteRoot + "desktops/wallpaper.html?wallpaper="+number+"_"+size+".jpg");
}

function popColorUs()
{
	track("color+us+game");
	popWindow(siteRoot + "games/heffcolor.html", 550, 430, "colorus");
}

function popFindHeffalump()
{
	track("find+game");
	popWindow(siteRoot + "games/heff-whereslumpy.html", 770, 500, "whereslumpy");
}

function popEcard(card)
{
	track("cards+download");
	popScrollingWindow(siteRoot + "ecards/ecards.html?card="+card, 640, 540, "heff_ecard");
}

function popSongbook()
{
	track("song+book");
	popWindow(siteRoot + "games/heff_book.html",760,500,"songbook");
}

function popTradingCards()
{
	track("tokenzone");
	openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/Home");
}
function popTradingCard()
{
	popTradingCards();
}
function popSendValentine()
{
	popWindow(siteRoot + "valentine/send.html", 750, 500, "valentine");
}

function popTokenZone(tokenZoneNumber)
{
	switch (tokenZoneNumber)
	{
	case 1:
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc101- d98n5-htnyt-fhci7-qctxy");
		break;
	case 2:
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc102- tuwdv-fcwcj-45a4b-zx6g6");
		break;
	case 3:
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc103- vskj5-2i7iq-mrqy2-kkbkx");
		break;
	case 4:
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc104 -49eq4-jf9bd-tqhd9-t2wn4");
		break;
	case "book":
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc110- d42xd-z9zfq-vwyia-8ztd8");
		break;
	case "cards":
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc114-k68zv-gyfdr-57hfb-nj2zu");
		break;
	case "trailer1":
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc111- aahbv-q2k52-3hkyg-qz38j");
		break;
	case "clip1":
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc112- i4x2e-2uruh-vd38f-m5s7f");
		break;
	case "clip5":
		openWindow("http://disney.tokenzone.com/dtz2/set/heffalump/CaptureEvent?sc=tc113- qh7jm-r2w7p-vrt28-wzrac");
		break;
	default:
		break;
	}
}

function popOrder()
{
	track("order");
	//win = void(window.open('http://www.go-disneyshopping.com/poohsheffalumpmoviedvd').focus);
	win = window.open('http://www.go-disneyshopping.com/poohsheffalumpmoviedvd', 'newWin');
	win.focus();
}

function popRecipe()
{
	track("rd+recipe");
	popWindow("recipe.html",567,734,"recipe");
}

function popPoohDVD()
{
	track("pooh+site");
    openWindow("http://disney.go.com/disneyvideos/animatedfilms/pooh/");
}

function goHalloween() 
{
    openWindow("http://www.heffalumphalloween.com");
    track("heffalump_tracking_preschool_heff+halloween+site/");    
}




