 (function($){
	$.fn.pagePeel = function(options){
	
		var defaults = {
			
			// SET WIDTH / HEIGHT OF CORNER AD (SAME AS .SWF)
			smallWidth: 100,
			smallHeight: 100,
			smallBG: '/images/peel/smallBG.png',
			smallAd: '/images/peel/smallAd-day.jpg',
			smallSWF: '/swf/page-peel-small.swf',
			
			// SET WIDTH / HEIGHT OF BIG AD (SAME AS .SWF)
			bigWidth: 500,
			bigHeight: 500,
			bigBG: '/images/peel/bigBG.png',
			bigAd: '/images/peel/bigAd-day.jpg',
			bigSWF: '/swf/page-peel-big.swf',
			
			// POSITION WILL REMAIN THE SAME FOR BOTH
			hPosition: 'right', // can use 'left' or 'right'
			vPosition: 'top', // can use 'top' or 'bottom'
			
			// WHETHER TO USE INTRO ANIMATION OR NOT
			introAnim: false,
			
			// ADD LINK IF LEFT 'BLANK', NO ADD LINK WILL BE APPLIED
			adLink: 'blank'
		};
		
		var options = $.extend(defaults, options);
		
		var element = this;
		
	return this.each(function(){
		
		$(element).before("<div id='page-peel-small' style='width:" + options.smallWidth + "px; height: " + options.smallHeight + "px; display:block; position:absolute; " + options.vPosition + ":0px; " + options.hPosition + ":0px; z-index:9990;'><embed style='display: block;' src='" + options.smallSWF + " 'flashvars='smallURL=" + options.smallAd + "' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer' wmode='transparent' autoplay='false' width='" + options.smallWidth + "' height='" + options.smallHeight + "'></div> <div id='page-peel-big' style='width:" + options.bigWidth + "px; height: " + options.bigHeight + "px; display:none; position:absolute; " + options.vPosition + ":0px; " + options.hPosition + ":0px; z-index:9999;'><embed style='display: block;' src='" + options.bigSWF + " 'flashvars='bigURL=" + options.bigAd + "&amp;linkURL=" + options.adLink + "' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer' wmode='transparent' autoplay='false' width='" + options.bigWidth + "' height='" + options.bigHeight + "'></div>");
			
		$('#page-peel-small').mouseover(
			function(){
				$('#page-peel-big').stop().show();			
			}
		);
		
		$('#page-peel-big').mouseout(
			function(){
				$(this).animate({right:'0px'},600).fadeOut('fast', function() {$(this).hide();});
			}
		);
	});
		
	};
})(jQuery);

$().ready(function(){
	$('#pagePeel').pagePeel({
		introAnim: true,
		adLink: '/' + varPageURL + '?tod=night'
	});
});
