function popWindow( url, width, height, windowName )
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    win=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;
    
    win=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";
    win=window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}

function popTrailer()
{
    //trackTrailer();
    popWindow("trailer/trailer.html",500,550,"trailer");
}

function popTrailer1(type, size)
{
    if (type == "QT")
    {
        if (size == "small")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/1_small.html',680,422,'qtmovie');
        else if (size == "medium")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/1_medium.html',680,422,'qtmovie');
        else if (size == "large")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/1_large.html',680,422,'qtmovie');
    }
    else
        popWindow("trailer/movies-old.html?movie="+type+size,500,500,"trailer1");
}

function popTrailer2(type, size)
{
    if (type == "QT")
    {
        if (size == "small")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/2_small.html',680,422,'qtmovie');
        else if (size == "medium")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/2_medium.html',680,422,'qtmovie');
        else if (size == "large")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/2_large.html',680,422,'qtmovie');
    }
    else
        popWindow("trailer/movies.html?movie="+type+size,500,500,"trailer2");
}

function popTrailer3(type, size)
{
    if (size == "huge")
        popWindow('trailer/big_movies3.html?movie='+type+size,646,386,'fullscreenmovie');
    else if (type == "QT")
    {
        if (size == "small")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/3_small.html',680,422,'qtmovie');
        else if (size == "medium")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/3_medium.html',680,422,'qtmovie');
        else if (size == "large")
            popWindow('http://www.apple.com/trailers/disney/finding_nemo/trailer/3_large.html',680,422,'qtmovie');
    }
    else
        popWindow('trailer/movies3.html?movie='+type+size,500,500,'trailer3');
}

function popExtraClip(clip, size)
{
    popWindow('trailer/clips.html?movie='+clip+'&size='+size,500,350,'popup_clip');
}

function popFishyFacts(type, size)
{
    popWindow("trailer/fishyfactsmovies.html?movie="+type+size,500,400,"fishyfacts");
}

function homePage()
{
    window.location.replace("main.html");
}

function popTurtleGame()
{
    //trackCruisinWithCrush();
    popWindow('turtlegame.html',480,330,'turtle');
}

function popMemoryGame()
{
    //trackDoryMemoryGame();
    popWindow('memorygame.html',640,480,'memory');
}

function popSeaGallery()
{
    trackSplashSeaGallery();
    popWindow('sea_gallery/index.html',500,400,'gallery');
}

function popPoll()
{
    trackHowManyFishPoll();
	 popWindow('poll/poll.html',370,480,'poll');
}

function popPoster()
{
    trackPoster();
    popScrollingWindow('confirm.html',400,500,'confirm');
}

function popWallpapers(number, size)
{
    var zero = '';
    if (number < 10)
        zero = '0';

    //trackWallpaper("wp"+number+"+"+size);
    openWindow('wallpapers/instructions.html?wallpaper='+zero+number+'_'+size+'.jpg');
}

function popCard()
{
    popWindow('cards/index.html'+window.location.search,600,370,'postcard');
}

function popAIM()
{
    popWindow('aim/index.html',500,420,'nemo_aim');
}

function popAskCrush()
{
    trackAskCrush();
    popWindow('http://disney.go.com/disneypictures/findingnemo/askcrush/today/index.html',500,500,'askcrushgame');
}

function popAustraliaSweeps()
{
    trackAustraliaSweeps();
    popWindow('http://disney.go.com/disneypictures/findingnemo/sweeps/index.html',631,510,'australia_sweeps');
}
function popSweepstakes()
{
    //trackSweepstakes();
    popComingSoonSweeps();
}

function popTradingCardGame()
{
    trackTradingCardGame();
//    popComingSoon();
    openWindow('http://disney.tokenzone.com/dtz2/set/nemo/Home');
}

function popFishCharades()
{
    trackFishCharades();
    popWindow('http://transfer.go.com/cgi/transfer.dll?name=BL_1231&SOURCE=BL_1231&srvc=dolsubsrvc&goto=http%3A%2F%2Fwww.disney.go.com%2Fpreview%2Fblast%2Fgames%2Ffishcharades%2Findex.html?DETECT=SWF.600000',530,345,'fish_charades');
}

function popRays()
{
    //trackUnderwaterClassroom();
    popWindow('fn-rays.html',760,460,'classroom');
}

function popScreenmate()
{
    //trackScreenmate();
    popWindow('screenmate.html',351,400,'screenmate');
//    popComingSoon();
}
function popScreenMate()
{
    popScreenmate();
}

function popOceanFutures()
{
    //trackClassroomOceanSocietySite();
	hitbox.Set_hbLink(exitLinkArray[1]);
	//alert(exitLinkArray[1])
    externalLink('http://www.oceanfutures.com');
}

function popOceanFutures2()
{
    //alert("error?");
    externalLink('http://www.oceanfutures.org/Nemo/index2.html');
}

function externalLink(url)
{
    popWindow('http://disney.go.com/disneypictures/javascript/disclaimer/disclaimer.html?'+url,370,210,'intermediate');
}

function popPearlsPuzzle()
{
    //trackPearlsPuzzle();
    popWindow('puzzlegame.html',640,460,'pearls_puzzle');
}

function popCreateAScene()
{
    //trackCreateAScene();
    popWindow('createascene.html',700,560,'create_a_scene');
}

function popupScreensaver( url, windowName, r, s, m ) {
	win = window.open(url, windowName, 'height=150, width=400, resizable=' +r+ ', status=no, scrollbars=' +s+ ', location=no, menubar=' +m+  ', toolbar=no, left=50, top=50');
}

function popScreensaver(platform)
{
    switch(platform)
    {
    case 'os9':
        //trackScreensaverDownload("os9");
        //window.location.href='screensavers/nemo-dvdSS_OSX.sit';
		popupScreensaver("screensavers/nemo-dvdss_os9.html", "screensaver", "no", "no", "no");
        break;
    case 'osx':
        //trackScreensaverDownload("os10");
        //window.location.href='screensavers/nemo-dvdSS_OS9.sit';
		popupScreensaver("screensavers/nemo-dvdss_osx.html", "screensaver", "no", "no", "no");
		popupScreensaver
        break;
    case 'win':
        //trackScreensaverDownload("windows");
        //popWindow('screensavers/nemo_ss_win.zip',100,100,'ss');
        popupScreensaver("screensavers/nemo_ss_win.html", "screensaver", "no", "no", "no");
		break;
    }
}

function popCameraPickup(pickupImageData)
{
	popWindow('fn-cameragame-pickup.html?imageData='+pickupImageData,590,354,'cameraPickup');
}

function popMenuWindow( url, width, height, windowName )
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    win=window.open(url, windowName, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
}

function popHiddenSecrets()
{
    popMenuWindow('hiddensecrets/hiddensecrets.html',540,460,'hiddensecrets');
}

function popOrder()
{
    trackOrder();
    openWindow("http://go-disneystore.com/findingnemodvd");
}

function popDVDTrailer()
{
    //trackTrailer();
	hitbox.Set_hbLink(exitLinkArray[2]);
    popWindow("http://www.totaleclips.com/disney/monsters/splash.asp?clipid=e18041",340,480,"trailer");
}

function popComingSoon()
{
    popWindow("comingsoon.html",243,140,"coming_soon");
}

function popComingSoonSweeps()
{
    popWindow("sweeps.html",500,462,"sweepsPop");
}
