﻿var currentGallery;
var selectedImage;

//Logos and banners
var logoImages = new Array();
var logoComments = new Array();

logoComments[0] = '"Arrowhead Designs" Adobe Illustrator<br> Freelance: Grayscale version of the corporate logo for Arrowhead Designs, a Windows 7 phone application company.';
logoComments[1] = '"Arrowhead Designs" Adobe Illustrator<br> Freelance: Color version of the corporate logo for Arrowhead Designs, a Windows 7 phone application company.';
logoComments[2] = '"Arrowhead Designs" Adobe Illustrator<br> Freelance: Black and white version of the corporate logo for Arrowhead Designs, a Windows 7 phone application company.';
logoComments[3] = '"BobCat" Adobe Illustrator<br> Freelance: Design for the transom of a boat for Captain Bob and his wife Cathy.';
logoComments[4] = '"Oh No! My Hairdresser Lives There!" Adobe Photoshop & Illustrator<br> Freelance: Banner for Gamesraid.com.';

logoImages[0] = 'portfolio/logos/arrowhead.jpg';
logoImages[1] = 'portfolio/logos/arrwhd-yellow.jpg';
logoImages[2] = 'portfolio/logos/arrwhd-bw.jpg';
logoImages[3] = 'portfolio/logos/bobcat.jpg';
logoImages[4] = 'portfolio/logos/gamesraid.jpg';

//Print Media
var printImages = new Array();
var printComments = new Array();

printComments[0] = '"Heroines of Feminism"</b> Adobe Illustrator & Photoshop<br> Poster design.';
printComments[1] = '"New Global Pharma" Adobe InDesign & Illustrator<br> Annual Report spread for a hypothetical pharmaceutical company that focuses on third world countries.';
printComments[2] = '"MoMA: Typographic Modernism" Adobe Illustrator<br> Book cover redesign for the MoMA Typographic Modernism Exhibit.';

printImages[0] = 'portfolio/print/whiteout.jpg';
printImages[1] = 'portfolio/print/ngpspread.jpg';
printImages[2] = 'portfolio/print/moma.jpg';

//Package Design
var packageImages = new Array();
var packageComments = new Array();

packageComments[0] = '"Have You Seen Me?" Adobe Illustrator<br> Only you can prevent sock attacks (or you can ask your mom to do it). <br>(Photographed by Bill Geleneau)';
packageComments[1] = '"Lick the Vinyl" Adobe Photoshop & Illustrator<br> Personal redesign of CD cover for Kompact 10.';
packageComments[2] = '"At the Lab" Adobe Illustrator & Photoshop<br> Package redesign for Peak LE6 audio program.';

packageImages[0] = 'portfolio/package/sockmonster.jpg';
packageImages[1] = 'portfolio/package/cdcover.jpg';
packageImages[2] = 'portfolio/package/peak.jpg';

//Photo Design
var photoImages = new Array();
var photoComments = new Array();

photoComments[0] = '"Restructure" Adobe Photoshop<br> Freelance: Featured image for the Faceplate application coded by Arrowhead Designs.';
photoComments[1] = '"Interchangeable" Adobe Photoshop<br> Freelance: Splash screen for the Faceplate application coded by Arrowhead Designs.';
photoComments[2] = 'Comment3';

photoImages[0] = 'portfolio/photo/disintegrate.jpg';
photoImages[1] = 'portfolio/photo/facecubes.jpg';

//Digital Design
var digitalImages = new Array();
var digitalComments = new Array();

digitalComments[0] = '"Native Sunrise" Adobe Photoshop, Wacom Tablet<br> Serenity and peace overcome at the waxing illumination of dawn and humble lunar presence.';
digitalComments[1] = '"Screw the Beauty Mark" Adobe Photoshop, Wacom Tablet<br> How do you turn this thing on? Ready, set, lick.';
digitalComments[2] = '"Consult Your Physician First" Adobe Illustrator<br> Jumping into toxic waste does not give you super powers.';

digitalImages[0] = 'portfolio/digital/native.jpg';
digitalImages[1] = 'portfolio/digital/lick.jpg';
digitalImages[2] = 'portfolio/digital/toxic.png';

//Oil Design
var oilImages = new Array();
var oilComments = new Array();

oilComments[0] = '"Hello, My Name is Fear" Oil on Panel<br> There is nothing to fear but fear itself.';
oilComments[1] = '"Weapon of Choice" Oil on Canvas<br> Know yourself, protect yourself';
oilComments[2] = '"Roses and Thorns" Oil on Canvas<br> The silence scares me because the silence screams the truth. But so do we.';
oilComments[3] = '"Commander and Chief" Oil on Canvas<br> Fight for yourself, live for yourself, love yourself. (Work In Progress)';

oilImages[0] = 'portfolio/oil/portrait.jpg';
oilImages[1] = 'portfolio/oil/ww.jpg';
oilImages[2] = 'portfolio/oil/rosie.jpg';
oilImages[3] = 'portfolio/oil/tank.jpg';


function loadGallery(galleryName) {
    if (galleryName != currentGallery) {
        //Hide all of the bullets
        document.getElementById('bullet1').style.display = 'none';
        document.getElementById('bullet2').style.display = 'none';
        document.getElementById('bullet3').style.display = 'none';
        document.getElementById('bullet4').style.display = 'none';
        document.getElementById('bullet5').style.display = 'none';
        document.getElementById('bullet6').style.display = 'none';

        //Logo gallery
        if (galleryName == 'logo') {
            //Display the appropriate number of bullets
            if (logoImages.length > 0) {
                document.getElementById('bullet1').style.display = 'inline';
                document.getElementById('bullet1').src = 'images/bullet-selected.png';
            }

            if (logoImages.length > 1) {
                document.getElementById('bullet2').style.display = 'inline';
                document.getElementById('bullet2').src = 'images/bullet.png';
            }

            if (logoImages.length > 2) {
                document.getElementById('bullet3').style.display = 'inline';
                document.getElementById('bullet3').src = 'images/bullet.png';
            }

            if (logoImages.length > 3) {
                document.getElementById('bullet4').style.display = 'inline';
                document.getElementById('bullet4').src = 'images/bullet.png';
            }

            if (logoImages.length > 4) {
                document.getElementById('bullet5').style.display = 'inline';
                document.getElementById('bullet5').src = 'images/bullet.png';
            }

            if (logoImages.length > 5) {
                document.getElementById('bullet6').style.display = 'inline';
                document.getElementById('bullet6').src = 'images/bullet.png';
            }
        }

        //Print gallery
        if (galleryName == 'print') {
            //Display the appropriate number of bullets
            if (printImages.length > 0) {
                document.getElementById('bullet1').style.display = 'inline';
                document.getElementById('bullet1').src = 'images/bullet-selected.png';
            }

            if (printImages.length > 1) {
                document.getElementById('bullet2').style.display = 'inline';
                document.getElementById('bullet2').src = 'images/bullet.png';
            }

            if (printImages.length > 2) {
                document.getElementById('bullet3').style.display = 'inline';
                document.getElementById('bullet3').src = 'images/bullet.png';
            }

            if (printImages.length > 3) {
                document.getElementById('bullet4').style.display = 'inline';
                document.getElementById('bullet4').src = 'images/bullet.png';
            }

            if (printImages.length > 4) {
                document.getElementById('bullet5').style.display = 'inline';
                document.getElementById('bullet5').src = 'images/bullet.png';
            }

            if (printImages.length > 5) {
                document.getElementById('bullet6').style.display = 'inline';
                document.getElementById('bullet6').src = 'images/bullet.png';
            }
        }
        
        //Package gallery
        if (galleryName == 'package') {
            //Display the appropriate number of bullets
            if (packageImages.length > 0) {
                document.getElementById('bullet1').style.display = 'inline';
                document.getElementById('bullet1').src = 'images/bullet-selected.png';
            }

            if (packageImages.length > 1) {
                document.getElementById('bullet2').style.display = 'inline';
                document.getElementById('bullet2').src = 'images/bullet.png';
            }

            if (packageImages.length > 2) {
                document.getElementById('bullet3').style.display = 'inline';
                document.getElementById('bullet3').src = 'images/bullet.png';
            }

            if (packageImages.length > 3) {
                document.getElementById('bullet4').style.display = 'inline';
                document.getElementById('bullet4').src = 'images/bullet.png';
            }

            if (packageImages.length > 4) {
                document.getElementById('bullet5').style.display = 'inline';
                document.getElementById('bullet5').src = 'images/bullet.png';
            }

            if (packageImages.length > 5) {
                document.getElementById('bullet6').style.display = 'inline';
                document.getElementById('bullet6').src = 'images/bullet.png';
            }
        }

		//Photo gallery
        if (galleryName == 'photo') {
            //Display the appropriate number of bullets
            if (photoImages.length > 0) {
                document.getElementById('bullet1').style.display = 'inline';
                document.getElementById('bullet1').src = 'images/bullet-selected.png';
            }

            if (photoImages.length > 1) {
                document.getElementById('bullet2').style.display = 'inline';
                document.getElementById('bullet2').src = 'images/bullet.png';
            }

            if (photoImages.length > 2) {
                document.getElementById('bullet3').style.display = 'inline';
                document.getElementById('bullet3').src = 'images/bullet.png';
            }

            if (photoImages.length > 3) {
                document.getElementById('bullet4').style.display = 'inline';
                document.getElementById('bullet4').src = 'images/bullet.png';
            }

            if (photoImages.length > 4) {
                document.getElementById('bullet5').style.display = 'inline';
                document.getElementById('bullet5').src = 'images/bullet.png';
            }

            if (photoImages.length > 5) {
                document.getElementById('bullet6').style.display = 'inline';
                document.getElementById('bullet6').src = 'images/bullet.png';
            }
        }
        

        //Digital gallery
        if (galleryName == 'digital') {
            //Display the appropriate number of bullets
            if (digitalImages.length > 0) {
                document.getElementById('bullet1').style.display = 'inline';
                document.getElementById('bullet1').src = 'images/bullet-selected.png';
            }

            if (digitalImages.length > 1) {
                document.getElementById('bullet2').style.display = 'inline';
                document.getElementById('bullet2').src = 'images/bullet.png';
            }

            if (digitalImages.length > 2) {
                document.getElementById('bullet3').style.display = 'inline';
                document.getElementById('bullet3').src = 'images/bullet.png';
            }

            if (digitalImages.length > 3) {
                document.getElementById('bullet4').style.display = 'inline';
                document.getElementById('bullet4').src = 'images/bullet.png';
            }

            if (digitalImages.length > 4) {
                document.getElementById('bullet5').style.display = 'inline';
                document.getElementById('bullet5').src = 'images/bullet.png';
            }

            if (digitalImages.length > 5) {
                document.getElementById('bullet6').style.display = 'inline';
                document.getElementById('bullet6').src = 'images/bullet.png';
            }
        }

        
        //Oil gallery
        if (galleryName == 'oil') {
            //Display the appropriate number of bullets
            if (oilImages.length > 0) {
                document.getElementById('bullet1').style.display = 'inline';
                document.getElementById('bullet1').src = 'images/bullet-selected.png';
            }

            if (oilImages.length > 1) {
                document.getElementById('bullet2').style.display = 'inline';
                document.getElementById('bullet2').src = 'images/bullet.png';
            }

            if (oilImages.length > 2) {
                document.getElementById('bullet3').style.display = 'inline';
                document.getElementById('bullet3').src = 'images/bullet.png';
            }

            if (oilImages.length > 3) {
                document.getElementById('bullet4').style.display = 'inline';
                document.getElementById('bullet4').src = 'images/bullet.png';
            }

            if (oilImages.length > 4) {
                document.getElementById('bullet5').style.display = 'inline';
                document.getElementById('bullet5').src = 'images/bullet.png';
            }

            if (oilImages.length > 5) {
                document.getElementById('bullet6').style.display = 'inline';
                document.getElementById('bullet6').src = 'images/bullet.png';
            }
        }





        //Set the currently selected gallery
        currentGallery = galleryName;

        //Show the first image from the gallery
        selectImage(1);
    }

    return true;
}

function selectImage(imageNumber) {

    //Set the currently selected bullet
    selectedImage = imageNumber;

    //Reset bullets
    document.getElementById('bullet1').src = 'images/bullet.png';
    document.getElementById('bullet2').src = 'images/bullet.png';
    document.getElementById('bullet3').src = 'images/bullet.png';
    document.getElementById('bullet4').src = 'images/bullet.png';
    document.getElementById('bullet5').src = 'images/bullet.png';
    document.getElementById('bullet6').src = 'images/bullet.png';

    //Set the appropriate bullet
    document.getElementById('bullet' + imageNumber).src = 'images/bullet-selected.png';

    // Logo Images
    if (currentGallery == 'logo') {
        //Set the comment
        document.getElementById('comments').innerHTML = logoComments[imageNumber - 1];

        //Transition to the new image
        fadeImage(logoImages[imageNumber - 1]);
    }

    //Print Images
    if (currentGallery == 'print') {
        //Set the comment
        document.getElementById('comments').innerHTML = printComments[imageNumber - 1];

        //Transition to the new image
        fadeImage(printImages[imageNumber - 1]);
    }
    
     //Package Images
    if (currentGallery == 'package') {
        //Set the comment
        document.getElementById('comments').innerHTML = packageComments[imageNumber - 1];

        //Transition to the new image
        fadeImage(packageImages[imageNumber - 1]);
    }
    
     //Photo Images
    if (currentGallery == 'photo') {
        //Set the comment
        document.getElementById('comments').innerHTML = photoComments[imageNumber - 1];

        //Transition to the new image
        fadeImage(photoImages[imageNumber - 1]);
    }
    
     //Digital Images
    if (currentGallery == 'digital') {
        //Set the comment
        document.getElementById('comments').innerHTML = digitalComments[imageNumber - 1];

        //Transition to the new image
        fadeImage(digitalImages[imageNumber - 1]);
    }
    
     //Oil Images
    if (currentGallery == 'oil') {
        //Set the comment
        document.getElementById('comments').innerHTML = oilComments[imageNumber - 1];

        //Transition to the new image
        fadeImage(oilImages[imageNumber - 1]);
    }
}

function fadeImage(imgSrc) {
    //Fade out the comments
    $('#comments').fadeOut();

    //Fade out image
    $('#galleryimage').fadeOut(400, function () { $.loadImages(imgSrc, setImage(imgSrc)); });
}

function setImage(imgSrc) {
    document.getElementById('galleryimage').style.width = 'auto';
    document.getElementById('galleryimage').style.height = 'auto';
    $("#galleryimage").attr("src", imgSrc);

    //Fade in the image
    $('#galleryimage').fadeIn();

    //Fade in the comments
    $('#comments').fadeIn();
}
