jQuery(document).ready( function()
{
   PEPS.rollover.init();
});

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\./, '.'); 
   }
};



(function(a){a.fn.extend({reflect:function(b){b=a.extend({height:0.33,opacity:0.5},b);return this.unreflect().each(function(){var c=this;if(/^img$/i.test(c.tagName)){function d(){var j,g=Math.floor(c.height*b.height),k,f,i;if(a.browser.msie){j=a("<img />").attr("src",c.src).css({width:c.width,height:c.height,marginBottom:-c.height+g,filter:"flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+(b.opacity*100)+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+(b.height*100)+")"})[0]}else{j=a("<canvas />")[0];if(!j.getContext){return}}a(j).css({display:"block",border:0});k=a(/^a$/i.test(c.parentNode.tagName)?"<span />":"<div />").insertAfter(c).append([c,j])[0];k.className=c.className;a.data(c,"reflected",k.style.cssText=c.style.cssText);a(k).css({width:c.width,height:c.height+g,overflow:"hidden"});c.style.cssText="display: block; border: 0px";c.className="";if(!a.browser.msie){try{f=a(j).attr({width:c.width,height:g})[0].getContext("2d");f.save();f.translate(0,c.height-1);f.scale(1,-1);f.drawImage(c,0,0,c.width,c.height);f.restore();f.globalCompositeOperation="destination-out";i=f.createLinearGradient(0,0,0,g);i.addColorStop(0,"rgba(255, 255, 255, "+(1-b.opacity)+")");i.addColorStop(1,"rgba(255, 255, 255, 1.0)");f.fillStyle=i;f.rect(0,0,c.width,g);f.fill()}catch(h){a(c).unreflect()}}}if(c.complete){d()}else{a(c).unbind("load").load(d)}}})},unreflect:function(){return this.each(function(){var c=this,b=a.data(this,"reflected"),d;a(c).unbind("load");if(b!==undefined){d=c.parentNode;c.className=d.className;c.style.cssText=b;a.removeData(c,"reflected");d.parentNode.replaceChild(c,d)}})}})})(jQuery);

// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
jQuery(function($) {
	$("img.reflect").reflect({/* Put custom options here */});
});



jQuery(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				jQuery('.boxgrid.slidedown').hover(function(){
					jQuery(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
				}, function() {
					jQuery(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
				//Horizontal Sliding
				jQuery('.boxgrid.slideright').hover(function(){
					jQuery(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
				}, function() {
					jQuery(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				jQuery('.boxgrid.thecombo').hover(function(){
					jQuery(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
				}, function() {
					jQuery(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				jQuery('.boxgrid.peek').hover(function(){
					jQuery(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
				}, function() {
					jQuery(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Full Caption Sliding (Hidden to Visible)
				jQuery('.boxgrid.captionfull').hover(function(){
					jQuery(".cover", this).stop().animate({top:'120px'},{queue:false,duration:160});
				}, function() {
					jQuery(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				jQuery('.boxgrid.caption').hover(function(){
					jQuery(".cover", this).stop().animate({top:'85px'},{queue:false,duration:160});
				}, function() {
					jQuery(".cover", this).stop().animate({top:'200px'},{queue:false,duration:160});
				});
			});
