﻿function swapImage(imgNumber, path) {

    if (path == "fashion") {
        source = "images/" + path + "/IMG_" + imgNumber + ".jpg";
    }
    else {
        source = "images/" + path + "/" + path + "-" + imgNumber + ".jpg";
    }
    
    document.getElementById('main-image').src = source;
}

function swapFeatured(imgNumber, path) {

    document.getElementById('main-image').src = "images/featured/" + path + "/IMG_" + imgNumber + ".jpg";
}

function swapPortrait(imgNumber, path) {

    document.getElementById('main-image').src = "images/portrait/" + path + "/IMG_" + imgNumber + ".jpg";
}

function swapHome(elementID, action) {

    if (action == "over") {
        switch (elementID) {
            case "home-wedding":
                document.getElementById('home-wedding').src = "images/wedding-photography-selected.jpg";
                break;
            case "home-portraiture":
                document.getElementById('home-portraiture').src = "images/portraiture-selected.jpg";
                break;
            case "home-fashion":
                document.getElementById('home-fashion').src = "images/fashion-photography-selected.jpg";
                break;
            default:
                break;
        }

    }
    if (action == "out") {
        switch (elementID) {
            case "home-wedding":
                document.getElementById('home-wedding').src = "images/wedding-photography.jpg";
                break;
            case "home-portraiture":
                document.getElementById('home-portraiture').src = "images/portraiture.jpg";
                break;
            case "home-fashion":
                document.getElementById('home-fashion').src = "images/fashion-photography.jpg";
                break;
            default:
                break;
        }

    }
}

var fadeSpeed = 2;  // number of seconds for fade to last
var delay = 5; // number of seconds before fading out
var fadeSteps = 30; // number of opacity intervals for the fade

var fadeSpeedms = fadeSpeed * 1000;
var delayms = delay * 1000;

var current = 0; // start the counter at 0
var ns6 = document.getElementById && !document.all; //detect netscape 6

    /* set the opacity of the element (between 0.0 and 1.0) */
    function setOpacity(level) {
        document.getElementById("quoteplaceholderdiv").style.opacity = level;
        document.getElementById("quoteplaceholderdiv").style.MozOpacity = level;
        document.getElementById("quoteplaceholderdiv").style.KhtmlOpacity = level;
        document.getElementById("quoteplaceholderdiv").style.filter = "alpha(opacity=" + (level * 100) + ");";
    }

    function fadeIn() {
        for (i = 0; i <= 1; i += (1 / fadeSteps)) {
            setTimeout("setOpacity(" + i + ")", i * fadeSpeedms);
        }
        setTimeout("fadeOut()", delayms);
    }

    function fadeOut() {
        for (i = 0; i <= 1; i += (1 / fadeSteps)) {
            setTimeout("setOpacity(" + (1 - i) + ")", i * fadeSpeedms);
        }
        setTimeout("rotater()", fadeSpeedms);
    }

    function rotater() {

        setOpacity(0);

        if (document.layers) {
            document.placeholderlayer.document.write(quotes[current]);
            document.placeholderlayer.document.close();
        }

        if (ns6) {
            document.getElementById("quoteplaceholderdiv").innerHTML = quotes[current];
        }

        if (document.all) {
            quoteplaceholderdiv.innerHTML = quotes[current];
        }

        if (current == quotes.length - 1) {
            current = 0;
        }
        else {
            current = current + 1;
        }

        fadeIn();
    }

function startRotate() {
    setOpacity(1);
    document.getElementById("quoteplaceholderdiv").innerHTML = quotes[current];
    current = current + 1;
    setTimeout("fadeOut()", delayms);
}


