function popWindow( url, width, height, windowName )
{
	if (windowName == "undefined" || windowName == "" || windowName == "null")
	{
		windowName = "_blank";
	}
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    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");
}

var pageRoot = "";

function downloadFile(theFile)
{
    popWindow(pageRoot + "download.html?theFile="+theFile, 300, 100, "downloadWindow");
}

var debugFlag=false;
function debug(string)
{
    if (debugFlag == true)
	{
		alert(string);
	}
}

function track(trackString)
{
    switch (trackString)
    {
    case "XXXXX":
        debug(trackString);
        break;
    default:
        debug(trackString);
        //_hbPageView(trackString, "/NewProject");
        break;
    }
}

function popClip(clip, player, size)
{
    player = player.toUpperCase();
    size = size.toLowerCase();

	popWindow(pageRoot + 'clips/clips.html?movie='+clip+'&size='+player+size, 648, 384, "trailer");
}

function popAIM()
{
    popWindow(pageRoot + "aim/aim.html", 500, 416, "aim_icons");
}

function popWallpaper(number, size)
{
	openWindow(pageRoot + "wallpaper/wallpaper.html?wallpaper=wallpaper_"+number+"_"+size+".jpg");
}

function linkToMain()
{
	//window.location.href = pageRoot + "main.html";
	popWindow("main.html",1000,620,"surviving_main");
}
