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 downloadFile(theFile){
    popWindow(siteRoot + "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(siteRoot + "clips/clips.html?movie="+clip+"&size="+player+size, 648, 488, "trailer");
}

function popNews() {
    popWindow(siteRoot + "news_popup.html", 400, 400, "pop_news");
}


function popAIM() {
    popWindow(siteRoot + "aim/aim.html", 413, 492, "aim_icons");
}

function popRegister(){
    popWindow(siteRoot + "register.html", 406, 530, "register");
}

function popWallpaper(number, size){
	openWindow(siteRoot + "wallpapers/wallpaper.html?image=ymd_wall_"+number+"_"+size+".jpg");
}

function popGame(id){
    switch (id) {
    case 0:
	case "0":
	    popWindow(siteRoot + "games/tour_dupree.html", 600, 400, "games");
        break;
    }
	
}

function popScreensaver(id){
    switch (id) {
    case 0:
	case "0":
	    popWindow(siteRoot + "download.html?theFile=screensaver/ymd_screensaver_mac_osx.zip", 300, 100, "games");
        break;
    case 1:
	case "1":
	    popWindow(siteRoot + "download.html?theFile=screensaver/ymd_screensaver_pc.zip", 300, 100, "games");
        break;
    }
}

function popTrailer(){
    popWindow(siteRoot + "trailer.htm", 413, 400, "trailer");	
}