var localRoot = "";
var siteRoot = "";

function track(page, link){
	hitbox.Set_hbPageView(page, link);
};


var newwindow;
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 openWindow2(url, win){
	newwindow = window.open(url,win,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
	if (window.focus) {newwindow.focus()}
}

function popWindow( url, width, height, windowName ) {
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    newwindow = window.open(url, windowName, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
	if (window.focus) {newwindow.focus()}
}
function popLink( url, width, height, windowName ) {
	popWindow( url, width, height, windowName );
}


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 popWallpaper(country, filename){
	openWindow2(siteRoot + country + "/wallpaper.html?image=../"+filename, "wllpapers");
}

function popAIM(country, filename){
	popWindow(siteRoot + country + '/aim.html?image=../'+filename, 413, 490, "aim");
}

function popSignatures(country, filename){
	popWindow(siteRoot + country + '/signatures.html?image=../'+filename, 300, 300, "signatures");
}

function popAdsPrintXXX(country, filename){
	openWindow(siteRoot + country + "/ads.html?image=../"+filename);
}

function popAdsPrint(country, filename){
	openWindow2(siteRoot + country + "/ads.html?image=../"+filename, "printAds");
}

function popTokenzone(url){
	openWindow2(url, "_self");
}

//function popDownload(country, filename){
//	popWindow(siteRoot + filename, 200, 200, "_self");
//}


function popDownload(country, theFile, title){
    popWindow(siteRoot + "download.html?theFile="+escape(theFile), 400, 200, "downloadWindow");
}

function popDownAds(country, theFile){
    popWindow(siteRoot + "download.html?theFile="+theFile, 400, 200, "downloadWindow");
}

function popPodcastSubscribe(){
    popWindow(siteRoot + "podcast_subscribe.html", 370, 240, "podcast");
}



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 openDisclaimer(URL){
	win = window.open('http://disney.go.com/disneypictures/javascript/disclaimer/disclaimer.html?'+ URL, 'intermediate', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=370,height=210');
}