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 downloadFile(theFile)
{
    popWindow("download.html?theFile="+theFile, 300, 100, "downloadWindow");
}

function popDVDClipWindow(clipCode)
{
    popWindow("http://www.totaleclips.com/disney/player/2/splash.asp?clipid="+clipCode,340,490,"trailer");
}

var debugFlag = false;
function debug(string)
{
	if (debugFlag)
	{
		alert(string);
	}
}

function popClip(clip)
{
	if (clip == "trailer" || clip == "trailer1")
	{
		track("trailer");
		popDVDClipWindow("e20273");
	}
}

function popAIM()
{
    track("icons+download");
    popWindow("aim/aim.html", 500, 416, "aim_icons");
}

function popWallpaper(number, size)
{
	track("wp"+number+"+"+size);
	openWindow("wallpaper/wallpaper.html?wallpaper=wallpaper_"+number+"_"+size+".jpg");
}

function popEcard(card)
{
	popScrollingWindow("ecards/ecards.html?card="+card+".jpg", 600, 600, "ecards");
}

function enterSite()
{
	window.location.href = "main.html";
}

function deeplinkTrailer()
{
	window.location.href = "main.html?deepLink=thePlan";
}

function popPoster()
{
    track("poster");
    popScrollingWindow('poster/posterconfirm.html?poster=LK-poster',400,560,'Poster');
}

function externalLink(link)
{
    popWindow("http://touchstone.movies.go.com/global/disclaimer/index.html?newURL="+link, 370, 210, "linkWindow");
}

function popBlackJack()
{
	track("blackjack+game");
	popWindow("blackjack.html", 770, 620, "blackjack");
}

function ssWindows()
{
	track("ss+win");
	downloadFile("screensaver/screensaver_setup.zip");
}
function ssOS9()
{
	track("ss+os9");
	downloadFile("screensaver/theladykillers_ss_OS9.sit");
}
function ssOSX()
{
	track("ss+os10");
	downloadFile("screensaver/theladykillers_ss_OSX.sit");
}

function popStory()
{
	popWindow("story_popup.html?dl=story", 400, 550, "story");
}

function popFeatures()
{
	popWindow("story_popup.html?dl=features", 400, 550, "story");
}

function popOrderNow()
{
	track("order");
	openWindow("http://www.bestbuy.com/site/olspage.jsp?id=1368352&skuId=6710044&type=product&Ref=22&Loc=01");
}
