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

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

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

	// When jQuery is used it will be available as $ and jQuery but only
	// inside the closure.
	var jQuery = stacks.jQuery;
	var $ = jQuery;
	
/*
 * 
 * jFontSizer Plugin
 * Written by fluidByte - http://www.fluidbyte.net
 * 
 * 
 */

jQuery.fn.jfontsizer = function(o) {

	// Cookie functions
	function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	}
	
	function getCookie(c_name){
	if (document.cookie.length>0){
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1){
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    }
	  }
	return "";
	}

    
	// Defaults
	var o = jQuery.extend( {
		applyTo: 'body',
		changesmall: '2',
		changelarge: '2',
		expire: 30
	},o);
	
	var s = '';
	var m = '';
	var l = '';
	
	// Current
	var c = 'fs_med';
	
	// Check cookie  
	if (getCookie('fsizer') != "") {
		var c = getCookie('fsizer');
		switch (c) {
			case 'fs_sml':
				s = 'fsactive';
			$(o.applyTo).css('font-size','.'+(10-o.changesmall)+'em');
				break;
			case 'fs_med':
				m = 'fsactive';
			$(o.applyTo).css('font-size','1em');
				break;
			case 'fs_lrg':
				l = 'fsactive';
			$(o.applyTo).css('font-size','1.'+o.changelarge+'em');
				break;
		}
	}
	else {
		m = "fsactive";
	}
	
	// Create font-chooser box
	$(this).html('<div class="fsizer"><a id="fs_sml" class="'+s+'">-</a><a id="fs_med" class="'+m+'">A</a><a id="fs_lrg" class="'+l+'">+</a><br style="clear: both" /></div>');
	
	
	$('.fsizer a').click(function(){
	
		var t = $(this).attr('id');
		
		setCookie('fsizer',t,o.expire);
		
		$('.fsizer a').removeClass('fsactive');
		$(this).addClass('fsactive');
		
		var f = $(o.applyTo).css('font-size');	
		
		switch(t){
			case 'fs_sml':
				$(o.applyTo).css('font-size','.'+(10-o.changesmall)+'em');
				break;
			case 'fs_med':
			    $(o.applyTo).css('font-size','1em');
				break;
			case 'fs_lrg':
				$(o.applyTo).css('font-size','1.'+o.changelarge+'em');
				$(o.applyTo).css('line-height','1'+o.changelarge+'0%');
				break;
		}	
	});
};

jQuery(document).ready(function(){
  jQuery('#fontsizer').jfontsizer({
    applyTo: '#contentContainer',
    changesmall: '1',
    changelarge: '2',
    expire: 30
  });
});

	return stack;
})(stacks.stacks_in_96_page1);



