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

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

// A closure is defined and assined to the stack's object.  The object
// is also passed in as 'stack' which gives you a shorthand for refering
// to this object from elsewhere.
stacks.stacks_in_373_page0 = (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 Curtain Intro stack by Tsooj Media.
 * Version 1.1.0.
 *
 * 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_strFancyIntroPaddingTop = '',
	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: ((1 == 0) ? -1 : 1),
 		path: '/',
 		domain: document.domain,
 		secure: ((document.location.protocol == 'https:') ? true : false)
 	}
})(jQuery);
 

/** 
 *
 * Main Fancy Curtain Intro Function.
 *
 */
function atm_ShowFancyCurtainIntro() {

	// Hide normal page elements and add Fancy Curtain Intro elements.
	$('iframe').hide();
	$('body').css('overflow-y', 'hidden');
	$('<div class="atmFancyIntroBackground"></div>').appendTo('body');
	$('<div class="atmFancyCurtainIntroBackgroundLeft"></div>').appendTo('body');
	$('<div class="atmFancyCurtainIntroBackgroundRight"></div>').appendTo('body');
	$('<div class="atmFancyIntroText"><div class="atmFancyIntroUpperText"></div></div>').appendTo('body');
	$('.atmFancyIntroUpperText').html($('.atmFancyIntroUpperTextHolder').html());
	$('.atmFancyIntroBackground').remove();
	
	// IE7 margin fix.	
	if (navigator.userAgent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/) == "MSIE 7.0,7.0") {
	$('.atmFancyIntroTextUpper').css('padding-top', 'expression(this.offsetHeight < this.parentNode.offsetHeight ? parseInt((this.parentNode.offsetHeight - this.offsetHeight) / 2) + "px" : "0px")');
	}
	
	$('div[class*="atmFancyCurtainIntroBackground"]').css('visibility', 'visible');
	$('body').css('visibility', 'hidden');
	$('.atmFancyIntroText').css('visibility', 'visible');
	
	$('.atmFancyIntroText').delay(1000).animate({opacity: 0}, 2000, function() {
		$('body').attr('style','');
		$('body').css('visibility', 'visible');
		$('.atmFancyIntroText').css('visibility', 'hidden');
		if (false) {
			$('.atmFancyCurtainIntroBackgroundLeft').addClass('atmFancyCurtainIntroShadowLeft');
			$('.atmFancyCurtainIntroBackgroundRight').addClass('atmFancyCurtainIntroShadowRight');
		}
		$('div[class*="atmFancyCurtainIntroBackground"]').css('width', '49%');
		$('div[class*="atmFancyCurtainIntroBackground"]').animate({width: '-=49%'}, 2000, function() {
			$('.atmFancyIntroText').remove();
			$('#stacks_in_373_page0').remove();
			$('iframe').show();
			$('body').css('overflow-y', 'visible');
			$('div[class*="atmFancyCurtainIntroBackground"]').remove();
		});
	});
};


/** 
 *
 * 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 == '') || (1 == 0)) {

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

});

	return stack;
})(stacks.stacks_in_373_page0);



