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 popAIM()
{
    popWindow(siteRoot + "aim/aim.html", 500, 540, "aim_icons");
}

function popWallpaper(number, size)
{
	openWindow(siteRoot + "wallpaper/wallpaper.html?image=wallpaper_"+number+"_"+size+".jpg");
}

function wallpaperCreator()
{
	popWindow(siteRoot + "wallpaper_creator/index.html", 700, 500, "wallpaper_creator");
}

function horseshoeGame()
{
	popWindow(siteRoot + "games/horseshoes.html", 700, 500, "horseshoes");
}

function popAllAIM(plat)
{
if(plat=='WIN'){
	downloadFile("aim/serenity_icons.zip");
	}else if(plat =='MAC'){
		downloadFile("aim/serenity_icons.sit");
	}else{}
}

function popScreensaver(joe)
{
if(joe=='pc'){
	downloadFile("screensavers/serenity.zip");
	}else if(joe =='osx'){
		downloadFile("screensavers/serenity.sit");
	}else{}
}
function popCookbook(){
	
          openWindow(siteRoot + "cookbook.pdf");
}

function emailCard(cardNo,from,fromMail,to,toMail)
{
pic1= new Image(1,1); 
pic1.src="ecards/mime2.php?cardNo="+cardNo+"&from="+from+"&fromMail="+fromMail+"&to="+to+"&toMail="+toMail+""; 
}


function popXtraNavLink(link)
{
	switch (link)
	{
	case 1:
	case "signup":
		openWindow("http://signup.universalstudios.com/form/120");
		break;
	case 2:
	case "buyTickets":
		openWindow("http://movies.channel.aol.com/movie/main.adp?tab=showtimes&mid=19349");
		break;
	case 3:
	case "browncoats":
		openWindow("http://browncoats.serenitymovie.com/");
		break;
	case 4:
	case "links":
				popWindow("http://www.serenitymovie.com/popup.html", 520, 640, "Serenity Links");
		break;
	default:
		break;
	}
}
