var a,NextId=1,Custom="Custom",GoogleCheckout="GoogleCheckout",PayPal="PayPal",Email="Email",AustralianDollar=AUD="AUD",CanadianDollar=CAD="CAD",CzechKoruna=CZK="CZK",DanishKrone=DKK="DKK",Euro=EUR="EUR",HongKongDollar=HKD="HKD",HungarianForint=HUF="HUF",IsraeliNewSheqel=ILS="ILS",JapaneseYen=JPY="JPY",MexicanPeso=MXN="MXN",NorwegianKrone=NOK="NOK",NewZealandDollar=NZD="NZD",PolishZloty=PLN="PLN",PoundSterling=GBP="GBP",SingaporeDollar=SGD="SGD",SwedishKrona=SEK="SEK",SwissFranc=CHF="CHF",USDollar=
USD="USD";
function Cart(){var c=this;c.Version="2.0.1";c.Shelf=new Shelf;c.items={};c.isLoaded=false;c.pageIsReady=false;c.quantity=0;c.total=0;c.taxRate=0;c.taxCost=0;c.shippingFlatRate=0;c.shippingTotalRate=0;c.shippingQuantityRate=0;c.shippingRate=0;c.shippingCost=0;c.currency=USD;c.checkoutTo=PayPal;c.email="";c.merchantId="";c.cartHeaders=["Name","Price","Quantity","Total"];c.add=function(){var b=this;if(!b.pageIsReady){b.initializeView();b.update()}if(!b.isLoaded){b.load();b.update()}var d=new CartItem;
if(!arguments||arguments.length===0)error("No values passed for item.");else{var e=arguments;if(arguments[0]&&typeof arguments[0]!="string"&&typeof arguments[0]!="number")e=arguments[0];d.parseValuesFromArray(e);d.checkQuantityAndPrice();if(b.hasItem(d)){e=b.hasItem(d);b.items[e].quantity=parseInt(b.items[e].quantity,10)+parseInt(d.quantity,10)}else b.items[d.id]=d;b.update()}};c.remove=function(b){var d={};for(var e in this.items)if(e!=b)d[e]=this.items[e];this.items=d};c.empty=function(){simpleCart.items=
{};simpleCart.update()};c.find=function(b){if(!b)return null;var d=[];for(var e in c.items){var f=c.items[e],g=true;for(var h in b)if(!f[h]||f[h]!=b[h])g=false;g&&d.push(c.next)}return d.length==0?null:d};c.checkout=function(){if(simpleCart.quantity===0)error("Cart is empty");else switch(simpleCart.checkoutTo){case PayPal:simpleCart.paypalCheckout();break;case GoogleCheckout:simpleCart.googleCheckout();break;case Email:simpleCart.emailCheckout();break;default:simpleCart.customCheckout();break}};c.paypalCheckout=
function(){var b=this,d="https://www.paypal.com/cgi-bin/webscr?cmd=_cart&upload=1&business="+b.email+"&currency_code="+b.currency,e=1,f="";if(b.taxRate)d=d+"&tax_cart="+b.currencyStringForPaypalCheckout(b.taxCost);for(var g in b.items){var h=b.items[g],i="";for(var j in h)if(typeof h[j]!="function"&&j!="id"&&j!="price"&&j!="quantity"&&j!="name"&&j!="shipping")i=i+", "+j+"="+h[j];i=i.substring(2);f=f+"&item_name_"+e+"="+h.name+"&item_number_"+e+"="+e+"&quantity_"+e+"="+h.quantity+"&amount_"+e+"="+
b.currencyStringForPaypalCheckout(h.price)+"&on0_"+e+"=Options&os0_"+e+"="+i;e++}if(b.shipping()!=0)f=f+"&item_name_"+e+"=Shipping&item_number_"+e+"="+e+"&quantity_"+e+"=1&amount_"+e+"="+b.currencyStringForPaypalCheckout(b.shippingCost);d+=f;window.open(d,"paypal","scrollbars,location,resizable,status")};c.googleCheckout=function(){var b=this;if(b.currency!=USD&&b.currency!=GBP)error("Google Checkout only allows the USD and GBP for currency.");else if(b.merchantId===""||b.merchantId===null||!b.merchantId)error("No merchant Id for google checkout supplied.");
else{var d=document.createElement("form"),e=1;d.style.display="none";d.method="POST";d.action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/"+b.merchantId;d.acceptCharset="utf-8";for(var f in b.items){var g=b.items[f];d.appendChild(b.createHiddenElement("item_name_"+e,g.name));d.appendChild(b.createHiddenElement("item_quantity_"+e,g.quantity));d.appendChild(b.createHiddenElement("item_price_"+e,g.price));d.appendChild(b.createHiddenElement("item_currency_"+e,b.currency));d.appendChild(b.createHiddenElement("item_tax_rate_"+
e,b.taxRate));d.appendChild(b.createHiddenElement("_charset_",""));var h="";for(var i in g)if(typeof g[i]!="function"&&i!="id"&&i!="quantity"&&i!="price")h=h+", "+i+": "+g[i];h=h.substring(1);d.appendChild(b.createHiddenElement("item_description_"+e,h));e++}document.body.appendChild(d);d.submit();document.body.removeChild(d)}};c.emailCheckout=function(){};c.customCheckout=function(){};c.load=function(){var b=this;b.items={};b.total=0;b.quantity=0;if(readCookie("simpleCart"))for(var d=unescape(readCookie("simpleCart")).split("++"),
e=0,f=d.length;e<f;e++){var g=d[e].split("||"),h=new CartItem;if(h.parseValuesFromArray(g)){h.checkQuantityAndPrice();b.items[h.id]=h}}b.isLoaded=true};c.save=function(){var b="";for(var d in this.items)b=b+"++"+this.items[d].print();createCookie("simpleCart",b.substring(2),30)};c.initializeView=function(){var b=this;b.totalOutlets=getElementsByClassName("simpleCart_total");b.quantityOutlets=getElementsByClassName("simpleCart_quantity");b.cartDivs=getElementsByClassName("simpleCart_items");b.taxCostOutlets=
getElementsByClassName("simpleCart_taxCost");b.taxRateOutlets=getElementsByClassName("simpleCart_taxRate");b.shippingCostOutlets=getElementsByClassName("simpleCart_shippingCost");b.finalTotalOutlets=getElementsByClassName("simpleCart_finalTotal");b.addEventToArray(getElementsByClassName("simpleCart_checkout"),simpleCart.checkout,"click");b.addEventToArray(getElementsByClassName("simpleCart_empty"),simpleCart.empty,"click");b.Shelf.readPage();b.pageIsReady=true};c.updateView=function(){c.updateViewTotals();
c.cartDivs&&c.cartDivs.length>0&&c.updateCartView()};c.updateViewTotals=function(){for(var b=[["quantity","none"],["total","currency"],["shippingCost","currency"],["taxCost","currency"],["taxRate","percentage"],["finalTotal","currency"]],d=0,e=b.length;d<e;d++){var f=b[d][0]+"Outlets",g;for(var h in c[f]){switch(b[d][1]){case "none":g=""+c[b[d][0]];break;case "currency":g=c.valueToCurrencyString(c[b[d][0]]);break;case "percentage":g=c.valueToPercentageString(c[b[d][0]]);break;default:g=""+c[b[d][0]];
break}c[f][h].innerHTML=""+g}}};c.updateCartView=function(){var b=[],d,e,f,g,h,i,j,k,l;e=document.createElement("div");for(h in c.cartHeaders){i=document.createElement("div");f=c.cartHeaders[h].split("_");i.innerHTML=f[0];i.className="item"+f[0];d=1;for(xlen=f.length;d<xlen;d++)if(f[d].toLowerCase()=="noheader")i.style.display="none";e.appendChild(i)}e.className="cartHeaders";b[0]=e;d=1;for(g in c.items){e=document.createElement("div");f=c.items[g];for(h in c.cartHeaders){i=document.createElement("div");
j=c.cartHeaders[h].split("_");switch(j[0].toLowerCase()){case "total":k=c.valueToCurrencyString(parseFloat(f.price)*parseInt(f.quantity,10));break;case "increment":k=c.valueToLink("+","javascript:;","onclick=\"simpleCart.items['"+f.id+"'].increment();\"");break;case "decrement":k=c.valueToLink("-","javascript:;","onclick=\"simpleCart.items['"+f.id+"'].decrement();\"");break;case "remove":k=c.valueToLink("Remove","javascript:; ","onclick=\"simpleCart.items['"+f.id+"'].remove(); setTimeout('scItemsCheck()', 300);\"");break;case "price":k=
c.valueToCurrencyString(f[j[0].toLowerCase()]?f[j[0].toLowerCase()]:" ");break;default:k=f[j[0].toLowerCase()]?f[j[0].toLowerCase()]:" ";break}for(var m=1,n=j.length;m<n;m++){l=j[m].toLowerCase();switch(l){case "image":case "img":k=c.valueToImageString(k);break;case "input":k=c.valueToTextInput(k,"onchange=\"simpleCart.items['"+f.id+"'].set('"+k+"' , this.value);\"");break;case "div":case "span":case "h1":case "h2":case "h3":case "h4":case "p":k=c.valueToElement(l,k,"");break;case "noheader":break;
default:error("unkown header option: "+l);break}}i.innerHTML=k;i.className="item"+j[0];e.appendChild(i)}e.className="itemContainer";b[d]=e;d++}for(g in c.cartDivs){for(d=c.cartDivs[g];d.childNodes[0];)d.removeChild(d.childNodes[0]);e=0;for(h=b.length;e<h;e++)d.appendChild(b[e])}};c.addEventToArray=function(b,d,e){for(var f in b){var g=b[f];if(g.addEventListener)g.addEventListener(e,d,false);else g.attachEvent&&g.attachEvent("on"+e,d)}};c.createHiddenElement=function(b,d){var e=document.createElement("input");
e.type="hidden";e.name=b;e.value=d;return e};c.currencySymbol=function(){switch(c.currency){case JPY:return"&yen;";case EUR:return"&euro;";case GBP:return"&pound;";case USD:case CAD:case AUD:case NZD:case HKD:case SGD:return"&#36;";default:return""}};c.currencyStringForPaypalCheckout=function(b){return c.currencySymbol()=="&#36;"?"$"+parseFloat(b).toFixed(2):""+parseFloat(b).toFixed(2)};c.valueToCurrencyString=function(b){return parseFloat(b).toCurrency(c.currencySymbol())};c.valueToPercentageString=
function(b){return parseFloat(100*b)+"%"};c.valueToImageString=function(b){return b.match(/<\s*img.*src\=/)?b:'<img src="'+b+'" />'};c.valueToTextInput=function(b,d){return'<input type="text" value="'+b+'" '+d+" />"};c.valueToLink=function(b,d,e){return'<a href="'+d+'" '+e+" >"+b+"</a>"};c.valueToElement=function(b,d,e){return"<"+b+" "+e+" > "+d+"</"+b+">"};c.hasItem=function(b){for(var d in c.items){var e=c.items[d],f=true;for(var g in b)if(typeof b[g]!="function"&&g!="quantity"&&g!="id")if(b[g]!=
e[g])f=false;if(f)return d}return false};c.update=function(){simpleCart.isLoaded||simpleCart.load();simpleCart.pageIsReady||simpleCart.initializeView();c.updateTotals();c.updateView();c.save()};c.updateTotals=function(){c.total=0;c.quantity=0;for(var b in c.items){var d=c.items[b];if(d.quantity<1)d.remove();else if(d.quantity!==null&&d.quantity!="undefined")c.quantity=parseInt(c.quantity,10)+parseInt(d.quantity,10);if(d.price)c.total=parseFloat(c.total)+parseInt(d.quantity,10)*parseFloat(d.price)}c.shippingCost=
c.shipping();c.taxCost=parseFloat(c.total)*c.taxRate;c.finalTotal=c.shippingCost+c.taxCost+c.total};c.shipping=function(){if(parseInt(c.quantity,10)===0)return 0;var b=parseFloat(c.shippingFlatRate)+parseFloat(c.shippingTotalRate)*parseFloat(c.total)+parseFloat(c.shippingQuantityRate)*parseInt(c.quantity,10),d,e;for(e in c.items){d=c.items[e];if(d.shipping)b+=typeof d.shipping=="function"?parseFloat(d.shipping()):parseFloat(d.shipping)}return b};c.initialize=function(){simpleCart.initializeView();
simpleCart.load();simpleCart.update()}}function CartItem(){this.id="c"+NextId++}a=CartItem.prototype;
a.set=function(c,b){c=c.toLowerCase();if(typeof this[c]!="function"&&c!="id"){if(c=="quantity"){b=b.replace(/[^(\d|\.)]*/gi,"");b=b.replace(/,*/gi,"");b=parseInt(b,10)}else if(c=="price"){b=b.replace(/[^(\d|\.)]*/gi,"");b=b.replace(/,*/gi,"");b=parseFloat(b)}if(typeof b=="number"&&isNaN(b))error("Improperly formatted input.");else{this[c]=b;this.checkQuantityAndPrice()}}else error("Cannot change "+c+", this is a reserved field.");simpleCart.update()};
a.increment=function(){this.quantity=parseInt(this.quantity,10)+1;simpleCart.update()};a.decrement=function(){if(parseInt(this.quantity,10)<2)this.remove();else{this.quantity=parseInt(this.quantity,10)-1;simpleCart.update()}};a.print=function(){var c="";for(var b in this)if(typeof this[b]!="function")c+=escape(b)+"="+escape(this[b])+"||";return c.substring(0,c.length-2)};
a.checkQuantityAndPrice=function(){if(!this.price||this.quantity==null||this.quantity=="undefined"){this.quantity=1;error("No quantity for item.")}else{this.quantity=(""+this.quantity).replace(/,*/gi,"");this.quantity=parseInt((""+this.quantity).replace(/[^(\d|\.)]*/gi,""),10);if(isNaN(this.quantity)){error("Quantity is not a number.");this.quantity=1}}if(!this.price||this.price==null||this.price=="undefined"){this.price=0;error("No price for item or price not properly formatted.")}else{this.price=
(""+this.price).replace(/,*/gi,"");this.price=parseFloat((""+this.price).replace(/[^(\d|\.)]*/gi,""));if(isNaN(this.price)){error("Price is not a number.");this.price=0}}};a.parseValuesFromArray=function(c){if(c&&c.length&&c.length>0){for(var b=0,d=c.length;b<d;b++){c[b].replace(/||/,"| |");c[b].replace(/\+\+/,"+ +");var e=c[b].split("=");if(e.length>1){if(e.length>2)for(var f=2,g=e.length;f<g;f++)e[1]=e[1]+"="+e[f];this[unescape(e[0]).toLowerCase()]=unescape(e[1])}}return true}else return false};
a.remove=function(){simpleCart.remove(this.id);simpleCart.update()};function Shelf(){this.items={}}Shelf.prototype.readPage=function(){this.items={};var c=getElementsByClassName("store-item");for(var b in c){var d=new ShelfItem;this.checkChildren(c[b],d);this.items[d.id]=d}};
Shelf.prototype.checkChildren=function(c,b){for(var d=0;c.childNodes[d];d++){var e=c.childNodes[d];if(e.className&&e.className.match(/item_[^ ]+/)){var f=/item_[^ ]+/.exec(e.className)[0].split("_");if(f[1]=="add"||f[1]=="Add"){f=[];f.push(e);var g=simpleCart.Shelf.addToCart(b.id);simpleCart.addEventToArray(f,g,"click");e.id=b.id}else b[f[1]]=e}e.childNodes[0]&&this.checkChildren(e,b)}};Shelf.prototype.empty=function(){this.items={}};
Shelf.prototype.addToCart=function(c){return function(){simpleCart.Shelf.items[c]?simpleCart.Shelf.items[c].addToCart():error("Shelf item with id of "+c+" does not exist.")}};function ShelfItem(){this.id="s"+NextId++}ShelfItem.prototype.remove=function(){simpleCart.Shelf.items[this.id]=null};
ShelfItem.prototype.addToCart=function(){var c=[],b;for(var d in this)if(typeof this[d]!="function"&&d!="id"){b="";switch(d){case "price":if(this[d].value)b=this[d].value;else if(this[d].innerHTML)b=this[d].innerHTML;b=b.replace(/[^(\d|\.)]*/gi,"");b=b.replace(/,*/,"");break;case "image":b=this[d].src;break;default:b=this[d].value?this[d].value:this[d].innerHTML?this[d].innerHTML:this[d].src?this[d].src:this[d];break}c.push(d+"="+b)}simpleCart.add(c)};
function createCookie(c,b,d){if(d){var e=new Date;e.setTime(e.getTime()+d*24*60*60*1E3);d="; expires="+e.toGMTString()}else d="";document.cookie=c+"="+b+d+"; path=/"}function readCookie(c){c=c+"=";for(var b=document.cookie.split(";"),d=0;d<b.length;d++){for(var e=b[d];e.charAt(0)==" ";)e=e.substring(1,e.length);if(e.indexOf(c)===0)return e.substring(c.length,e.length)}return null}function eraseCookie(c){createCookie(c,"",-1); createCookie('coupon-applied', "", -1)}
var getElementsByClassName=function(c,b,d){getElementsByClassName=document.getElementsByClassName?function(e,f,g){g=g||document;e=g.getElementsByClassName(e);f=f?new RegExp("\\b"+f+"\\b","i"):null;g=[];for(var h,i=0,j=e.length;i<j;i+=1){h=e[i];if(!f||f.test(h.nodeName))g.push(h)}return g}:document.evaluate?function(e,f,g){f=f||"*";g=g||document;var h=e.split(" "),i="",j=document.documentElement.namespaceURI==="http://www.w3.org/1999/xhtml"?"http://www.w3.org/1999/xhtml":null;e=[];for(var k,l=0,m=
h.length;l<m;l+=1)i+="[contains(concat(' ', @class, ' '), ' "+h[l]+" ')]";try{k=document.evaluate(".//"+f+i,g,j,0,null)}catch(n){k=document.evaluate(".//"+f+i,g,null,0,null)}for(;f=k.iterateNext();)e.push(f);return e}:function(e,f,g){f=f||"*";g=g||document;var h=e.split(" ");e=[];f=f==="*"&&g.all?g.all:g.getElementsByTagName(f);g=[];var i;i=0;for(var j=h.length;i<j;i+=1)e.push(new RegExp("(^|\\s)"+h[i]+"(\\s|$)"));j=0;for(var k=f.length;j<k;j+=1){h=f[j];i=false;for(var l=0,m=e.length;l<m;l+=1){i=
e[l].test(h.className);if(!i)break}i&&g.push(h)}return g};return getElementsByClassName(c,b,d)};String.prototype.reverse=function(){return this.split("").reverse().join("")};Number.prototype.withCommas=function(){for(var c=6,b=parseFloat(this).toFixed(2).toString().reverse();c<b.length;){b=b.substring(0,c)+","+b.substring(c);c+=4}return b.reverse()};Number.prototype.toCurrency=function(c){return(c?c:"$")+this.withCommas()};function error(c){try{console.log(c)}catch(b){}}var simpleCart=new Cart;
if(typeof jQuery!=="undefined")$(document).ready(function(){simpleCart.initialize()});else if(typeof Prototype!=="undefined")Event.observe(window,"load",function(){simpleCart.initialize()});else window.onload=simpleCart.initialize;

/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/*
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.88 (08-JUN-2010)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.2.6 or later
 */
(function($){var ver="2.88";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,(!opts2.rev&&!opts.backwards));},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,(!opts.rev&&!opts.backwards));}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>=0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery);
/*
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version:  2.72
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0};};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);


(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

$.fn.cycle.transitions.scrollHorzLeft = function($cont, $slides, opts) {
        $cont.css('overflow','hidden');
        opts.before.push(function(curr, next, opts, fwd) {
                $.fn.cycle.commonReset(curr,next,opts);
                opts.cssBefore.left = fwd ? (next.cycleH-1) : (1-next.cycleH);
                opts.animOut.left = fwd ? -curr.cycleH : curr.cycleH;
        });
        opts.cssFirst = { left: 0 };
        opts.cssBefore= { top: 0 };
        opts.animIn   = { left: 0 };
        opts.animOut  = { top: 0 };
};

/**
 * 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
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
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;
    }
};



$(function(){

        $('.showme').hide();
        
        $('#subscription-links p').hide();
        
        $('#news-navigation').show();
        
        $('#news-cycle').cycle({
            fx: 'scrollHorzLeft',
            timeout: 0,
            next: '#next-news',
            prev: '#prev-news'
        });
        
        $('#home-slideshow').cycle({
            timeout: 5000,
            speed: 1200
        });
        
        $('.hi-thumb img').each(function(){
            var imgHeight = $(this).height();
            var boxHeight = $(this).parent().parent().height();

            if ((boxHeight - imgHeight) > 10 ){
                $(this).css({marginTop: 10});
            }
        });
        
        $('#highlights').cycle({
            timeout: 3000,
            pager: '#hi-nav',
            speed: 750
        });
        
/*
        $('.page-item-225').find('ul').css({left: '-45px'});
        $('.page-item-377').find('a').css({paddingTop: '5px'});
*/
                
        
        $('#topnav li').hoverIntent(
            function () {  
            //show its submenu  
                $('ul', this).slideDown(200);
                $('ul.sub-menu ul.sub-menu', this).slideUp(100);
                
                },   
            function () {  
                //hide its submenu  
                $('ul', this).slideUp(100); 
            });

            
          $('#topnav li ul').hoverIntent(
            function () {  
            //show its submenu  
                $('ul', this).animate({opacity: 1}, 200);
            },   
            function () {  
                //hide its submenu  
                $('ul', this).animate({opacity: 0}, 100);           
            });
            
        i = 0;
        
        $('h2.view-toggler').wrapInner('<span>').css({cursor: 'pointer'});
                
        $('.view-toggler span').click(function(){
        
            $(this).parent().next().next("div.showme").siblings("div.showme").slideUp(700);
        
            $(this).parent().next().next("div.showme").slideToggle(600, function(){
                setTimeout("$.scrollTo('span.open', 800)", 100);
            });
            
            $(this).toggleClass('open');
            $('.view-toggler span').not(this).removeClass('open');
                        
        });
        
        $('a.back-to-top').click(function(){
            
            var target = $(this).parent().prev().prev();
            
            $.scrollTo(target, 700);
            
            return false;
            
        });
            
        $('.text-alerts').click(function(){
            $('#hide-me, #subscription-links p').slideToggle(700);
            
            return false;
        });         
        
                
        $('img.newsletter').each(function(){
            var link = $(this).parent().find('a').attr('href');
            $(this).wrap('<a href="'+link+'">');
        });
        
        $('#affiliates li:first').attr('style','-moz-border-radius: 0 10px 0 0; -webkit-border-radius:0 10px 0 0;');
        
        $('#affiliates').prepend('<div id="toggle-affiliates">&hArr;</div>');
        


                        
        $('#toggle-affiliates').toggle(
            function(){
                $('#affiliates').animate({left: -135}, 500);
                $('#affiliates-container').animate({width: 26}, 500);

                },
            function(){
                $('#affiliates').animate({left: 0}, 500);
                $('#affiliates-container').animate({width: 161}, 500);

        }).css({cursor: 'pointer'});
        
        
        $('#affiliates li:last').attr('style','-moz-border-radius: 0 0 10px 0; -webkit-border-radius:0 0 10px 0;');
        
        var menuItems = $('#topnav li').not('#topnav ul.sub-menu li');
        
        var totalWidth = 0;
        
        $(menuItems).each(function(){
        
            totalWidth += $(this).width();
        
        });
        
        
        var menuWidth = $('#topnav').width();
        
        var paddingWidth = menuWidth - totalWidth;
        
        var padding = (paddingWidth/$(menuItems).length)/2;
        
        $(menuItems).css({padding: '0 '+padding+'px'});


        

            
});
        $(document).ready(function(){
            
            $('img.caption').each(function(){
                
                    var caption = $(this).attr('title');
                    var width = $(this).width();
                    var width = width + 10;
                    
                    if (width <= 10){
                        width = 400;
                    }
                    
                    $(this).wrap('<div class="wp-caption aligncenter" style="width:'+width+'px;"></div>').after('<p class="wp-caption-text">'+caption+'</p>');
                });
                

        
        });


