
(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);;(function($){$.fn.superfish=function(op){var sf=$.fn.superfish,c=sf.c,$arrow=$(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),over=function(){var $$=$(this),menu=getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl();},out=function(){var $$=$(this),menu=getMenu($$),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();if(o.$path.length&&$$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}},o.delay);},getMenu=function($menu){var menu=$menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu;},addArrow=function($a){$a.addClass(c.anchorClass).append($arrow.clone());};return this.each(function(){var s=this.serial=sf.o.length;var o=$.extend({},sf.defaults,op);o.$path=$('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);});sf.o[s]=sf.op=o;$('li:has(ul)',this)[($.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow($('>a:first-child',this));}).not('.'+c.bcClass).hideSuperfishUl();var $a=$('a',this);$a.each(function(i){var $li=$a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});});o.onInit.call(this);}).each(function(){var menuClasses=[c.menuClass];if(sf.op.dropShadows&&!($.browser.msie&&$.browser.version<7))menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '));});};var sf=$.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if($.browser.msie&&$.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined)
this.toggleClass(sf.c.shadowClass+'-off');};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:800,animation:{opacity:'show'},speed:'normal',autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};$.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.$path:'';o.retainPath=false;var $ul=$(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call($ul);return this;},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',$ul=this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,function(){sf.IE7fix.call($ul);o.onShow.call($ul);});return this;}});})(jQuery);(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);var tb_pathToImage="/images/loadingAnimation.gif";eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}))
function JT_init(){$("a.jtip").hover(function(){JT_show(this.href,this.id,this.name)},function(){JT_remove()}).click(function(){return false});}
function JT_show(url,linkId,title){if(title==false)title="&nbsp;";var de=document.documentElement;var windowWidth=self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;var windowHeight=self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;var elementDimension={width:0,height:0};var childElement=findChild(document.getElementById(linkId));if(childElement!=undefined){elementDimension.width=childElement.getAttribute('width');elementDimension.height=childElement.getAttribute('height');}
var tipPosition={left:0,top:0};var arrowPosition={left:0,top:0};var elementPosition=findPosition(childElement);var scrollOffset=getScrollXY();var queryString=url.replace(/^[^\?]+\??/,'');var params=parseQuery(queryString);if(params['width']==undefined){params['width']=250};if(params['height']==undefined){params['height']=250};if(params['link']!=undefined){$('#'+linkId).bind('click',function(){window.location=params['link']});$('#'+linkId).css('cursor','pointer');}
var arrowOffset={x:11,y:23};var widthRight=windowWidth-elementPosition.left-params['width'];var heightAbove=elementPosition.top-scrollOffset.y;var heightBelow=windowHeight+scrollOffset.y-elementPosition.top;var arrowRight=false;$("body").append("<div id='jt'><div id='jtTitle'>"+title+"</div><div id='jtCopy'><div class='jtLoader'></div></div></div>");$("body").append("<img id='jtArrowRight' src='/images/arrow_right.gif' width='11' height='23'></div>");$("body").append("<img id='jtArrowLeft' src='/images/arrow_left.gif' width='11' height='23'></div>");$('#jtArrowRight').hide();$('#jtArrowLeft').hide();if(widthRight>((params['width']*1)+50)){tipPosition.left=elementPosition.left+(elementDimension.width*1)+arrowOffset.x;arrowPosition.left=elementPosition.left+(elementDimension.width*1);}else{arrowRight=true;tipPosition.left=elementPosition.left-arrowOffset.x-(params['width']*1);arrowPosition.left=elementPosition.left-arrowOffset.x;}
if(heightAbove<0){tipPosition.top=elementPosition.top+(elementDimension.height*1)-arrowOffset.y;arrowPosition.top=tipPosition.top;}else if(heightBelow>((params['height']*1)+20)){tipPosition.top=elementPosition.top;arrowPosition.top=elementPosition.top;}else{tipPosition.top=elementPosition.top-(params['height']*1)+arrowOffset.y;arrowPosition.top=elementPosition.top;}
if(arrowRight==true){$('#jtArrowRight').css({left:arrowPosition.left+"px",top:arrowPosition.top+"px"});$('#jtArrowRight').show();}else{$('#jtArrowLeft').css({left:arrowPosition.left+"px",top:arrowPosition.top+"px"});$('#jtArrowLeft').show();}
$('#jt').css({left:tipPosition.left+"px",top:tipPosition.top+"px",width:(params['width']*1)+"px",height:(params['height']*1)+"px"});$('#jt').show();$('#jtCopy').load(url);return false;}
function JT_remove(){$('#jt').remove();$('#jtArrowLeft').remove();$('#jtArrowRight').remove();}
function getScrollXY(){var scrollOffset={x:0,y:0};if(typeof(window.pageYOffset)=='number'){scrollOffset.y=window.pageYOffset;scrollOffset.x=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrollOffset.y=document.body.scrollTop;scrollOffset.x=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrollOffset.y=document.documentElement.scrollTop;scrollOffset.x=document.documentElement.scrollLeft;}
return scrollOffset;}
function findChild(obj){var i,isnode;for(i=0;i<obj.childNodes.length;i++){var child=obj.childNodes[i];if(child.nodeType==1&&/img/i.test(child.nodeName)){isnode=i;break;}}
if(isnode==undefined)
return undefined;return obj.childNodes[isnode];}
function findImageDimensions(obj){var i,isnode;for(i=0;i<obj.childNodes.length;i++){var child=obj.childNodes[i];if(child.nodeType==1&&/img/i.test(child.nodeName)){isnode=i;break;}}
if(isnode==undefined)
return undefined;var dimensions={width:0,height:0};dimensions.width=obj.childNodes[isnode].getAttribute('width');dimensions.height=obj.childNodes[isnode].getAttribute('height');return dimensions;}
function findPosition(obj){var position={top:0,left:0};if(obj.offsetParent){position.left=obj.offsetLeft
position.top=obj.offsetTop
while(obj=obj.offsetParent){position.left+=obj.offsetLeft
position.top+=obj.offsetTop}}
return position;}
function parseQuery(query){var Params=new Object();if(!query)return Params;var Pairs=query.split(/[;&]/);for(var i=0;i<Pairs.length;i++){var KeyVal=Pairs[i].split('=');if(!KeyVal||KeyVal.length!=2)continue;var key=unescape(KeyVal[0]);var val=unescape(KeyVal[1]);val=val.replace(/\+/g,' ');Params[key]=val;}
return Params;}
function switchSiteMode(mode){$.cookie('com.picassomio.web.SiteMode.MODE',mode,{path:'/',expires:90});window.location="/";}
function switchLocale(language){$.cookie('org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE',language,{path:'/',expires:90});window.location.reload(true);}
function switchCurrency(currency){$.cookie('com.picassomio.web.spring.resolvers.CookieCurrencyResolver.CURRENCY',currency,{path:'/',expires:90});window.location.reload(true);}
function switchUom(uom){$.cookie('com.picassomio.web.spring.resolvers.CookieUomResolver.UOM',uom,{path:'/',expires:90});window.location.reload(true);}
$(document).ready(function(){$("a.switch-mode-open").click(function(){switchSiteMode('open');});$("a.switch-mode-curated").click(function(){switchSiteMode('curated');});$("a.switch-locale-en").click(function(){switchLocale('en');});$("a.switch-locale-es").click(function(){switchLocale('es');});$("a.switch-currency-jpy").click(function(){switchCurrency('JPY');});$("a.switch-currency-gbp").click(function(){switchCurrency('GBP');});$("a.switch-currency-usd").click(function(){switchCurrency('USD');});$("a.switch-currency-eur").click(function(){switchCurrency('EUR');});$("select#result-size").bind("change",function(){$("select#result-size").parents("form").trigger("submit");return false;});$("select#sort-by").bind("change",function(){$("select#sort-by").parents("form").trigger("submit");return false;});$('ul.sf-menu').superfish({opacity:false,animation:{opacity:'show',height:'show'},speed:'fast',autoArrows:false});$('#sitemap a').each(function(){var $this=$(this);$this.prepend('&#187;&nbsp;');});});jQuery.each(["id","title","name","href","src","rel"],function(i,n){jQuery.fn[n]=function(h){return h==undefined?this.length?this[0][n]:null:this.attr(n,h);};});jQuery.each("top,left,position,float,overflow,color,background".split(","),function(i,n){jQuery.fn[n]=function(h){return h==undefined?(this.length?jQuery.css(this[0],n):null):this.css(n,h);};});var e=("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select,"+"submit,keydown,keypress,keyup,error").split(",");for(var i=0;i<e.length;i++)new function(){var o=e[i];jQuery.fn["un"+o]=function(f){return this.unbind(o,f);};jQuery.fn["one"+o]=function(f){var element=jQuery(this);var handler=function(){element.unbind(o,handler);element=null;return f.apply(this,arguments);};return this.bind(o,handler);};};jQuery.fn.ancestors=jQuery.fn.parents;jQuery.expr[":"]["nth-child"]="jQuery.nth(a.parentNode.firstChild,parseInt(m[3])+1,'nextSibling')==a";jQuery.fn._filter=jQuery.fn.filter;jQuery.fn.filter=function(arr){return this._filter(arr.constructor==Array?arr.join(","):arr);};if(!jQuery.expr[':']['input'])
jQuery.extend(jQuery.expr[':'],{input:"a.nodeName.toLowerCase().match(/input|select|textarea|button/)"});jQuery.fn.ajaxSubmit=function(options){options=jQuery.extend({target:null,url:this.attr('action')||'',method:this.attr('method')||'GET',before:null,after:null,dataType:null,semantic:false},options||{});options.success=options.success||options.after;var a=this.formToArray(options.semantic);if(options.before&&options.before(a,this)===false)return;var q=jQuery.param(a);var get=(options.method&&options.method.toUpperCase()=='GET');if(get)
options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;if(!options.dataType&&options.target)
jQuery(options.target).load(options.url,get?null:a,options.success);else{options.type=options.method;options.data=get?null:q;jQuery.ajax(options);}
return this;};jQuery.fn.ajaxForm=function(options){return this.each(function(){jQuery("input:submit,input:image",this).click(function(ev){this.form.clk=this;if(ev.offsetX!=undefined){this.form.clk_x=ev.offsetX;this.form.clk_y=ev.offsetY;}else if(typeof jQuery.fn.offset=='function'){var offset=$(this).offset();this.form.clk_x=ev.pageX-offset.left;this.form.clk_y=ev.pageY-offset.top;}else{this.form.clk_x=ev.pageX-this.offsetLeft;this.form.clk_y=ev.pageY-this.offsetTop;}})}).submit(function(e){jQuery(this).ajaxSubmit(options);return false;});};jQuery.fn.formToArray=function(semantic){var a=[];var q=semantic?':input':'input,textarea,select,button';jQuery(q,this).each(function(){var n=this.name;var t=this.type;var tag=this.tagName.toLowerCase();if(!n||this.disabled||t=='reset'||(t=='checkbox'||t=='radio')&&!this.checked||(t=='submit'||t=='image'||t=='button')&&this.form&&this.form.clk!=this||tag=='select'&&this.selectedIndex==-1)
return;if(t=='image'&&this.form.clk_x!=undefined)
return a.push({name:n+'_x',value:this.form.clk_x},{name:n+'_y',value:this.form.clk_y});if(tag=='select'){var val=jQuery.fieldValue(this,false);if(t=='select-multiple'){for(var i=0;i<val.length;i++)
a.push({name:n,value:val[i]});}
else
a.push({name:n,value:val});}
else
a.push({name:n,value:this.value});});return a;};jQuery.fn.formSerialize=function(semantic){return jQuery.param(this.formToArray(semantic));};jQuery.fn.fieldValue=function(successful){var cbVal=[],cbName=null;for(var i=0;i<this.length;i++){var el=this[i];if(el.type=='checkbox'){if(!cbName)cbName=el.name||'unnamed';if(cbName!=el.name)
return cbVal;var val=jQuery.fieldValue(el,successful);if(val!==null&&typeof val!='undefined')
cbVal.push(val);}
else{var val=jQuery.fieldValue(el,successful);if(val!==null&&typeof val!='undefined')
return val;}}
return cbVal;};jQuery.fieldValue=function(el,successful){var n=el.name;var t=el.type;var tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image'||t=='button')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var a=[];for(var i=0;i<el.options.length;i++){var op=el.options[i];if(op.selected){var v=jQuery.browser.msie&&!(op.attributes['value'].specified)?op.text:op.value;if(t=='select-one')
return v;a.push(v);}}
return a;}
return el.value;};(function($){var debug=false;var buildRating=function($obj,options){if(debug)console.log("Building rating...");var $obj=buildInterface($obj),averageIndex=$obj.averageRating[0],averagePercent=$obj.averageRating[1],$stars=$($obj.children('.rating-stars').children('.star')),$cancel=$($obj.children('.rating-stars').children('.cancel'));$obj.end();if(debug)console.log("Cancel: "+$cancel.id);if(debug)console.log("Setting event handlers...");$stars.mouseover(function(){event.drain();event.fill(this);$('#rating-text-'+$obj.nid).html('');}).mouseout(function(){event.drain();event.reset();$('#rating-text-'+$obj.nid).html('');;}).focus(function(){event.drain();event.fill(this);$('#rating-text-'+$obj.nid).html('');}).blur(function(){event.drain();event.reset();$('#rating-text-'+$obj.nid).html('');;});$cancel.mouseover(function(){event.drain();$(this).addClass('on')}).mouseout(function(){event.reset();$(this).removeClass('on')}).focus(function(){event.drain();$(this).addClass('on')}).blur(function(){event.reset();$(this).removeClass('on')});$cancel.click(function(){if(debug)console.log("Handling cancel click...");if(!options.authorized){window.location=options.url
return false;}
event.drain();averageIndex=0;averagePercent=0;var index=$('#rating-options-'+$obj.nid).rating_option($(this).children('a')[0].href.split('#')[1]);$('#rating-options-'+$obj.nid).get(0).selectedIndex=index;rating_submit_rating($obj.nid,debug);return false;});$stars.click(function(){if(debug)console.log("Handling star click...");if(!options.authorized){window.location=options.url
return false;}
averageIndex=$stars.index(this)+1;averagePercent=0;var index=$('#rating-options-'+$obj.nid).rating_option($(this).children('a')[0].href.split('#')[1]);$('#rating-options-'+$obj.nid).get(0).selectedIndex=index;rating_submit_rating($obj.nid,debug);return false;});var event={fill:function(el){var index=$stars.index(el)+1;$stars.children('a').css('width','100%').end().slice(0,index).addClass('hover').end();},drain:function(){$stars.filter('.on').removeClass('on').end().filter('.hover').removeClass('hover').end();},reset:function(){$stars.slice(0,averageIndex).addClass('on').end();var percent=(averagePercent)?averagePercent*10:0;if(percent>0){$stars.eq(averageIndex*1).addClass('on').children('a').css('width',percent+"%").end().end()}}}
if(debug)console.log("Resetting event...");event.reset();if(debug)console.log("Returning obj...");return $obj;}
var buildInterface=function($form){if(debug)console.log("Building interface...");var $container=$(document.createElement('div')).attr({"title":$form.title(),"class":'rating-stars-container'});if(debug)console.log("Extending container...");$.extend($container,{averageRating:$.trim($container.title().split(':')[1]).split('.'),nid:$form.attr('id').split('-')[2]});var $optionGroup=$('#rating-options-'+$container.nid).children('option');$optionGroup.sort(function(a,b){return(a.value-b.value);});var $stars=$(document.createElement('div')).attr({"class":$form.attr('class')+'-stars'});for(var i=0,option;option=$optionGroup[i];i++){if(option.value=="0"){$div=$('<div class="cancel"><a style="width: 100%;" href="#0" title="Cancel Rating">&nbsp;</a></div>');}else{$div=$('<div class="star"><a style="width: 100%;" class="mod" href="#'+option.value+'" title="'+option.text+'">&nbsp;</a></div>');}
$stars.append($div[0]);}
$container.append($stars);$form.after($container).hide();$container.show();return $container;}
$.fn.rating=function(options){var defaults={authorized:false,url:null};var options=$.extend(defaults,options);var stack=[];this.each(function(){var ret=buildRating($(this),options);stack=$.merge(ret,stack);});if(debug)console.log("Returning stack...");return $(stack);}
if($.browser.msie==true){document.execCommand('BackgroundImageCache',false,true);}})(jQuery)
jQuery.fn.sort=function(){return this.pushStack(jQuery.merge([].sort.apply(this,arguments),[]),[]);};jQuery.fn.rating_option=function(value){var select=$(this)[0];for(var i=0;i<select.length;i++)
if(select[i].value==value)
return i;};function rating_submit_rating(nid,debug){$('#rating-form-'+nid).ajaxSubmit({dataType:'json',after:function(data){if(debug){console.log("Nid: "+nid);console.log("Response received: "+data.response);}
if(data.error){$('#rating-message-'+nid).background('#f95');$('#rating-message-'+nid).html(data.error).fadeIn('slow');return false;}
mean=data.mean.split('.');var $obj=$('#rating-mean-stars-'+nid);$stars=$($obj.children('.star'));$stars.filter('.on').removeClass('on').end();$stars.children('a').css('width','100%').end();$stars.slice(0,mean[0]).addClass('on').end();if(mean[1]>0){if(debug)console.log("mean[0]: "+mean[0]);$stars.eq(mean[0]*1).children('a').css('width',mean[1]*10+"%").end().addClass('on').end();}
$('#rating-num-votes-'+nid).html(data.num_votes);rating_postsubmit(nid);}});}
jQuery.fn.favorite=function(url,options){if(url==null)return;var settings={url:url,maxvalue:1,curvalue:0,authorized:false};if(options){jQuery.extend(settings,options);};var container=jQuery(this);jQuery.extend(container,{averageRating:settings.curvalue,url:settings.url});var div='<div class="star"><a href="#0" title="Add to Favorites" style="width: 100%">&nbsp;</a></div>';container.append(div);var stars=jQuery(container).children('.star');stars.mouseover(function(){event.drain();event.fill(this);}).mouseout(function(){event.drain();event.reset();}).focus(function(){event.drain();event.fill(this)}).blur(function(){event.drain();event.reset();});stars.click(function(){if(!settings.authorized){window.location=url
return false;}
settings.curvalue=(settings.curvalue==0)?1:0;$(this).toggleClass('on');jQuery.post(container.url,{"favorite":jQuery(this).children('a')[0].href.split('#')[1]});return false;});var event={fill:function(el){stars.addClass('hover').end();},drain:function(){stars.filter('.on').removeClass('on').end().filter('.hover').removeClass('hover').end();},reset:function(){stars.slice(0,settings.curvalue).addClass('on').end();}}
event.reset();return(this);}