/* create a timeOut function in jQuery */
    jQuery.fn.idle = function(time){
        return this.each(function(){
            var i = $(this);
            i.queue(function(){
                setTimeout(function(){
                i.dequeue();
                }, time);
            });
        });
    };
$(document).ready(function(){
	// home page slider rotation
	if (document.getElementById("gallery")){
		$('#gallery').galleryView({
			panel_width: 400,
			panel_height: 300,
			frame_width: 100,
			frame_height: 67,
	  		transition_speed: 350,
	 		easing: 'easeInOutQuad',
			transition_interval: 0,
			pointer_size: 5,
			frame_gap: 2,
			nav_theme: 'dark'
		});
	}
	
	 // messagebox 
        if(document.getElementById("splashMain")){
            // fade out
            $('#splashMain').idle(4500).fadeOut('slow');
            $('#splashEnter').idle(5000).fadeIn('slow');
        }
		// scroll pane
		if (document.getElementById("linksList")){
			$('#linksList').jScrollPane({scrollbarWidth:5,dragMaxHeight:45});
		}
		if (document.getElementById("contentPageProfile")){
			$('#contentPageProfile').jScrollPane({scrollbarWidth:5,dragMaxHeight:45});
		}
		// roll overs
		// about
		$('.topNavItem').hover(
			function() { $('.subNavItem', this).css('display', 'block'); },
			function() { $('.subNavItem', this).css('display', 'none'); });
	
	
	// top nav rollover
	$(".rollover").hover(
	 function()
	 {
	  this.src = this.src.replace("_off","_on");
	 },
	 function()
	 {
	  this.src = this.src.replace("_on","_off")	;
	 }
	);
});