var localRoot = "";

/*
exitLinkArray = new Array();
exitLinkArray[0] = escape("Exit_muppets+oz_sell+movies_abc_order+dvd");
exitLinkArray[1] = escape("Exit_muppets+oz_sell+movies_abc_order+soundtrack");
exitLinkArray[2] = escape("Exit_muppets+oz_multimedia_abc_trailer+e23845");
*/

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 popScrollingWindow2(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=1,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(localRoot + "download.html?theFile="+theFile, 400, 200, "downloadWindow");
}
var debugFlag=false;

function debug(string){
    if (debugFlag == true) { alert(string); }
}

function flashDebug(string){
	//to make sure nothing breaks
}

function popClip(clip, player, size){
    player = player.toUpperCase();
    size = size.toLowerCase();
    popWindow(localRoot + 'clips/clips.html?movie='+clip+'&size='+player+size, 648, 488, "trailer");
}

function popIcons(){
	
	javascript:installIcon('serenity_river')
    //popWindow(localRoot + "aim/aim.html", 550, 560, "aim_icons");
}

function popAIM(num){
	//var pagePath = "" + window.location;
    //var pageRoot = pagePath.substring(0,pagePath.lastIndexOf("/")+1);
	
	if(num == "1"){
		file = "AIM_ih_Renata.gif";
	}else if(num == "2"){
		file = "AIM_ih_Vic.gif";
	}else if(num == "3"){
		file = "AIM_ih_Charlie.gif";
	}else if(num == "4"){
		file = "AIM_ih_General.gif";
	}
    popWindow(localRoot + 'aim/aim.html?imgsrc='+file, 400, 300, "aim");

	
}

function popWallpaper(number, size){

	number = "0" + number;
	
	var dimensions = "";
	var size = "small";
	switch (size)
	{
	case "small":
		dimensions = "1024x768";
		break;
	case "medium":
		dimensions = "1280x960";
		break;
	case "large":
		dimensions = "1600x1200";
		break;
	default:
		dimensions = size;
		break;
	}
	openWindow(localRoot + "wallpaper/wallpaper.html?wallpaper=IH_"+number+"_"+dimensions+".jpg");
}

//----------------------------------------------------
function popSite() {
	var url = "main.html";
	popWindow(localRoot +  url, 1018, 714, "site" );
	//window.location.href="aim:BuddyIcon?src="+pageRoot+"images/"+icon+".gif";
}
//----------------------------------------------------
function installIcon(icon)
{
    var pagePath = "" + window.location;
    var pageRoot = pagePath.substring(0,pagePath.lastIndexOf("/")+1);

    //alert("aim:BuddyIcon?src="+pageRoot+"images/"+icon+".gif");
    window.location.href="aim:BuddyIcon?src="+pageRoot+"images/"+icon+".gif";
}