
// 'stacks' is the Stacks global object.
// All of the other Stacks related Javascript will 
// be attatched to it.
var stacks = {};


// this call to jQuery gives us access to the globaal
// jQuery object. 
// 'noConflict' removes the '$' variable.
// 'true' removes the 'jQuery' variable.
// removing these globals reduces conflicts with other 
// jQuery versions that might be running on this page.
stacks.jQuery = jQuery.noConflict(true);

// Javascript for stacks_in_215_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_215_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_215_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
jQuery(document).ready(function($){
	var MegaMenu_stacks_in_215_page2 = (function(){
		// VARIABLES
		var jq = $([]),
		MegaMenu = {};
		
		// GLOBAL VARIABLES
		MegaMenu.globals = (function() {
			if (typeof stacks.MegaMenu == 'undefined') {
		        stacks.MegaMenu = {},
				// set decremental z-index of parent stacks_out for multiple MM's 
				stacks.MegaMenu.z=(function(){stacks.MegaMenu.ul = jq.add("ul.MegaMenu"),stacks.MegaMenu.len = stacks.MegaMenu.ul.length - 1;if(stacks.MegaMenu.len>=1){var i=stacks.MegaMenu.len,j,zDex=10500;for(i;i>=0;i--){j=jq.add(stacks.MegaMenu.ul[i]);if(j.attr('id')=="menu_A"){zDex-=i;j.parent().parent().css('z-index',zDex);break;}}}})(),
				// Linear and Radial Gradient cssHook for jQuery (c) 2011 Tom Ellis (http://www.webmuse.co.uk)
				stacks.MegaMenu.grad=(function($){var div=document.createElement("div"),divStyle=div.style,rLinear=/^(.*?)linear-gradient(.*?)$/i,rRadial=/^(.*?)radial-gradient(.*?)$/i,rLinearSettings=/^(.*?)(:?linear-gradient)(\()(.*)(\))(.*?)$/i,rRadialSettings=/^(.*?)(:?radial-gradient)(\()(.*?)(\))(.*?)$/i,rSupportLinearW3C=/(^|\s)linear-gradient/,rSupportLinearMoz=/(^|\s)-moz-linear-gradient/,rSupportLinearWebkit=/(^|\s)-webkit-linear-gradient/,rSupportLinearOpera=/(^|\s)-o-linear-gradient/,rSupportRadialW3C=/(^|\s)radial-gradient/,rSupportRadialMoz=/(^|\s)-moz-radial-gradient/,rSupportRadialWebkit=/(^|\s)-webkit-radial-gradient/,rSupportRadialOpera=/(^|\s)-o-radial-gradient/,rWhitespace=/\s/,rWhiteGlobal=/\s/g,cssProps="background backgroundImage",cssLinear="background-image: -moz-linear-gradient(red, blue);background-image: -webkit-linear-gradient(red, blue);background-image: -o-linear-gradient(red, blue);background-image: linear-gradient(red, blue);",cssRadial="background-image: -moz-radial-gradient(circle, orange, red);background-image: -webkit-radial-gradient(circle, orange, red);background-image: -o-radial-gradient(circle,red, blue);background-image: radial-gradient(circle, orange, red);",cssPropsArray=cssProps.split(rWhitespace);divStyle.cssText=cssLinear,linearSettings=function(value){var parts=rLinearSettings.exec(value);value=value.replace(parts[2],$.support.linearGradient);return value;},radialSettings=function(value){var parts=rRadialSettings.exec(value);value=value.replace(parts[2],$.support.radialGradient);return value;};$.support.linearGradient=rSupportLinearW3C.test(divStyle.backgroundImage)?"linear-gradient":(rSupportLinearMoz.test(divStyle.backgroundImage)?"-moz-linear-gradient":(rSupportLinearWebkit.test(divStyle.backgroundImage)?"-webkit-linear-gradient":(rSupportLinearOpera.test(divStyle.backgroundImage)?"-o-linear-gradient":false)));divStyle.cssText=cssRadial;$.support.radialGradient=rSupportRadialW3C.test(divStyle.backgroundImage)?"radial-gradient":(rSupportRadialMoz.test(divStyle.backgroundImage)?"-moz-radial-gradient":(rSupportRadialWebkit.test(divStyle.backgroundImage)?"-webkit-radial-gradient":(rSupportRadialOpera.test(divStyle.backgroundImage)?"-o-radial-gradient":false)));if($.support.linearGradient&&$.support.linearGradient!=="linear-gradient"){$.each(cssPropsArray,function(i,prop){$.cssHooks[prop]={set:function(elem,value){if(rLinear.test(value)){elem.style[prop]=linearSettings(value);}else if(rRadial.test(value)){elem.style[prop]=radialSettings(value);}else{elem.style[prop]=value;}}};});}div=divStyle=null;})(jQuery),
				// color grab function
				stacks.MegaMenu.getThatColor=function(color,ratio,shade){var pad=function(num,totalChars){var pad='0';num=num+'';while(num.length<totalChars){num=pad+num;}return num;};var changeColor=function(color,ratio,darker){color=color.replace(/^\s*|\s*$/,'');color=color.replace(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i,'#$1$1$2$2$3$3');var difference=Math.round(ratio*256)*(darker?-1:1),rgb=color.match(new RegExp('^rgba?\\(\\s*'+'(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])'+'\\s*,\\s*'+'(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])'+'\\s*,\\s*'+'(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])'+'(?:\\s*,\\s*'+'(0|1|0?\\.\\d+))?'+'\\s*\\)$','i')),alpha=!!rgb&&rgb[4]!=null?rgb[4]:null,decimal=!!rgb?[rgb[1],rgb[2],rgb[3]]:color.replace(/^#?([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i,function(){return parseInt(arguments[1],16)+','+parseInt(arguments[2],16)+','+parseInt(arguments[3],16);}).split(/,/),returnValue;return!!rgb?'rgb'+(alpha!==null?'a':'')+'('+Math[darker?'max':'min'](parseInt(decimal[0],10)+difference,darker?0:255)+', '+Math[darker?'max':'min'](parseInt(decimal[1],10)+difference,darker?0:255)+', '+Math[darker?'max':'min'](parseInt(decimal[2],10)+difference,darker?0:255)+(alpha!==null?', '+alpha:'')+')':['#',pad(Math[darker?'max':'min'](parseInt(decimal[0],10)+difference,darker?0:255).toString(16),2),pad(Math[darker?'max':'min'](parseInt(decimal[1],10)+difference,darker?0:255).toString(16),2),pad(Math[darker?'max':'min'](parseInt(decimal[2],10)+difference,darker?0:255).toString(16),2)].join('');};if(shade=='lighter'){return changeColor(color,ratio,false);}else{return changeColor(color,ratio,true);}};
			}
		})();
		
		// FUNCTIONS
		
		// set text shadow
		MegaMenu.textShadow = (function(){
			if(0 > 0) jq.add('div#stacks_in_215_page2 li.MegaMenu_A a.mm_drop').css('text-shadow', (.05 + ((0/2)/10))+'em '+(.05 + ((0/2)/10))+'em '+(.05 + ((0/1)/10))+'em '+stacks.MegaMenu.getThatColor('#6FB100', (.8-(0/10)), 'darker'));
		})();

		// hover styles
		MegaMenu.hoverStyles = (function(){
			// VARIABLES
			var that = {};
			that.wrapper = jq.add('div#stacks_in_215_page2').add(jq.add('div#stacks_in_215_page2').parent()),
			that.wrapper.overflow = that.wrapper.css('overflow'),
			that.li = jq.add('div#stacks_in_215_page2 ul#menu_A li.MegaMenu_A'),
			that.li.color = that.li.find('a.mm_drop').css('color'),
			that.li.bg = that.li.css('background'),
			that.li.border = that.li.css('border'),
			that.dd = jq.add('div#stacks_in_215_page2 div.MegaMenu_dd_A'),
			that.dd.border = that.dd.css('border');
			
			// < IE 9 variables
			if (typeof stacks.MegaMenuIE != 'undefined') that.li.bg = that.li.css('background-color'),
				that.li.borderColor = that.li.css('border-color'),
				that.li.borderSize = that.li.css('border-size');
			// everything but <= IE 8 variables
			else that.li.shadow = that.li.find('a').css('text-shadow');

			// FUNCTION
			that.li.hover(function() {
			    $(this).css('border-color', stacks.MegaMenu.getThatColor('#95BF3D', .465, 'darker'));
			    $(this).find('a.mm_drop').css('color', stacks.MegaMenu.getThatColor('#95BF3D', .64, 'darker'));
				if (typeof stacks.MegaMenuIE == 'undefined') $(this).find('a.mm_drop').css('text-shadow', 'none');
				that.dd.css('border-color', stacks.MegaMenu.getThatColor('#95BF3D', .465, 'darker'));
			    if(3 > 0) {
			    	$(this).css({
						'background-image' : 'linear-gradient(top, '+stacks.MegaMenu.getThatColor('#95BF3D', (.04125 * 3), 'lighter')+', '+stacks.MegaMenu.getThatColor('#95BF3D', (.033 * 3), 'lighter')+')',
			    		'background-color' : '#95BF3D'
					});
			    }
				// if stacks_top is shorter the the drop-down content, include stacks_top in overflow override
				if (jq.add('div.stacks_top').height() < that.dd.height()) {
					that.wrapper = jq.add('div#stacks_in_215_page2').add(jq.add('div#stacks_in_215_page2').parent()).add(jq.add('div#stacks_in_215_page2').parent().parent()).add(jq.add('div#stacks_in_215_page2').parent().parent().parent()),
					that.wrapper.overflow = that.wrapper.css('overflow');
				}
				that.wrapper.css('overflow','visible');

			},function() {
				$(this).css({'border':that.li.border, 'background':that.li.bg});
				if (typeof stacks.MegaMenuIE != 'undefined') $(this).css({'border-color':that.li.borderColor, 'border-size':that.li.borderSize, 'background-color':that.li.bg});	
				else $(this).find('a.mm_drop').css({'color':that.li.color,'text-shadow':that.li.shadow});
				that.wrapper.css('overflow',that.wrapper.overflow);
				that.dd.css('border',that.dd.border);
			});
		})();
		
		// gradient styles
		MegaMenu.gradStyles = (function() {
			// set menu gradient
			if(8 > 0) {
				jq.add('div#stacks_in_215_page2 ul#menu_A').css({
					'background-image' : 'linear-gradient(top, ' + stacks.MegaMenu.getThatColor('#6FB100', (.05 * '8'), 'lighter') + ', ' + stacks.MegaMenu.getThatColor('#6FB100', (.05 * '8'), 'darker') + ')',
					'filter' : 'progid:DXImageTransform.Microsoft.gradient( startColorstr=' + stacks.MegaMenu.getThatColor('#6FB100', (.052 * '8'), 'lighter') + ', endColorstr=' + stacks.MegaMenu.getThatColor('#6FB100', (.040 * '8'), 'darker') + ',GradientType=0 )'
				});
			}
			// set dropdown gradient
			if(3 > 0) {
				jq.add('div#stacks_in_215_page2 div.MegaMenu_dd_A').css({
					'background' : 'linear-gradient(top, ' + stacks.MegaMenu.getThatColor('#95BF3D', (.033 * '3'), 'lighter') + ', ' + stacks.MegaMenu.getThatColor('#95BF3D', (.033 * '3'), 'darker') + ')',
					'background-color' : '#95BF3D'
				});
			}
		})();

		// megaContent
		MegaMenu.megaContent = (function(){
			var mcValue = jq.add('div#stacks_in_215_page2 div.megaContainer').length;
			for (i=0;i<=mcValue;i++){
				jq.add('div#myMegaContentA'+i+' script').remove();
				jq.add('div#myMegaContentA'+i).appendTo('div#stacks_in_215_page2 div#megaContainerA'+i);
			}
		})();

	})();
});
	return stack;
})(stacks.stacks_in_215_page2);


// Javascript for stacks_in_39_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_39_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_39_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// TWEETS STACK BY http://www.doobox.co.uk XXXXXXX
// COPYRIGHT@2010 MR JG SIMPSON, TRADING AS DOOBOX
// ALL RIGHTS RESERVED XXXXXXXXXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




// DOCUMENT READY FUNCTIONS
$(document).ready(function() {

   switch ("simbo") { 
        case 'TimelessHotel': 

            break; //end case 

        case 'ParadiseInn': 
   
            break; //end case 

        case 'TetrisHotel': 
 
            break; //end case  

        case 'JamstoneInn': 
   
            break; //end case 
    }




(function($){
	
	$.fn.stacks_in_39_page2twitterfeed = function(username, options) {	
	
		// Set pluign defaults
		var defaults = {
			limit: 1,
			tweeticon: true,
			retweets: false,
			replies: false,
			ssl: false
		};  
		var options = $.extend(defaults, options); 
		
		// Functions
		return this.each(function(i, e) {
			var $e = $(e);
			var s = '';
			
			// Add feed class to user div
			if (!$e.hasClass('stacks_in_39_page2twitterFeed')) $e.addClass('stacks_in_39_page2twitterFeed');
			
			// Check for valid user name
			if (username == null) return false;

			// Check limit does not exceed max
			if (options.limit > 200) options.limit = 200;

			// Check for SSL protocol
			if (options.ssl) s = 's';

			// Reverse replies option
			if (options.replies == true) { options.replies = false; } else { options.replies = true; }

			// Define Twitter feed request
			var url = 'http'+ s +'://api.twitter.com/1/statuses/user_timeline.json?include_rts='+ options.retweets +'&exclude_replies='+ options.replies +'&screen_name='+ username +'&count='+ options.limit;
			var params = {};

			params.count = options.limit;

			// Send request
			jQuery.ajax({
				url: url,
				data: params,
				dataType: 'jsonp',
				success: function (o) {
					_callback(e, o, options);
				}
			});
				
		});
	};
	
	// Callback function to create HTML result
	var _callback = function(e, feeds, options) {
		if (!feeds) {
			return false;
		}
		var html = '';	
		

		// Add body
		html += '<ul>';
		
		// Add feeds
		for (var i=0; i<feeds.length; i++) {
			
			// Get individual feed
			if (feeds[i].retweeted_status) {
				var tweet= feeds[i].retweeted_status;
			} else {
				var tweet= feeds[i];
			}
			var link = '<a href="http://twitter.com/' + tweet.user.screen_name + '/" title="Visit '+ tweet.user.name +' on Twitter">';

			// Add feed row
			html += '<li class="stacks_in_39_page2twitterRow"><div class="stacks_in_39_page2rowinner">';

			// Add user icon if required
			if ("custom" == "show") {
				var icon = tweet.user.profile_image_url;

				html += link + '<img src="'+ icon +'" alt="'+ name +'" /></a>';
			}
			
			if ("custom" == "custom") {
				html += link + '<img src="files/testimagecontrol_39.png" alt="'+ name +'" /></a>';
			}
		
			
			// Add lapsed time if required
			if ("none" == "top") {
				var lapsedTime = getLapsedTime(tweet.created_at);
				html += '<div class="stacks_in_39_page2tweetTime">'+ lapsedTime +'</div>'
			}
			
			
			html += '<div class="stacks_in_39_page2bodycontainer">';
			
			

			// Add user if required
				var name = tweet.user.name;
				if ("custom" == "username") {
				html += '<div class="stacks_in_39_page2tweetName">'+ link + name +'</a></div>'
				}else if("custom" == "custom"){
				html += '<div class="stacks_in_39_page2tweetName">Latest Foodflo tweet!</div>'
				}else{
				html += ""
				}
			
			
			// Get tweet text and add links (by Yusuke Horie)
			var text = tweet.text
				.replace(/(https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/, function (u) {
					var shortUrl = (u.length > 30) ? u.substr(0, 30) + '…': u;
					return '<a href="' + u + '" title="Click to view this link">' + shortUrl + '</a>';
				})
				.replace(/@([a-zA-Z0-9_]+)/g, '@<a href="http://twitter.com/$1" title="Click to view $1 on Twitter">$1</a>')
				.replace(/(?:^|\s)#([^\s\.\+:!]+)/g, function (a, u) {
					return ' <a href="http://twitter.com/search?q=' + encodeURIComponent(u) + '" title="Click to view this on Twitter">#' + u + '</a>';
			});
			html += '<div class="stacks_in_39_page2tweetmessage">'+ text+'</div>'
			html += '</div>';
			
			// Add lapsed time if required
			if ("none" == "bottom") {
				var lapsedTime = getLapsedTime(tweet.created_at);
				html += '<div class="stacks_in_39_page2tweetTime">'+ lapsedTime +'</div>'
			}
			
			
			html += '<div style="clear:both;"></div></div></li>';
						
		}
		
		html += '</ul>' +
			'</div>'
		
		$(e).html(html);
	};

	function getLapsedTime(strDate) {
		
		// Reformat Twitter date so that IE can convert
		strDate = Date.parse(strDate.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3'));

		// Define current time and format tweet date
		var todayDate = new Date();	
		var tweetDate = new Date(strDate)

		// Get lasped time in seconds
		var lapsedTime = Math.round((todayDate.getTime() - tweetDate.getTime())/1000)

		// Return lasped time in seconds, minutes, hours, days and weeks
		if (lapsedTime < 60) {
			return 'JP';
		} else if (lapsedTime < (60*60)) {
			return (Math.round(lapsedTime / 60)) + 'm';
		} else if (lapsedTime < (24*60*60)) {
			return (Math.round(lapsedTime / 3600)) + 'h';  //removed -1 from hour not so sure yet??
		} else if (lapsedTime < (7*24*60*60)) {
			return (Math.round(lapsedTime / 86400)) + 'd';  //removed -1 from day not so sure yet??
		} else {
			return (Math.round(lapsedTime / 604800)) + 'w'; //removed -1 from week not so sure yet??
		}
	};
})(jQuery);



$(document).ready(function () {

	$('.stacks_in_39_page2tweets').stacks_in_39_page2twitterfeed('foodflo', {
		limit: 1
	});
	
	var itsIEnine = navigator.userAgent.match(/MSIE 9/i) != null;

	if(itsIEnine){
	$(".stacks_in_39_page2rowinner").css({
    "background" : "#C2DE81"
    });
	}
	
});


});





// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// END DOOBOX TWEETS STACK XXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	return stack;
})(stacks.stacks_in_39_page2);


// Javascript for stacks_in_1836_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_1836_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_1836_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// IMAGE POP STACK BY http://www.doobox.co.uk XXXXXXX
// COPYRIGHT@2010 MR JG SIMPSON, TRADING AS DOOBOX
// ALL RIGHTS RESERVED XXXXXXXXXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




// DOCUMENT READY FUNCTIONS
$(document).ready(function() {


(function($) {


    $.fn.stacks_in_1836_page2manifest_me = function(options) {
    

        return this.each(function() {

            var
                opts = $.extend({}, $.fn.stacks_in_1836_page2manifest_me.defaults, options),
                $overlay = $(),
                $self = $(this),
                $iframe = $('<iframe id="stacks_in_1836_page2manifestframe" style="z-index: ' + (opts.zIndex + 10) + ';border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0; filter: mask();"/>'),
                ie6 = ($.browser.msie && $.browser.version < 7);
                

            if (opts.showOverlay) {
                //check if there's an existing overlay, if so, make subequent ones clear
               var $currentOverlays = $(".js_lb_overlay:visible");
                if ($currentOverlays.length > 0){
                    $overlay = $('<div class="lb_overlay_clear js_lb_overlay"/>');
                } else {
                    $overlay = $('<div class="' + opts.classPrefix + '_overlay js_lb_overlay"/>');
                }
            }

            /*----------------------------------------------------
               DOM Building
            ---------------------------------------------------- */
            if (ie6) {
                var src = /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank';
                $iframe.attr('src', src);
                $('body').append($iframe);
            } // iframe shim for ie6, to hide select elements
            $('body').append($self.hide()).append($overlay);
            


            /*----------------------------------------------------
               Overlay CSS stuffs
            ---------------------------------------------------- */

            // set css of the overlay
            if (opts.showOverlay) {
                setOverlayHeight(); // pulled this into a function because it is called on window resize.
                $overlay.css({ position: 'absolute', width: '100%', top: 0, left: 0, right: 0, bottom: 0, zIndex: (opts.zIndex + 2), display: 'none' });
				if (!$overlay.hasClass('lb_overlay_clear')){
                	$overlay.css(opts.overlayCSS);
                }
            }

            /*----------------------------------------------------
               Animate it in.
            ---------------------------------------------------- */
               //
            if (opts.showOverlay) {
                $overlay.fadeIn(opts.overlaySpeed, function() {
                    setSelfPosition();
                    $self[opts.appearEffect](opts.lightboxSpeed, function() { setOverlayHeight(); setSelfPosition(); opts.onLoad()});
                    

                });
            }
            

            /*----------------------------------------------------
               Hide parent if parent specified (parentLightbox should be jquery reference to any parent lightbox)
            ---------------------------------------------------- */
            if (opts.parentLightbox) {
                opts.parentLightbox.fadeOut(200);
            }


            /*----------------------------------------------------
               Bind Events
            ---------------------------------------------------- */

            $(window).resize(setOverlayHeight)
                     .resize(setSelfPosition)
                     .scroll(setSelfPosition)
                     .keyup(observeKeyPress);
            if (opts.closeClick) {
                $overlay.click(function(e) { closeLightbox(); e.preventDefault; });
            }
            $self.delegate(opts.closeSelector, "click", function(e) {
                closeLightbox(); e.preventDefault();
            });
            $self.bind('stacks_in_1836_page2manifestclose', closeLightbox);
            $self.bind('reposition', setSelfPosition);

            

            /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
              -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */


            /*----------------------------------------------------
               Private Functions
            ---------------------------------------------------- */

            /* Remove or hide all elements */
            function closeLightbox() {
                var s = $self[0].style;
                if (opts.destroyOnClose) {
                	$self.add($overlay).remove();
                } else {
                    $self.add($overlay).hide();
                }

                //show the hidden parent lightbox
                if (opts.parentLightbox) {
                    opts.parentLightbox.fadeIn(200);
                }

                $iframe.remove();
                
				// clean up events.
                $self.undelegate(opts.closeSelector, "click");

                $(window).unbind('reposition', setOverlayHeight);
                $(window).unbind('reposition', setSelfPosition);
                $(window).unbind('scroll', setSelfPosition);
                $(document).unbind('keyup', observeKeyPress);
                if (ie6)
                    s.removeExpression('top');
                opts.onClose();
            }


            /* Function to bind to the window to observe the escape/enter key press */
            function observeKeyPress(e) {
                if((e.keyCode == 27 || (e.DOM_VK_ESCAPE == 27 && e.which==0)) && opts.closeEsc) closeLightbox();
            }


            /* Set the height of the overlay
                    : if the document height is taller than the window, then set the overlay height to the document height.
                    : otherwise, just set overlay height: 100%
            */
            function setOverlayHeight() {
                if ($(window).height() < $(document).height()) {
                    $overlay.css({height: $(document).height() + 'px'});
                     $iframe.css({height: $(document).height() + 'px'}); 
                } else {
                    $overlay.css({height: '100%'});
                    if (ie6) {
                        $('html,body').css('height','100%');
                        $iframe.css('height', '100%');
                    } // ie6 hack for height: 100%; TODO: handle this in IE7
                }
            }


            /* Set the position of the modal'd window ($self)
                    : if $self is taller than the window, then make it absolutely positioned
                    : otherwise fixed
            */
            function setSelfPosition() {
                var s = $self[0].style;

                // reset CSS so width is re-calculated for margin-left CSS
                $self.css({left: '50%', marginLeft: ($self.outerWidth() / 2) * -1,  zIndex: (opts.zIndex + 3) });


                /* we have to get a little fancy when dealing with height, because stacks_in_1836_page2manifest_me
                    is just so fancy.
                 */

                // if the height of $self is bigger than the window and self isn't already position absolute
                if (($self.height() + 80  >= $(window).height()) && ($self.css('position') != 'absolute' || ie6)) {

                    // we are going to make it positioned where the user can see it, but they can still scroll
                    // so the top offset is based on the user's scroll position.
                    var topOffset = $(document).scrollTop() + 40;
                    $self.css({position: 'absolute', top: topOffset + 'px', marginTop: 0})
                    if (ie6) {
                        s.removeExpression('top');
                    }
                } else if ($self.height()+ 80  < $(window).height()) {
                    //if the height is less than the window height, then we're gonna make this thing position: fixed.
                    // in ie6 we're gonna fake it.
                    if (ie6) {
                        s.position = 'absolute';
                        if (opts.centered) {
                            s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')
                            s.marginTop = 0;
                        } else {
                            var top = (opts.modalCSS && opts.modalCSS.top) ? parseInt(opts.modalCSS.top) : 0;
                            s.setExpression('top', '((blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"')
                        }
                    } else {
                        if (opts.centered) {
                            $self.css({ position: 'fixed', top: '50%', marginTop: ($self.outerHeight() / 2) * -1})
                        } else {
                            $self.css({ position: 'fixed'}).css(opts.modalCSS);
                        }

                    }
                }
            }

        });



    };

    $.fn.stacks_in_1836_page2manifest_me.defaults = {

        // animation
        appearEffect: "fadeIn",
        appearEase: "",
        overlaySpeed: 250,
        lightboxSpeed: 300,

        // close
        closeSelector: ".stacks_in_1836_page2manifestclose",
        closeClick: true,
        closeEsc: true,

        // behavior
        destroyOnClose: false,
        showOverlay: true,
        parentLightbox: false,

        // callbacks
        onLoad: function() {},
        onClose: function() {},

        // style
        classPrefix: 'stacks_in_1836_page2manifest',
        zIndex: 10001,
        centered: false,
        modalCSS: {top: '40px'},
        overlayCSS: {background: 'black', opacity: .4}
    }
    
    		
})(jQuery);




// call the main function
$('.stacks_in_1836_page2thumnailimage, .stacks_in_1836_page2hoveroverlay').click(function(e) {
    $('.stacks_in_1836_page2manifestbox').stacks_in_1836_page2manifest_me({
        centered: true
        });
    e.preventDefault();
});


 $(".stacks_in_1836_page2hoveroverlay").mouseenter(function() {
$('.stacks_in_1836_page2hoveroverlay').stop().animate({opacity: 0.3}, 250);
  }).mouseleave(function(){
    $('.stacks_in_1836_page2hoveroverlay').stop().delay(100).animate({opacity: 0.0}, 500);
  });
  



});


// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// END DOOBOX IMAGE POP STACK XXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	return stack;
})(stacks.stacks_in_1836_page2);


// Javascript for stacks_in_68_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_68_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_68_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
$(document).ready(function() {
	var custom_bg_src = $("#stacks_in_68_page2 .custom_bg img").attr("src");
	if (custom_bg_src) { $("#stacks_in_68_page2").css({'background-image':'url(' + custom_bg_src + ')'});	}
});
	return stack;
})(stacks.stacks_in_68_page2);


// Javascript for stacks_in_0_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_0_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_0_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

//-- Sweet Button Stack v1.5.2 by Joe Workman --//



jQuery.fn.exists = function(){return jQuery(this).length>0;}
$(document).ready(function() {
	function change_button_state() {
        $('#stacks_in_0_page2 .sweet_button_wrapper').removeClass('animate');
	    if($('#stacks_in_0_page2 .sweet_button.clicked').exists() && false){
            $('#stacks_in_0_page2 .sweet_button').removeClass('clicked');
            
            	if ('=' != 'H') {
            		$('#stacks_in_0_page2 .button_icon').html('H');
            	}
            
            if ('Yum!' != 'Tell me more about Flo Bars!') {
            	$('#stacks_in_0_page2 .button_label').html('Tell me more about Flo Bars!');
            }		
            
	    }
	    else {
            $('#stacks_in_0_page2 .sweet_button').addClass('clicked');
            
            	if ('=' != 'H') {
            		$('#stacks_in_0_page2 .button_icon').html('=');
            	}
            
            if ('Yum!' != 'Tell me more about Flo Bars!') {
            	$('#stacks_in_0_page2 .button_label').html('Yum!');
            }		
            
	    }
	}
    
	$('#stacks_in_0_page2 .sweet_button').click(function() {
		change_button_state();
		
	});
});

//-- End Sweet Button Stack --//


	return stack;
})(stacks.stacks_in_0_page2);


// Javascript for stacks_in_91_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_91_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_91_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
$(document).ready(function() {
	var custom_bg_src = $("#stacks_in_91_page2 .custom_bg img").attr("src");
	if (custom_bg_src) { $("#stacks_in_91_page2").css({'background-image':'url(' + custom_bg_src + ')'});	}
});
	return stack;
})(stacks.stacks_in_91_page2);


// Javascript for stacks_in_1_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_1_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_1_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Chauffeur STACK BY http://www.doobox.co.uk XXXXXXX
// COPYRIGHT@2010 MR JG SIMPSON, TRADING AS DOOBOX
// ALL RIGHTS RESERVED XXXXXXXXXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx




// DOCUMENT READY FUNCTIONS
$(document).ready(function() {

// COOKIE FUNCTIONS
function setCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires ;
}

function getCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function deleteCookie(name) {
    setCookie(name,"");
}



// GET THE FOLDER FROM THE URL FUNCTION
jQuery.url=function()
{var segments={};var parsed={};var options={url:window.location,strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};var parseUri=function()
{str=decodeURI(options.url);var m=options.parser[options.strictMode?"strict":"loose"].exec(str);var uri={};var i=14;while(i--){uri[options.key[i]]=m[i]||"";}
uri[options.q.name]={};uri[options.key[12]].replace(options.q.parser,function($0,$1,$2){if($1){uri[options.q.name][$1]=$2;}});return uri;};var key=function(key)
{if(!parsed.length)
{setUp();}
if(key=="base")
{if(parsed.port!==null&&parsed.port!=="")
{return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/";}
else
{return parsed.protocol+"://"+parsed.host+"/";}}
return(parsed[key]==="")?null:parsed[key];};var param=function(item)
{if(!parsed.length)
{setUp();}
return(parsed.queryKey[item]===null)?null:parsed.queryKey[item];};var setUp=function()
{parsed=parseUri();getSegments();};var getSegments=function()
{var p=parsed.path;segments=[];segments=parsed.path.length==1?{}:(p.charAt(p.length-1)=="/"?p.substring(1,p.length-1):path=p.substring(1)).split("/");};return{setMode:function(mode)
{strictMode=mode=="strict"?true:false;return this;},setUrl:function(newUri)
{options.url=newUri===undefined?window.location:newUri;setUp();return this;},segment:function(pos)
{if(!parsed.length)
{setUp();}
if(pos===undefined)
{return segments.length;}
return(segments[pos]===""||segments[pos]===undefined)?null:segments[pos];},attr:key,param:param};}();

var yourfolder = jQuery.url.attr("directory");
if(yourfolder == "/"){yourfolder = ""};



// CUSTOM STACK SCRIPT

// check the cookie
var cooky = getCookie('stacks_in_1_page2roar');


// start the good stuff if there is no valid cookie
if (cooky != "stacks_in_1_page2roar"){

if(!$(".stacks_in_1_page2icon").find("img").attr("src")){
$(".stacks_in_1_page2icon").html('<img width="50" height="50" src="files/roar_files/alert.png" />');
}


var h = $("body").height();
var topquarter = h / 200;

var thebutton = $(".stacks_in_1_page2wrapper").clone();
$(".stacks_in_1_page2wrapper").remove();
$(thebutton).prependTo("body");

$(".stacks_in_1_page2wrapper").css({
"display":"none",
"position":"fixed",
"top": "30px",
"left":"40px",
"z-index":"1000001"
});

if("left" == "center"){
var stacks_in_1_page2negleftmargin = 300 / 2;
var stacks_in_1_page2negtopmargin = $(".stacks_in_1_page2wrapper").height() / 2;

$(".stacks_in_1_page2wrapper").css({
"display":"none",
"position":"fixed",
"top":"50%",
"left":"50%",
"marginTop": -stacks_in_1_page2negtopmargin,
"marginLeft": -stacks_in_1_page2negleftmargin,
"z-index":"1000001"
});
}

$(".stacks_in_1_page2wrapper a").css({
"color":"#2A4E0F",
"textDecoration":"underline"
});

$(".stacks_in_1_page2wrapper a:hover").css({
"color":"#2A4E0F",
"textDecoration":"underline"
});

$(".stacks_in_1_page2wrapper a:visited").css({
"color":"#2A4E0F",
"textDecoration":"underline"
});



var itsIEnine = navigator.userAgent.match(/MSIE 9/i) != null;

if(itsIEnine){
	$(".stacks_in_1_page2wrapper").css({
    "background" : "#84BF04"
    });
}
else{
    $(".stacks_in_1_page2wrapper").css({
    "-webkit-border-radius" : "10px",
    "-moz-border-radius" : "10px",
    "border-radius" : "10px",
    "behavior":"url(" + yourfolder + "files/chauffeur_files/RBPIE.htc)" 
    });
}



// LOAD THE ROARBOX FUNCTION
if("timed" == "scroll"){
$(window).scroll(function() {
    if ($(this).scrollTop() > topquarter) {
        $(".stacks_in_1_page2wrapper").fadeIn();
    }
});
}else if("timed" == "timed"){
$(".stacks_in_1_page2wrapper").delay("1" * 1000).queue(function(){ 
  $(".stacks_in_1_page2wrapper").fadeIn();
  $(this).dequeue(); 
});
}else{
	$(window).load(
    function() {
        $(".stacks_in_1_page2wrapper").fadeIn();
    }
);
}




// X BUTTON CLICK FUNCTION
 $('.stacks_in_1_page2thex').click(function(){
 
  $('.stacks_in_1_page2wrapper').fadeOut( function() { $(this).remove(); });

 
 });

} // end cookie check


deleteCookie('stacks_in_1_page2roar');


});





// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// END DOOBOX Chauffeur STACK XXXXXXXXXXXXXXXXXXXX
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	return stack;
})(stacks.stacks_in_1_page2);


// Javascript for stacks_in_126_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_126_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_126_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

  

  jQuery(document).ready(function($){

function findPlainTextExceptInLinks(element, substring, callback) {
    for (var childi= element.childNodes.length; childi-->0;) {
        var child= element.childNodes[childi];
        if (child.nodeType===1) {
            if (child.tagName.toLowerCase()!=='a')
                findPlainTextExceptInLinks(child, substring, callback);
        } else if (child.nodeType===3) {
            var index= child.data.length;
            while (true) {
                index= child.data.lastIndexOf(substring, index);
                if (index===-1)
                    break;
                callback.call(window, child, index)
            }
        }
    }
}

var substring= 'telecert';
findPlainTextExceptInLinks(document.body, substring, function(node, index) {
    node.splitText(index+substring.length);
    var span= document.createElement('span');
    span.className = "teleportHere";
    span.appendChild(node.splitText(index));
    node.parentNode.insertBefore(span, node.nextSibling);
});


var injectionStack = $("#stacks_in_126_page2").html();


$("#stacks_in_126_page2 .teleportMe").remove();
$(".teleportHere").replaceWith(injectionStack);


});
	return stack;
})(stacks.stacks_in_126_page2);


// Javascript for stacks_in_128_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_128_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_128_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
//-- lynx v1.0.0 by Nick Cates Design --//

    jQuery.noConflict();
    jQuery(document).ready(function($){
    
        /********** FUNCTION ***********/
    	
        $('.lynxWrap').mouseenter(function(){
          $(this).stop().animate({opacity:1}, 460);
        }).mouseleave(function(){
          $(this).stop().animate({opacity:0}, 460);
        });
        
        $('.lynxLink').mouseup(function(){
          $(this).removeClass('press');
        }).mousedown(function(){
          $(this).addClass('press');
        });
        
        /********** FORM ***********/
    			
        $('.lynxStack').each(function() {
    	    if (!$(this).find('img').length ) {
                $(this).find('.lynxWrap').after('<div class="noImg">Add Image</div>');
                $('.noImg').animate({opacity:1},1000);
                $(this).find('.lynxWrap').remove();
            }
            if (!$(this).find('.lynxLink a').length ) {
            	$(this).find('.lynxTitle').css('padding-bottom','20px');
            }
        });
        
        $('.lynxText:contains("Description Text"), .lynxTitle:contains("Box Title")').remove();
        $('.lynxStack .lynxText a.hover').after('<br />');
    	$('.lynxLink').each(function() {$(this).has('a').addClass('linked');});
    });
    
//-- End lynx Stack --//
	return stack;
})(stacks.stacks_in_128_page2);


// Javascript for stacks_in_133_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_133_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_133_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
$(document).ready(function() {
	var custom_bg_src = $("#stacks_in_133_page2 .custom_bg img").attr("src");
	if (custom_bg_src) { $("#stacks_in_133_page2").css({'background-image':'url(' + custom_bg_src + ')'});	}
});
	return stack;
})(stacks.stacks_in_133_page2);


// Javascript for stacks_in_138_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_138_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_138_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
$(document).ready(function() {
	var custom_bg_src = $("#stacks_in_138_page2 .custom_bg img").attr("src");
	if (custom_bg_src) { $("#stacks_in_138_page2").css({'background-image':'url(' + custom_bg_src + ')'});	}
});
	return stack;
})(stacks.stacks_in_138_page2);


// Javascript for stacks_in_6_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_6_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_6_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
$(document).ready(function() {
	var custom_bg_src = $("#stacks_in_6_page2 .custom_bg img").attr("src");
	if (custom_bg_src) { $("#stacks_in_6_page2").css({'background-image':'url(' + custom_bg_src + ')'});	}
});
	return stack;
})(stacks.stacks_in_6_page2);


// Javascript for stacks_in_11_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_11_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_11_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

  

  jQuery(document).ready(function($){

function findPlainTextExceptInLinks(element, substring, callback) {
    for (var childi= element.childNodes.length; childi-->0;) {
        var child= element.childNodes[childi];
        if (child.nodeType===1) {
            if (child.tagName.toLowerCase()!=='a')
                findPlainTextExceptInLinks(child, substring, callback);
        } else if (child.nodeType===3) {
            var index= child.data.length;
            while (true) {
                index= child.data.lastIndexOf(substring, index);
                if (index===-1)
                    break;
                callback.call(window, child, index)
            }
        }
    }
}

var substring= 'tsign';
findPlainTextExceptInLinks(document.body, substring, function(node, index) {
    node.splitText(index+substring.length);
    var span= document.createElement('span');
    span.className = "teleportHere";
    span.appendChild(node.splitText(index));
    node.parentNode.insertBefore(span, node.nextSibling);
});


var injectionStack = $("#stacks_in_11_page2").html();


$("#stacks_in_11_page2 .teleportMe").remove();
$(".teleportHere").replaceWith(injectionStack);


});
	return stack;
})(stacks.stacks_in_11_page2);


// Javascript for stacks_in_13_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_13_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_13_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
$(document).ready(function() {
	var custom_bg_src = $("#stacks_in_13_page2 .custom_bg img").attr("src");
	if (custom_bg_src) { $("#stacks_in_13_page2").css({'background-image':'url(' + custom_bg_src + ')'});	}
});
	return stack;
})(stacks.stacks_in_13_page2);


// Javascript for stacks_in_1231_page2
// ---------------------------------------------------------------------

// Each stack has its own object with its own namespace.  The name of
// that object is the same as the stack's id.
stacks.stacks_in_1231_page2 = {};

// A closure is defined and assigned to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for referring
// to this object from elsewhere.
stacks.stacks_in_1231_page2 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	

  

  jQuery(document).ready(function($){

function findPlainTextExceptInLinks(element, substring, callback) {
    for (var childi= element.childNodes.length; childi-->0;) {
        var child= element.childNodes[childi];
        if (child.nodeType===1) {
            if (child.tagName.toLowerCase()!=='a')
                findPlainTextExceptInLinks(child, substring, callback);
        } else if (child.nodeType===3) {
            var index= child.data.length;
            while (true) {
                index= child.data.lastIndexOf(substring, index);
                if (index===-1)
                    break;
                callback.call(window, child, index)
            }
        }
    }
}

var substring= 'healthxxx';
findPlainTextExceptInLinks(document.body, substring, function(node, index) {
    node.splitText(index+substring.length);
    var span= document.createElement('span');
    span.className = "teleportHere";
    span.appendChild(node.splitText(index));
    node.parentNode.insertBefore(span, node.nextSibling);
});


var injectionStack = $("#stacks_in_1231_page2").html();


$("#stacks_in_1231_page2 .teleportMe").remove();
$(".teleportHere").replaceWith(injectionStack);


});
	return stack;
})(stacks.stacks_in_1231_page2);



