/**
 * @author enm
 */

 $(document).ready(function(){
	 $("img[rel]").overlay({ 
		 
		    // custom top position 
		    top: 272, 
		 
		    // some expose tweaks suitable for facebox-looking dialogs 
		    expose: { 
		 
		        // you might also consider a "transparent" color for the mask 
		        color: '#fff', 
		 
		        // load mask a little faster 
		        loadSpeed: 200, 
		 
		        // highly transparent 
		        opacity: 0.8 
		    }, 
		 
		    // disable this for modal dialog-type of overlays 
		    closeOnClick: false
		});
	 
	 $("a[rel|=#external_overlay]").overlay({ 
		    top: 272,
	        expose:{color:'#000',opacity:0.6}, 
	        //effect: 'apple', 
	 
	        onBeforeLoad: function() { 
	 
	            // grab wrapper element inside content 
	            var wrap = this.getContent().find(".contentWrap"); 
	 
	            // load the page specified in the trigger 
	            wrap.load(this.getTrigger().attr("href") + ' #bonusInfo'); 
	        } 
	 
	    });
	 
	 

 $('.imgSwap').each(function(){
	    var currentImgPath = this.src;
		var ext = this.src.substring(this.src.length - 3);
		
		if(this.src.indexOf('-off.') > -1){
		    //img is off
			var turn = 'on';
			var trimOff = 7;
		}
		else{
		    //img is on
			var turn = 'off';
			var trimOff = 6;
		}
		
		var newImg = this.src.substring(0,this.src.length - trimOff) + turn + '.' + ext;
		
		$(this).hover(
		    function(){$(this).attr('src',newImg);},
			function(){$(this).attr('src',currentImgPath);}
		);
		
	});
});
