/** jQuery Browser Plugin
 * Version 2.3
 * 2008-09-17 19:27:05
 * URL: http://jquery.thewikies.com/browser
 * Description: jQuery Browser Plugin extends browser detection capabilities and can assign browser selectors to CSS classes.
 * Author: Nate Cavanaugh, Minhchau Dang, & Jonathan Neal
 * Copyright: Copyright (c) 2008 Jonathan Neal under dual MIT/GPL license.
 * JSLint: This javascript file passes JSLint verification.
*//*jslint
		bitwise: true,
		browser: true,
		eqeqeq: true,
		forin: true,
		nomen: true,
		plusplus: true,
		undef: true,
		white: true
*//*global
		jQuery
*/

(function (jQuery) {
	jQuery.browserTest = function (a, z) {
		var u = 'unknown', x = 'X', m = function (r, h) {
			for (var i = 0; i < h.length; i = i + 1) {
				r = r.replace(h[i][0], h[i][1]);
			}
			return r;
		},
		c = function (i, a, b, c) {
			var r = {
				name: m((a.exec(i) || [u, u])[1], b)
			};
			r[r.name] = true;
			r.version = (c.exec(i) || [x, x, x, x])[3];
			if (r.name.match(/safari/) && r.version > 400) {
				r.version = '2.0';
			}
			if (r.name === 'presto') {
				r.version = (jQuery.browser.version > 9.27) ? 'futhark' : 'linear_b';
			}
			r.versionNumber = parseFloat(r.version, 10) || 0;
			r.versionX = (r.version !== x) ? (r.version + '').substr(0, 1) : x;
			r.className = r.name + r.versionX;
			return r;
		},
		a = (a.match(/Opera|Navigator|Minefield|KHTML|Chrome/) ? m(a, [
			[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''],
			['Chrome Safari', 'Chrome'],
			['KHTML', 'Konqueror'],
			['Minefield', 'Firefox'],
			['Navigator', 'Netscape']
		]) : a).toLowerCase();
		jQuery.browser = jQuery.extend((!z) ? jQuery.browser : {}, c(a, /(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/, [], /(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));
		jQuery.layout = c(a, /(gecko|konqueror|msie|opera|webkit)/, [
			['konqueror', 'khtml'],
			['msie', 'trident'],
			['opera', 'presto']
		], /(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);
		jQuery.os = {
			name: (/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase()) || [u])[0].replace('sunos', 'solaris')
		};
		if (!z) {
			jQuery('html').addClass([jQuery.os.name, jQuery.browser.name, jQuery.browser.className, jQuery.layout.name, jQuery.layout.className].join(' '));
		}
	};
	jQuery.browserTest(navigator.userAgent);
})(jQuery);

/**
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqmodal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 07/06/2008 +r13
 * SK 2009-10-14 added the ability to specify hover
 */
(function(jQuery) {
jQuery.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F,
hover: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=jQuery.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:jQuery.extend(p,jQuery.jqm.params,o),a:F,w:jQuery(this).addClass('jqmID'+s),s:s};
if(p.trigger)jQuery(this).jqmAddTrigger(p.trigger);
});};

jQuery.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
jQuery.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
jQuery.fn.jqmShow=function(t){return this.each(function(){jQuery.jqm.open(this._jqm,t);});};
jQuery.fn.jqmHide=function(t){return this.each(function(){jQuery.jqm.close(this._jqm,t)});};

jQuery.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=jQuery('<div></div>').css({height:(jQuery('body').scrollTop()+jQuery('body').innerHeight())+'px',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){
 	jQuery('html,body').css({height:'100%',width:'100%'});
 	if(o){
		o=o.css({position:'absolute'})[0];
 		for(var y in {Top:1,Left:1})
			o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");
	}
}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?jQuery(r,h.w):jQuery(r),u=(u.substr(0,1) == '@')?jQuery(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose(jQuery(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose(jQuery(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)jQuery('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=jQuery.jqm.hash,A=[],ie6=jQuery.browser.msie&&(jQuery.browser.version == "6.0"),F=false,
i=jQuery('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!jQuery('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{jQuery(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){jQuery()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!jQuery(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;jQuery(t).each(function() {
 if(!this[c]){	this[c]=[];
	if(H[s].c.hover){
		jQuery(this).hover(
			function(){for(var i in {jqmShow:1}) for(var s in this[i]) if(H[this[i][s]]) H[this[i][s]].w[i](this); return F;},
			function(){for(var i in {jqmHide:1}) for(o in H) if(H[o].t==this) H[o].w[i](this); return F;}
		);
	}else{
		jQuery(this).click(function(){for(var i in {jqmShow:1,jqmHide:1}) for(var s in this[i]) if(H[this[i][s]]) H[this[i][s]].w[i](this);return F;});
	}
 }this[c].push(s);});});};
})(jQuery);

/**
 * jQuery center plugin
 * Centers an element in the browser window
 * @version 0.0.2
 * @author skresge
 */
(function(jQuery){
  jQuery.fn.center = function(c) {
	 c = jQuery.extend({position: 'absolute'}, c || {}); 
    var pos = {
      sTop : function() {
	      return window.pageYOffset || jQuery.support.boxModel && document.documentElement.scrollTop || document.body.scrollTop; 
      },
      wHeight : function() {
	     if ( jQuery.browser.opera || (jQuery.browser.safari && parseInt (jQuery.browser.version) > 520) ) {
	        return window.innerHeight - ((jQuery(document).height() > window.innerHeight) ? getScrollbarWidth() : 0); 
        } else if ( jQuery.browser.safari ) {
           return window.innerHeight;
        } else {
	        return jQuery.support.boxModel && document.documentElement.clientHeight || document.body.clientHeight; 
        }
      },
      sLeft : function() {
         return window.pageXOffset || jQuery.support.boxModel && document.documentElement.scrollLeft || document.body.scrollLeft; 
      },
      wWidth : function() {
		  if ( jQuery.browser.opera || (jQuery.browser.safari && parseInt (jQuery.browser.version) > 520) ) {
          return window.innerWidth - ((jQuery(document).width() > window.innerWidth) ? getScrollbarWidth() : 0); 
        } else if ( jQuery.browser.safari ) {
          return window.innerWidth;
        } else {
			 return jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth; 
        }
      }
    };
    return this.each(function(index) {
      if (index == 0) {
        var elHeight = jQuery(this).height();
        var elWidth = jQuery(this).width();
		  var newX = ((pos.wWidth() / 2) - (elWidth / 2));
		  var newY = ((pos.wHeight() / 2) - (elHeight / 2));
		  if(c.position == "absolute") {
			 var newX = (newX + pos.sLeft());
			 var newY = (newY + pos.sTop());
		  }
        jQuery(this).css({position: c.position, marginTop: '0', top: newY, left: newX});
      }
    });
  };
})(jQuery);

/**
 * jQuery custom selectboxes
 * 
 * Copyright (c) 2008 Krzysztof Suszyński (suszynski.org)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * @version 0.6.1
 * @category visual
 * @package jquery
 * @subpakage ui.selectbox
 * @author Krzysztof Suszyński <k.suszynski@wit.edu.pl>
**/
(function(jQuery){
jQuery.fn.selectbox = function(options){
	/* Default settings */
	var settings = {
		className: 'jquery-selectbox',
		animationSpeed: "fast",
		listboxMaxSize: 10,
		replaceInvisible: false,
		tStrings: {s:'Option',p:'Options'}
	};
	var commonClass = 'jquery-custom-selectboxes-replaced';
	var listOpen = false;
	var showList = function(listObj) {
		var selectbox = listObj.parents('.' + settings.className + '');
		listObj.slideDown(settings.animationSpeed, function(){
			listOpen = true;
		});
		selectbox.addClass('selecthover');
		if (selectbox.find('select')[0].multiple == false)
			jQuery(document).bind('click', onBlurList);
		return listObj;
	};
	var hideList = function(listObj) {
		var selectbox = listObj.parents('.' + settings.className + '');
		listObj.slideUp(settings.animationSpeed, function(){
			listOpen = false;
			jQuery(this).parents('.' + settings.className + '').removeClass('selecthover');
		});
		jQuery(document).unbind('click', onBlurList);
		return listObj;
	};
	var onBlurList = function(e) {
		var trgt = e.target;
		var currentListElements = jQuery('.' + settings.className + '-list:visible').parent().find('*').andSelf();
		if(jQuery.inArray(trgt, currentListElements)<0 && listOpen) {
			hideList( jQuery('.' + commonClass + '-list') );
		}
		return false;
	};
	var assignShowHide = function(e) {
		var thisMoreButton = jQuery(e);
		var otherLists = jQuery('.' + settings.className + '-list')
			.not(thisMoreButton.siblings('.' + settings.className + '-list'));
		hideList( otherLists );
		var thisList = thisMoreButton.siblings('.' + settings.className + '-list');
		if(thisList.filter(":visible").length > 0) {
			hideList( thisList );
		}else{
			showList( thisList );
		}
	};
	var setMultiControls = function(listObj) {
		var x = jQuery('<div class="' + settings.className + '-multi_controls"><a class="mc_all" title="Click to select all">all</a> | <a class="mc_clear" title="Click to clear all selections">none</a> <a title="Click to close" class="mc_close">&nbsp;</a></div>');
		jQuery('.' + settings.className + '-list', listObj).append(x);
		var thisSublist = listObj.find('.' + settings.className + '-list');
		listObj.find('.mc_close').click(function() { hideList(thisSublist); });
		listObj.find('.mc_all').click(function() { handleCheckboxes(listObj,'select option',true); });
		listObj.find('.mc_clear').click(function() { handleCheckboxes(listObj,'select option',false); });
	};
	var handleCheckboxes = function (listObj,selector,state,listEl) {
		var mso = listObj.find(selector);
		if (typeof state != 'boolean') state = (mso.attr('selected'))?false:true;
		if (typeof listEl == 'object') {
			listEl.find('input').attr({checked:state});
		} else {
			listObj.find('.jquery-selectbox-item input').attr({checked:state});
		}
		mso.attr({selected:state}).triggerHandler('change');
		if (mso.parent().attr('onchange')) mso.parent().triggerHandler('change');
		var c = listObj.find('select option[selected]').length;
		c = (c==0) ? 'All ': c+' ';
		var txt = (c == 1) ? settings.tStrings.s: settings.tStrings.p;
		listObj.find('.' + settings.className + '-currentItem').text(c+txt);
	};
	
	/* Processing settings */
	settings = jQuery.extend(settings, options || {});
	/* Wrapping all passed elements */
	return this.each(function() {
		var _this = jQuery(this);
		if(_this.filter(':visible').length == 0 && !settings.replaceInvisible)
			return;
		var replacement = jQuery(
			'<div class="' + settings.className + ' ' + commonClass + '">' +
				'<div class="' + settings.className + '-moreButton" />' +
				'<div class="' + settings.className + '-list ' + commonClass + '-list" />' +
				'<span class="' + settings.className + '-currentItem" />' +
			'</div>'
		);
		// SK - modified to handle 'multiple' <select>, tStrings can be passed for custom text
		settings.isMultiple = _this.attr('multiple');
		var osc = 0;
		jQuery('option', _this).each(function(k,v){
			v = jQuery(v);
			if (settings.isMultiple) {
				var chkStr = '';
				if (v.attr('selected')) {
					var chkStr = 'checked="checked"';
					osc++;
				}
				var currentItemText = 'All '+settings.tStrings.p;
				if (osc==1) currentItemText = osc+' '+settings.tStrings.s;
				if (osc>1) currentItemText = osc+' '+settings.tStrings.p;
				var listElement =  jQuery('<span class="' + settings.className + '-item value-'+v.val()+' item-'+k+'"><input type="checkbox" class="checkbox" ' + chkStr + '/><span class="checkbox">' + v.text() + '</span></span>');
			} else {
				var currentItemText = v.text();
				var listElement =  jQuery('<span class="' + settings.className + '-item value-'+v.val()+' item-'+k+'">' + v.text() + '</span>');
			}
			listElement.click(function(){
				var thisListElement = jQuery(this);
				var thisReplacment = thisListElement.parents('.'+settings.className);
				var thisIndex = thisListElement[0].className.split(' ');
				for( k1 in thisIndex ) {
					if(/^item-[0-9]+$/.test(thisIndex[k1])) {
						thisIndex = parseInt(thisIndex[k1].replace('item-',''), 10);
						break;
					}
				};
				var thisValue = thisListElement[0].className.split(' ');
				for( k1 in thisValue ) {
					if(/^value-.+$/.test(thisValue[k1])) {
						thisValue = thisValue[k1].replace('value-','');
						break;
					}
				};
				if (settings.isMultiple) {
					handleCheckboxes(thisReplacment,'select option[value=\''+thisValue+'\']','',thisListElement);
				} else {
					thisReplacment.find('.' + settings.className + '-currentItem').text(thisListElement.text());
					thisReplacment.find('select').val(thisValue).triggerHandler('change');
					var thisSublist = thisReplacment.find('.' + settings.className + '-list');
					if(thisSublist.filter(":visible").length > 0) {
						hideList( thisSublist );
					}else{
						showList( thisSublist );
					}
				}
			}).bind('mouseenter',function(){
				jQuery(this).addClass('listelementhover');
			}).bind('mouseleave',function(){
				jQuery(this).removeClass('listelementhover');
			});
			jQuery('.' + settings.className + '-list', replacement).append(listElement);
			
			if(v.filter(':selected').length > 0 || settings.isMultiple) {
				jQuery('.'+settings.className + '-currentItem', replacement).text(currentItemText);
			}
		});
		if (settings.isMultiple) {
			setMultiControls(replacement);
		}
		replacement.find('.' + settings.className + '-moreButton').click(function(){
			assignShowHide(this);
		}).bind('mouseenter',function(){
			jQuery(this).addClass('morebuttonhover');
		}).bind('mouseleave',function(){
			jQuery(this).removeClass('morebuttonhover');
		});
		replacement.find('.' + settings.className + '-currentItem').click(function(){
			assignShowHide(this);
		});
		_this.hide().replaceWith(replacement).appendTo(replacement);
		var thisListBox = replacement.find('.' + settings.className + '-list');
		var thisListBoxSize = thisListBox.find('.' + settings.className + '-item').length;
		
		// SK - added to accept an option for 'ListBoxHeight' and 'ListBoxWidth' - use a value that would be used to set css height/width attributes (e.g. '50px','auto', etc.)
		var thisListBoxItemHeight = parseInt(jQuery('.' + settings.className + '-item').css("height"));
		if(options.ListBoxHeight != '') {
			thisListBoxSize = options.ListBoxHeight;
		}else{
  		if(thisListBoxSize > settings.listboxMaxSize) thisListBoxSize = settings.listboxMaxSize;
  		if(thisListBoxSize == 0) thisListBoxSize = 1;
			thisListBoxSize = thisListBoxSize + 'em';
		}
		var thisListBoxWidth = Math.round(_this.width() + 5);
		if(jQuery.browser.safari)
			thisListBoxWidth = thisListBoxWidth * 0.94;
		replacement.css('width', thisListBoxWidth + 'px');
		if(options.ListBoxWidth != '') thisListBoxWidth = options.ListBoxWidth;
		thisListBox.css({
			width: Math.round(thisListBoxWidth-5) + 'px',
			height: thisListBoxSize
		});
	});
};
jQuery.fn.unselectbox = function(){
	var commonClass = 'jquery-custom-selectboxes-replaced';
	return this.each(function() {
		var selectToRemove = jQuery(this).filter('.' + commonClass);
		selectToRemove.replaceWith(selectToRemove.find('select').show());		
	});
};
})(jQuery);

/** jQuery elementReady plugin
 * Version 0.6
 * Copyright (C) 2007-08 Bennett McElwee.
 * Licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License (http://creativecommons.org/licenses/by-sa/3.0/)
 * Permissions beyond the scope of this license may be available at http://www.thunderguy.com/semicolon/.
 */
/* SKresge - removed documentation to reduce file size. Original version can be found at http://plugins.jquery.com/files/jquery.elementReady.js.txt*/
(function(jQuery) {
var interval = null;
var checklist = [];
jQuery.elementReady = function(id, fn) {
	checklist.push({id: id, fn: fn});
	if (!interval) {
		interval = setInterval(check, jQuery.elementReady.interval_ms);
	}
	return this;
};
// Plugin settings
jQuery.elementReady.interval_ms = 23; // polling interval in ms
// Private function
function check() {
	var docReady = jQuery.isReady; // check doc ready first; thus ensure that check is made at least once _after_ doc is ready
	for (var i = checklist.length - 1; 0 <= i; --i) {
		var el = document.getElementById(checklist[i].id);
		if (el) {
			var fn = checklist[i].fn; // first remove from checklist, then call function
			checklist[i] = checklist[checklist.length - 1];
			checklist.pop();
			fn.apply(el, [jQuery]);
		}
	}
	if (docReady) {
		clearInterval(interval);
		interval = null;
	}
};
})(jQuery);

/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 * http://gmarwaha.com/jquery/jcarousellite/
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php & http://www.gnu.org/licenses/gpl.html
 * Version: 1.0.1
 * !!!!! modded by skresge for Advance Internet
 */
(function(jQuery) {
jQuery.fn.jCarouselLiteMod =  function (c) {
   c = jQuery.extend({
      current_i:0, count:0, abstracts:[], linkClass:'.abBrLink', nextClass:'.abBrNext', prevClass:'.abBrPrev',
      vertical: false, circular: true, visible: 3, start: 0, scroll: 1}, c || {}); 
   
	return this.each(function() {
		c.count = c.abstracts.length;
		var curr_i = c.current_i;
      var running = false, animCss=c.vertical?"top":"left", sizeCss=c.vertical?"height":"width";
      var div = jQuery(this), ul = jQuery("ul", div), tLi = jQuery("li", ul), tl = tLi.size(), v = c.visible;
      if(c.circular) {
			if(c.count>0) {
				ul.before(ul.clone(true)).after(ul.clone());
			} else {
				ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());
			}
			c.start += v;
      }
      var li = jQuery("li", div), tUl = jQuery("ul", div), itemLength = li.size(), curr = c.start;
      div.css("visibility", "visible");
      li.css({overflow: "hidden", float: c.vertical ? "none" : "left"});
		if(c.count>0) tUl.css({margin: "0", padding: "0", position: "relative", float: "left", "list-style-type": "none", "z-index": "1"});
      else ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
		div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
		var liSize = c.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
      var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
      var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
      li.css({width: li.width(), height: li.height()});
		if(c.count>0) tUl.css(sizeCss, divSize+"px").css(animCss, -(divSize));
		else ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
      div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images
      if(c.count>0) ul.parent("div, span").css(sizeCss, (divSize*3)+"px");
		if(c.prevClass)
         jQuery(c.prevClass).click(function() {
				if(c.count>0) setNew();
            return go(curr-c.scroll);
         });
      if(c.nextClass)
         jQuery(c.nextClass).click(function() {
				if(c.count>0) setNew();
            return go(curr+c.scroll);
         });
		if(c.count>0){
			var i = curr_i-v;
			if(i<0) i = i+c.count;
			jQuery(c.linkClass,div).each(function(m){  // !!!! must use linkClass with abstracts
				if(i>=c.count) i=0;if(i<0) i=c.count-i;
				if (!((m>=curr) && (m<curr+v))) {
					jQuery(this).attr("href", c.abstracts[i].link).children("img").attr("src", c.abstracts[i].thumbnail).siblings("span").html(c.abstracts[i].text);
				}
				i++;
			});
		}

		function setNew () {
			if (running || (!(curr==0) && !(curr==v*2))) return false;
			var x=0;
			if (curr==0) { //new ul before and kill last
				jQuery(tUl[2]).remove();
				jQuery(tUl[0]).before(jQuery(tUl[0]).clone(true));
				var i = curr_i-v;
				if(i<0) i = i+c.count;
			}
			if (curr==v*2) { //new ul after and kill first
				jQuery(tUl[0]).remove();
				x=2;
				jQuery(tUl[x]).after(jQuery(tUl[x]).clone(true));
				var i = curr_i+v;
				if(i>=c.count) i = i-c.count;
			}
			tUl = jQuery("ul", div);
			jQuery(c.linkClass,tUl[x]).each(function(n){
				if(i>=c.count) i=0;if(i<0) i=c.count-i;
				jQuery(this).attr("href", c.abstracts[i].link).children("img").attr("src", c.abstracts[i].thumbnail).siblings("span").html(c.abstracts[i].text);
				i++;
			});
			tUl.css('left','-'+(liSize*v)+'px');
			curr=c.start;
			return false;
		};

		function vis() { return li.slice(curr).slice(0,v); };

		function go(to) {
			if(!running) {
				if(c.beforeStart) c.beforeStart.call(this, vis());
				if(c.count>0) {
					var x = (to>curr)?curr_i+c.scroll:curr_i-c.scroll;
					curr_i = (x>=c.count)?x-c.count:(x<0)?c.count+x:x;
				}	
				if(c.circular) {            // If circular we are in first or last, then goto the other end
					if(to<=c.start-v-1) {           // If first, then goto last
						tUl.css(animCss, -((itemLength-(v*2))*liSize)+"px");
                  // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
						curr = to==c.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-c.scroll;
					} else if(to>=itemLength-v+1) { // If last, then goto first
						tUl.css(animCss, -( (v) * liSize ) + "px" );
						// If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
						curr = to==itemLength-v+1 ? v+1 : v+c.scroll;
					} else curr = to;
				} else {                    // If non-circular and to points to first or last, we just return.
					if(to<0 || to>itemLength-v) return false;
					else curr = to;
				}                           // If neither overrides it, the curr will still be "to" and we can proceed.
				running = true;
				tUl.animate(
					animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , c.speed, c.easing,
					function() {
						if(c.afterEnd) c.afterEnd.call(this, vis());
						running = false;
					}
				);
				if(!c.circular) { // Disable buttons when the carousel reaches the last/first, and enable when not
					jQuery(c.btnPrev + "," + c.btnNext).removeClass("disabled");
					jQuery( (curr-c.scroll<0 && c.btnPrev)
						||
						(curr+c.scroll > itemLength-v && c.btnNext)
						|| []
					).addClass("disabled");
				}
			}
			return false;
		};
	});
};  
   
function css(el, prop) { return parseInt(jQuery.css(el[0], prop)) || 0; };
function width(el) { return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight'); };
function height(el) { return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom'); };
})(jQuery);


/*
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2008 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Revision: $Id$
 * Version:  1.3.1
 *
 */
(function(jQuery) {

    jQuery.fn.lazyload = function(options) {
        var settings = {
            threshold    : 0,
            failurelimit : 0,
            event        : "scroll",
            effect       : "show",
            container    : window
        };
                
        if(options) {
            jQuery.extend(settings, options);
        }

        /* Fire one scroll event per scroll. Not one scroll event per image. */
        var elements = this;
        if ("scroll" == settings.event) {
            jQuery(settings.container).bind("scroll", function(event) {
                var counter = 0;
                elements.each(function() {
                    if (!jQuery.belowthefold(this, settings) &&
                        !jQuery.rightoffold(this, settings)) {
                            jQuery(this).trigger("appear");
                    } else {
                        if (counter++ > settings.failurelimit) {
                            return false;
                        }
                    }
                });
                /* Remove image from array so it is not looped next time. */
                var temp = jQuery.grep(elements, function(element) {
                    return !element.loaded;
                });
                elements = jQuery(temp);
            });
        }
        
        return this.each(function() {
            var self = this;
            /* TODO: use .data() instead of .attr() */
            jQuery(self).attr("original", jQuery(self).attr("src"));
            if ("scroll" != settings.event 
                         || jQuery.belowthefold(self, settings) 
                         || jQuery.rightoffold(self, settings)) {
                if (settings.placeholder) {
                    jQuery(self).attr("src", settings.placeholder);      
                } else {
                    jQuery(self).removeAttr("src");
                }
                self.loaded = false;
            } else {
                self.loaded = true;
            }
            
            /* When appear is triggered load original image. */
            jQuery(self).one("appear", function() {
                if (!this.loaded) {
                    jQuery("<img />")
                        .bind("load", function() {
                            jQuery(self)
                                .hide()
                                .attr("src", jQuery(self).attr("original"))
                                [settings.effect](settings.effectspeed);
                            self.loaded = true;
                        })
                        .attr("src", jQuery(self).attr("original"));
                };
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if ("scroll" != settings.event) {
                jQuery(self).bind(settings.event, function(event) {
                    if (!self.loaded) {
                        jQuery(self).trigger("appear");
                    }
                });
            }
        });

    };

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    jQuery.belowthefold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = jQuery(window).height() + jQuery(window).scrollTop();
        }
        else {
            var fold = jQuery(settings.container).offset().top + jQuery(settings.container).height();
        }
        return fold <= jQuery(element).offset().top - settings.threshold;
    };
    
    jQuery.rightoffold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = jQuery(window).width() + jQuery(window).scrollLeft();
        }
        else {
            var fold = jQuery(settings.container).offset().left + jQuery(settings.container).width();
        }
        return fold <= jQuery(element).offset().left - settings.threshold;
    };
    
    /* Custom selectors for your convenience.   */
    /* Use as $("img:below-the-fold").something() */

    jQuery.extend(jQuery.expr[':'], {
        "below-the-fold" : "jQuery.belowthefold(a, {threshold : 0, container: window})",
        "above-the-fold" : "!jQuery.belowthefold(a, {threshold : 0, container: window})",
        "right-of-fold"  : "jQuery.rightoffold(a, {threshold : 0, container: window})",
        "left-of-fold"   : "!jQuery.rightoffold(a, {threshold : 0, container: window})"
    });
    
})(jQuery);

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
(function(jQuery){
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
})(jQuery);
