
// '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_1_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_1_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_1_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;
	
var $MB = jQuery.noConflict();
        $MB(function() {
		if (self.location.href == top.location.href){
		var tobody=$MB("#box1");
		$MB("body").prepend(tobody);};
			$MB('body').append($MB('#overlay1'));
				$MB('#activator1').click(function(){
					$MB('#overlay1').fadeIn('fast',function(){
					$MB('#box1').animate({'top':'12px'},500);
				$MB(document).ready(function(){
						$MB("#box1").css("left", ( $MB(window).width() - $MB("#box1").outerWidth() ) / 2+$MB(window).scrollLeft() + "px");		
						$MB(window).bind("resize", resizeWindow);
							function resizeWindow( e ) {
							$MB("#box1").css("left", ( $MB(window).width() - $MB("#box1").outerWidth() ) / 2+$MB(window).scrollLeft() + "px");		
							}
						});
					});
                });
				 
		$MB("#boxclose1").css({'cursor' : 'pointer'});
             $MB('#boxclose1').click(function(){
                 $MB('#box1').animate({'top':'-811px'},500,function(){
                 $MB('#overlay1').fadeOut('fast');
                 });
             });
         });
$MB(document).ready(function () {
		setTimeout(function() {
			var cookieval = readCookie('timer');
			if(!cookieval || cookieval != 'showed'){
				$MB('#activator1%id=addOpenMBLink%').click();
				createCookie('timer','showed',4);
			}	
		},1000);
	});
function createCookie(name,value,minutes) {
	if (minutes) {
		var date = new Date();
		date.setTime(date.getTime()+(4*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(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 eraseCookie(name) {
	createCookie(name,"",-4);
};
//$MB(document).ready(function () {setTimeout(function(){ $MB('#activator1').click(); }, 1000);});

	return stack;
})(stacks.stacks_in_1_page0);



