// JAVASCRIPT

// Assign BG Style
function chooseStyle(choice, path){
	$("body").css({"background-image" : "url("+path+"gui/bg"+choice+".jpg)"});
	$("#logo").css({"background-image" : "url("+path+"gui/logo"+choice+".gif)"});
}

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

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

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

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

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

$(document).ready(function(){

	// Randomly Pick BG Style
	var choice = Math.ceil(Math.random()*5);
	if($("#section_home").length > 0 ){var path = "";}else{var path = "../";}
	if($("#section_extras").length > 0 ){var path = "";}
	chooseStyle(choice, path);
	
	// Control Marquee
	(function($) {
		$(function() { //on DOM ready
			$("#marquee").simplyScroll({
				autoMode: 'loop',
				pauseOnHover: false,
				speed: 4,
				frameRate: 20
			});
		});
	})(jQuery);
	
	$('#submit').hover(
		function(){$(this).addClass(" over");},
		function(){$(this).removeClass(" over");}
	);
	
	// Activate Slideshow
	var initial = Math.floor(Math.random()*5);					   
	$('#slideshow IMG:eq('+initial+')').addClass('active');					   				   
						   
	if($("#section_home").length > 0 ){setInterval( "slideSwitch()", 4000);}


});




// Date
function date(get) {
	var mydate=new Date()
	var year=mydate.getFullYear()
	if(get=="year"){document.write(year);}
}








