
// '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_65_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_65_page0 = {};

// 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_65_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;
	
jQuery(document).ready(function(e){
	jQuery('#signUpstacks_in_65_page0wrapper button#cancelBut').click(function(e) {
		if (fade=='fade') {
			jQuery('#signUpstacks_in_65_page0wrapper').stop().fadeOut(200, function() {
				jQuery(this).hide;
				jQuery('a.showSU').show();
				});
			
			e.preventDefault();
		}
		
	});
	
	jQuery('a.showSU').click(function(e) {
		if (fade=='fade') {
			jQuery('#signUpstacks_in_65_page0wrapper #contact_form').show();
			jQuery('#signUpstacks_in_65_page0wrapper').stop().fadeIn(200);
			jQuery('a.showSU').css('display', 'none');
		}
		e.preventDefault();
	});
	
	

	jQuery("#signUpstacks_in_65_page0wrapper button#submitBut").click(function(e) {
		var firstname=jQuery('#signUpstacks_in_65_page0wrapper input#firstname').val();
		var lastname=jQuery('#signUpstacks_in_65_page0wrapper input#lastname').val();
		var email=jQuery('#signUpstacks_in_65_page0wrapper input#email').val();
		if ((firstname=='') || (lastname=='') || (email=='')) {
			alert('All fields are required');
			return false;
		}
		
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		
	   if(reg.test(email) == false) {
	      alert('Please enter a valid mail address');
	      return false;
	   }
		jQuery(this).attr('disabled', 'disabled');
		
		jQuery('#submitBut').add('#cancelBut').fadeOut(200, function() {
			jQuery('#signUpstacks_in_65_page0wrapper #process').fadeIn();
		});
		
		var list="maillouisas";
		var dataString = 'lastname='+ lastname + '&email=' + email + '&firstname=' + firstname + '&cmd=subscribe&list=' + list +'&resptype=simple';  
		jQuery.ajax({  
			type: "POST",  
			url: "http://www.louisascafe.com/lm/lm.php",  
			data: dataString,  
			success: function() {
				jQuery('#signUpstacks_in_65_page0wrapper #contact_form').stop().fadeOut(500, function() {
					jQuery('#signUpstacks_in_65_page0wrapper #message').fadeIn(500).delay(5000).fadeOut(500, function() {
						jQuery('#signUpstacks_in_65_page0wrapper').stop().fadeOut(500);
					});
				}); 
				
			}  
		});
	
	return false;
	});
	
	
	
	var layout='vertical';
	if (layout=='vertical') {
			jQuery('#signUpstacks_in_65_page0wrapper').css({
				'position': 'absolute',
				'top': '-5000px',
				'display': 'block'
			});
		var theMaxLabelWidth=0;
		jQuery('#signUpstacks_in_65_page0wrapper #myForm label').each(function() {
			var theTmpInputWidth=jQuery(this).outerWidth();
			if (theTmpInputWidth>theMaxLabelWidth) {
				theMaxLabelWidth=theTmpInputWidth;
			}
		});
		jQuery('#signUpstacks_in_65_page0wrapper').css({
			'position': 'static',
			'top': 'auto',
			'display': 'none'
		});
		
		
		var margLeft=theMaxLabelWidth+6+'px';
		jQuery('#signUpstacks_in_65_page0wrapper #myForm input').css('margin-bottom', '6px').after('<br>');
		
		jQuery('#signUpstacks_in_65_page0wrapper button#submitBut').css({
			'margin-left': margLeft,
			'margin-top': '10px'
			});
		jQuery('#signUpstacks_in_65_page0wrapper label').css({
			'display': 'inline-block',
			'width': theMaxLabelWidth
		});
		jQuery('#signUpstacks_in_65_page0wrapper input').css({
			'margin-right': '0'
		});
	}
	else {
		jQuery('#signUpstacks_in_65_page0wrapper label').css({
			'display': 'inline'
		});
	}
	var fade='nofade';
		if (fade=='nofade') {
			jQuery('#signUpstacks_in_65_page0wrapper').css('display', 'block');
		}
	var bg_color = $('#stacks_in_65_page0').css('background-color'); 
	if (bg_color) { 
		$('#stacks_in_65_page0').css({'background-color': 'transparent'});     
		$('#stacks_in_65_page0 form').css({'background-color': bg_color });   
	}
	/*var theColor = $('#stacks_in_65_page0').css('color'); 
	if (theColor) { 
		$('#stacks_in_65_page0').css({'color': 'transparent'});     
		$('#stacks_in_65_page0 form').css({'color': theColor });   
	}*/
	var move='false';
	if (move=='true') {
		jQuery('#SUMove').append(jQuery('#signUpstacks_in_65_page0wrapper'));
	}
	
    return;
});
	return stack;
})(stacks.stacks_in_65_page0);


// Javascript for stacks_in_51_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_51_page0 = {};

// 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_51_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;
	
(function (jsp) {
jsp.topZIndex = function (selector) {
        return Math.max(0, Math.max.apply(null, jsp.map(jsp(selector || ".SPactive *"), 
                function (v) {
                        return parseInt(jsp(v).css("z-index")) || null;
                }
        )));
};

jsp.fn.topZIndex = function (opt) {
        if (this.length === 0) {
                return this;
        }
        opt = jsp.extend({increment: 1, selector: ".SPactive *"}, opt);
        var zmax = jsp.topZIndex(opt.selector), inc = opt.increment;
        return this.each(function () {
                jsp(this).css("z-index", zmax += inc);
        });
};
})(jQuery);

var jsp = jQuery.noConflict();
(function (jQuery) {
	jsp.fn.SPbutton_stacks_in_51_page0 = function (options) 
	{
		jsp(this).html('<div id="SPbutton_stacks_in_51_page0"></div><div id="SPBlock_stacks_in_51_page0"></div>');
		jsp(this).addClass('SPactive');
		jsp('div#SPbutton_stacks_in_51_page0').toggle(function () 
		{
			//
			//closePanels();
			
			jsp("#SPBlock_stacks_in_51_page0").topZIndex( { increment: 5 } );
			jsp("#SPbutton_stacks_in_51_page0").topZIndex( { increment: 5 } );
			jsp(this).animate({"marginRight": "-=3px"},"fast");
			jsp('#SPBlock_stacks_in_51_page0').animate({"marginRight": "-=0px"},"fast");
			jsp(this).animate({"marginRight": "+=295px"},"slow");
			jsp('#SPBlock_stacks_in_51_page0').animate({"marginRight": "+=295px"},"slow");
						
			// Make active
			//jsp(this).addClass('activeslp');
		},
		function () 
		{
			jsp('#SPBlock_stacks_in_51_page0').animate({"marginRight": "-=295px"},"slow");
			jsp(this).animate({"marginRight": "-=295px"},"slow").animate({"marginRight": "+=3px"},"fast");
			// active
			//jsp(this).removeClass('activeslp');
		});//toggle
	}
})(jQuery);

	jQuery(function(){
		jsp('body').append('<div id="SlidingPanel_stacks_in_51_page0"></div>');
		jsp('#SlidingPanel_stacks_in_51_page0').SPbutton_stacks_in_51_page0();
		jsp('#SPBlock_stacks_in_51_page0').html( jsp('#SlidingPanelContent_stacks_in_51_page0').html() );
		jsp('#SPbutton_stacks_in_51_page0').html( jsp('#button_stacks_in_51_page0').html() );
		jsp('#SlidingPanelContent_stacks_in_51_page0').remove();
		jsp('#button_stacks_in_51_page0').remove();
	});
	
//	function closePanels() {
//		jsp("div[id^='SPbutton']").each(function(){
//			if( jsp(this).hasClass('activeslp') )
//			{
//				jsp(this).click();
//			}
//		});
//	}
	return stack;
})(stacks.stacks_in_51_page0);



