var $j = jQuery.noConflict();
$j(document).ready(function(){
	$j("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);
});

$j(document).ready(function(){
	$j('#tabs div').hide(); // Hide all divs
	$j('#tabs div:first').show(); // Show the first div
	$j('#tabs ul li:first').addClass('active'); // Set the class of the first link to active
	$j('#tabs ul li a').click(function(){ //When any link is clicked
		$j('#tabs ul li').removeClass('active'); // Remove active class from all links
		$j(this).parent().addClass('active'); //Set clicked link class to active
		
		var currentTab = $j(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
		$j('#tabs div').hide(); // Hide all divs
		$j(currentTab).show(); // Show div with id equal to variable currentTab
		return false;
	});
});

/* Roll Over scripts */
$j(document).ready( function()
{
   PEPS.rollover.init();
});

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

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