PEPS = {};

PEPS.rollover = 
{
   init: function()
   {
      this.preload();
      
      jQuery(".ro").hover(
         function () { jQuery(this).attr( 'src', PEPS.rollover.newimage(jQuery(this).attr('src')) ); }, 
         function () { jQuery(this).attr( 'src', PEPS.rollover.oldimage(jQuery(this).attr('src')) ); }
      );
   },

   preload: function()
   {
      jQuery(window).bind('load', function() {
         jQuery('.ro').each( function( key, elm ) { jQuery('<img>').attr( 'src', PEPS.rollover.newimage( jQuery(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\./, '.'); 
   }
};


jQuery(document).ready(function() {

	PEPS.rollover.init();
	
	if($('#Gallery').size() > 0 && $('.radGallery').size() < 1){
		$('div#Content, div#subNavigation, div#ContentRight').hover(
			function () {
	        	$('div#contentContainer *').animate({opacity: 1},'slow');
	      	}, 
	    	function () {
	    		$('div#contentContainer *').animate({opacity: 0.25},'slow');
		})
	}
	
	$('#Gallery img:not(.Active)').hover(
		function () {
			$(this).css({
				'margin': '0px',
				'border-width' : '8px',
				'border-color' : '#564E44',
				'border-style' : 'solid'
			});
		},
		function () {
			$(this).css({
				'margin' : '8px',
				'border-width' : '0px',
				'border-style' : 'none'
			});
		}
	)
	
});

window.onload = function()
{
	if(jQuery.support.style === true){
		$('#subNavigation').animate({height:'465px'}, 'slow');
	};
	
	if($('#Gallery').size() > 0 && $('.radGallery').size() < 1){
		setTimeout( function(){
			$('div#contentContainer *').animate({opacity:0.25},'slow');
		}, 250)
	}
}
