﻿// Navigation DropDowns



$(document).ready(function(){

    $("#nav-one li").hover(

        function(){ $("ul", this).fadeIn("fast"); }, 

        function() { } 

    );

    if (document.all) {

        $("#nav-one li").hoverClass ("sfHover");

    }

});



$.fn.hoverClass = function(c) {

    return this.each(function(){

        $(this).hover( 

            function() { $(this).addClass(c);  },

            function() { $(this).removeClass(c); }

        );

    });

}; 



//Intro



$(document).ready(function() {		

	

	 //Execute the Intro

	    slideShow();



});



function showNav() { 



    // ShowNav function 2000 = fade in time

        $('#hidenav').animate({opacity: 1.0}, 2000);

}



function slideShow() {



	//Set the opacity of all images to 0

	    $('#intro a').css({opacity: 0.0});

	    $('#hidenav').css({opacity: 1.0});

	

	//Get the first image and display it (set it to full opacity)

	    $('#intro a:first').css({opacity: 1.0});

	

	//Call the gallery function to run the intro, 3000 = change to next image after 3 seconds

        var speed = 500; 

        setInterval('startIntro()', speed);

}



function startIntro() {

		

	//if no IMGs have the show class, grab the first image

	    var current = ($('#intro a.show')?  $('#intro a.show') : $('#intro a:first'));



	//Get next image

	    var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#intro a:first') : current.next()) : $('#intro a:first'));	



	//ShowNav on second Slide

	    if (current.next().hasClass('second'))

        {

            showNav();

        }

      

   //Stop Slideshow at last IMG

        if (current.next().hasClass('end'))

        {

            clearInterval('startIntro()');   

            return false;   

        }

	

	//Set the fade in effect for the next image, show class has higher z-index. 2000 = fade speed.

	    next.css({opacity: 0.0})

	    .addClass('show')

	    .animate({opacity: 1.0}, 2000);



	//Hide the current image

	    current.animate({opacity: 0.0}, 2000)

	    .removeClass('show');	

	}

function  resizeText(sizeKind) {
	
  if (sizeKind == "size1") {
    document.body.style.fontSize = "14px";
  }
  if (sizeKind == "size2") {
    document.body.style.fontSize = "16px";
  }
  if (sizeKind == "size3") {
    document.body.style.fontSize = "18px";
  }
}

