$(document).ready(function() {

PEPS.rollover.init();


/*   FRONTPAGE CAROUSEL   */
	  
	



  $('#habitus').wslide({
	width: 910,
	height: 700,
	autolink: false,
	fade: true,
	duration: 800
    });

  $('#cumulus').wslide({
	width: 910,
	height: 700,
	autolink: false,
	fade: true,
	duration: 800
    });
  
  $('#tempus').wslide({
	width: 910,
	height: 700,
	autolink: false,
	fade: true,
	duration: 800
    });
  
    
  $('#archive').wslide({
	width: 910,
	height: 700,
	autolink: false,
	fade: true,
	duration: 800
    });




    
 
     
    
      
});


$(window).bind("load", function() { 
   $('#frontpage-bigimage').innerfade({
				speed: 'slow',
				timeout: 4000,
				type: 'sequence',
				containerheight: '700px'
			});

}); 



/*   START JUMPENU   */

    function initJumpMenus() {
        // Turns all <select> elements with the 'jumpmenu' class into jump menus
        var selectElements = document.getElementsByTagName("select");
        for( i = 0; i < selectElements.length; i++ ) {
            // Check for the class and make sure the element has an ID
            if( selectElements[i].className == "jumpmenu" && document.getElementById(selectElements[i].id) != "" ) {
                jumpmenu = document.getElementById(selectElements[i].id);
                jumpmenu.onchange = function() {
                    if( this.options[this.selectedIndex].value != '' ) {
                        // Redirect
                        location.href=this.options[this.selectedIndex].value;
                    }
                }
            }
        }
    }
    
    window.onload = function() {
        initJumpMenus();
    }

/*   END JUMPENU   */


/*   ROLLOVER   */

      PEPS = {};
      
      PEPS.rollover =
      {
         init: function()
         {
            this.preload();
            
            $(".ro").hover(
               function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
               function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
            );
         },
         
         preload: function()
         {
            $(window).bind('load', function() {
               $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
            });
         },
         
         newimage: function( src ) { return src.substring( 0, src.search(/(\.[a-z]+)/) ) + '_o' + src.match(/(\.[a-z]+)/)[0]; },
         oldimage: function( src ){ return src.replace(/_o/, ''); }
      };




