function mainmenu(){
	$(" #navmenu ul ").css({display: "none"}); // Opera Fix
	$(" #navmenu li ").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).animate({height: "toggle"}, "medium");
		//$(this).find('ul:first').slideDown('fast').show();
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		//$(this).find('ul:first').slideUp('medium');
	});
}

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

function textSize() {
	// Increase Font Size
	  $("#increase_me").click(function(){
	    var currentFontSize = $('html').css('font-size');
	    var currentFontSizeNum = parseFloat(currentFontSize, 10);
	    var newFontSize = currentFontSizeNum*1.2;
	    $('html').css('font-size', newFontSize);
	    return false;
	  });
	// Decrease Font Size
	  $("#decrease_me").click(function(){
	    var currentFontSize = $('html').css('font-size');
	    var currentFontSizeNum = parseFloat(currentFontSize, 10);
	    var newFontSize = currentFontSizeNum*0.8;
	    $('html').css('font-size', newFontSize);
	    return false;
	  });
}

function resizeText(multiplier) { 
	var tags = new Array();
	tags[0] = 'p'; tags[1] = 'a'; tags[2] = 'li'; tags[4] = 'strong';
	for (i=0; i<=4; i++) {
		var currentFontSize = $(tags[i]).css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		$(tags[i]).css('font-size', (currentFontSizeNum + multiplier) + 'px');
	}
}


/* FIRE UP ALL FUNCTIONS WHEN PAGE LOAD COMPLETES */

$(document).ready(function(){	
	// mainmenu init				
	//mainmenu();
	var config = {    
	         sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
	         interval: 200,  // number = milliseconds for onMouseOver polling interval    
	         over: doOpen,   // function = onMouseOver callback (REQUIRED)    
	         timeout: 200,   // number = milliseconds delay before onMouseOut    
	         out: doClose    // function = onMouseOut callback (REQUIRED)    
	    };

	    function doOpen() {
	        $(this).addClass("hover");
	        $('ul:first',this).css('visibility', 'visible');
	    }

	    function doClose() {
	        $(this).removeClass("hover");
	        $('ul:first',this).css('visibility', 'hidden');
	    }

	    $("ul.dropdown li").hoverIntent(config);
	
	// slideshow init
	setInterval( "slideSwitch()", 4000 );
	
	// font size init
	$("#increase_me").click(function() { resizeText(1); } );//resizeText(1);}); 
	$("#decrease_me").click(function() { resizeText(-1); } ); 
	
});
