jQuery(document).ready(function(){

	navPopUp();	
	bannerScroller();
	initPagePeel();	
	
});
	
	
/* Main Navigation Pop Up */
function navPopUp() {
    jQuery('.navPopup').hide();
    jQuery('#nav li').children().removeAttr('filter');
    jQuery('#nav li').hover(
    function () {
        jQuery(this).children().first().css({
            'background': 'white',
            'color': 'black'
        });
        jQuery(this).children('.navPopup').stop(true, true).fadeIn(250);
    }, function () {
        jQuery(this).children().first().css({
            'background': 'none',
            'color': 'white'
        });
        jQuery(this).children('.navPopup').stop(true, true).fadeOut(50);
    });
}

//Banner Scroller
//Variables for Scrolling Banner declared outside of bannerScroller(). Enables functions outside of bannerScroller() to be able to call pause() and play()
var bannerInterval,
    bannerTimeout,
	numberOfListItems,
	listItem,
	scrollerTimer,
	intervalDelay,
	timeoutDelay;
	
//Banner Scroller Function
//Use class of 'full' on a listItem if whole background should move off
function bannerScroller() {
	
	var bannerContainer = jQuery("div.bannerContainer"),
		bannerList = bannerContainer.children().last();
			
    if (bannerList.length > 0) {

        	//Speed of animations
        var backgroundSpeed = 700,
            contentSpeedOut = 500,
            contentSpeedIn = 600,
            initialContentSpeedIn = 800;

        //Delay on interval
        intervalDelay = 7000;
       	timeoutDelay = 1500;

        	//Easing Styles
        var backgroundEasing = 'easeOutQuart', 
			contentEasingIn = 'easeOutExpo', 
			contentEasingOut = 'easeInExpo',
			
			left = '-100%', //leave
			right = '100%', //leave			
			
			childMoveIn = left, //Sets move in from direction of child content
			childMoveInPrev = left, //Sets move in from direction of child content if previous button is clicked
			
			childMoveOff = left, //Sets move off to direction of child content
			childMoveOffPrev = left; //Sets move off to direction of child content if previous button is clicked

        listItem = bannerList.children();         
		var firstItem = listItem.eq(0);
        numberOfListItems = listItem.length;
		
        //Sets state of initial item on page load
        var firstItemChildLeft = firstItem.children().css("left");
        firstItem.css('left', '0%').children().css('left', '100%');
        if (firstItem.children().length > 0) {
            firstItem.children().animate({
                left: firstItemChildLeft
            }, {
                duration: initialContentSpeedIn,
                easing: contentEasingIn,
                complete: function () {
                    listItem.addClass('complete');
                }
            });
        } else {
            listItem.addClass('complete');
        }

        //Play Function: Set Interval and Timeouts
        scrollerTimer = function () {
							scroller();
						};
        playBanners();

        //Banner Nav Links: Previous, Next and Pause/Play
        if (numberOfListItems > 1) {
            bannerList.before('<div class="bannerNavLinks"><a class="bannerNav bannerFeaturePrev" href="#"><span class="bg"></span><span class="icon"></span></a><a class="bannerNav bannerFeatureNext" href="#"><span class="bg"></span><span class="icon"></span></a><a class="bannerNav pause pausePlayButton" href="#"><span class="bg"></span><span class="icon"></span></a></div>');
            var bannerNavLinksContainer = bannerContainer.find("div.bannerNavLinks"),
                bannerNavLinks = bannerNavLinksContainer.children(),
                prevLink = bannerNavLinks.eq(0),
                nextLink = bannerNavLinks.eq(1),
				pausePlayButton = bannerNavLinks.eq(2);
            bannerNavLinks.hide();
		    var navTimeout;
		    bannerContainer.hover(
            function () {
			    clearTimeout(navTimeout);
			    bannerNavLinks.stop(true, true).fadeIn();
            }, function () {
				if(listItem.hasClass('paused')) {
				} else {
					navTimeout = setTimeout(function () {
						bannerNavLinks.stop(true, true).fadeOut();
					}, 600);
				}
            });
		    bannerNavLinks.hover(
            function () {
                pauseBanners();
            });
		    prevLink.click(function () {
				if (listItem.hasClass('complete')) {
					listItem.addClass('prevClick');
                	navClick();
				}
				else {
					return false;
				}
            });
            nextLink.click(function () {
				if (listItem.hasClass('complete')) {
					navClick();
				}
				else {
					return false;
				}
		    });
		    function navClick() {				
				pausePlayButton.removeClass('play');
				listItem.removeClass('paused');
				listItem.addClass('interaction');
			    listItem.addClass('navClick');
				pauseBanners();
			    playBanners();
			    return false;
		    }
			//Pause and Play Button
			pausePlayButton.click(function () {
				if(listItem.hasClass('paused')) {
					listItem.removeClass('paused');
					pausePlayButton.removeClass('play');
					listItem.addClass('interaction');
					pauseBanners();
					playBanners();
					return false;
				} else {
					listItem.addClass('paused');
					pausePlayButton.addClass('play');
					pauseBanners();
					return false;
				}
			});
        }

        //On Mouse hover
        listItem.hover(
        function () {
			if(listItem.hasClass('paused')) {
			} else {
				pauseBanners();
            	listItem.addClass('interaction');
			}
        }, function () {
			if(listItem.hasClass('paused')) {
			} else {
            	playBanners();
			}
        });		

        //Function for Scrolling Items
        function scroller() {
            var listItem = bannerList.children(),
                currentItem = listItem.eq(0),
                currentItemChildLeft = currentItem.children().css("left"),
                next = listItem.eq(1),
                prev = listItem.filter(":last"),
                nextChildLeft = next.children().css("left"),
                prevChildLeft = prev.children().css("left"),
                contentWidthCurrent = currentItem.children().outerWidth(),
                moveOffLeft = '-100%',
                moveOffRight = '100%';				
            listItem.removeClass('complete');			
            if (listItem.hasClass('prevClick')) {
                prev.css('left', '-100%');
                prev.children().css('left', childMoveInPrev);				
                if (currentItem.children().length != 0) {					
                    currentItem.children().animate({
                        left: childMoveOffPrev
                    }, {
                        duration: contentSpeedOut,
                        easing: contentEasingOut,
                        complete: function () {
                            itemScroller(moveOffRight, currentItem, prev, currentItemChildLeft, prevChildLeft);
                        }
                    });					
                } else {					
                    itemScroller(moveOffRight, currentItem, prev, currentItemChildLeft, prevChildLeft);					
                }				
            } else {				
                next.children().css('left', childMoveIn);		
                if (currentItem.children().length != 0) {
                    currentItem.children().animate({
                        left: childMoveOff
                    }, {
                        duration: contentSpeedOut,
                        easing: contentEasingOut,
                        complete: function () {
                            itemScroller(moveOffLeft, currentItem, next, currentItemChildLeft, nextChildLeft);
                        }
                    });					
                } else {					
                    itemScroller(moveOffLeft, currentItem, next, currentItemChildLeft, nextChildLeft);					
                }
            }
        }
        function itemScroller(moveOffPosition, currentItem, itemToShow, currentItemChildLeft, itemToShowChildLeft) {
            currentItem.animate({
                left: moveOffPosition
            }, {
                duration: backgroundSpeed,
                easing: backgroundEasing,
                complete: function () {
                    if (itemToShow.hasClass("full")) {
                        appendCurrentItem(currentItem, currentItemChildLeft);
                    } else {
                        newItem(itemToShow, itemToShowChildLeft);
                        appendCurrentItem(currentItem, currentItemChildLeft);
                    }
                }
            });
            if (itemToShow.hasClass("full")) {
                newItem(itemToShow, itemToShowChildLeft);
            }
        }
        function appendCurrentItem(currentItem, currentItemChildLeft) {
            if (listItem.hasClass('prevClick')) {                
            } else {
                currentItem.appendTo(bannerList);
            }
            currentItem.css('left', '100%');
            currentItem.children().css('left', currentItemChildLeft);
        }
        function newItem(itemToShow, itemToShowChildLeft) {
            itemToShow.animate({
                left: '0%'
            }, {
                duration: backgroundSpeed,
                easing: backgroundEasing,
                complete: function () {
                    if (itemToShow.children().length > 0) {
                        itemToShow.children().animate({
                            left: itemToShowChildLeft
                        }, {
                            duration: contentSpeedIn,
                            easing: contentEasingIn,
                            complete: function () {
                                if (listItem.hasClass('prevClick')) {
                                    itemToShow.prependTo(bannerList);
                                    listItem.removeClass('prevClick');
                                }
                                listItem.addClass('complete');
                            }
                        })
                    } else {
                        if (listItem.hasClass('prevClick')) {
                            itemToShow.prependTo(bannerList);
                            listItem.removeClass('prevClick');
                        }
                        listItem.addClass('complete');
                    }
                }
            });
        }
    }
}
//Play Banners
//External to bannerScroller() so that it can be called by other functions outside of bannerScroller()
function playBanners() {
	if (numberOfListItems > 1) {		
		if (listItem.hasClass('paused')) {
		} else {
			if (listItem.hasClass('interaction')) {
				listItem.removeClass('interaction');
				if (listItem.hasClass('complete')) {
					if (listItem.hasClass('navClick')) {
						listItem.removeClass('navClick');
						bannerTimeout = setTimeout(scrollerTimer, 0);
					} else {
						bannerTimeout = setTimeout(scrollerTimer, timeoutDelay);
					}
				}
			}
			bannerInterval = setInterval(scrollerTimer, intervalDelay);
		}
	}
}
//Pause Banners: Clear Banner Intervals and Timeouts
//External to bannerScroller() so that it can be called by other functions outside of bannerScroller()
function pauseBanners() {
	clearInterval(bannerInterval);
	clearTimeout(bannerTimeout);
}

/* page peel (homepage)*/
function initPagePeel() {

    var pagePeel = jQuery('#pagePeel');
    var peelPeekObj = jQuery('#pagePeel');
    jQuery(this).peelPeekObj;
    var nextPageContent = jQuery('#nextPageContent');
    var maxHeight = 215; //was 319;
    var maxWidth = 410; //500
    var minHeight = 52;
    var minWidth = 54; //56
    var maxImgHeight = 234; //349
    var maxImgWidth = 287; //319
    var minImgHeight = 59;
    var minImgWidth = 56;
    var animationSpeed = 350;
    var peekSpeed = 400; // page peel inital peek speed
    var peekShowDelay = 1000; // delay inital opening of peel - so webpage can load before peel reveals
    var peekHideDelay = 3000; // delay inital closing of peel
    var peelOpen = false; // Boolean to flag if inital page peel peek is open or not - default closed page peel
    nextPageContent.css({

        height: maxHeight,
        width: maxWidth

    });

    // Initial Page Peel Peek
    var timerOpen = setTimeout(function () {
        peelShow(peelPeekObj);
    }, peekShowDelay);

    function peelShow() {

        peelOpen = true;

        // check if intial page peel is open and user is hovering within the peel			  
        if (peelOpen == true) {
            jQuery(peelPeekObj).hover(function () {
                clearTimeout(timerHide); // clear peel hide timer
                //clearInterval(play); // clear rotator timer
				pauseBanners(); //added 17-11/2011 DH
            }, function () {
                jQuery(peelPeekObj).unbind(); // unbind hover events and instantly hide peel
                //rotateTimer(); // start banner rotation
				listItem.addClass('interaction');
				playBanners(); //added 17-11/2011 DH
				 //added 17-11/2011 DH
                peelHide(peelPeekObj);
            });

        } else {
            pagePeelAnimation(); // if peel is closed call the peel animation function
        }

        // Inital page peel peek animation if user doesnt hover over peel			  			    
        peelPeekObj.animate({

            width: maxWidth,
            height: maxHeight,
            right: 0
        }, peekSpeed)

        .children("#pagePeelImage")

        .animate({

            width: maxImgWidth,
            height: maxImgHeight
        }, peekSpeed);

        var timerHide = setTimeout(function () {
            peelHide(peelPeekObj); // trigger hide peel after delay
        }, peekHideDelay);
    }


    function peelHide() {

        peelOpen = false;

        jQuery(peelPeekObj).unbind(); // unbind events so - pagePeelAnimation hover events can take over after inital peel peek
        peelPeekObj.animate({

            width: minWidth,
            height: minHeight,
            right: 0
        }, animationSpeed)

        .children("#pagePeelImage")

        .animate({

            width: minImgWidth,
            height: minImgHeight
        }, animationSpeed, pagePeelAnimation()); // callback function once inital page peel is completed to regular peel animation
    }

    // MAIN MODE FUNCTIONS

    function pagePeelAnimation() {

        peelOpen = false;

        pagePeel.hover(function () {

            // Page Peel Chain
            //clearInterval(play); // Stop rotating banners 
			pauseBanners(); //added 17-11/2011 DH
            jQuery(this) // Reference PagePeel
            .stop(true) // Stop the animation queue and don't let it finish
            .animate({ // Make the page peel bigger
                width: maxWidth,
                height: maxHeight,
                right: 0

            }, animationSpeed)

            .removeAttr("style") // Remove the style attribute so that the animation doesn't add left positioning
            .children("#pagePeelImage") // Reference the page peel image
            .stop(true) // Stop the animation queue and don't let it finish
            .animate({ // Make the page peel image bigger
                width: maxImgWidth,
                height: maxImgHeight

            }, animationSpeed)

            .removeAttr("style"); // Remove the style attribute so that the animation doesn't add left positioning
        }, function () {

            //rotateTimer(); // Start rotating banner
			listItem.addClass('interaction'); //added 17-11/2011 DH
			playBanners(); //added 17-11/2011 DH			
            jQuery(this) // Reference PagePeel
            .stop(true) // Stop the animation queue and don't let it finish
            .animate({ // Make the page peel smaller
                width: minWidth,
                height: minHeight,
                right: 0

            }, animationSpeed)

            .removeAttr("style") // Remove the style attribute so that the animation doesn't add left positioning
            .children("#pagePeelImage") // Reference the page peel image
            .stop(true) // Stop the animation queue and don't let it finish
            .animate({ // Make the page peel image smaller
                width: minImgWidth,
                height: minImgHeight

            }, animationSpeed)

            .removeAttr("style"); // Remove the style attribute so that the animation doesn't add left positioning
        });
    }
}




/* USEFUL */

function activateURLs(stringToConvert){
	var rx = new RegExp(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig);
	return stringToConvert.replace(rx, "<a href='$1' target='_blank'>$1</a>");
}


/* TWITTER API */

//	function getTweets
//	returns string containing <tweetCount> tweets from @<screenname> in a specified <outputTemplate>
//	outputTemplate:			default benaviour, output all tweets in a string	
//					p 		wraps each tweet in <p> & </p> tag. URLs are output as hyperlinks
//					li		wraps each tweet in <li> & <li> tags. URLs are output as hyperlinks
//					ul		as li, but outputs list items within unordered list tags
//					ol		as li, but outputs list items within ordered list tags
//	outputLocation	ID of the container where HTML should be output
//	uses Twitter's API: GET statuses/user_timeline
//	https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
function getTweets(screenName, tweetCount, outputTemplate, outputLocation)
{
	var destinationObject = jQuery("#"+outputLocation);
	if (destinationObject.length == 0){
		return false;
	}
	
	var apiURL = "http://twitter.com/statuses/user_timeline/" + screenName + ".json?callback=?";
	jQuery.getJSON(apiURL, function(data) {
		
		var carryOn = true;
		var i = 0;
		var output = ""; 
		var total = data.length;
		
		if (i == data.length){
			carryOn = false;
		}
		
		while ((i < tweetCount)&&(carryOn)){
			
			var tweet = data[i].text;
			var tweetDate = data[i].created_at;
			
			switch (outputTemplate){
				case "li":
				case "ul":
				case "ol":
					//output = output + "<li class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "<span class='getTweetsTweetDate'>" + data[i].created_at + "</span></li>";
					output = output + "<li class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "</li>";
					break;
				case "p":
					output = output + "<p class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "</p>";
					break;
				case "span":
					output = output + "<span class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "</span>";
					break;
				default:
					output = output + tweet;
			}
			
			i++;
			if (i == data.length){
				carryOn = false;
			}
		}
		
		switch (outputTemplate){
			case "ul":
				output = "<ul>" + output + "</ul>"
				break;
			case "ol":
				output = "<ol>" + output + "</ol>"
				break;
		}
		
		jQuery(destinationObject).html(output);
	});
}

/* DAILY DEALS RSS */
//appends daily deals html into specified destination element
function dailydealsRSS(destinationElement) {
	
	var destinationElement,
		destination = jQuery(destinationElement),
		html = jQuery("input#dailyDealRSS").val();
		
		//Content generated from blogRSStoHTML.asp appended to destination element
		destination.append(html);
		
		//Backup content if nothing appended from blogRSStoHTML.asp
		if (jQuery("div#nextPage").length > 0) {
		} else {
			var backup = "<div id='nextPage'><div id='nextPageContent' class='noDeals'><div id='inactiveDeal'><div id='dealText'><h2>Discover fantastic deals - updated daily. Be quick before they expire!</h2></div><div id='dealURL'><a href='http://deals.probrand.co.uk' title='View Deals' target='_blank'>View Deals</a></div></div></div></div>";
			destination.append(backup);
		}
		
}



//BELOW TEMPORARILY COMMENTED OUT AND REPLACED WITH ABOVE ON 17-11-2011.


//jQuery(document).ready(function(){
//
//	var bannersList = jQuery('.bannersList');
//	var bannerListNavigation = jQuery('.bannerListNavigation');
//	
//	bannerListNavigation.children().first().addClass('current');
//	
//	var positionleft = 0;
//	var bannersArray = [];
//	
//	bannersList.children().each(function(i)
//	{	
//		jQuery(this).css('left', function(j, val)
//		{
//			positionleft = positionleft+964;
//			return(positionleft)+'px';			
//		});
//		
//		jQuery(this).attr('id','headerBanner'+i);
//		bannersArray[('headerBanner'+i)] = i;
//	});
//	
//	var currentBanner = bannersList.children().first().attr('id');
//			
//	function startInterval() {
//	
//		interval = setInterval(function()
//		{
//			bannerRotate(1000,1);
//			
//		}, 4000)
//	}
//
//	function bannerRotate(speed,requestedIndex){
//				
//		do {
//			bannersList.children().animate(
//			{
//				left : '-=964',
//				opacity : 1
//				
//			}, speed, 'swing');
//							
//			previousBanner = bannersList.children().first();
//			previousBanner.appendTo(bannersList);
//										
//			previousBanner.animate(
//			{
//				left : positionleft,
//				opacity : 0
//				
//			}, 0, 'linear');
//			
//			currentBanner = bannersList.children().first().attr('id');
//			
//			bannerListNavigation.children().removeClass();
//			bannerListNavigation.children().eq(bannersArray[currentBanner]).addClass('current');
//											
//			requestedIndex--;
//		}
//		while (requestedIndex > 0);
//	}
//	
//	bannerListNavigation.children().click(function() {
//	
//		var index = jQuery(this).index();
//		bannerIndex = jQuery('#headerBanner'+index).index();
//
//		if (bannersArray[currentBanner] != index) {
//			bannerRotate(0,bannerIndex);
//		}
//	});
//	
//	bannerListNavigation.children().mouseover(function(){
//	
//		clearInterval(interval);
//	});
//	
//	bannerListNavigation.children().mouseout(function(){
//	
//		startInterval();
//	});
//	
//	startInterval();
//	
//	jQuery('.navPopup').hide();
//	
//	jQuery('#nav li').children().removeAttr('filter');
//
//	
//	jQuery('#nav li').hover(
//		function()
//		{
//			jQuery(this).children().first().css({'background':'white','color':'black'});
//			jQuery(this).children('.navPopup').stop(true,true).fadeIn(250);
//		},
//		function()
//		{
//			jQuery(this).children().first().css({'background':'none','color':'white'});
//			jQuery(this).children('.navPopup').stop(true,true).fadeOut(50);
//		}
//	);
//	
//	
//	
//	// peel
//	initPagePeel();
//		
//});
//
//
//
//
///* USEFUL */
//
//function activateURLs(stringToConvert){
//	var rx = new RegExp(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig);
//	return stringToConvert.replace(rx, "<a href='$1' target='_blank'>$1</a>");
//}
//
//
///* TWITTER API */
//
////	function getTweets
////	returns string containing <tweetCount> tweets from @<screenname> in a specified <outputTemplate>
////	outputTemplate:			default benaviour, output all tweets in a string	
////					p 		wraps each tweet in <p> & </p> tag. URLs are output as hyperlinks
////					li		wraps each tweet in <li> & <li> tags. URLs are output as hyperlinks
////					ul		as li, but outputs list items within unordered list tags
////					ol		as li, but outputs list items within ordered list tags
////	outputLocation	ID of the container where HTML should be output
////	uses Twitter's API: GET statuses/user_timeline
////	https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
//function getTweets(screenName, tweetCount, outputTemplate, outputLocation)
//{
//	var destinationObject = jQuery("#"+outputLocation);
//	if (destinationObject.length == 0){
//		return false;
//	}
//	
//	var apiURL = "http://twitter.com/statuses/user_timeline/" + screenName + ".json?callback=?";
//	jQuery.getJSON(apiURL, function(data) {
//		
//		var carryOn = true;
//		var i = 0;
//		var output = ""; 
//		var total = data.length;
//		
//		if (i == data.length){
//			carryOn = false;
//		}
//		
//		while ((i < tweetCount)&&(carryOn)){
//			
//			var tweet = data[i].text;
//			var tweetDate = data[i].created_at;
//			
//			switch (outputTemplate){
//				case "li":
//				case "ul":
//				case "ol":
//					//output = output + "<li class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "<span class='getTweetsTweetDate'>" + data[i].created_at + "</span></li>";
//					output = output + "<li class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "</li>";
//					break;
//				case "p":
//					output = output + "<p class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "</p>";
//					break;
//				case "span":
//					output = output + "<span class='getTweetsTweet" + i + "'>" + activateURLs(tweet) + "</span>";
//					break;
//				default:
//					output = output + tweet;
//			}
//			
//			i++;
//			if (i == data.length){
//				carryOn = false;
//			}
//		}
//		
//		switch (outputTemplate){
//			case "ul":
//				output = "<ul>" + output + "</ul>"
//				break;
//			case "ol":
//				output = "<ol>" + output + "</ol>"
//				break;
//		}
//		
//		jQuery(destinationObject).html(output);
//	});
//}
//
//
//
///* page peel (homepage)*/
//function initPagePeel() {
//	
//	var pagePeel = jQuery('#pagePeel');
//	var nextPageContent = jQuery('#nextPageContent');
//	var maxHeight = 215; //was 319;
//	var maxWidth = 410;  //500
//	var minHeight = 52;
//	var minWidth = 56;
//	var maxImgHeight = 234; //349
//	var maxImgWidth = 287; //319
//	var minImgHeight = 59;
//	var minImgWidth = 56;
//	var animationSpeed = 300;
//	
//	nextPageContent.css({
//	
//		height : maxHeight,
//		width :	maxWidth
//	
//	});
//	
//// MAIN MODE FUNCTIONS
//	
//	pagePeel.hover(function(){
//		
//		// Page Peel Chain
//		
//		jQuery(this)				// Reference PagePeel
//		
//		.stop(true)					// Stop the animation queue and don't let it finish
//		
//		.animate({					// Make the page peel bigger
//		
//			width: maxWidth,
//			height: maxHeight,
//			right: 0
//		
//		}, animationSpeed)
//		
//		.removeAttr("style")		// Remove the style attribute so that the animation doesn't add left positioning
//		
//		.children("#pagePeelImage") // Reference the page peel image
//		
//		.stop(true)					// Stop the animation queue and don't let it finish
//		
//		.animate({					// Make the page peel image bigger
//		
//			width: maxImgWidth,
//			height: maxImgHeight
//		
//		}, animationSpeed)
//		
//		.removeAttr("style");		// Remove the style attribute so that the animation doesn't add left positioning
//		
//	},function(){
//		
//		jQuery(this)				// Reference PagePeel
//		
//		.stop(true)					// Stop the animation queue and don't let it finish
//		
//		.animate({					// Make the page peel smaller
//
//			width: minWidth,
//			height: minHeight,
//			right: 0
//
//		}, animationSpeed)
//		
//		.removeAttr("style")		// Remove the style attribute so that the animation doesn't add left positioning
//		
//		.children("#pagePeelImage")	// Reference the page peel image
//		
//		.stop(true)					// Stop the animation queue and don't let it finish
//		
//		.animate({					// Make the page peel image smaller
//		
//			width: minImgWidth,
//			height: minImgHeight
//		
//		}, animationSpeed)
//		
//		.removeAttr("style");		// Remove the style attribute so that the animation doesn't add left positioning
//		
//	});
//
//}

