//*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
//* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
//* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
//*
//* Version: 1.0.3
//* Requires jQuery 1.1.3+
//* Docs: http://docs.jquery.com/Plugins/livequery
(function(jQuery) {

jQuery.extend(jQuery.fn, {
	livequery: function(type, fn, fn2) {
		var self = this, q;

		// Handle different call patterns
		if (jQuery.isFunction(type))
			fn2 = fn, fn = type, type = undefined;

		// See if Live Query already exists
		jQuery.each( jQuery.livequery.queries, function(i, query) {
			if ( self.selector == query.selector && self.context == query.context &&
				type == query.type && (!fn || fn.jQuerylqguid == query.fn.jQuerylqguid) && (!fn2 || fn2.jQuerylqguid == query.fn2.jQuerylqguid) )
					// Found the query, exit the each loop
					return (q = query) && false;
		});

		// Create new Live Query if it wasn't found
		q = q || new jQuery.livequery(this.selector, this.context, type, fn, fn2);

		// Make sure it is running
		q.stopped = false;

		// Run it immediately for the first time
		q.run();

		// Contnue the chain
		return this;
	},

	expire: function(type, fn, fn2) {
		var self = this;

		// Handle different call patterns
		if (jQuery.isFunction(type))
			fn2 = fn, fn = type, type = undefined;

		// Find the Live Query based on arguments and stop it
		jQuery.each( jQuery.livequery.queries, function(i, query) {
			if ( self.selector == query.selector && self.context == query.context &&
				(!type || type == query.type) && (!fn || fn.jQuerylqguid == query.fn.jQuerylqguid) && (!fn2 || fn2.jQuerylqguid == query.fn2.jQuerylqguid) && !this.stopped )
					jQuery.livequery.stop(query.id);
		});

		// Continue the chain
		return this;
	}
});

jQuery.livequery = function(selector, context, type, fn, fn2) {
	this.selector = selector;
	this.context  = context || document;
	this.type     = type;
	this.fn       = fn;
	this.fn2      = fn2;
	this.elements = [];
	this.stopped  = false;

	// The id is the index of the Live Query in jQuery.livequery.queries
	this.id = jQuery.livequery.queries.push(this)-1;

	// Mark the functions for matching later on
	fn.jQuerylqguid = fn.jQuerylqguid || jQuery.livequery.guid++;
	if (fn2) fn2.jQuerylqguid = fn2.jQuerylqguid || jQuery.livequery.guid++;

	// Return the Live Query
	return this;
};

jQuery.livequery.prototype = {
	stop: function() {
		var query = this;

		if ( this.type )
			// Unbind all bound events
			this.elements.unbind(this.type, this.fn);
		else if (this.fn2)
			// Call the second function for all matched elements
			this.elements.each(function(i, el) {
				query.fn2.apply(el);
			});

		// Clear out matched elements
		this.elements = [];

		// Stop the Live Query from running until restarted
		this.stopped = true;
	},

	run: function() {
		// Short-circuit if stopped
		if ( this.stopped ) return;
		var query = this;

		var oEls = this.elements,
			els  = jQuery(this.selector, this.context),
			nEls = els.not(oEls);

		// Set elements to the latest set of matched elements
		this.elements = els;

		if (this.type) {
			// Bind events to newly matched elements
			nEls.bind(this.type, this.fn);

			// Unbind events to elements no longer matched
			if (oEls.length > 0)
				jQuery.each(oEls, function(i, el) {
					if ( jQuery.inArray(el, els) < 0 )
						jQuery.event.remove(el, query.type, query.fn);
				});
		}
		else {
			// Call the first function for newly matched elements
			nEls.each(function() {
				query.fn.apply(this);
			});

			// Call the second function for elements no longer matched
			if ( this.fn2 && oEls.length > 0 )
				jQuery.each(oEls, function(i, el) {
					if ( jQuery.inArray(el, els) < 0 )
						query.fn2.apply(el);
				});
		}
	}
};

jQuery.extend(jQuery.livequery, {
	guid: 0,
	queries: [],
	queue: [],
	running: false,
	timeout: null,

	checkQueue: function() {
		if ( jQuery.livequery.running && jQuery.livequery.queue.length ) {
			var length = jQuery.livequery.queue.length;
			// Run each Live Query currently in the queue
			while ( length-- )
				jQuery.livequery.queries[ jQuery.livequery.queue.shift() ].run();
		}
	},

	pause: function() {
		// Don't run anymore Live Queries until restarted
		jQuery.livequery.running = false;
	},

	play: function() {
		// Restart Live Queries
		jQuery.livequery.running = true;
		// Request a run of the Live Queries
		jQuery.livequery.run();
	},

	registerPlugin: function() {
		jQuery.each( arguments, function(i,n) {
			// Short-circuit if the method doesn't exist
			if (!jQuery.fn[n]) return;

			// Save a reference to the original method
			var old = jQuery.fn[n];

			// Create a new method
			jQuery.fn[n] = function() {
				// Call the original method
				var r = old.apply(this, arguments);

				// Request a run of the Live Queries
				jQuery.livequery.run();

				// Return the original methods result
				return r;
			}
		});
	},

	run: function(id) {
		if (id != undefined) {
			// Put the particular Live Query in the queue if it doesn't already exist
			if ( jQuery.inArray(id, jQuery.livequery.queue) < 0 )
				jQuery.livequery.queue.push( id );
		}
		else
			// Put each Live Query in the queue if it doesn't already exist
			jQuery.each( jQuery.livequery.queries, function(id) {
				if ( jQuery.inArray(id, jQuery.livequery.queue) < 0 )
					jQuery.livequery.queue.push( id );
			});

		// Clear timeout if it already exists
		if (jQuery.livequery.timeout) clearTimeout(jQuery.livequery.timeout);
		// Create a timeout to check the queue and actually run the Live Queries
		jQuery.livequery.timeout = setTimeout(jQuery.livequery.checkQueue, 20);
	},

	stop: function(id) {
		if (id != undefined)
			// Stop are particular Live Query
			jQuery.livequery.queries[ id ].stop();
		else
			// Stop all Live Queries
			jQuery.each( jQuery.livequery.queries, function(id) {
				jQuery.livequery.queries[ id ].stop();
			});
	}
});

// Register core DOM manipulation methods
jQuery.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');

// Run Live Queries when the Document is ready
jQuery(function() { jQuery.livequery.play(); });


// Save a reference to the original init method
var init = jQuery.prototype.init;

// Create a new init method that exposes two new properties: selector and context
jQuery.prototype.init = function(a,c) {
	// Call the original init and save the result
	var r = init.apply(this, arguments);

	// Copy over properties if they exist already
	if (a && a.selector)
		r.context = a.context, r.selector = a.selector;

	// Set properties
	if ( typeof a == 'string' )
		r.context = c || document, r.selector = a;

	// Return the result
	return r;
};

// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
jQuery.prototype.init.prototype = jQuery.prototype;

})(jQuery);


/*
 * stickyfloat - jQuery plugin for verticaly floating anything in a constrained area
 *
 * Example: jQuery('#menu').stickyfloat({duration: 400});
 * parameters:
 * 		duration 	- the duration of the animation
 *		startOffset - the amount of scroll offset after it the animations kicks in
 *		offsetY		- the offset from the top when the object is animated
 *		lockBottom	- 'true' by default, set to false if you don't want your floating box to stop at parent's bottom
 * $Version: 05.16.2009 r1
 * Copyright (c) 2009 Yair Even-Or
 * vsync.design@gmail.com
 */

jQuery.fn.stickyfloat = function(options, lockBottom) {
	var $obj 				= this;
	var parentPaddingTop 	= parseInt($obj.parent().css('padding-top'));
	var startOffset 		= $obj.parent().offset().top;
	var opts 				= jQuery.extend({ startOffset: startOffset, offsetY: parentPaddingTop, duration: 200, lockBottom:true }, options);

	$obj.css({ position: 'absolute' });

	if(opts.lockBottom){
		var bottomPos = $obj.parent().height() - $obj.height() + parentPaddingTop; //get the maximum scrollTop value
		if( bottomPos < 0 )
			bottomPos = 0;
	}

	jQuery(window).scroll(function () {
		$obj.stop(); // stop all calculations on scroll event

		var pastStartOffset			= jQuery(document).scrollTop() > opts.startOffset;	// check if the window was scrolled down more than the start offset declared.
		var objFartherThanTopPos	= $obj.offset().top > startOffset;	// check if the object is at it's top position (starting point)
		var objBiggerThanWindow 	= $obj.outerHeight() < jQuery(window).height();	// if the window size is smaller than the Obj size, then do not animate.

		// if window scrolled down more than startOffset OR obj position is greater than
		// the top position possible (+ offsetY) AND window size must be bigger than Obj size
		if( (pastStartOffset || objFartherThanTopPos) && objBiggerThanWindow ){
			var newpos = (jQuery(document).scrollTop() -startOffset + opts.offsetY );
			if ( newpos > bottomPos )
				newpos = bottomPos;
			if ( jQuery(document).scrollTop() < opts.startOffset ) // if window scrolled < starting offset, then reset Obj position (opts.offsetY);
				newpos = parentPaddingTop - 47;
//				console.log(newpos);

			$obj.animate({ top: newpos }, opts.duration );
		}
	});
};

/*
// jQuery multiSelect
//
// Version 1.0.2 beta
//
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
// 10 May 2009
//
// Visit http://abeautifulsite.net/notebook.php?article=62 for more information
//
// Usage: jQuery('#control_id').multiSelect( options, callback )
//
// Options:  selectAll          - whether or not to display the Select All option; true/false, default = true
//           selectAllText      - text to display for selecting/unselecting all options simultaneously
//           noneSelected       - text to display when there are no selected items in the list
//           oneOrMoreSelected  - text to display when there are one or more selected items in the list
//                                (note: you can use % as a placeholder for the number of items selected).
//                                Use * to show a comma separated list of all selected; default = '% selected'
//
// Dependencies:  jQuery 1.2.6 or higher (http://jquery.com/)
//
// Change Log:
//
//		1.0.1	- Updated to work with jQuery 1.2.6+ (no longer requires the dimensions plugin)
//				- Changed jQuery(this).offset() to jQuery(this).position(), per James' and Jono's suggestions
//
//		1.0.2	- Fixed issue where dropdown doesn't scroll up/down with keyboard shortcuts
//				- Changed '$' in setTimeout to use 'jQuery' to support jQuery.noConflict
//				- Renamed from jqueryMultiSelect.* to jquery.multiSelect.* per the standard recommended at
//				  http://docs.jquery.com/Plugins/Authoring (does not affect API methods)
//
// Licensing & Terms of Use
//
// This plugin is dual-licensed under the GNU General Public License and the MIT License and
// is copyright 2008 A Beautiful Site, LLC.
//
*/
if(jQuery) (function($a){

	$a.extend($.fn, {
		multiSelect: function(o, callback) {
			// Default options
			if( !o ) var o = {};
			if( o.selectAll == undefined ) o.selectAll = true;
			if( o.selectAllText == undefined ) o.selectAllText = "Select All";
			if( o.noneSelected == undefined ) o.noneSelected = 'Select options';
			if( o.oneOrMoreSelected == undefined ) o.oneOrMoreSelected = '% selected';

			// Initialize each multiSelect
			jQuery(this).each( function() {
				var select = jQuery(this);
				var html = '<input type="text" readonly="readonly" class="multiSelect" value="" style="cursor: default;" />';
				html += '<div class="multiSelectOptions" style="position: absolute; z-index: 99999; display: none;">';
				if( o.selectAll ) html += '<label class="selectAll"><input type="checkbox" class="selectAll" />' + o.selectAllText + '</label>';
				jQuery(select).find('OPTION').each( function() {
					if( jQuery(this).val() != '' ) {
						html += '<label><input type="checkbox" name="' + jQuery(select).attr('name') + '" value="' + jQuery(this).val() + '"';
						if( jQuery(this).attr('selected') ) html += ' checked="checked"';
						html += ' />' + jQuery(this).html() + '</label>';
					}
				});
				html += '</div>';
				jQuery(select).after(html);

				// Events
				jQuery(select).next('.multiSelect').mouseover( function() {
					jQuery(this).addClass('hover');
				}).mouseout( function() {
					jQuery(this).removeClass('hover');
				}).click( function() {
					// Show/hide on click
					if( jQuery(this).hasClass('active') ) {
						jQuery(this).multiSelectOptionsHide();
					} else {
						jQuery(this).multiSelectOptionsShow();
					}
					return false;
				}).focus( function() {
					// So it can be styled with CSS
					jQuery(this).addClass('focus');
				}).blur( function() {
					// So it can be styled with CSS
					jQuery(this).removeClass('focus');
				});

				// Determine if Select All should be checked initially
				if( o.selectAll ) {
					var sa = true;
					jQuery(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT:checkbox').not('.selectAll').each( function() {
						if( !jQuery(this).attr('checked') ) sa = false;
					});
					if( sa ) jQuery(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT.selectAll').attr('checked', true).parent().addClass('checked');
				}

				// Handle Select All
				jQuery(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT.selectAll').click( function() {
					if( jQuery(this).attr('checked') == true ) jQuery(this).parent().parent().find('INPUT:checkbox').attr('checked', true).parent().addClass('checked'); else jQuery(this).parent().parent().find('INPUT:checkbox').attr('checked', false).parent().removeClass('checked');
				});

				// Handle checkboxes
				jQuery(select).next('.multiSelect').next('.multiSelectOptions').find('INPUT:checkbox').click( function() {
					jQuery(this).parent().parent().multiSelectUpdateSelected(o);
					jQuery(this).parent().parent().find('LABEL').removeClass('checked').find('INPUT:checked').parent().addClass('checked');
					jQuery(this).parent().parent().prev('.multiSelect').focus();
					if( !jQuery(this).attr('checked') ) jQuery(this).parent().parent().find('INPUT:checkbox.selectAll').attr('checked', false).parent().removeClass('checked');
					if( callback ) callback(jQuery(this));
				});

				// Initial display
				jQuery(select).next('.multiSelect').next('.multiSelectOptions').each( function() {
					jQuery(this).multiSelectUpdateSelected(o);
					jQuery(this).find('INPUT:checked').parent().addClass('checked');
				});

				// Handle hovers
				jQuery(select).next('.multiSelect').next('.multiSelectOptions').find('LABEL').mouseover( function() {
					jQuery(this).parent().find('LABEL').removeClass('hover');
					jQuery(this).addClass('hover');
				}).mouseout( function() {
					jQuery(this).parent().find('LABEL').removeClass('hover');
				});

				// Keyboard
				jQuery(select).next('.multiSelect').keydown( function(e) {
					// Is dropdown visible?
					if( jQuery(this).next('.multiSelectOptions').is(':visible') ) {
						// Dropdown is visible
						// Tab
						if( e.keyCode == 9 ) {
							jQuery(this).addClass('focus').trigger('click'); // esc, left, right - hide
							jQuery(this).focus().next(':input').focus();
							return true;
						}

						// ESC, Left, Right
						if( e.keyCode == 27 || e.keyCode == 37 || e.keyCode == 39 ) {
							// Hide dropdown
							jQuery(this).addClass('focus').trigger('click');
						}
						// Down
						if( e.keyCode == 40 ) {
							if( !jQuery(this).next('.multiSelectOptions').find('LABEL').hasClass('hover') ) {
								// Default to first item
								jQuery(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');
							} else {
								// Move down, cycle to top if on bottom
								jQuery(this).next('.multiSelectOptions').find('LABEL.hover').removeClass('hover').next('LABEL').addClass('hover');
								if( !jQuery(this).next('.multiSelectOptions').find('LABEL').hasClass('hover') ) {
									jQuery(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');
								}
							}

							// Adjust the viewport if necessary
							jQuery(this).multiSelectAdjustViewport(jQuery(this) );

							return false;
						}
						// Up
						if( e.keyCode == 38 ) {
							if( !jQuery(this).next('.multiSelectOptions').find('LABEL').hasClass('hover') ) {
								// Default to first item
								jQuery(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');
							} else {
								// Move up, cycle to bottom if on top
								jQuery(this).next('.multiSelectOptions').find('LABEL.hover').removeClass('hover').prev('LABEL').addClass('hover');
								if( !jQuery(this).next('.multiSelectOptions').find('LABEL').hasClass('hover') ) {
									jQuery(this).next('.multiSelectOptions').find('LABEL:last').addClass('hover');
								}
							}

							// Adjust the viewport if necessary
							jQuery(this).multiSelectAdjustViewport(jQuery(this) );

							return false;
						}
						// Enter, Space
						if( e.keyCode == 13 || e.keyCode == 32 ) {
							// Select All
							if( jQuery(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').hasClass('selectAll') ) {
								if( jQuery(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked') ) {
									// Uncheck all
									jQuery(this).next('.multiSelectOptions').find('INPUT:checkbox').attr('checked', false).parent().removeClass('checked');
								} else {
									// Check all
									jQuery(this).next('.multiSelectOptions').find('INPUT:checkbox').attr('checked', true).parent().addClass('checked');
								}
								jQuery(this).next('.multiSelectOptions').multiSelectUpdateSelected(o);
								if( callback ) callback(jQuery(this));
								return false;
							}
							// Other checkboxes
							if( jQuery(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked') ) {
								// Uncheck
								jQuery(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked', false);
								jQuery(this).next('.multiSelectOptions').multiSelectUpdateSelected(o);
								jQuery(this).next('.multiSelectOptions').find('LABEL').removeClass('checked').find('INPUT:checked').parent().addClass('checked');
								// Select all status can't be checked at this point
								jQuery(this).next('.multiSelectOptions').find('INPUT:checkbox.selectAll').attr('checked', false).parent().removeClass('checked');
								if( callback ) callback(jQuery(this));
							} else {
								// Check
								jQuery(this).next('.multiSelectOptions').find('LABEL.hover INPUT:checkbox').attr('checked', true);
								jQuery(this).next('.multiSelectOptions').multiSelectUpdateSelected(o);
								jQuery(this).next('.multiSelectOptions').find('LABEL').removeClass('checked').find('INPUT:checked').parent().addClass('checked');
								if( callback ) callback(jQuery(this));
							}
						}
						return false;
					} else {
						// Dropdown is not visible
						if( e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 13 || e.keyCode == 32 ) { // down, enter, space - show
							// Show dropdown
							jQuery(this).removeClass('focus').trigger('click');
							jQuery(this).next('.multiSelectOptions').find('LABEL:first').addClass('hover');
							return false;
						}
						//  Tab key
						if( e.keyCode == 9 ) {
							// Shift focus to next INPUT element on page
							jQuery(this).focus().next(':input').focus();
							return true;
						}
					}
					// Prevent enter key from submitting form
					if( e.keyCode == 13 ) return false;
				});

				// Eliminate the original form element
				jQuery(select).remove();
			});

		},

		// Hide the dropdown
		multiSelectOptionsHide: function() {
			jQuery(this).removeClass('active').next('.multiSelectOptions').hide();
		},

		// Show the dropdown
		multiSelectOptionsShow: function() {
			// Hide any open option boxes
			jQuery('.multiSelect').multiSelectOptionsHide();
			jQuery(this).next('.multiSelectOptions').find('LABEL').removeClass('hover');
			jQuery(this).addClass('active').next('.multiSelectOptions').show();

			// Position it
			var offset = jQuery(this).position();
			jQuery(this).next('.multiSelectOptions').css({ top:  offset.top + jQuery(this).outerHeight() + 'px' });
			jQuery(this).next('.multiSelectOptions').css({ left: offset.left + 'px' });

			// Disappear on hover out
			multiSelectCurrent = jQuery(this);
			var timer = '';
			jQuery(this).next('.multiSelectOptions').hover( function() {
				clearTimeout(timer);
			}, function() {
				timer = setTimeout('jQuery(multiSelectCurrent).multiSelectOptionsHide(); jQuery(multiSelectCurrent).unbind("hover");', 250);
			});

		},

		// Update the textbox with the total number of selected items
		multiSelectUpdateSelected: function(o) {
			var i = 0, s = '';
			jQuery(this).find('INPUT:checkbox:checked').not('.selectAll').each( function() {
				i++;
			})
			if( i == 0 ) {
				jQuery(this).prev('INPUT.multiSelect').val( o.noneSelected );
			} else {
				if( o.oneOrMoreSelected == '*' ) {
					var display = '';
					jQuery(this).find('INPUT:checkbox:checked').each( function() {
						if( jQuery(this).parent().text() != o.selectAllText ) display = display + jQuery(this).parent().text() + ', ';
					});
					display = display.substr(0, display.length - 2);
					jQuery(this).prev('INPUT.multiSelect').val( display );
				} else {
					jQuery(this).prev('INPUT.multiSelect').val( o.oneOrMoreSelected.replace('%', i) );
				}
			}
		},

		// Ensures that the selected item is always in the visible portion of the dropdown (for keyboard controls)
		multiSelectAdjustViewport: function(el) {
			// Calculate positions of elements
			var i = 0;
			var selectionTop = 0, selectionHeight = 0;
			jQuery(el).next('.multiSelectOptions').find('LABEL').each( function() {
				if( jQuery(this).hasClass('hover') ) { selectionTop = i; selectionHeight = jQuery(this).outerHeight(); return; }
				i += jQuery(this).outerHeight();
			});
			var divScroll = jQuery(el).next('.multiSelectOptions').scrollTop();
			var divHeight = jQuery(el).next('.multiSelectOptions').height();
			// Adjust the dropdown scroll position
			jQuery(el).next('.multiSelectOptions').scrollTop(selectionTop - ((divHeight / 2) - (selectionHeight / 2)));
		}

	});

})(jQuery);

/**
#  * Copyright (c) 2008 Pasyuk Sergey (www.codeasily.com)
#  * Licensed under the MIT License:
#  * http://www.opensource.org/licenses/mit-license.php
#  *
#  * Splits a <ul>/<ol>-list into equal-sized columns.
#  *
#  * Requirements:
#  * <ul>
#  * <li>"ul" or "ol" element must be styled with margin</li>
#  * </ul>
#  *
#  * @see http://www.codeasily.com/jquery/multi-column-list-with-jquery
#  */
jQuery.fn.makeacolumnlists = function(settings){
	settings = jQuery.extend({
		cols: 3,				// set number of columns
		colWidth: 0,			// set width for each column or leave 0 for auto width
		equalHeight: 'ul', 	// can be false, 'ul', 'ol', 'li'
		startN: 1				// first number on your ordered list
	}, settings);

	if(jQuery('> li', this)) {
		this.each(function(y) {
			var y=jQuery('.li_container').size(),
		    	height = 0,
		        maxHeight = 0,
				t = jQuery(this),
				classN = t.attr('class'),
				listsize = jQuery('> li', this).size(),
				percol = Math.ceil(listsize/settings.cols),
				contW = t.width(),
				bl = ( isNaN(parseInt(t.css('borderLeftWidth'),10)) ? 0 : parseInt(t.css('borderLeftWidth'),10) ),
				br = ( isNaN(parseInt(t.css('borderRightWidth'),10)) ? 0 : parseInt(t.css('borderRightWidth'),10) ),
				pl = parseInt(t.css('paddingLeft'),10),
				pr = parseInt(t.css('paddingRight'),10),
				ml = parseInt(t.css('marginLeft'),10),
				mr = parseInt(t.css('marginRight'),10),
				col_Width = Math.floor((contW - (settings.cols-1)*(bl+br+pl+pr+ml+mr))/settings.cols);
			if (settings.colWidth) {
				col_Width = settings.colWidth;
			}
			var colnum=1,
				percol2=percol;
			jQuery(this).addClass('li_cont1').wrap('<div id="li_container' + (++y) + '" class="li_container"></div>');
			for (var i=0; i<=listsize; i++) {
				if(i>=percol2) { percol2+=percol; colnum++; }
				var eq = jQuery('> li:eq('+i+')',this);
				eq.addClass('li_col'+ colnum);
				if(jQuery(this).is('ol')){eq.attr('value', ''+(i+settings.startN))+'';}
			}
			jQuery(this).css({cssFloat:'left', width:''+col_Width+'px'});
			for (colnum=2; colnum<=settings.cols; colnum++) {
				if(jQuery(this).is('ol')) {
					jQuery('li.li_col'+ colnum, this).appendTo('#li_container' + y).wrapAll('<ol class="li_cont'+colnum +' ' + classN + '" style="float:left; width: '+col_Width+'px;"></ol>');
				} else {
					jQuery('li.li_col'+ colnum, this).appendTo('#li_container' + y).wrapAll('<ul class="li_cont'+colnum +' ' + classN + '" style="float:left; width: '+col_Width+'px;"></ul>');
				}
			}
			if (settings.equalHeight=='li') {
				for (colnum=1; colnum<=settings.cols; colnum++) {
				    jQuery('#li_container'+ y +' li').each(function() {
				        var e = jQuery(this);
				        var border_top = ( isNaN(parseInt(e.css('borderTopWidth'),10)) ? 0 : parseInt(e.css('borderTopWidth'),10) );
				        var border_bottom = ( isNaN(parseInt(e.css('borderBottomWidth'),10)) ? 0 : parseInt(e.css('borderBottomWidth'),10) );
				        height = e.height() + parseInt(e.css('paddingTop'), 10) + parseInt(e.css('paddingBottom'), 10) + border_top + border_bottom;
				        maxHeight = (height > maxHeight) ? height : maxHeight;
				    });
				}
				for (colnum=1; colnum<=settings.cols; colnum++) {
					var eh = jQuery('#li_container'+ y +' li');
			        var border_top = ( isNaN(parseInt(eh.css('borderTopWidth'),10)) ? 0 : parseInt(eh.css('borderTopWidth'),10) );
			        var border_bottom = ( isNaN(parseInt(eh.css('borderBottomWidth'),10)) ? 0 : parseInt(eh.css('borderBottomWidth'),10) );
					mh = maxHeight - (parseInt(eh.css('paddingTop'), 10) + parseInt(eh.css('paddingBottom'), 10) + border_top + border_bottom );
			        eh.height(mh);
				}
			} else
			if (settings.equalHeight=='ul' || settings.equalHeight=='ol') {
				for (colnum=1; colnum<=settings.cols; colnum++) {
				    jQuery('#li_container'+ y +' .li_cont'+colnum).each(function() {
				        var e = jQuery(this);
				        var border_top = ( isNaN(parseInt(e.css('borderTopWidth'),10)) ? 0 : parseInt(e.css('borderTopWidth'),10) );
				        var border_bottom = ( isNaN(parseInt(e.css('borderBottomWidth'),10)) ? 0 : parseInt(e.css('borderBottomWidth'),10) );
				        height = e.height() + parseInt(e.css('paddingTop'), 10) + parseInt(e.css('paddingBottom'), 10) + border_top + border_bottom;
				        maxHeight = (height > maxHeight) ? height : maxHeight;
				    });
				}
				for (colnum=1; colnum<=settings.cols; colnum++) {
					var eh = jQuery('#li_container'+ y +' .li_cont'+colnum);
			        var border_top = ( isNaN(parseInt(eh.css('borderTopWidth'),10)) ? 0 : parseInt(eh.css('borderTopWidth'),10) );
			        var border_bottom = ( isNaN(parseInt(eh.css('borderBottomWidth'),10)) ? 0 : parseInt(eh.css('borderBottomWidth'),10) );
					mh = maxHeight - (parseInt(eh.css('paddingTop'), 10) + parseInt(eh.css('paddingBottom'), 10) + border_top + border_bottom );
			        eh.height(mh);
				}
			}
		    jQuery('#li_container' + y).append('<div style="clear:both; overflow:hidden; height:0px;"></div>');
		});
	}
};

/*
 * Facebox (for jQuery)
 * version: 1.2 (05/05/2008)
 * @requires jQuery v1.2 or later
 *
 * Licensed under the MIT:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
 *
 */
(function(jQuery) {
  jQuery.facebox = function(data, klass) {
    jQuery.facebox.loading()

    if (data.ajax) fillFaceboxFromAjax(data.ajax)
    else if (data.image) fillFaceboxFromImage(data.image)
    else if (data.div) fillFaceboxFromHref(data.div)
    else if (jQuery.isFunction(data)) data.call(jQuery)
    else jQuery.facebox.reveal(data, klass)
  }

  /*
   * Public, jQuery.facebox methods
   */

  jQuery.extend(jQuery.facebox, {
    settings: {
      opacity      : 0,
      overlay      : true,
      loadingImage : LOADER_IMG,
      closeImage   : '/images/facebox/closelabel.gif',
      imageTypes   : [ 'png', 'jpg', 'jpeg', 'gif' ],
      faceboxHtml  : '\
    <div id="facebox" style="display:none;"> \
      <div class="popup"> \
        <table> \
          <tbody> \
            <tr> \
              <td class="tl"/><td class="b"/><td class="tr"/> \
            </tr> \
            <tr> \
              <td class="b"/> \
              <td class="body"> \
                <div class="content"> \
                </div> \
                <div class="footer"> \
                  <a href="#" class="close"> \
                    <img src="/facebox/closelabel.gif" title="close" class="close_image" /> \
                  </a> \
                </div> \
              </td> \
              <td class="b"/> \
            </tr> \
            <tr> \
              <td class="bl"/><td class="b"/><td class="br"/> \
            </tr> \
          </tbody> \
        </table> \
      </div> \
    </div>'
    },

    loading: function() {
      init()
      if (jQuery('#facebox .loading').length == 1) return true
      showOverlay()

      jQuery('#facebox .content').empty()
      jQuery('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="'+jQuery.facebox.settings.loadingImage+'"/></div>')

      jQuery('#facebox').css({
        top:	getPageScroll()[1] + (getPageHeight() / 10),
        left:	385.5
      }).show()

      jQuery(document).bind('keydown.facebox', function(e) {
        if (e.keyCode == 27) jQuery.facebox.close()
        return true
      })
      jQuery(document).trigger('loading.facebox')
    },

    reveal: function(data, klass) {
      jQuery(document).trigger('beforeReveal.facebox')
      if (klass) jQuery('#facebox .content').addClass(klass)
      jQuery('#facebox .content').append(data)
      jQuery('#facebox .loading').remove()
      jQuery('#facebox .body').children().fadeIn('normal')
      jQuery('#facebox').css('left', jQuery(window).width() / 2 - (jQuery('#facebox table').width() / 2))
      jQuery(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
    },

    close: function() {
      jQuery(document).trigger('close.facebox')
      return false
    }
  })

  /*
   * Public, jQuery.fn methods
   */

  jQuery.fn.facebox = function(settings) {
    init(settings)

    function clickHandler() {
      jQuery.facebox.loading(true)

      // support for rel="facebox.inline_popup" syntax, to add a class
      // also supports deprecated "facebox[.inline_popup]" syntax
      var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
      if (klass) klass = klass[1]

      fillFaceboxFromHref(this.href, klass)
      return false
    }

    return this.click(clickHandler)
  }

  /*
   * Private methods
   */

  // called one time to setup facebox on this page
  function init(settings) {
    if (jQuery.facebox.settings.inited) return true
    else jQuery.facebox.settings.inited = true

    jQuery(document).trigger('init.facebox')
    makeCompatible()

    var imageTypes = jQuery.facebox.settings.imageTypes.join('|')
    jQuery.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + 'jQuery', 'i')

    if (settings) jQuery.extend(jQuery.facebox.settings, settings)
    jQuery('body').append(jQuery.facebox.settings.faceboxHtml)

    var preload = [ new Image(), new Image() ]
    preload[0].src = jQuery.facebox.settings.closeImage
    preload[1].src = jQuery.facebox.settings.loadingImage

    jQuery('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
      preload.push(new Image())
      preload.slice(-1).src = jQuery(this).css('background-image').replace(/url\((.+)\)/, 'jQuery1')
    })

    jQuery('#facebox .close').click(jQuery.facebox.close)
    jQuery('#facebox .close_image').attr('src', jQuery.facebox.settings.closeImage)
  }

  // getPageScroll() by quirksmode.com
  function getPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;
    }
    return new Array(xScroll,yScroll)
  }

  // Adapted from getPageSize() by quirksmode.com
  function getPageHeight() {
    var windowHeight
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }
    return windowHeight
  }

  // Backwards compatibility
  function makeCompatible() {
    var jQuerys = jQuery.facebox.settings

    jQuerys.loadingImage = jQuerys.loading_image || jQuerys.loadingImage
    jQuerys.closeImage = jQuerys.close_image || jQuerys.closeImage
    jQuerys.imageTypes = jQuerys.image_types || jQuerys.imageTypes
    jQuerys.faceboxHtml = jQuerys.facebox_html || jQuerys.faceboxHtml
  }

  // Figures out what you want to display and displays it
  // formats are:
  //     div: #id
  //   image: blah.extension
  //    ajax: anything else
  function fillFaceboxFromHref(href, klass) {
    // div
    if (href.match(/#/)) {
      var url    = window.location.href.split('#')[0]
      var target = href.replace(url,'')
      jQuery.facebox.reveal(jQuery(target).clone().show(), klass)

    // image
    } else if (href.match(jQuery.facebox.settings.imageTypesRegexp)) {
      fillFaceboxFromImage(href, klass)
    // ajax
    } else {
      fillFaceboxFromAjax(href, klass)
    }
  }

  function fillFaceboxFromImage(href, klass) {
    var image = new Image()
    image.onload = function() {
      jQuery.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
    }
    image.src = href
  }

  function fillFaceboxFromAjax(href, klass) {
    jQuery.get(href, function(data) { jQuery.facebox.reveal(data, klass) })
  }

  function skipOverlay() {
    return jQuery.facebox.settings.overlay == false || jQuery.facebox.settings.opacity === null
  }

  function showOverlay() {
    if (skipOverlay()) return

    if (jQuery('facebox_overlay').length == 0)
      jQuery("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')

    jQuery('#facebox_overlay').hide().addClass("facebox_overlayBG")
      .css('opacity', jQuery.facebox.settings.opacity)
      .click(function() { jQuery(document).trigger('close.facebox') })
      .fadeIn(200)
    return false
  }

  function hideOverlay() {
    if (skipOverlay()) return

    jQuery('#facebox_overlay').fadeOut(200, function(){
      jQuery("#facebox_overlay").removeClass("facebox_overlayBG")
      jQuery("#facebox_overlay").addClass("facebox_hide")
      jQuery("#facebox_overlay").remove()
    })

    return false
  }

  /*
   * Bindings
   */

  jQuery(document).bind('close.facebox', function() {
    jQuery(document).unbind('keydown.facebox')
    jQuery('#facebox').fadeOut(function() {
      jQuery('#facebox .content').removeClass().addClass('content')
      hideOverlay()
      jQuery('#facebox .loading').remove()
    })
  })

})(jQuery);

jQuery.fn.nospam = function() {
	var at = / at /;
	var dot = / dot /g;

	return this.each(function() {
		var addr = jQuery(this).text().replace(at,"@").replace(dot,".");
		jQuery(this).after('<a href="mailto:'+addr+'" title="">'+ addr +'</a>').hover(function(){window.status="";}, function(){window.status="";});
		jQuery(this).remove();
	});
};
