﻿var MY_HOME = "http://emac.sportplanet.emacberry.com";

if (top!=self){
	if(navigator.appName.toLowerCase().indexOf("internet explorer")> -1) {
		try {
			window.top.document.location.href=MY_HOME+'/linkingerror.html';
		} catch (t){ }
	} else {
		var checkRef='';
		try {
			checkRef=window.top.document.location.href;
		} catch (t){
			checkRef=t;
		}
		window.top.document.location.href=MY_HOME+'/linkingerror.html?'+checkRef;
	}
}

function getNewEMACFile(url){
	url="http://fileplanetNEW.emacberry.com/games/"+url;
    status='Download @ emacberry.com';
    xpos=screen.availWidth-360;
    xpos=Math.min(xpos,730)
    //inst=window.open("http://emac.sportplanet.emacberry.com/help/fpdownhelp.html","GameSpyDownloadWindowEMACHELP","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left="+xpos+",width=360,height=780");
    hx=screen.availHeight;
    window.open(url,"emacberryEMACDownloadWindow","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,top=0,left=0,width=740,height="+hx);
    /*if (inst != null) {
            inst.focus();
    }*/
}

function getNewVLMFile(url){
	url="http://fileplanetNEW.emacberry.com/mirror/"+url;
    status='Download @ emacberry.com';
    xpos=screen.availWidth-360;
    xpos=Math.min(xpos,730)
    hx=screen.availHeight;
    window.open(url,"emacberryVLMDownloadWindow","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,top=0,left=0,width=740,height="+hx);
}

function getNewEMACFileOld(url){
	url="http://www.fileplanet.com/hosteddl.aspx?/hst/e/m/emac/games/"+url;
    status='Download @ FilePlanet.com';
    xpos=screen.availWidth-360;
    xpos=Math.min(xpos,730)
    inst=window.open("http://emac.sportplanet.emacberry.com/help/fpdownhelp.html","GameSpyDownloadWindowEMACHELP","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left="+xpos+",width=360,height=780");
    hx=screen.availHeight;
    window.open(url,"GameSpyDownloadWindowEMAC","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,top=0,left=0,width=740,height="+hx);
    if (inst != null) {
            inst.focus();
    }
}

function getEMACFile(url){
        getEMACFileInternal(url, false, false);
}

function getEMACFile2(url){
        getEMACFileInternal(url, true, false);
}

function getFILEPLANETFile(url){
        getEMACFileInternal(url, true, true);
}


function getEMACFileInternal(url, DO_INTDEPEND, DO_FILEP){
        status='Download @ FilePlanet.com';
        xpos=screen.availWidth-360;
        xpos=Math.min(xpos,730)
        inst=window.open("http://emac.sportplanet.emacberry.com/help/fpdownhelp.html","GameSpyDownloadWindowEMACHELP","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left="+xpos+",width=360,height=780");
        //OPEN the REST...
        if(DO_INTDEPEND){
                if (DO_FILEP) {
                        //url="http://www.fileplanet.com/dl/dl.asp?/sportplanet/emac/independent/"+url;
                        url="http://www.fileplanet.com/dl.aspx?/sportplanet/emac/independent/"+url;
                } else {
                        //url="http://www.fileplanet.com/dl/dl.asp?/"+url;
                        url="http://www.fileplanet.com/dl.aspx?/"+url;
                }
        } else {
                //url="http://www.fileplanet.com/dl/dl.asp?/sportplanet/emac/0146"+url;
                url="http://www.fileplanet.com/dl.aspx?/sportplanet/emac/0146"+url;
        }
        //alert(url);
        hx=screen.availHeight;
        window.open(url,"GameSpyDownloadWindowEMAC","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,top=0,left=0,width=740,height="+hx);
        if (inst != null) {
                inst.focus();
        }
}