﻿
/************************* the navigation functions **********************************************/

function SelectHome() {
    document.getElementById('AboutPageText').style.display = "none";
    document.getElementById('TestimonialsPageText').style.display = "none";
    document.getElementById('SignUpPageText').style.display = "none"; 
    document.getElementById('HomePageText').style.display = "block";
    //scrollToTop();
    //initScroll();        
}
function MenuHome() {
    document.getElementById('Menu').src = "PageImages/nav_home.png";
}


function SelectAbout() {
    document.getElementById('HomePageText').style.display = "none";
    document.getElementById('TestimonialsPageText').style.display = "none";
    document.getElementById('SignUpPageText').style.display = "none";
    document.getElementById('AboutPageText').style.display = "block";
    //scrollToTop(); 
    //initScroll();        
}
function MenuAbout() {
    document.getElementById('Menu').src = "PageImages/nav_about.png";
}

function SelectTestimonials() {
    document.getElementById('HomePageText').style.display = "none";
    document.getElementById('AboutPageText').style.display = "none";
    document.getElementById('SignUpPageText').style.display = "none";
    document.getElementById('TestimonialsPageText').style.display = "block";
    //scrollToTop(); 
    //initScroll();            
}
function MenuTestimonials() {
    document.getElementById('Menu').src = "PageImages/nav_testimonials.png";
}

function SelectSignUp() {
    document.getElementById('HomePageText').style.display = "none";
    document.getElementById('AboutPageText').style.display = "none";
    document.getElementById('TestimonialsPageText').style.display = "none";
    document.getElementById('SignUpPageText').style.display = "block";
    //scrollToTop(); 
    //initScroll();            
}
function MenuSignUp() {
    document.getElementById('Menu').src = "PageImages/nav_signup.png";
}

function MenuPhotos() {
    document.getElementById('Menu').src = "PageImages/nav_photos.png";
}

function MenuOff() {
    document.getElementById('Menu').src = "PageImages/nav_off.png";
}


/************************* the scroll functions **********************************************/

var slowStep = 2;
var fastStep = 10;
var stepSize = slowStep;
var scrollInterval;
var intervalSpeed = 5;

function scrollDown() {

    var content = document.getElementById('SubPageContent');
    var y = content.scrollTop;
    var h = content.scrollHeight - content.offsetHeight;

    if (y < h) {
        content.scrollTop = y + stepSize;
    } else {
        stopScroll();
        document.getElementById('arrowdown').style.display = "none";
    }

}

function scrollToTop() {
    var content = document.getElementById('SubPageContent');
    content.scrollTop = 0;
    document.getElementById('arrowup').style.display = "none";
    
}

function scrollUp() {
    var content = document.getElementById('SubPageContent');
    var y = content.scrollTop;

    if (y > 0) {
        content.scrollTop = y - stepSize;
    } else {
        stopScroll();
        document.getElementById('arrowup').style.display = "none";
    }

}


function startScrollUp() {

    if (scrollInterval != null) {
        clearInterval(scrollInterval);
    }

    stepSize = slowStep;
    scrollInterval = setInterval("scrollUp()", intervalSpeed);
    document.getElementById('arrowdown').style.display = "block";

}

function startScrollDown() {

    if (scrollInterval != null) {
        clearInterval(scrollInterval);
    }

    stepSize = slowStep;
    scrollInterval = setInterval("scrollDown()", intervalSpeed);
    document.getElementById('arrowup').style.display = "block";

}


function stopScroll() {

    clearInterval(scrollInterval);
    scrollInterval = null;

}

function stepUp() {

    stepSize = fastStep;

}

function stepDown() {

    stepSize = slowStep;

}

function initScroll() {
    var content = document.getElementById('SubPageContent');
    var y = content.scrollTop;    
    var h = content.scrollHeight - content.offsetHeight;
    
    if (y != 0) {
        document.getElementById('arrowup').style.display = "block";

    }

    if ((y != h) && (h > 0)) {
        document.getElementById('arrowdown').style.display = "block";
    }

}

/************** Mouse Wheel *****************************************/
/** This is high-level function; REPLACE IT WITH YOUR CODE.
* It must react to delta being more/less than zero.
*/
/*
function handle(delta) {
    stepSize = fastStep * 3;
    if (delta < 0) {
        scrollDown();
        document.getElementById('arrowup').style.display = "block";
    }
    else {
        scrollUp();
        document.getElementById('arrowdown').style.display = "block";
    }
    document.getElementById('arrowup').style.display = "none";
    document.getElementById('arrowdown').style.display = "none";
    initScroll();
}

function wheel(event) {
    var delta = 0;
    if (!event) event = window.event;
    if (event.wheelDelta) {
        delta = event.wheelDelta / 120;
        if (window.opera) delta = -delta;
    } else if (event.detail) {
        delta = -event.detail / 3;

    }
    if (delta)
        handle(delta);
    if (event.preventDefault)
        event.preventDefault();
    event.returnValue = false;
}


function KeyCheck(e) {

    var KeyID = (window.event) ? event.keyCode : e.keyCode;

    //alert(KeyID);
    switch (KeyID) {

        case 38:
            //alert("Arrow Up");
            stepSize = fastStep;
            stopScroll();
            scrollUp();
            document.getElementById('arrowdown').style.display = "block";
            break;

        case 40:
            //alert("Arrow Down");
            stepSize = fastStep;
            stopScroll();
            scrollDown();
            document.getElementById('arrowup').style.display = "block";
            break;

        case 33:
            //alert("Page Up");
            stepSize = fastStep * 10;
            stopScroll();
            scrollUp();
            document.getElementById('arrowdown').style.display = "block";
            break;

        case 34:
            //alert("Page Down");
            stepSize = fastStep * 10;
            stopScroll();
            scrollDown();
            document.getElementById('arrowup').style.display = "block";
            break;
    }
    document.getElementById('arrowup').style.display = "none";
    document.getElementById('arrowdown').style.display = "none";
    initScroll();
}
*/
/* Initialization code. */
/*
if (window.addEventListener)
    window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;

//document.onkeyup = KeyCheck;
document.onkeydown = KeyCheck;
document.onkeyup = stopScroll;
*/


/*
Copyright (c) 2007, James Auldridge
All rights reserved.
Code licensed under the BSD License:
http://www.jaaulde.com/license.txt

Version 1.0

Change Log:
* 09 JAN 07 - Version 1.0 written

*/
//Preparing namespace
var jimAuld = window.jimAuld || {};
jimAuld.utils = jimAuld.utils || {};
/*
* This library is a member of the jimAuld.utils namespace
* The libary is useful for detecting Flash presence and major version with JavaScript
* There are 4 methods in the flashsniffer library, each of which is documented separately below
*
*/
jimAuld.utils.flashsniffer = {
    //Properties
    //Configurable: what was the last major release number of Flash?
    lastMajorRelease: 9,
    //End Configurables

    // installed : BOOL : TRUE if detect() finds Flash installed, false if not
    installed: false,
    // version : MIXED : INT representing major version number of installed Flash if detect() can find it, NULL if not
    version: null,

    //Methods
    /* METHOD: detect();
    * PURPOSE: Determine if, and at what major version, Flash is installed
    * ARGUMENTS: VOID
    * RETURN: VOID (sets 'installed' and 'version' properties as documented above)
    */
    detect: function() {
        var fp, fpd, fAX;
        if (navigator.plugins && navigator.plugins.length) {
            fp = navigator.plugins["Shockwave Flash"];
            if (fp) {
                jimAuld.utils.flashsniffer.installed = true;
                if (fp.description) {
                    fpd = fp.description;
                    jimAuld.utils.flashsniffer.version = fpd.charAt(fpd.indexOf('.') - 1);
                }
            }
            else {
                jimAuld.utils.flashsniffer.installed = false;
            }
            if (navigator.plugins["Shockwave Flash 2.0"]) {
                jimAuld.utils.flashsniffer.installed = true;
                jimAuld.utils.flashsniffer.version = 2;
            }
        }
        else if (navigator.mimeTypes && navigator.mimeTypes.length) {
            fp = navigator.mimeTypes['application/x-shockwave-flash'];
            if (fp && fp.enabledPlugin) {
                jimAuld.utils.flashsniffer.installed = true;
            }
            else {
                jimAuld.utils.flashsniffer.installed = false;
            }
        }
        else {
            for (var i = jimAuld.utils.flashsniffer.lastMajorRelease; i >= 2; i--) {
                try {
                    fAX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
                    jimAuld.utils.flashsniffer.installed = true;
                    jimAuld.utils.flashsniffer.version = i;
                    break;
                }
                catch (e) {
                }
            }
            if (jimAuld.utils.flashsniffer.installed == null) {
                try {
                    fAX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                    jimAuld.utils.flashsniffer.installed = true;
                    jimAuld.utils.flashsniffer.version = 2;
                }
                catch (e) {
                }
            }
            if (jimAuld.utils.flashsniffer.installed == null) {
                jimAuld.utils.flashsniffer.installed = false;
            }
            fAX = null;
        }
    },
    /* METHOD: isVersion();
    * PURPOSE: Determine if Flash is installed at a specified major version
    * ARGUMENTS: exactVersion : INT : the exact version for which to check
    * RETURN: BOOL : TRUE if Flash is at specified version, FALSE if not
    */
    isVersion: function(exactVersion) {
        return (jimAuld.utils.flashsniffer.version != null && jimAuld.utils.flashsniffer.version == exactVersion);
    },
    /* METHOD: isLatestVersion();
    * PURPOSE: Determine if Flash is installed the latest released version of Flash (as configured in property 'lastMajorRelease' documented above)
    * ARGUMENTS: VOID
    * RETURN: BOOL : TRUE if Flash is at latest version, FALSE if not
    */
    isLatestVersion: function() {
        return (jimAuld.utils.flashsniffer.version != null && jimAuld.utils.flashsniffer.version == jimAuld.utils.flashsniffer.lastMajorRelease);
    },
    /* METHOD: meetsMinVersion();
    * PURPOSE: Determine if Flash is installed at a specified minimum version
    * ARGUMENTS: minVersion : INT : the version number that installed Flash should be at OR above
    * RETURN: BOOL : TRUE if Flash is at minimum version, FALSE if not
    */
    meetsMinVersion: function(minVersion) {
        return (jimAuld.utils.flashsniffer.version != null && jimAuld.utils.flashsniffer.version >= minVersion);
    }
}

/***********************************************
* Ultimate Fade-In Slideshow (v1.51): &copy; Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var slides = new Array();
//SET IMAGE PATHS. Extend or contract array as needed
//                  [image filename, target url | "", _new | ""]

slides[0] = ['HomePgSlideShow/slide1.jpg', "", ""];
slides[1] = ['HomePgSlideShow/slide2.jpg', "", ""];
slides[2]= ['HomePgSlideShow/slide3.jpg', "", ""];
slides[3]= ['HomePgSlideShow/slide4.jpg', "", ""];
slides[4]= ['HomePgSlideShow/slide5.jpg', "", ""];
slides[5]= ['HomePgSlideShow/slide6.jpg', "", ""];
slides[6]= ['HomePgSlideShow/slide7.jpg', "", ""];
slides[7]= ['HomePgSlideShow/slide8.jpg', "", ""];
slides[8]= ['HomePgSlideShow/slide9.jpg', "", ""];
slides[9]= ['HomePgSlideShow/slide10.jpg', "", ""];
slides[10]= ['HomePgSlideShow/slide11.jpg', "", ""];
slides[11]= ['HomePgSlideShow/slide12.jpg', "", ""];
slides[12]= ['HomePgSlideShow/slide13.jpg', "", ""];
slides[13]= ['HomePgSlideShow/slide14.jpg', "", ""];
slides[14]= ['HomePgSlideShow/slide15.jpg', "", ""];
slides[15]= ['HomePgSlideShow/slide16.jpg', "", ""];
slides[16]= ['HomePgSlideShow/slide17.jpg', "", ""];
slides[17]= ['HomePgSlideShow/slide18.jpg', "", ""];
slides[18]= ['HomePgSlideShow/slide19.jpg', "", ""];
slides[19]= ['HomePgSlideShow/slide20.jpg', "", ""];
slides[20]= ['HomePgSlideShow/slide21.jpg', "", ""];
slides[21]= ['HomePgSlideShow/slide22.jpg', "", ""];
slides[22]= ['HomePgSlideShow/slide23.jpg', "", ""];
slides[23]= ['HomePgSlideShow/slide24.jpg', "", ""];
slides[24]= ['HomePgSlideShow/slide25.jpg', "", ""];
slides[25]= ['HomePgSlideShow/slide26.jpg', "", ""];
slides[26]= ['HomePgSlideShow/slide27.jpg', "", ""];
slides[27]= ['HomePgSlideShow/slide28.jpg', "", ""];
slides[28]= ['HomePgSlideShow/slide29.jpg', "", ""];
slides[29]= ['HomePgSlideShow/slide30.jpg', "", ""];
slides[30]= ['HomePgSlideShow/slide31.jpg', "", ""];
slides[31]= ['HomePgSlideShow/slide32.jpg', "", ""];
slides[32]= ['HomePgSlideShow/slide33.jpg', "", ""];
slides[33]= ['HomePgSlideShow/slide34.jpg', "", ""];
slides[34]= ['HomePgSlideShow/slide35.jpg', "", ""];
slides[35]= ['HomePgSlideShow/slide36.jpg', "", ""];
slides[36]= ['HomePgSlideShow/slide37.jpg', "", ""];


var fadebgcolor = "white"

////NO need to edit beyond here/////////////

var fadearray = new Array() //array to cache fadeshow instances
var fadeclear = new Array() //array to cache corresponding clearinterval pointers

var dom = (document.getElementById) //modern dom browsers
var iebrowser = document.all

function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder) {
    this.pausecheck = pause
    this.mouseovercheck = 0
    this.delay = delay
    this.degree = 10 //initial opacity degree (10%)
    this.curimageindex = 0
    this.nextimageindex = 1
    fadearray[fadearray.length] = this
    this.slideshowid = fadearray.length - 1
    this.canvasbase = "canvas" + this.slideshowid
    this.curcanvas = this.canvasbase + "_0"
    if (typeof displayorder != "undefined")
        theimages.sort(function() { return 0.5 - Math.random(); }) //thanks to Mike (aka Mwinter) :)
    this.theimages = theimages
    this.imageborder = parseInt(borderwidth)
    this.postimages = new Array() //preload images
    for (p = 0; p < theimages.length; p++) {
        this.postimages[p] = new Image()
        this.postimages[p].src = theimages[p][0]
    }

    var fadewidth = fadewidth + this.imageborder * 2
    var fadeheight = fadeheight + this.imageborder * 2

    if (iebrowser && dom || dom) //if IE5+ or modern browsers (ie: Firefox)
        document.write('<div id="master' + this.slideshowid + '" style="position:relative;width:' + fadewidth + 'px;height:' + fadeheight + 'px;overflow:hidden;"><div id="' + this.canvasbase + '_0" style="position:absolute;width:' + fadewidth + 'px;height:' + fadeheight + 'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:' + fadebgcolor + '"></div><div id="' + this.canvasbase + '_1" style="position:absolute;width:' + fadewidth + 'px;height:' + fadeheight + 'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:' + fadebgcolor + '"></div></div>')
    else
        document.write('<div><img name="defaultslide' + this.slideshowid + '" src="' + this.postimages[0].src + '"></div>')

    if (iebrowser && dom || dom) //if IE5+ or modern browsers such as Firefox
        this.startit()
    else {
        this.curimageindex++
        setInterval("fadearray[" + this.slideshowid + "].rotateimage()", this.delay)
    }
}

function fadepic(obj) {
    if (obj.degree < 100) {
        obj.degree += 10
        if (obj.tempobj.filters && obj.tempobj.filters[0]) {
            if (typeof obj.tempobj.filters[0].opacity == "number") //if IE6+
                obj.tempobj.filters[0].opacity = obj.degree
            else //else if IE5.5-
                obj.tempobj.style.filter = "alpha(opacity=" + obj.degree + ")"
        }
        else if (obj.tempobj.style.MozOpacity)
            obj.tempobj.style.MozOpacity = obj.degree / 101
        else if (obj.tempobj.style.KhtmlOpacity)
            obj.tempobj.style.KhtmlOpacity = obj.degree / 100
        else if (obj.tempobj.style.opacity && !obj.tempobj.filters)
            obj.tempobj.style.opacity = obj.degree / 101
    }
    else {
        clearInterval(fadeclear[obj.slideshowid])
        obj.nextcanvas = (obj.curcanvas == obj.canvasbase + "_0") ? obj.canvasbase + "_0" : obj.canvasbase + "_1"
        obj.tempobj = iebrowser ? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
        obj.populateslide(obj.tempobj, obj.nextimageindex)
        obj.nextimageindex = (obj.nextimageindex < obj.postimages.length - 1) ? obj.nextimageindex + 1 : 0
        setTimeout("fadearray[" + obj.slideshowid + "].rotateimage()", obj.delay)
    }
}

fadeshow.prototype.populateslide = function(picobj, picindex) {
    var slideHTML = ""
    if (this.theimages[picindex][1] != "") //if associated link exists for image
        slideHTML = '<a href="' + this.theimages[picindex][1] + '" target="' + this.theimages[picindex][2] + '">'
    slideHTML += '<img src="' + this.postimages[picindex].src + '" border="' + this.imageborder + 'px">'
    if (this.theimages[picindex][1] != "") //if associated link exists for image
        slideHTML += '</a>'
    picobj.innerHTML = slideHTML
}


fadeshow.prototype.rotateimage = function() {
    if (this.pausecheck == 1) //if pause onMouseover enabled, cache object
        var cacheobj = this
    if (this.mouseovercheck == 1)
        setTimeout(function() { cacheobj.rotateimage() }, 100)
    else if (iebrowser && dom || dom) {
        this.resetit()
        var crossobj = this.tempobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
        crossobj.style.zIndex++
        fadeclear[this.slideshowid] = setInterval("fadepic(fadearray[" + this.slideshowid + "])", 50)
        this.curcanvas = (this.curcanvas == this.canvasbase + "_0") ? this.canvasbase + "_1" : this.canvasbase + "_0"
    }
    else {
        var ns4imgobj = document.images['defaultslide' + this.slideshowid]
        ns4imgobj.src = this.postimages[this.curimageindex].src
    }
    this.curimageindex = (this.curimageindex < this.postimages.length - 1) ? this.curimageindex + 1 : 0
}

fadeshow.prototype.resetit = function() {
    this.degree = 10
    var crossobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
    if (crossobj.filters && crossobj.filters[0]) {
        if (typeof crossobj.filters[0].opacity == "number") //if IE6+
            crossobj.filters(0).opacity = this.degree
        else //else if IE5.5-
            crossobj.style.filter = "alpha(opacity=" + this.degree + ")"
    }
    else if (crossobj.style.MozOpacity)
        crossobj.style.MozOpacity = this.degree / 101
    else if (crossobj.style.KhtmlOpacity)
        crossobj.style.KhtmlOpacity = this.degree / 100
    else if (crossobj.style.opacity && !crossobj.filters)
        crossobj.style.opacity = this.degree / 101
}


fadeshow.prototype.startit = function() {
    var crossobj = iebrowser ? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
    this.populateslide(crossobj, this.curimageindex)
    if (this.pausecheck == 1) { //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
        var cacheobj = this
        var crossobjcontainer = iebrowser ? iebrowser["master" + this.slideshowid] : document.getElementById("master" + this.slideshowid)
        crossobjcontainer.onmouseover = function() { cacheobj.mouseovercheck = 1 }
        crossobjcontainer.onmouseout = function() { cacheobj.mouseovercheck = 0 }
    }
    this.rotateimage()
}

	