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,270,'turtle');
}

function popMemoryGame()
{
    trackDoryMemoryGame();
    popWindow('memorygame.html',640,420,'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';

    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 popTradingCardGame()
{
    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()
{
    trackMrRaysClassroom();
    popWindow('fn-rays.html',760,425,'raysclassroom');
}

function popScreenmate()
{
    trackScreenmate();
    popWindow('screenmate.html',351,315,'screenmate');
}

function popOceanFutures()
{
    externalLink('http://www.oceanfutures.com');
}

function popOceanFutures2()
{
    externalLink('http://www.oceanfutures.org/Nemo/index2.html');
}

function externalLink(url)
{
    popWindow('disclaimer.html?'+url,370,210,'intermediate');
}

function popPearlsPuzzle()
{
    trackPearlsPuzzle();
    popWindow('puzzlegame.html',640,400,'pearls_puzzle');
}

function popCreateAScene()
{
    trackCreateAScene();
    popWindow('createascene.html',700,500,'create_a_scene');
}

function popScreensaver(platform)
{
    switch(platform)
    {
    case 'os9':
        window.location.href='screensavers/nemo_ss_os9.sit';
        break;
    case 'osx':
        window.location.href='screensavers/nemo_ss_osx.sit';
        break;
    case 'win':
        popWindow('screensavers/nemo_ss_win.zip',100,100,'ss');
        break;
    }
}

function popCameraPickup(pickupImageData)
{
	popWindow('fn-cameragame-pickup.html?imageData='+pickupImageData,590,354,'cameraPickup');
}

function popTerms()
{
    popScrollingWindow('terms.html',450,450,'terms');
}

function popOrchestra()
{
    popWindow('oceanorchestra/index.html',800,590,'orchestra');
}
