
// '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_72_page8
// ---------------------------------------------------------------------

// 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_72_page8 = {};

// 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_72_page8 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
 *
 * RapidWeaver Fancy Intro stack by Tsooj Media.
 * Version 1.1.1.
 *
 * Visit http://www.tsooj.net for more information on how to use this stacks product for RapidWeaver.
 *
 */

/**
 *
 *  Globals.
 *
 */
var atm_strFancyIntroCookieName = 'atm_FancyIntroDays',
	atm_strFancyIntroDays = '',
	atm_blnFancyIntroSkipBrowser = false,
	atm_strFancyIntroLineHeight = '',
	atm_blnFancyIntroAsync = false;
	
/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
 
(function($){
 	$.cookie = function(key, value, options) {
 		if(arguments.length > 1) {
 			var o = $.extend({}, $.cookie.defaults, options);
 	        if (value === null || value === undefined) {
 	            value = '';
 	            o.expires = -1;
 	        }
 	        if (o.expires.constructor != Date) {
 				var today = new Date();
 				today.setDate(today.getDate() + o.expires);
 				o.expires = today;
 			}
 			// Create the cookie string
 			document.cookie = 
 				key + '=' + value +
 				'; expires=' + o.expires.toUTCString() +
 				(o.path? '; path=' + (o.path) : '') +
 				(o.domain? '; domain=' + (o.domain) : '') +
 				(o.secure? '; secure' : '');
 		} else {
 			if(result = new RegExp(key+"=(.*?)(?:;|$)").exec(document.cookie))
 				return decodeURIComponent(result[1]);
 			return false;
 		}
 	};
 	$.cookie.defaults = {
 		expires: ((0 == 0) ? -1 : 0),
 		path: '/',
 		domain: document.domain,
 		secure: ((document.location.protocol == 'https:') ? true : false)
 	}
})(jQuery);
 

/** 
 *
 * Main Fancy Intro Function.
 *
 */
function atm_ShowFancyIntro() {

	// Hide normal page elements and add Fancy Intro elements.
	$('iframe').hide();
	$('body').css('overflow-y', 'hidden');
	$('<div class="atmFancyIntroBackground"></div>').appendTo('body');
	$('<div class="atmFancyIntroText atmFancyIntroUpperText"></div>').appendTo('body');
	$('<div class="atmFancyIntroText atmFancyIntroLowerText"></div>').appendTo('body');	
	$('<div class="atmFancyIntroLine"></div>').appendTo('body');
	$('.atmFancyIntroUpperText').html($('.atmFancyIntroUpperTextHolder').html());
	$('.atmFancyIntroLowerText').html($('.atmFancyIntroLowerTextHolder').html());	

	// Opera percentage fix.
	if ($.browser.opera) { $('.atmFancyIntroLine').css('height', '2px'); }
	
	// IE7 margin fix.	
	if (navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/) == "MSIE 7.0,7.0") {
		atm_strFancyIntroLineHeight = String(parseInt(100 + parseInt(30))) + '% !important';	
		$('.atmFancyIntroText').css('line-height', atm_strFancyIntroLineHeight);
	} else {
		$('.atmFancyIntroText').css('line-height', '100% !important');
	}
		
	$('.atmFancyIntroBackground').css('visibility', 'visible');
	$('body').css('visibility', 'hidden');
	$('.atmFancyIntroText').css('visibility', 'visible');
	$('.atmFancyIntroLine').css('visibility', 'visible');

	// Fancy the Intro.
	$('.atmFancyIntroLine').delay(1000).animate({ width: '+=100%' }, 2500, function() {
		$('.atmFancyIntroLine').animate({ height: '+=100%', top: '-=50%' }, 1000, function() {
			$('body').attr('style','');
			$('body').css('visibility', 'visible');
			$('.atmFancyIntroText').css('visibility', 'hidden');
			$('.atmFancyIntroBackground').css('visibility', 'hidden');

			// IE Filter Fix.
			if ($.browser.msie) { $('.atmFancyIntroLine').css('filter', ''); }

			// Fadeout and remove Fancy Intro elements.
			$('.atmFancyIntroLine').animate({ opacity: 0 }, 500, function() {
				$('.atmFancyIntroBackground').remove();
				$('.atmFancyIntroText').remove();
				$('.atmFancyIntroLine').remove();
				$('#stacks_in_72_page8').remove();
				$('iframe').show();
				$('body').css('overflow-y', 'visible');
			});
		});
	});
};


/** 
 *
 * Add Hour(s) Function.
 *
 */
Date.prototype.atm_addHours = function(h){
    this.setHours(this.getHours()+h);
    return this;
}



/** 
 *
 * Document Ready Actions.
 *
 */
 
$(document).ready(function() {

	// Skip old IE6 Browser
	if (navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/) == "MSIE 6.0,6.0") {
		atm_blnFancyIntroSkipBrowser = true;
	} else {
		atm_strFancyIntroDays = $.cookie(atm_strFancyIntroCookieName);
		if ((atm_strFancyIntroDays == '') || (0 == 0)) {

			// Show the Fancy Intro.
			atm_ShowFancyIntro();
			
			// Hide for given number of Days or Hours.
			if ((false) && (0 != 0)) {
				$.cookie(atm_strFancyIntroCookieName, 0, { expires: new Date().atm_addHours(0)});
			} else {
				$.cookie(atm_strFancyIntroCookieName, 0);
			}
		} else {
			$('.atmFancyIntroBackground').remove();
		}	
	}

});

	return stack;
})(stacks.stacks_in_72_page8);


// Javascript for stacks_in_1334_page8
// ---------------------------------------------------------------------

// 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_1334_page8 = {};

// 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_1334_page8 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
var $fis = jQuery.noConflict();
$fis(window).load(function(){
	$fis('#fadeInStackstacks_in_1334_page8').hide().delay(0).fadeIn(3000);
});
	return stack;
})(stacks.stacks_in_1334_page8);


// Javascript for stacks_in_0_page8
// ---------------------------------------------------------------------

// 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_page8 = {};

// 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_page8 = (function(stack) {

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/**
		 * Cookie plugin
		 *
		 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
		 * Dual licensed under the MIT and GPL licenses:
		 * http://www.opensource.org/licenses/mit-license.php
		 * http://www.gnu.org/licenses/gpl.html
		 *
		 */

		/**
		 * Create a cookie with the given name and value and other optional parameters.
		 *
		 * @example $.cookie('the_cookie', 'the_value');
		 * @desc Set the value of a cookie.
		 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
		 * @desc Create a cookie with all available options.
		 * @example $.cookie('the_cookie', 'the_value');
		 * @desc Create a session cookie.
		 * @example $.cookie('the_cookie', null);
		 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
		 *       used when the cookie was set.
		 *
		 * @param String name The name of the cookie.
		 * @param String value The value of the cookie.
		 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
		 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
		 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
		 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
		 *                             when the the browser exits.
		 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
		 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
		 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
		 *                        require a secure protocol (like HTTPS).
		 * @type undefined
		 *
		 * @name $.cookie
		 * @cat Plugins/Cookie
		 * @author Klaus Hartl/klaus.hartl@stilbuero.de
		 */

		/**
		 * Get the value of a cookie with the given name.
		 *
		 * @example $.cookie('the_cookie');
		 * @desc Get the value of a cookie.
		 *
		 * @param String name The name of the cookie.
		 * @return The value of the cookie.
		 * @type String
		 *
		 * @name $.cookie
		 * @cat Plugins/Cookie
		 * @author Klaus Hartl/klaus.hartl@stilbuero.de
		 */
		jQuery.cookie = function(name, value, options) {
		    if (typeof value != 'undefined') { // name and value given, set cookie
		        options = options || {};
		        if (value === null) {
		            value = '';
		            options.expires = -1;
		        }
		        var expires = '';
		        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
		            var date;
		            if (typeof options.expires == 'number') {
		                date = new Date();
		                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
		            } else {
		                date = options.expires;
		            }
		            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
		        }
		        // CAUTION: Needed to parenthesize options.path and options.domain
		        // in the following expressions, otherwise they evaluate to undefined
		        // in the packed version for some reason...
		        var path = options.path ? '; path=' + (options.path) : '';
		        var domain = options.domain ? '; domain=' + (options.domain) : '';
		        var secure = options.secure ? '; secure' : '';
		        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
		    } else { // only name given, get cookie
		        var cookieValue = null;
		        if (document.cookie && document.cookie != '') {
		            var cookies = document.cookie.split(';');
		            for (var i = 0; i < cookies.length; i++) {
		                var cookie = jQuery.trim(cookies[i]);
		                // Does this cookie string begin with the name we want?
		                if (cookie.substring(0, name.length + 1) == (name + '=')) {
		                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
		                    break;
		                }
		            }
		        }
		        return cookieValue;
		    }
		};
		
		
/**
* Gateway Stack
*/

var $gw = jQuery.noConflict();
$gw(document).ready(function(){

	// Set the background fill opacity
	$gw('#gatewayBarFillstacks_in_0_page8').css({'opacity':.90});
	
	// Create a new container appended to the page body
	$gw("body").append('<div id="gatewayContainerstacks_in_0_page8" class="gatewayContainer"></div>');
		
	// Append the Gateway content onto the newly created message container
	$gw('#gatewayBarstacks_in_0_page8').appendTo('#gatewayContainerstacks_in_0_page8');
			
	// Look for a cookie. If none found, fade in the Gateway stack to display
	if ($gw.cookie('gateway1') != 'closed') {
		$gw('#gatewayBarstacks_in_0_page8').delay(1000).fadeIn(600);
	}
			
	// Set cookie status to 'closed' and hide the Gateway stack when the close button is clicked
	$gw('#closeButtonstacks_in_0_page8').click(function () {
		var date = new Date();
		date.setTime(date.getTime() + (1 * 60 * 1000));
	$gw.cookie('gateway1', 'closed', { expires: date }); 
	$gw('#gatewayBarstacks_in_0_page8').fadeOut(600);
	});		

	// Set cookie status to 'closed' and hide the Gateway stack when any close function is called
	$gw('.gatewayClose').click(function () {
		var date = new Date();
		date.setTime(date.getTime() + (1 * 60 * 1000));
	$gw.cookie('gateway1', 'closed', { expires: date }); 
	$gw('#gatewayBarstacks_in_0_page8').fadeOut(600);
	});	

	// Reset
	$gw('.resetGateway').click(function () {
		$gw.cookie('gateway1', null);
	});	

});


	return stack;
})(stacks.stacks_in_0_page8);



