//jquery.hoverIntent.minified.js
(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.checkbox.min.js
(function($){var i=function(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation()};$.fn.checkbox=function(f){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}var g={cls:'jquery-checkbox',empty:'empty.png'};g=$.extend(g,f||{});var h=function(a){var b=a.checked;var c=a.disabled;var d=$(a);if(a.stateInterval)clearInterval(a.stateInterval);a.stateInterval=setInterval(function(){if(a.disabled!=c)d.trigger((c=!!a.disabled)?'disable':'enable');if(a.checked!=b)d.trigger((b=!!a.checked)?'check':'uncheck')},10);return d};return this.each(function(){var a=this;var b=h(a);if(a.wrapper)a.wrapper.remove();a.wrapper=$('<span class="'+g.cls+'"><span class="mark"><img src="'+g.empty+'" /></span></span>');a.wrapperInner=a.wrapper.children('span:eq(0)');a.wrapper.hover(function(e){a.wrapperInner.addClass(g.cls+'-hover');i(e)},function(e){a.wrapperInner.removeClass(g.cls+'-hover');i(e)});b.css({position:'absolute',zIndex:-1,visibility:'hidden'}).after(a.wrapper);var c=false;if(b.attr('id')){c=$('label[for='+b.attr('id')+']');if(!c.length)c=false}if(!c){c=b.closest?b.closest('label'):b.parents('label:eq(0)');if(!c.length)c=false}if(c){c.hover(function(e){a.wrapper.trigger('mouseover',[e])},function(e){a.wrapper.trigger('mouseout',[e])});c.click(function(e){b.trigger('click',[e]);i(e);return false})}a.wrapper.click(function(e){b.trigger('click',[e]);i(e);return false});b.click(function(e){i(e)});b.bind('disable',function(){a.wrapperInner.addClass(g.cls+'-disabled')}).bind('enable',function(){a.wrapperInner.removeClass(g.cls+'-disabled')});b.bind('check',function(){a.wrapper.addClass(g.cls+'-checked')}).bind('uncheck',function(){a.wrapper.removeClass(g.cls+'-checked')});$('img',a.wrapper).bind('dragstart',function(){return false}).bind('mousedown',function(){return false});if(window.getSelection)a.wrapper.css('MozUserSelect','none');if(a.checked)a.wrapper.addClass(g.cls+'-checked');if(a.disabled)a.wrapperInner.addClass(g.cls+'-disabled')})}})(jQuery);
//jcarousellite_custom.min.js
(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 running=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$("ul",div),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 li=$("li",ul),itemLength=li.size(),curr=o.start;div.css("visibility","visible");li.css({overflow:"hidden",float:o.vertical?"none":"left"});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=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;li.css({width:li.width(),height:li.height()});ul.css(sizeCss,ulSize+"px").css(animCss,-(curr*liSize));div.css(sizeCss,divSize+"px");if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled");if(itemLength-v==0){$(o.btnNext).addClass("disabled")}}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,val){$(val).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&div.mousewheel)div.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 li.slice(curr).slice(0,v)};function go(to){if(!running){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(to<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*liSize)+"px");curr=to==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(to>=itemLength-v+1){ul.css(animCss,-((v)*liSize)+"px");curr=to==itemLength-v+1?v+1:v+o.scroll}else curr=to}else{if(to<0||to>itemLength-v)return;else curr=to}running=true;ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,curr);running=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(el,prop){return parseInt($.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);
//jquery.qtip Copyright (c) 2009 Craig Thompson
(function(f){f.fn.qtip=function(B,u){var y,t,A,s,x,w,v,z;if(typeof B=="string"){if(typeof f(this).data("qtip")!=="object"){f.fn.qtip.log.error.call(self,1,f.fn.qtip.constants.NO_TOOLTIP_PRESENT,false)}if(B=="api"){return f(this).data("qtip").interfaces[f(this).data("qtip").current]}else{if(B=="interfaces"){return f(this).data("qtip").interfaces}}}else{if(!B){B={}}if(typeof B.content!=="object"||(B.content.jquery&&B.content.length>0)){B.content={text:B.content}}if(typeof B.content.title!=="object"){B.content.title={text:B.content.title}}if(typeof B.position!=="object"){B.position={corner:B.position}}if(typeof B.position.corner!=="object"){B.position.corner={target:B.position.corner,tooltip:B.position.corner}}if(typeof B.show!=="object"){B.show={when:B.show}}if(typeof B.show.when!=="object"){B.show.when={event:B.show.when}}if(typeof B.show.effect!=="object"){B.show.effect={type:B.show.effect}}if(typeof B.hide!=="object"){B.hide={when:B.hide}}if(typeof B.hide.when!=="object"){B.hide.when={event:B.hide.when}}if(typeof B.hide.effect!=="object"){B.hide.effect={type:B.hide.effect}}if(typeof B.style!=="object"){B.style={name:B.style}}B.style=c(B.style);s=f.extend(true,{},f.fn.qtip.defaults,B);s.style=a.call({options:s},s.style);s.user=f.extend(true,{},B)}return f(this).each(function(){if(typeof B=="string"){w=B.toLowerCase();A=f(this).qtip("interfaces");if(typeof A=="object"){if(u===true&&w=="destroy"){while(A.length>0){A[A.length-1].destroy()}}else{if(u!==true){A=[f(this).qtip("api")]}for(y=0;y<A.length;y++){if(w=="destroy"){A[y].destroy()}else{if(A[y].status.rendered===true){if(w=="show"){A[y].show()}else{if(w=="hide"){A[y].hide()}else{if(w=="focus"){A[y].focus()}else{if(w=="disable"){A[y].disable(true)}else{if(w=="enable"){A[y].disable(false)}}}}}}}}}}}else{v=f.extend(true,{},s);v.hide.effect.length=s.hide.effect.length;v.show.effect.length=s.show.effect.length;if(v.position.container===false){v.position.container=f(document.body)}if(v.position.target===false){v.position.target=f(this)}if(v.show.when.target===false){v.show.when.target=f(this)}if(v.hide.when.target===false){v.hide.when.target=f(this)}t=f.fn.qtip.interfaces.length;for(y=0;y<t;y++){if(typeof f.fn.qtip.interfaces[y]=="undefined"){t=y;break}}x=new d(f(this),v,t);f.fn.qtip.interfaces[t]=x;if(typeof f(this).data("qtip")=="object"){if(typeof f(this).attr("qtip")==="undefined"){f(this).data("qtip").current=f(this).data("qtip").interfaces.length}f(this).data("qtip").interfaces.push(x)}else{f(this).data("qtip",{current:0,interfaces:[x]})}if(v.content.prerender===false&&v.show.when.event!==false&&v.show.ready!==true){v.show.when.target.bind(v.show.when.event+".qtip-"+t+"-create",{qtip:t},function(C){z=f.fn.qtip.interfaces[C.data.qtip];z.options.show.when.target.unbind(z.options.show.when.event+".qtip-"+C.data.qtip+"-create");z.cache.mouse={x:C.pageX,y:C.pageY};p.call(z);z.options.show.when.target.trigger(z.options.show.when.event)})}else{x.cache.mouse={x:v.show.when.target.offset().left,y:v.show.when.target.offset().top};p.call(x)}}})};function d(u,t,v){var s=this;s.id=v;s.options=t;s.status={animated:false,rendered:false,disabled:false,focused:false};s.elements={target:u.addClass(s.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};s.cache={mouse:{},position:{},toggle:0};s.timers={};f.extend(s,s.options.api,{show:function(y){var x,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"show")}if(s.elements.tooltip.css("display")!=="none"){return s}s.elements.tooltip.stop(true,false);x=s.beforeShow.call(s,y);if(x===false){return s}function w(){if(s.options.position.type!=="static"){s.focus()}s.onShow.call(s,y);if(f.browser.msie){s.elements.tooltip.get(0).style.removeAttribute("filter")}}s.cache.toggle=1;if(s.options.position.type!=="static"){s.updatePosition(y,(s.options.show.effect.length>0))}if(typeof s.options.show.solo=="object"){z=f(s.options.show.solo)}else{if(s.options.show.solo===true){z=f("div.qtip").not(s.elements.tooltip)}}if(z){z.each(function(){if(f(this).qtip("api").status.rendered===true){f(this).qtip("api").hide()}})}if(typeof s.options.show.effect.type=="function"){s.options.show.effect.type.call(s.elements.tooltip,s.options.show.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.show.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeIn(s.options.show.effect.length,w);break;case"slide":s.elements.tooltip.slideDown(s.options.show.effect.length,function(){w();if(s.options.position.type!=="static"){s.updatePosition(y,true)}});break;case"grow":s.elements.tooltip.show(s.options.show.effect.length,w);break;default:s.elements.tooltip.show(null,w);break}s.elements.tooltip.addClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(y){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"hide")}else{if(s.elements.tooltip.css("display")==="none"){return s}}clearTimeout(s.timers.show);s.elements.tooltip.stop(true,false);x=s.beforeHide.call(s,y);if(x===false){return s}function w(){s.onHide.call(s,y)}s.cache.toggle=0;if(typeof s.options.hide.effect.type=="function"){s.options.hide.effect.type.call(s.elements.tooltip,s.options.hide.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.hide.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeOut(s.options.hide.effect.length,w);break;case"slide":s.elements.tooltip.slideUp(s.options.hide.effect.length,w);break;case"grow":s.elements.tooltip.hide(s.options.hide.effect.length,w);break;default:s.elements.tooltip.hide(null,w);break}s.elements.tooltip.removeClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_HIDDEN,"hide")},updatePosition:function(w,x){var C,G,L,J,H,E,y,I,B,D,K,A,F,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updatePosition")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_POSITION_STATIC,"updatePosition")}}G={position:{left:0,top:0},dimensions:{height:0,width:0},corner:s.options.position.corner.target};L={position:s.getPosition(),dimensions:s.getDimensions(),corner:s.options.position.corner.tooltip};if(s.options.position.target!=="mouse"){if(s.options.position.target.get(0).nodeName.toLowerCase()=="area"){J=s.options.position.target.attr("coords").split(",");for(C=0;C<J.length;C++){J[C]=parseInt(J[C])}H=s.options.position.target.parent("map").attr("name");E=f('img[usemap="#'+H+'"]:first').offset();G.position={left:Math.floor(E.left+J[0]),top:Math.floor(E.top+J[1])};switch(s.options.position.target.attr("shape").toLowerCase()){case"rect":G.dimensions={width:Math.ceil(Math.abs(J[2]-J[0])),height:Math.ceil(Math.abs(J[3]-J[1]))};break;case"circle":G.dimensions={width:J[2]+1,height:J[2]+1};break;case"poly":G.dimensions={width:J[0],height:J[1]};for(C=0;C<J.length;C++){if(C%2==0){if(J[C]>G.dimensions.width){G.dimensions.width=J[C]}if(J[C]<J[0]){G.position.left=Math.floor(E.left+J[C])}}else{if(J[C]>G.dimensions.height){G.dimensions.height=J[C]}if(J[C]<J[1]){G.position.top=Math.floor(E.top+J[C])}}}G.dimensions.width=G.dimensions.width-(G.position.left-E.left);G.dimensions.height=G.dimensions.height-(G.position.top-E.top);break;default:return f.fn.qtip.log.error.call(s,4,f.fn.qtip.constants.INVALID_AREA_SHAPE,"updatePosition");break}G.dimensions.width-=2;G.dimensions.height-=2}else{if(s.options.position.target.add(document.body).length===1){G.position={left:f(document).scrollLeft(),top:f(document).scrollTop()};G.dimensions={height:f(window).height(),width:f(window).width()}}else{if(typeof s.options.position.target.attr("qtip")!=="undefined"){G.position=s.options.position.target.qtip("api").cache.position}else{G.position=s.options.position.target.offset()}G.dimensions={height:s.options.position.target.outerHeight(),width:s.options.position.target.outerWidth()}}}y=f.extend({},G.position);if(G.corner.search(/right/i)!==-1){y.left+=G.dimensions.width}if(G.corner.search(/bottom/i)!==-1){y.top+=G.dimensions.height}if(G.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left+=(G.dimensions.width/2)}if(G.corner.search(/((left|right)Middle)|center/)!==-1){y.top+=(G.dimensions.height/2)}}else{G.position=y={left:s.cache.mouse.x,top:s.cache.mouse.y};G.dimensions={height:1,width:1}}if(L.corner.search(/right/i)!==-1){y.left-=L.dimensions.width}if(L.corner.search(/bottom/i)!==-1){y.top-=L.dimensions.height}if(L.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left-=(L.dimensions.width/2)}if(L.corner.search(/((left|right)Middle)|center/)!==-1){y.top-=(L.dimensions.height/2)}I=(f.browser.msie)?1:0;B=(f.browser.msie&&parseInt(f.browser.version.charAt(0))===6)?1:0;if(s.options.style.border.radius>0){if(L.corner.search(/Left/)!==-1){y.left-=s.options.style.border.radius}else{if(L.corner.search(/Right/)!==-1){y.left+=s.options.style.border.radius}}if(L.corner.search(/Top/)!==-1){y.top-=s.options.style.border.radius}else{if(L.corner.search(/Bottom/)!==-1){y.top+=s.options.style.border.radius}}}if(I){if(L.corner.search(/top/)!==-1){y.top-=I}else{if(L.corner.search(/bottom/)!==-1){y.top+=I}}if(L.corner.search(/left/)!==-1){y.left-=I}else{if(L.corner.search(/right/)!==-1){y.left+=I}}if(L.corner.search(/leftMiddle|rightMiddle/)!==-1){y.top-=1}}if(s.options.position.adjust.screen===true){y=o.call(s,y,G,L)}if(s.options.position.target==="mouse"&&s.options.position.adjust.mouse===true){if(s.options.position.adjust.screen===true&&s.elements.tip){K=s.elements.tip.attr("rel")}else{K=s.options.position.corner.tooltip}y.left+=(K.search(/right/i)!==-1)?-6:6;y.top+=(K.search(/bottom/i)!==-1)?-6:6}if(!s.elements.bgiframe&&f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){f("select, object").each(function(){A=f(this).offset();A.bottom=A.top+f(this).height();A.right=A.left+f(this).width();if(y.top+L.dimensions.height>=A.top&&y.left+L.dimensions.width>=A.left){k.call(s)}})}y.left+=s.options.position.adjust.x;y.top+=s.options.position.adjust.y;F=s.getPosition();if(y.left!=F.left||y.top!=F.top){z=s.beforePositionUpdate.call(s,w);if(z===false){return s}s.cache.position=y;if(x===true){s.status.animated=true;s.elements.tooltip.animate(y,200,"swing",function(){s.status.animated=false})}else{s.elements.tooltip.css(y)}s.onPositionUpdate.call(s,w);if(typeof w!=="undefined"&&w.type&&w.type!=="mousemove"){f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_POSITION_UPDATED,"updatePosition")}}return s},updateWidth:function(w){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateWidth")}else{if(w&&typeof w!=="number"){return f.fn.qtip.log.error.call(s,2,"newWidth must be of type number","updateWidth")}}x=s.elements.contentWrapper.siblings().add(s.elements.tip).add(s.elements.button);if(!w){if(typeof s.options.style.width.value=="number"){w=s.options.style.width.value}else{s.elements.tooltip.css({width:"auto"});x.hide();if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"normal"})}w=s.getDimensions().width+1;if(!s.options.style.width.value){if(w>s.options.style.width.max){w=s.options.style.width.max}if(w<s.options.style.width.min){w=s.options.style.width.min}}}}if(w%2!==0){w-=1}s.elements.tooltip.width(w);x.show();if(s.options.style.border.radius){s.elements.tooltip.find(".qtip-betweenCorners").each(function(y){f(this).width(w-(s.options.style.border.radius*2))})}if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"1"});s.elements.wrapper.width(w);if(s.elements.bgiframe){s.elements.bgiframe.width(w).height(s.getDimensions.height)}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_WIDTH_UPDATED,"updateWidth")},updateStyle:function(w){var z,A,x,y,B;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateStyle")}else{if(typeof w!=="string"||!f.fn.qtip.styles[w]){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.STYLE_NOT_DEFINED,"updateStyle")}}s.options.style=a.call(s,f.fn.qtip.styles[w],s.options.user.style);s.elements.content.css(q(s.options.style));if(s.options.content.title.text!==false){s.elements.title.css(q(s.options.style.title,true))}s.elements.contentWrapper.css({borderColor:s.options.style.border.color});if(s.options.style.tip.corner!==false){if(f("<canvas>").get(0).getContext){z=s.elements.tooltip.find(".qtip-tip canvas:first");x=z.get(0).getContext("2d");x.clearRect(0,0,300,300);y=z.parent("div[rel]:first").attr("rel");B=b(y,s.options.style.tip.size.width,s.options.style.tip.size.height);h.call(s,z,B,s.options.style.tip.color||s.options.style.border.color)}else{if(f.browser.msie){z=s.elements.tooltip.find('.qtip-tip [nodeName="shape"]');z.attr("fillcolor",s.options.style.tip.color||s.options.style.border.color)}}}if(s.options.style.border.radius>0){s.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:s.options.style.border.color});if(f("<canvas>").get(0).getContext){A=g(s.options.style.border.radius);s.elements.tooltip.find(".qtip-wrapper canvas").each(function(){x=f(this).get(0).getContext("2d");x.clearRect(0,0,300,300);y=f(this).parent("div[rel]:first").attr("rel");r.call(s,f(this),A[y],s.options.style.border.radius,s.options.style.border.color)})}else{if(f.browser.msie){s.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function(){f(this).attr("fillcolor",s.options.style.border.color)})}}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_STYLE_UPDATED,"updateStyle")},updateContent:function(A,y){var z,x,w;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateContent")}else{if(!A){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateContent")}}z=s.beforeContentUpdate.call(s,A);if(typeof z=="string"){A=z}else{if(z===false){return}}if(f.browser.msie){s.elements.contentWrapper.children().css({zoom:"normal"})}if(A.jquery&&A.length>0){A.clone(true).appendTo(s.elements.content).show()}else{s.elements.content.html(A)}x=s.elements.content.find("img[complete=false]");if(x.length>0){w=0;x.each(function(C){f('<img src="'+f(this).attr("src")+'" />').load(function(){if(++w==x.length){B()}})})}else{B()}function B(){s.updateWidth();if(y!==false){if(s.options.position.type!=="static"){s.updatePosition(s.elements.tooltip.is(":visible"),true)}if(s.options.style.tip.corner!==false){n.call(s)}}}s.onContentUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_UPDATED,"loadContent")},loadContent:function(w,z,A){var y;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"loadContent")}y=s.beforeContentLoad.call(s);if(y===false){return s}if(A=="post"){f.post(w,z,x)}else{f.get(w,z,x)}function x(B){s.onContentLoad.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_LOADED,"loadContent");s.updateContent(B)}return s},updateTitle:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateTitle")}else{if(!w){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateTitle")}}returned=s.beforeTitleUpdate.call(s);if(returned===false){return s}if(s.elements.button){s.elements.button=s.elements.button.clone(true)}s.elements.title.html(w);if(s.elements.button){s.elements.title.prepend(s.elements.button)}s.onTitleUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_TITLE_UPDATED,"updateTitle")},focus:function(A){var y,x,w,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"focus")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_FOCUS_STATIC,"focus")}}y=parseInt(s.elements.tooltip.css("z-index"));x=6000+f("div.qtip[qtip]").length-1;if(!s.status.focused&&y!==x){z=s.beforeFocus.call(s,A);if(z===false){return s}f("div.qtip[qtip]").not(s.elements.tooltip).each(function(){if(f(this).qtip("api").status.rendered===true){w=parseInt(f(this).css("z-index"));if(typeof w=="number"&&w>-1){f(this).css({zIndex:parseInt(f(this).css("z-index"))-1})}f(this).qtip("api").status.focused=false}});s.elements.tooltip.css({zIndex:x});s.status.focused=true;s.onFocus.call(s,A);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_FOCUSED,"focus")}return s},disable:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"disable")}if(w){if(!s.status.disabled){s.status.disabled=true;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DISABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,"disable")}}else{if(s.status.disabled){s.status.disabled=false;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_ENABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,"disable")}}return s},destroy:function(){var w,x,y;x=s.beforeDestroy.call(s);if(x===false){return s}if(s.status.rendered){s.options.show.when.target.unbind("mousemove.qtip",s.updatePosition);s.options.show.when.target.unbind("mouseout.qtip",s.hide);s.options.show.when.target.unbind(s.options.show.when.event+".qtip");s.options.hide.when.target.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind("mouseover.qtip",s.focus);s.elements.tooltip.remove()}else{s.options.show.when.target.unbind(s.options.show.when.event+".qtip-create")}if(typeof s.elements.target.data("qtip")=="object"){y=s.elements.target.data("qtip").interfaces;if(typeof y=="object"&&y.length>0){for(w=0;w<y.length-1;w++){if(y[w].id==s.id){y.splice(w,1)}}}}delete f.fn.qtip.interfaces[s.id];if(typeof y=="object"&&y.length>0){s.elements.target.data("qtip").current=y.length-1}else{s.elements.target.removeData("qtip")}s.onDestroy.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DESTROYED,"destroy");return s.elements.target},getPosition:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getPosition")}w=(s.elements.tooltip.css("display")!=="none")?false:true;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x=s.elements.tooltip.offset();if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x},getDimensions:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getDimensions")}w=(!s.elements.tooltip.is(":visible"))?true:false;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x={height:s.elements.tooltip.outerHeight(),width:s.elements.tooltip.outerWidth()};if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x}})}function p(){var s,w,u,t,v,y,x;s=this;s.beforeRender.call(s);s.status.rendered=true;s.elements.tooltip='<div qtip="'+s.id+'" class="qtip '+(s.options.style.classes.tooltip||s.options.style)+'"style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;position:'+s.options.position.type+';">  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">    <div class="qtip-contentWrapper" style="overflow:hidden;">       <div class="qtip-content '+s.options.style.classes.content+'"></div></div></div></div>';s.elements.tooltip=f(s.elements.tooltip);s.elements.tooltip.appendTo(s.options.position.container);s.elements.tooltip.data("qtip",{current:0,interfaces:[s]});s.elements.wrapper=s.elements.tooltip.children("div:first");s.elements.contentWrapper=s.elements.wrapper.children("div:first").css({background:s.options.style.background});s.elements.content=s.elements.contentWrapper.children("div:first").css(q(s.options.style));if(f.browser.msie){s.elements.wrapper.add(s.elements.content).css({zoom:1})}if(s.options.hide.when.event=="unfocus"){s.elements.tooltip.attr("unfocus",true)}if(typeof s.options.style.width.value=="number"){s.updateWidth()}if(f("<canvas>").get(0).getContext||f.browser.msie){if(s.options.style.border.radius>0){m.call(s)}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color})}if(s.options.style.tip.corner!==false){e.call(s)}}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color});s.options.style.border.radius=0;s.options.style.tip.corner=false;f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,"render")}if((typeof s.options.content.text=="string"&&s.options.content.text.length>0)||(s.options.content.text.jquery&&s.options.content.text.length>0)){u=s.options.content.text}else{if(typeof s.elements.target.attr("title")=="string"&&s.elements.target.attr("title").length>0){u=s.elements.target.attr("title").replace("\\n","<br />");s.elements.target.attr("title","")}else{if(typeof s.elements.target.attr("alt")=="string"&&s.elements.target.attr("alt").length>0){u=s.elements.target.attr("alt").replace("\\n","<br />");s.elements.target.attr("alt","")}else{u=" ";f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.NO_VALID_CONTENT,"render")}}}if(s.options.content.title.text!==false){j.call(s)}s.updateContent(u);l.call(s);if(s.options.show.ready===true){s.show()}if(s.options.content.url!==false){t=s.options.content.url;v=s.options.content.data;y=s.options.content.method||"get";s.loadContent(t,v,y)}s.onRender.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_RENDERED,"render")}function m(){var F,z,t,B,x,E,u,G,D,y,w,C,A,s,v;F=this;F.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();t=F.options.style.border.width;B=F.options.style.border.radius;x=F.options.style.border.color||F.options.style.tip.color;E=g(B);u={};for(z in E){u[z]='<div rel="'+z+'" style="'+((z.search(/Left/)!==-1)?"left":"right")+":0; position:absolute; height:"+B+"px; width:"+B+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if(f("<canvas>").get(0).getContext){u[z]+='<canvas height="'+B+'" width="'+B+'" style="vertical-align: top"></canvas>'}else{if(f.browser.msie){G=B*2+3;u[z]+='<v:arc stroked="false" fillcolor="'+x+'" startangle="'+E[z][0]+'" endangle="'+E[z][1]+'" style="width:'+G+"px; height:"+G+"px; margin-top:"+((z.search(/bottom/)!==-1)?-2:-1)+"px; margin-left:"+((z.search(/Right/)!==-1)?E[z][2]-3.5:-1)+'px; vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>'}}u[z]+="</div>"}D=F.getDimensions().width-(Math.max(t,B)*2);y='<div class="qtip-betweenCorners" style="height:'+B+"px; width:"+D+"px; overflow:hidden; background-color:"+x+'; line-height:0.1px; font-size:1px;">';w='<div class="qtip-borderTop" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.topLeft+u.topRight+y;F.elements.wrapper.prepend(w);C='<div class="qtip-borderBottom" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.bottomLeft+u.bottomRight+y;F.elements.wrapper.append(C);if(f("<canvas>").get(0).getContext){F.elements.wrapper.find("canvas").each(function(){A=E[f(this).parent("[rel]:first").attr("rel")];r.call(F,f(this),A,B,x)})}else{if(f.browser.msie){F.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>')}}s=Math.max(B,(B+(t-B)));v=Math.max(t-B,0);F.elements.contentWrapper.css({border:"0px solid "+x,borderWidth:v+"px "+s+"px"})}function r(u,w,s,t){var v=u.get(0).getContext("2d");v.fillStyle=t;v.beginPath();v.arc(w[0],w[1],s,0,Math.PI*2,false);v.fill()}function e(v){var t,s,x,u,w;t=this;if(t.elements.tip!==null){t.elements.tip.remove()}s=t.options.style.tip.color||t.options.style.border.color;if(t.options.style.tip.corner===false){return}else{if(!v){v=t.options.style.tip.corner}}x=b(v,t.options.style.tip.size.width,t.options.style.tip.size.height);t.elements.tip='<div class="'+t.options.style.classes.tip+'" dir="ltr" rel="'+v+'" style="position:absolute; height:'+t.options.style.tip.size.height+"px; width:"+t.options.style.tip.size.width+'px; margin:0 auto; line-height:0.1px; font-size:1px;">';if(f("<canvas>").get(0).getContext){t.elements.tip+='<canvas height="'+t.options.style.tip.size.height+'" width="'+t.options.style.tip.size.width+'"></canvas>'}else{if(f.browser.msie){u=t.options.style.tip.size.width+","+t.options.style.tip.size.height;w="m"+x[0][0]+","+x[0][1];w+=" l"+x[1][0]+","+x[1][1];w+=" "+x[2][0]+","+x[2][1];w+=" xe";t.elements.tip+='<v:shape fillcolor="'+s+'" stroked="false" filled="true" path="'+w+'" coordsize="'+u+'" style="width:'+t.options.style.tip.size.width+"px; height:"+t.options.style.tip.size.height+"px; line-height:0.1px; display:inline-block; behavior:url(#default#VML); vertical-align:"+((v.search(/top/)!==-1)?"bottom":"top")+'"></v:shape>';t.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';t.elements.contentWrapper.css("position","relative")}}t.elements.tooltip.prepend(t.elements.tip+"</div>");t.elements.tip=t.elements.tooltip.find("."+t.options.style.classes.tip).eq(0);if(f("<canvas>").get(0).getContext){h.call(t,t.elements.tip.find("canvas:first"),x,s)}if(v.search(/top/)!==-1&&f.browser.msie&&parseInt(f.browser.version.charAt(0))===6){t.elements.tip.css({marginTop:-4})}n.call(t,v)}function h(t,v,s){var u=t.get(0).getContext("2d");u.fillStyle=s;u.beginPath();u.moveTo(v[0][0],v[0][1]);u.lineTo(v[1][0],v[1][1]);u.lineTo(v[2][0],v[2][1]);u.fill()}function n(u){var t,w,s,x,v;t=this;if(t.options.style.tip.corner===false||!t.elements.tip){return}if(!u){u=t.elements.tip.attr("rel")}w=positionAdjust=(f.browser.msie)?1:0;t.elements.tip.css(u.match(/left|right|top|bottom/)[0],0);if(u.search(/top|bottom/)!==-1){if(f.browser.msie){if(parseInt(f.browser.version.charAt(0))===6){positionAdjust=(u.search(/top/)!==-1)?-3:1}else{positionAdjust=(u.search(/top/)!==-1)?1:2}}if(u.search(/Middle/)!==-1){t.elements.tip.css({left:"50%",marginLeft:-(t.options.style.tip.size.width/2)})}else{if(u.search(/Left/)!==-1){t.elements.tip.css({left:t.options.style.border.radius-w})}else{if(u.search(/Right/)!==-1){t.elements.tip.css({right:t.options.style.border.radius+w})}}}if(u.search(/top/)!==-1){t.elements.tip.css({top:-positionAdjust})}else{t.elements.tip.css({bottom:positionAdjust})}}else{if(u.search(/left|right/)!==-1){if(f.browser.msie){positionAdjust=(parseInt(f.browser.version.charAt(0))===6)?1:((u.search(/left/)!==-1)?1:2)}if(u.search(/Middle/)!==-1){t.elements.tip.css({top:"50%",marginTop:-(t.options.style.tip.size.height/2)})}else{if(u.search(/Top/)!==-1){t.elements.tip.css({top:t.options.style.border.radius-w})}else{if(u.search(/Bottom/)!==-1){t.elements.tip.css({bottom:t.options.style.border.radius+w})}}}if(u.search(/left/)!==-1){t.elements.tip.css({left:-positionAdjust})}else{t.elements.tip.css({right:positionAdjust})}}}s="padding-"+u.match(/left|right|top|bottom/)[0];x=t.options.style.tip.size[(s.search(/left|right/)!==-1)?"width":"height"];t.elements.tooltip.css("padding",0);t.elements.tooltip.css(s,x);if(f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){v=parseInt(t.elements.tip.css("margin-top"))||0;v+=parseInt(t.elements.content.css("margin-top"))||0;t.elements.tip.css({marginTop:v})}}function j(){var s=this;if(s.elements.title!==null){s.elements.title.remove()}s.elements.title=f('<div class="'+s.options.style.classes.title+'">').css(q(s.options.style.title,true)).css({zoom:(f.browser.msie)?1:0}).prependTo(s.elements.contentWrapper);if(s.options.content.title.text){s.updateTitle.call(s,s.options.content.title.text)}if(s.options.content.title.button!==false&&typeof s.options.content.title.button=="string"){s.elements.button=f('<a class="'+s.options.style.classes.button+'" style="float:right; position: relative"></a>').css(q(s.options.style.button,true)).html(s.options.content.title.button).prependTo(s.elements.title).click(function(t){if(!s.status.disabled){s.hide(t)}})}}function l(){var t,v,u,s;t=this;v=t.options.show.when.target;u=t.options.hide.when.target;if(t.options.hide.fixed){u=u.add(t.elements.tooltip)}if(t.options.hide.when.event=="inactive"){s=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter","mouseleave","mouseover"];function y(z){if(t.status.disabled===true){return}clearTimeout(t.timers.inactive);t.timers.inactive=setTimeout(function(){f(s).each(function(){u.unbind(this+".qtip-inactive");t.elements.content.unbind(this+".qtip-inactive")});t.hide(z)},t.options.hide.delay)}}else{if(t.options.hide.fixed===true){t.elements.tooltip.bind("mouseover.qtip",function(){if(t.status.disabled===true){return}clearTimeout(t.timers.hide)})}}function x(z){if(t.status.disabled===true){return}if(t.options.hide.when.event=="inactive"){f(s).each(function(){u.bind(this+".qtip-inactive",y);t.elements.content.bind(this+".qtip-inactive",y)});y()}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.timers.show=setTimeout(function(){t.show(z)},t.options.show.delay)}function w(z){if(t.status.disabled===true){return}if(t.options.hide.fixed===true&&t.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&f(z.relatedTarget).parents("div.qtip[qtip]").length>0){z.stopPropagation();z.preventDefault();clearTimeout(t.timers.hide);return false}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.elements.tooltip.stop(true,true);t.timers.hide=setTimeout(function(){t.hide(z)},t.options.hide.delay)}if((t.options.show.when.target.add(t.options.hide.when.target).length===1&&t.options.show.when.event==t.options.hide.when.event&&t.options.hide.when.event!=="inactive")||t.options.hide.when.event=="unfocus"){t.cache.toggle=0;v.bind(t.options.show.when.event+".qtip",function(z){if(t.cache.toggle==0){x(z)}else{w(z)}})}else{v.bind(t.options.show.when.event+".qtip",x);if(t.options.hide.when.event!=="inactive"){u.bind(t.options.hide.when.event+".qtip",w)}}if(t.options.position.type.search(/(fixed|absolute)/)!==-1){t.elements.tooltip.bind("mouseover.qtip",t.focus)}if(t.options.position.target==="mouse"&&t.options.position.type!=="static"){v.bind("mousemove.qtip",function(z){t.cache.mouse={x:z.pageX,y:z.pageY};if(t.status.disabled===false&&t.options.position.adjust.mouse===true&&t.options.position.type!=="static"&&t.elements.tooltip.css("display")!=="none"){t.updatePosition(z)}})}}function o(u,v,A){var z,s,x,y,t,w;z=this;if(A.corner=="center"){return v.position}s=f.extend({},u);y={x:false,y:false};t={left:(s.left<f.fn.qtip.cache.screen.scroll.left),right:(s.left+A.dimensions.width+2>=f.fn.qtip.cache.screen.width+f.fn.qtip.cache.screen.scroll.left),top:(s.top<f.fn.qtip.cache.screen.scroll.top),bottom:(s.top+A.dimensions.height+2>=f.fn.qtip.cache.screen.height+f.fn.qtip.cache.screen.scroll.top)};x={left:(t.left&&(A.corner.search(/right/i)!=-1||(A.corner.search(/right/i)==-1&&!t.right))),right:(t.right&&(A.corner.search(/left/i)!=-1||(A.corner.search(/left/i)==-1&&!t.left))),top:(t.top&&A.corner.search(/top/i)==-1),bottom:(t.bottom&&A.corner.search(/bottom/i)==-1)};if(x.left){if(z.options.position.target!=="mouse"){s.left=v.position.left+v.dimensions.width}else{s.left=z.cache.mouse.x}y.x="Left"}else{if(x.right){if(z.options.position.target!=="mouse"){s.left=v.position.left-A.dimensions.width}else{s.left=z.cache.mouse.x-A.dimensions.width}y.x="Right"}}if(x.top){if(z.options.position.target!=="mouse"){s.top=v.position.top+v.dimensions.height}else{s.top=z.cache.mouse.y}y.y="top"}else{if(x.bottom){if(z.options.position.target!=="mouse"){s.top=v.position.top-A.dimensions.height}else{s.top=z.cache.mouse.y-A.dimensions.height}y.y="bottom"}}if(s.left<0){s.left=u.left;y.x=false}if(s.top<0){s.top=u.top;y.y=false}if(z.options.style.tip.corner!==false){s.corner=new String(A.corner);if(y.x!==false){s.corner=s.corner.replace(/Left|Right|Middle/,y.x)}if(y.y!==false){s.corner=s.corner.replace(/top|bottom/,y.y)}if(s.corner!==z.elements.tip.attr("rel")){e.call(z,s.corner)}}return s}function q(u,t){var v,s;v=f.extend(true,{},u);for(s in v){if(t===true&&s.search(/(tip|classes)/i)!==-1){delete v[s]}else{if(!t&&s.search(/(width|border|tip|title|classes|user)/i)!==-1){delete v[s]}}}return v}function c(s){if(typeof s.tip!=="object"){s.tip={corner:s.tip}}if(typeof s.tip.size!=="object"){s.tip.size={width:s.tip.size,height:s.tip.size}}if(typeof s.border!=="object"){s.border={width:s.border}}if(typeof s.width!=="object"){s.width={value:s.width}}if(typeof s.width.max=="string"){s.width.max=parseInt(s.width.max.replace(/([0-9]+)/i,"$1"))}if(typeof s.width.min=="string"){s.width.min=parseInt(s.width.min.replace(/([0-9]+)/i,"$1"))}if(typeof s.tip.size.x=="number"){s.tip.size.width=s.tip.size.x;delete s.tip.size.x}if(typeof s.tip.size.y=="number"){s.tip.size.height=s.tip.size.y;delete s.tip.size.y}return s}function a(){var s,t,u,x,v,w;s=this;u=[true,{}];for(t=0;t<arguments.length;t++){u.push(arguments[t])}x=[f.extend.apply(f,u)];while(typeof x[0].name=="string"){x.unshift(c(f.fn.qtip.styles[x[0].name]))}x.unshift(true,{classes:{tooltip:"qtip-"+(arguments[0].name||"defaults")}},f.fn.qtip.styles.defaults);v=f.extend.apply(f,x);w=(f.browser.msie)?1:0;v.tip.size.width+=w;v.tip.size.height+=w;if(v.tip.size.width%2>0){v.tip.size.width+=1}if(v.tip.size.height%2>0){v.tip.size.height+=1}if(v.tip.corner===true){v.tip.corner=(s.options.position.corner.tooltip==="center")?false:s.options.position.corner.tooltip}return v}function b(v,u,t){var s={bottomRight:[[0,0],[u,t],[u,0]],bottomLeft:[[0,0],[u,0],[0,t]],topRight:[[0,t],[u,0],[u,t]],topLeft:[[0,0],[0,t],[u,t]],topMiddle:[[0,t],[u/2,0],[u,t]],bottomMiddle:[[0,0],[u,0],[u/2,t]],rightMiddle:[[0,0],[u,t/2],[0,t]],leftMiddle:[[u,0],[u,t],[0,t/2]]};s.leftTop=s.bottomRight;s.rightTop=s.bottomLeft;s.leftBottom=s.topRight;s.rightBottom=s.topLeft;return s[v]}function g(s){var t;if(f("<canvas>").get(0).getContext){t={topLeft:[s,s],topRight:[0,s],bottomLeft:[s,0],bottomRight:[0,0]}}else{if(f.browser.msie){t={topLeft:[-90,90,0],topRight:[-90,90,-s],bottomLeft:[90,270,0],bottomRight:[90,270,-s]}}}return t}function k(){var s,t,u;s=this;u=s.getDimensions();t='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; height:'+u.height+"px; width:"+u.width+'px" />';s.elements.bgiframe=s.elements.wrapper.prepend(t).children(".qtip-bgiframe:first")}f(document).ready(function(){f.fn.qtip.cache={screen:{scroll:{left:f(window).scrollLeft(),top:f(window).scrollTop()},width:f(window).width(),height:f(window).height()}};var s;f(window).bind("resize scroll",function(t){clearTimeout(s);s=setTimeout(function(){if(t.type==="scroll"){f.fn.qtip.cache.screen.scroll={left:f(window).scrollLeft(),top:f(window).scrollTop()}}else{f.fn.qtip.cache.screen.width=f(window).width();f.fn.qtip.cache.screen.height=f(window).height()}for(i=0;i<f.fn.qtip.interfaces.length;i++){var u=f.fn.qtip.interfaces[i];if(u.status.rendered===true&&(u.options.position.type!=="static"||u.options.position.adjust.scroll&&t.type==="scroll"||u.options.position.adjust.resize&&t.type==="resize")){u.updatePosition(t,true)}}},100)});f(document).bind("mousedown.qtip",function(t){if(f(t.target).parents("div.qtip").length===0){f(".qtip[unfocus]").each(function(){var u=f(this).qtip("api");if(f(this).is(":visible")&&!u.status.disabled&&f(t.target).add(u.elements.target).length>1){u.hide(t)}})}})});f.fn.qtip.interfaces=[];f.fn.qtip.log={error:function(){return this}};f.fn.qtip.constants={};f.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:"bottomRight",tooltip:"topLeft"},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:"absolute",container:false},show:{when:{target:false,event:"mouseover"},effect:{type:"fade",length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:"mouseout"},effect:{type:"fade",length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};f.fn.qtip.styles={defaults:{background:"white",color:"#111",overflow:"hidden",textAlign:"left",width:{min:0,max:250},padding:"5px 9px",border:{width:1,radius:0,color:"#d3d3d3"},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:"#e1e1e1",fontWeight:"bold",padding:"7px 12px"},button:{cursor:"pointer"},classes:{target:"",tip:"qtip-tip",title:"qtip-title",button:"qtip-button",content:"qtip-content",active:"qtip-active"}},cream:{border:{width:3,radius:0,color:"#F9E98E"},title:{background:"#F0DE7D",color:"#A27D35"},background:"#FBF7AA",color:"#A27D35",classes:{tooltip:"qtip-cream"}},light:{border:{width:3,radius:0,color:"#E2E2E2"},title:{background:"#f1f1f1",color:"#454545"},background:"white",color:"#454545",classes:{tooltip:"qtip-light"}},dark:{border:{width:3,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#505050",color:"#f3f3f3",classes:{tooltip:"qtip-dark"}},red:{border:{width:3,radius:0,color:"#CE6F6F"},title:{background:"#f28279",color:"#9C2F2F"},background:"#F79992",color:"#9C2F2F",classes:{tooltip:"qtip-red"}},green:{border:{width:3,radius:0,color:"#A9DB66"},title:{background:"#b9db8c",color:"#58792E"},background:"#CDE6AC",color:"#58792E",classes:{tooltip:"qtip-green"}},blue:{border:{width:3,radius:0,color:"#ADD9ED"},title:{background:"#D0E9F5",color:"#5E99BD"},background:"#E5F6FE",color:"#4D9FBF",classes:{tooltip:"qtip-blue"}}}})(jQuery);
//auto_complete_and_dependencies.js bigiframe ajaxqueue autocomplete
(function($){$.fn.extend({autocomplete:function(urlOrData,options){var isUrl=typeof urlOrData=="string";options=$.extend({},$.Autocompleter.defaults,{url:isUrl?urlOrData:null,data:isUrl?null:urlOrData,delay:isUrl?$.Autocompleter.defaults.delay:10,max:options&&!options.scroll?10:150},options);options.highlight=options.highlight||function(value){return value;};options.formatMatch=options.formatMatch||options.formatItem;return this.each(function(){new $.Autocompleter(this,options);});},result:function(handler){return this.bind("result",handler);},search:function(handler){return this.trigger("search",[handler]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(options){return this.trigger("setOptions",[options]);},unautocomplete:function(){return this.trigger("unautocomplete");}});$.Autocompleter=function(input,options){var KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var $input=$(input).attr("autocomplete","off").addClass(options.inputClass);var timeout;var previousValue="";var cache=$.Autocompleter.Cache(options);var hasFocus=0;var lastKeyPressCode;var config={mouseDownOnSelect:false};var select=$.Autocompleter.Select(options,input,selectCurrent,config);var blockSubmit;$.browser.opera&&$(input.form).bind("submit.autocomplete",function(){if(blockSubmit){blockSubmit=false;return false;}});$input.bind(($.browser.opera?"keypress":"keydown")+".autocomplete",function(event){hasFocus=1;lastKeyPressCode=event.keyCode;switch(event.keyCode){case KEY.UP:event.preventDefault();if(select.visible()){select.prev();}else{onChange(0,true);}break;case KEY.DOWN:event.preventDefault();if(select.visible()){select.next();}else{onChange(0,true);}break;case KEY.PAGEUP:event.preventDefault();if(select.visible()){select.pageUp();}else{onChange(0,true);}break;case KEY.PAGEDOWN:event.preventDefault();if(select.visible()){select.pageDown();}else{onChange(0,true);}break;case options.multiple&&$.trim(options.multipleSeparator)==","&&KEY.COMMA:case KEY.TAB:case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=true;return false;}break;case KEY.ESC:select.hide();break;default:clearTimeout(timeout);timeout=setTimeout(onChange,options.delay);break;}}).focus(function(){hasFocus++;}).blur(function(){hasFocus=0;if(!config.mouseDownOnSelect){hideResults();}}).click(function(){if(hasFocus++>1&&!select.visible()){onChange(0,true);}}).bind("search",function(){var fn=(arguments.length>1)?arguments[1]:null;function findValueCallback(q,data){var result;if(data&&data.length){for(var i=0;i<data.length;i++){if(data[i].result.toLowerCase()==q.toLowerCase()){result=data[i];break;}}}if(typeof fn=="function")fn(result);else $input.trigger("result",result&&[result.data,result.value]);}$.each(trimWords($input.val()),function(i,value){request(value,findValueCallback,findValueCallback);});}).bind("flushCache",function(){cache.flush();}).bind("setOptions",function(){$.extend(options,arguments[1]);if("data"in arguments[1])cache.populate();}).bind("unautocomplete",function(){select.unbind();$input.unbind();$(input.form).unbind(".autocomplete");});function selectCurrent(){var selected=select.selected();if(!selected)return false;var v=selected.result;previousValue=v;if(options.multiple){var words=trimWords($input.val());if(words.length>1){var seperator=options.multipleSeparator.length;var cursorAt=$(input).selection().start;var wordAt,progress=0;$.each(words,function(i,word){progress+=word.length;if(cursorAt<=progress){wordAt=i;return false;}progress+=seperator;});words[wordAt]=v;v=words.join(options.multipleSeparator);}v+=options.multipleSeparator;}$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true;}function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL || lastKeyPressCode==KEY.RETURN){select.hide();return;}var currentValue=$input.val();if(!skipPrevCheck&&currentValue==previousValue)return;previousValue=currentValue;currentValue=lastWord(currentValue);if(currentValue.length>=options.minChars){$input.addClass(options.loadingClass);if(!options.matchCase)currentValue=currentValue.toLowerCase();request(currentValue,receiveData,hideResultsNow);}else{stopLoading();select.hide();}};function trimWords(value){if(!value)return[""];if(!options.multiple)return[$.trim(value)];return $.map(value.split(options.multipleSeparator),function(word){return $.trim(value).length?$.trim(word):null;});}function lastWord(value){if(!options.multiple)return value;var words=trimWords(value);if(words.length==1)return words[0];var cursorAt=$(input).selection().start;if(cursorAt==value.length){words=trimWords(value)}else{words=trimWords(value.replace(value.substring(cursorAt),""));}return words[words.length-1];}function autoFill(q,sValue){if(options.autoFill&&(lastWord($input.val()).toLowerCase()==q.toLowerCase())&&lastKeyPressCode!=KEY.BACKSPACE){$input.val($input.val()+sValue.substring(lastWord(previousValue).length));$(input).selection(previousValue.length,previousValue.length+sValue.length);}};function hideResults(){clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){var wasVisible=select.visible();select.hide();clearTimeout(timeout);stopLoading();if(options.mustMatch){$input.search(function(result){if(!result){if(options.multiple){var words=trimWords($input.val()).slice(0,-1);$input.val(words.join(options.multipleSeparator)+(words.length?options.multipleSeparator:""));}else{$input.val("");$input.trigger("result",null);}}});}};function receiveData(q,data){if(data&&data.length&&hasFocus){stopLoading();select.display(data,q);autoFill(q,data[0].value);select.show();}else{hideResultsNow();}};function request(term,success,failure){if(!options.matchCase)term=term.toLowerCase();var data=cache.load(term);if(data&&data.length){success(term,data);}else if((typeof options.url=="string")&&(options.url.length>0)){var extraParams={timestamp:+new Date()};$.each(options.extraParams,function(key,param){extraParams[key]=typeof param=="function"?param():param;});$.ajax({mode:"abort",port:"autocomplete"+input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max},extraParams),success:function(data){var parsed=options.parse&&options.parse(data)||parse(data);cache.add(term,parsed);success(term,parsed);}});}else{select.emptyList();failure(term);}};function parse(data){var parsed=[];var rows=data.split("\n");for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){row=row.split("|");parsed[parsed.length]={data:row,value:row[0],result:options.formatResult&&options.formatResult(row,row[0])||row[0]};}}return parsed;};function stopLoading(){$input.removeClass(options.loadingClass);};};$.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row){return row[0];},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:180};$.Autocompleter.Cache=function(options){var data={};var length=0;function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(options.matchContains=="word"){i=s.toLowerCase().search("\\b"+sub.toLowerCase());}if(i==-1)return false;return i==0||options.matchContains;};function add(q,value){if(length>options.cacheLength){flush();}if(!data[q]){length++;}data[q]=value;}function populate(){if(!options.data)return false;var stMatchSets={},nullData=0;if(!options.url)options.cacheLength=1;stMatchSets[""]=[];for(var i=0,ol=options.data.length;i<ol;i++){var rawValue=options.data[i];rawValue=(typeof rawValue=="string")?[rawValue]:rawValue;var value=options.formatMatch(rawValue,i+1,options.data.length);if(value===false)continue;var firstChar=value.charAt(0).toLowerCase();if(!stMatchSets[firstChar])stMatchSets[firstChar]=[];var row={value:value,data:rawValue,result:options.formatResult&&options.formatResult(rawValue)||value};stMatchSets[firstChar].push(row);if(nullData++<options.max){stMatchSets[""].push(row);}};$.each(stMatchSets,function(i,value){options.cacheLength++;add(i,value);});}setTimeout(populate,25);function flush(){data={};length=0;}return{flush:flush,add:add,populate:populate,load:function(q){if(!options.cacheLength||!length)return null;if(!options.url&&options.matchContains){var csub=[];for(var k in data){if(k.length>0){var c=data[k];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub.push(x);}});}}return csub;}else
if(data[q]){return data[q];}else
if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var c=data[q.substr(0,i)];if(c){var csub=[];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub[csub.length]=x;}});return csub;}}}return null;}};};$.Autocompleter.Select=function(options,input,select,config){var CLASSES={ACTIVE:"ac_over"};var listItems,active=-1,data,term="",needsInit=true,element,list;function init(){if(!needsInit)return;element=$("<div/>").hide().addClass(options.resultsClass).css("position","absolute").appendTo(document.body);list=$("<ul/>").appendTo(element).mouseover(function(event){if(target(event).nodeName&&target(event).nodeName.toUpperCase()=='LI'){active=$("li",list).removeClass(CLASSES.ACTIVE).index(target(event));$(target(event)).addClass(CLASSES.ACTIVE);}}).click(function(event){$(target(event)).addClass(CLASSES.ACTIVE);select();input.focus();return false;}).mousedown(function(){config.mouseDownOnSelect=true;}).mouseup(function(){config.mouseDownOnSelect=false;});if(options.width>0)element.css("width",options.width);needsInit=false;}function target(event){var element=event.target;while(element&&element.tagName!="LI")element=element.parentNode;if(!element)return[];return element;}function moveSelect(step){listItems.slice(active,active+1).removeClass(CLASSES.ACTIVE);movePosition(step);var activeItem=listItems.slice(active,active+1).addClass(CLASSES.ACTIVE);if(options.scroll){var offset=0;listItems.slice(0,active).each(function(){offset+=this.offsetHeight;});if((offset+activeItem[0].offsetHeight-list.scrollTop())>list[0].clientHeight){list.scrollTop(offset+activeItem[0].offsetHeight-list.innerHeight());}else if(offset<list.scrollTop()){list.scrollTop(offset);}}};function movePosition(step){active+=step;if(active<0){active=listItems.size()-1;}else if(active>=listItems.size()){active=0;}}function limitNumberOfItems(available){return options.max&&options.max<available?options.max:available;}function fillList(){list.empty();var max=limitNumberOfItems(data.length);for(var i=0;i<max;i++){if(!data[i])continue;var formatted=options.formatItem(data[i].data,i+1,max,data[i].value,term);if(formatted===false)continue;var li=$("<li/>").html(options.highlight(formatted,term)).addClass(i%2==0?"ac_even":"ac_odd").appendTo(list)[0];$.data(li,"ac_data",data[i]);}listItems=list.find("li");if(options.selectFirst){listItems.slice(0,1).addClass(CLASSES.ACTIVE);active=0;}if($.fn.bgiframe)list.bgiframe();}return{display:function(d,q){init();data=d;term=q;fillList();},next:function(){moveSelect(1);},prev:function(){moveSelect(-1);},pageUp:function(){if(active!=0&&active-8<0){moveSelect(-active);}else{moveSelect(-8);}},pageDown:function(){if(active!=listItems.size()-1&&active+8>listItems.size()){moveSelect(listItems.size()-1-active);}else{moveSelect(8);}},hide:function(){element&&element.hide();listItems&&listItems.removeClass(CLASSES.ACTIVE);active=-1;},visible:function(){return element&&element.is(":visible");},current:function(){return this.visible()&&(listItems.filter("."+CLASSES.ACTIVE)[0]||options.selectFirst&&listItems[0]);},show:function(){var offset=$(input).offset();element.css({width:typeof options.width=="string"||options.width>0?options.width:$(input).width(),top:offset.top+input.offsetHeight,left:offset.left}).show();if(options.scroll){list.scrollTop(0);list.css({maxHeight:options.scrollHeight,overflow:'auto'});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;listItems.each(function(){listHeight+=this.offsetHeight;});var scrollbarsVisible=listHeight>options.scrollHeight;list.css('height',scrollbarsVisible?options.scrollHeight:listHeight);if(!scrollbarsVisible){listItems.width(list.width()-parseInt(listItems.css("padding-left"))-parseInt(listItems.css("padding-right")));}}}},selected:function(){var selected=listItems&&listItems.filter("."+CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);return selected&&selected.length&&$.data(selected[0],"ac_data");},emptyList:function(){list&&list.empty();},unbind:function(){element&&element.remove();}};};$.fn.selection=function(start,end){if(start!==undefined){return this.each(function(){if(this.createTextRange){var selRange=this.createTextRange();if(end===undefined||start==end){selRange.move("character",start);selRange.select();}else{selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}}else if(this.setSelectionRange){this.setSelectionRange(start,end);}else if(this.selectionStart){this.selectionStart=start;this.selectionEnd=end;}});}var field=this[0];if(field.createTextRange){var range=document.selection.createRange(),orig=field.value,teststring="<->",textLength=range.text.length;range.text=teststring;var caretAt=field.value.indexOf(teststring);field.value=orig;this.selection(caretAt,caretAt+textLength);return{start:caretAt,end:caretAt+textLength}}else if(field.selectionStart!==undefined){return{start:field.selectionStart,end:field.selectionEnd}}};})(jQuery);
(function($){var ajax=$.ajax;var pendingRequests={};var synced=[];var syncedData=[];$.ajax=function(settings){settings=jQuery.extend(settings,jQuery.extend({},jQuery.ajaxSettings,settings));var port=settings.port;switch(settings.mode){case"abort":if(pendingRequests[port]){pendingRequests[port].abort();}
return pendingRequests[port]=ajax.apply(this,arguments);case"queue":var _old=settings.complete;settings.complete=function(){if(_old)
_old.apply(this,arguments);jQuery([ajax]).dequeue("ajax"+port);;};jQuery([ajax]).queue("ajax"+port,function(){ajax(settings);});return;case"sync":var pos=synced.length;synced[pos]={error:settings.error,success:settings.success,complete:settings.complete,done:false};syncedData[pos]={error:[],success:[],complete:[]};settings.error=function(){syncedData[pos].error=arguments;};settings.success=function(){syncedData[pos].success=arguments;};settings.complete=function(){syncedData[pos].complete=arguments;synced[pos].done=true;if(pos==0||!synced[pos-1])
for(var i=pos;i<synced.length&&synced[i].done;i++){if(synced[i].error)synced[i].error.apply(jQuery,syncedData[i].error);if(synced[i].success)synced[i].success.apply(jQuery,syncedData[i].success);if(synced[i].complete)synced[i].complete.apply(jQuery,syncedData[i].complete);synced[i]=null;syncedData[i]=null;}};}
return ajax.apply(this,arguments);};})(jQuery);
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){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;};})(jQuery);

jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++) {
		jQuery("<img>").attr("src", arguments[i]);
	}
}
function GetThisMyspace(T, C, U, L) { 
	var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T) 
	+ '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L; 
	window.open(targetUrl); 
}
function setup_hide_affiliate_button() {
	$(".hide-affiliate-button").css('opacity', 0);
	$(".hide-affiliate-button").click(function(){
		$("#affiliate-li-"+$(this).attr("iID")+"-"+$(this).attr("aID")).remove();
		if ($("#affiliate-links-"+$(this).attr("iID")+" li").size() < 1) {
			$("#affiliate-links-"+$(this).attr("iID")).hide();
		}
		$.get("hide_affiliate_link_ajax.php", { item_id: $(this).attr("iID"), affiliate_url_id: $(this).attr("aID") });
		return false;
	});
	$(".affiliate-links").hover(function(){
		$(".hide-affiliate-button", this).stop().animate({opacity:1}, 400)
	}, function() {
		$(".hide-affiliate-button", this).stop().animate({opacity:0}, 400)
	});
}
$(document).ready(function(){
	
	//make our tables pretty
	function stripeMe(){
		$(".stripeMe li").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
		$('.stripeMe li:even').addClass('alt'); 
	}
	stripeMe();
	
// navigation 
	function addMega(){ 
		$(this).addClass("hovering"); 
		$($(this).find("h2 a")).addClass("hover"); 
	} 
	function removeMega(){ 
		$(this).removeClass("hovering"); 
		$($(this).find("h2 a")).removeClass("hover"); 
	}

	var megaConfig = {    
	     interval: 100,
	     sensitivity: 10,
		 over: addMega, 
	     timeout: 200,
	     out: removeMega
	};

	$("li.mega").hoverIntent(megaConfig)

// Import Functions
	
	$("#search-amazon-lists").submit(function(){
		$('#search-amazon-lists-submit').attr("disabled", true);
		$('#search-amazon-lists-submit').attr("src", "t/default/img/ajax-loader.gif");
		$('.amazon-import-undo').append(" <em class='search_cancel'>undo?</em>");
		$('#search-amazon-lists-response-form').load("amazon_list_search_ajax.php", {e: $('#search-amazon-lists-user-textbox').val(), hash: $('#search-lists-hash-hidden-amazon').val()},function(){
		
			$('#search-amazon-lists-submit').hide();
			
			$("#search-amazon-lists-response-form").submit(function(){
				$('#amazon-import-submit').attr("disabled", true);
				$('#amazon-import-submit').attr("src", "t/default/img/ajax-loader.gif");
				$("#search-amazon-lists-response-form").append('Please wait, this might take a while...');
				return true;
			});
		});
		$(".search_cancel").click(function(){ 
			$('#search-amazon-lists-submit').attr("disabled", false);
			$('#search-amazon-lists-submit').attr("src", "t/default/img/btn_import.png");
			$('#search-amazon-lists-submit').show();
			$('#search-amazon-lists-user-textbox').attr("value", "");
			$('.amazon-import-undo').html("");
			$('#search-amazon-lists-response-form').html("");
			return false;
		});
		return false;
	});
	
	$("#search-newegg-list-form").submit(function(){
		$('#search-newegg-lists-submit').attr("disabled", true);
		$('#search-newegg-lists-submit').attr("src", "t/default/img/ajax-loader.gif");
		$('.newegg-import-undo').append(" <em class='search_cancel'>undo?</em>");
		$('#search-newegg-response-form').load("newegg_list_search_ajax.php", {url: $('#newegg-list').val(), hash: $('#search-lists-hash-hidden-newegg').val()},function(){
		
			$('#search-newegg-lists-submit').hide();
			
			$("#search-newegg-lists-response-form").submit(function(){
				$('#newegg-import-submit').attr("disabled", true);
				$('#newegg-import-submit').attr("src", "t/default/img/ajax-loader.gif");
				$("#search-newegg-lists-response-form").append('Please wait, this might take a while...');
				return true;
			});
		});
		$(".search_cancel").click(function(){ 
			$('#search-newegg-lists-submit').attr("disabled", false);
			$('#search-newegg-lists-submit').attr("src", "t/default/img/btn_import.png");
			$('#search-newegg-lists-submit').show();
			$('#search-newegg-lists-user-textbox').attr("value", "");
			$('.newegg-import-undo').html("");
			$('#search-newegg-response-form').html("");
			return false;
		});
		return false;
	});

// Add item from top add item bar

	$('.default_text').focus(function() {
	    if (this.value == this.defaultValue){ 
	    	this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('.default_text').blur(function() {
	    if ($.trim(this.value) == ''){
	    	this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});

	// hide the slide bars, might want to move this to CSS for users without javascript
	$("#add-item-response-wait").css('height', 0).css('opacity', 0);
	$("#add-item-response").css('height', 0).css('opacity', 0);
	$("#pages-cache").hide();
	
	function showPleaseWaitSlider(){
		$('#add-item-response-wait').append("<p><img src='t/default/img/ajax-loader.gif' alt='please wait' /> Please wait while we grab your item</p>");
		$("#add-item-response-wait").animate({height:'40px', opacity: '1'},{queue:false, duration:250, easing: 'easeOutQuad'});
	}
	function hidePleaseWaitSlider(){
		$("#add-item-response-wait").animate({height:'0px', opacity: '0'},{queue:false, duration:300, easing: 'easeInQuad', complete: function() {
			//clear out the div so the spinning gif isnt using cycles
			$('#add-item-response-wait').html('');
		}});
	}
	
	$("#add-item-form-front-page").submit(function(){
		$('#add-item-textbox').val($('#add-item-textbox-front-page').val())
		$("#add-item").submit();
		return false;
	});
	
	$("#add-item").submit(function(){
		if ($('#add-item-textbox').val() != '') {
			$('.ac_results').hide();
			showPleaseWaitSlider();
			$('#add-item-response').load("item_small_edit_slider.php", {url: $('#add-item-textbox').val()},function(){
				hidePleaseWaitSlider();
				var slider_height;
				if ( $("#item_search_slider").length > 0) {
					//they are searching
					//clear the cache in case they have another search still in the browser
					$('#pages-cache').html('');
					//cache the current page
					$('#pages-cache').append("<div id='search-item-page-cache-0'></div>");
					$('#search-item-page-cache-0').html($('#add-item-response').html());
					//cache the next page
					if ($('#add-item-response .pagination-button-next').attr('current_page') < $('#add-item-response .pagination-button-next').attr('num_pages')) {
						//create the page
						$('#pages-cache').append("<div id='search-item-page-cache-" + $('.pagination-button-next').attr('p') + "'></div>");
						$('#search-item-page-cache-' + $('.pagination-button-next').attr('p')).load("item_small_edit_slider.php", {url: $('#add-item-textbox').val(), p: $('.pagination-button-next').attr('p'), c: $('.pagination-button-next').attr('c')},function(){
							$('#add-item-response .pagination-button-next').attr('disabled', false).removeClass('disabled waiting').addClass('active-next');
						});
					}
					/*
					//don't know why this was here, since it is a form submit button and will submit naturally. I must have changed something in the past.
					$(".search-item-button-want").click(function(){
						var formID = $(this).attr("fID");
						$('#item-slider-form-'+formID).submit();
					});
					*/
					$('.pagination-button').click(function(){
						searchItemResponse($(this).attr("direction"));
						return false;
					});
					$('#skip-item-search').click(function(){
						$('#add-item-response').load("item_small_edit_slider.php", {url: $('#add-item-textbox').val(), skip_item_search: 'true'},function(){
							$("#item-save-button-slider").click(function(){ 
								$('#item-save-button-slider').attr("disabled", true);
								$('#item-slider-form').submit();
							});
							load_jcarousel();
							slider_height = "120px";
							$("#add-item-response").animate({height:slider_height, opacity: '1'},{queue:false, duration:500, easing: 'easeInSine'});
						});
					});
					slider_height = "250px";
				} else {
					//they entered a url
					if ($("#item-price-check-url-hidden").length > 0) {
						if ($("#item-price-check-url-hidden").attr("value").length > 0) {
							$.get($("#item-price-check-url-hidden").attr("value"), {},function(data){
								$('#price-'+data).attr("selected","selected");
							});
						}
					}
					$("#item-save-button-slider").click(function(){ 
						$('#item-save-button-slider').attr("disabled", true);
						$('#item-slider-form').submit();
					});
					load_jcarousel();
					slider_height = "120px";
				}
				$("#add-item-response").animate({height:slider_height, opacity: '1'},{queue:false, duration:500, easing: 'easeInSine'});
			}); // #add-item-response
		}
	return false;
	}); // #add-item
	
	function searchItemResponse(direction) {
		if (direction == 'prev') {
			//prev <- left
			$('#add-item-response').animate({left:$(document).width()+'px'},{queue:false, duration:250, easing: 'easeInSine', complete: function() {
				$('#add-item-response').html($('#search-item-page-cache-'+$('#add-item-response .pagination-button-prev').attr('p')).html());
				$('#add-item-response .pagination-button').click(function(){
					searchItemResponse($(this).attr("direction"));
					return false;
				});
				$('#add-item-response .pagination-button-next').attr('disabled', false).removeClass('disabled waiting').addClass('active-next');
				if ($('#add-item-response .pagination-button-prev').attr('current_page') > 1) {
					$('#add-item-response .pagination-button-prev').attr('disabled', false).removeClass('disabled');
				} else {
					$('#add-item-response .pagination-button-prev').attr('disabled', true).addClass('disabled');
				}
				/*
				//don't know why this was here, since it is a form submit button and will submit naturally. I must have changed something in the past.
				$("#add-item-response .search-item-button-want").click(function(){
					$('#item-slider-form-'+$(this).attr("fID")).submit();
				});
				*/
				$('#add-item-response').css('left','-'+$(document).width()+'px');
				$('#add-item-response').animate({left:'0px'},{queue:false, duration:500, easing: 'easeOutQuad', complete: function() {
				}});
			}});
		} else {
			//next -> right
			$('#add-item-response').animate({left:'-'+$(document).width()+'px'},{queue:false, duration:250, easing: 'easeInSine', complete: function() {
				$('#add-item-response').html($('#search-item-page-cache-'+$('#add-item-response .pagination-button-next').attr('p')).html());
				$('#add-item-response .pagination-button').click(function(){
					searchItemResponse($(this).attr("direction"));
					return false;
				});
				/*
				//don't know why this was here, since it is a form submit button and will submit naturally. I must have changed something in the past.
				$("#add-item-response .search-item-button-want").click(function(){
					$('#item-slider-form-'+$(this).attr("fID")).submit();
				});
				*/
				$('#add-item-response .pagination-button-prev').attr('disabled', false).removeClass('disabled');
				$('#add-item-response .pagination-button-next').attr('disabled', true).addClass('disabled');
				if (Number($('#add-item-response .pagination-button-next').attr('current_page')) < Number($('#add-item-response .pagination-button-next').attr('num_pages'))) {
					if ($("#search-item-page-cache-" + $('#add-item-response .pagination-button-next').attr('p')).length < 1) {
						$('#pages-cache').append("<div id='search-item-page-cache-" + $('#add-item-response .pagination-button-next').attr('p') + "'></div>");
						$('#search-item-page-cache-' + $('#add-item-response .pagination-button-next').attr('p')).load("item_small_edit_slider.php", {url: $('#add-item-textbox').val(), p: $('#add-item-response .pagination-button-next').attr('p'), c: $('#add-item-response .pagination-button-next').attr('c')},function(){
							$('#add-item-response .pagination-button-next').attr('disabled', false).removeClass('disabled waiting').addClass('active-next');
						});
					} else {
						$('#add-item-response .pagination-button-next').attr('disabled', false).removeClass('disabled waiting').addClass('active-next');
					}
				}
				$('#add-item-response').css('left',$(document).width()+'px');
				$('#add-item-response').animate({left:'0px'},{queue:false, duration:600, easing: 'easeOutQuad', complete: function() {
				}});
			}});
		}
	}

// save item called from bookmarklet
// this id is present in item_small_edit_slider.php, but normally that html appears via ajax, so this bit of javascript is ignored unless we are on the bookmarklet
$("#item-slider-form").submit(function(){ 
	$('#item-save-button-slider').attr("disabled", true);
	//Pete, can you put these feedback appends somewhere?
	//$('#bookmarklet_header').append("<img src='t/default/img/ajax-loader.gif' alt='please wait' />Saving... Please wait.");
	$.post($("#item-slider-form").attr('action'),$("#item-slider-form").serializeArray(),function(data){ 
		//$('#bookmarklet_header').append(" Success!");
		window.close();
	});
	return false;
});

//if they are on the bookmarklet page
if ($("#bookmarklet-page").length > 0) {
	load_jcarousel();
}

function load_jcarousel() {
	var current_image_key = 0;
	$(".jcarousellite-box").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		visible: 1,
		circular: false,
		afterEnd: function(current_image_key) { 
			$("#item-image-hidden").attr("value", $("#carousel-image-"+current_image_key).attr("src")); 
		}
	});
}
	
	
// share your list
	$("#share-your-list-ul").hide();
	$(".share").click(function(){ 
		$("#share-your-list-ul").toggle("blind",{}, 350).stop();
		$(this).toggleClass("active"); return false;
	});
	
	$("#friends-ul").hide();
	$(".view_friends").click(function(){ 
		$("#friends-ul").toggle("blind",{}, 350).stop();
		$(this).toggleClass("active"); return false;
	});

// == save/edit wishlist == //
	
	//fade these out at the beginning
	$(".list-modify").css('opacity', 0);
	$(".display-price img").css('opacity', 0);
	$("li .edit-2").hide();
	
	$(".list-item").hover(function(){
		//$(this).addClass('hover');
		$(".list-modify", this).stop().animate({opacity:1}, 400);
		$(".display-price img", this).stop().animate({opacity:.7}, 400);
	}, function(){
		if ($(this).is(".editing")) {
			//don't remove the buttons
		} else {
			$(".list-modify", this).stop().animate({opacity:0}, 400);
			$(".display-price img", this).stop().animate({opacity:0}, 400);
		}
		//$(this).removeClass('hover');
	});
	
	$(".button-edit").click(function(){ 
		var formID = $(this).attr("fID");
		var originalBackground = $("#list-item-"+formID).css('background-color');
		$("#list-item-"+formID).animate({ backgroundColor: "white" }, 50,function(){
			$("#list-item-"+formID).animate({ backgroundColor: originalBackground }, 200);
		});
		//just a variable so that if they roll off the li the save button won't dissapear
		$("#list-item-"+formID).addClass('editing');
		$("#list-item-"+formID+" .edit-1").hide();  
		$("#list-item-"+formID+" .edit-2").show();
	});

	$(".button-save").click(function(){
		var formID = $(this).attr("fID");
		save_item_changes(formID);
	}); 
	
	$(".edit-item-form").submit(function(){
		var formID = $(this).attr("fID");
		save_item_changes(formID);
		return false;
	});
	
	function save_item_changes(formID) {
		$.post($("#edit-form-"+formID).attr('action'),$("#edit-form-"+formID).serializeArray(),function(data){ 
			$("#affiliate-links-"+formID).stop().animate({"opacity":0}, 500);
			$.get("create_affiliate_urls_ajax.php",{item_id: formID},function(data){
				if ($("#affiliate-links-"+formID).length > 0) {
				} else {
					$("#list-item-"+formID).append("<ul id='affiliate-links-"+formID+"' class='affiliate-links edit-1'></ul>");
				}
				$("#affiliate-links-"+formID).html(data).stop();
				setup_hide_affiliate_button();
				$("#affiliate-links-"+formID).animate({"opacity":1}, 500);
			});
		});
		var originalBackground = $("#list-item-"+formID).css('background-color');
		$("#list-item-"+formID).animate({ backgroundColor: "white" }, 50,function(){
			$("#list-item-"+formID).animate({ backgroundColor: originalBackground }, 200);
		});
		$("#title-"+formID).html($("#edit-title-textbox-"+formID).val());
		$("#price-"+formID).html($("#edit-price-textbox-"+formID).val());
		$("#sub-text-"+formID).html($("#edit-sub-text-textbox-"+formID).val());
		$("#list-item-"+formID+" .edit-2").hide();   
		$("#list-item-"+formID+" .edit-1").show();    
		$("#list-item-"+formID+" .list-modify").stop().animate({opacity:0}, 400);
		$("#list-item-"+formID).removeClass('editing');
	}
	
	$(".button-want").click(function(){
		var formID = $(this).attr("fID");
		$('#i-want-this-button-'+formID).attr("disabled",true);
		$.post('i_want_this_too_ajax.php',{item_id: formID,hash: $(this).attr("hash")},function(data){ 
		});
		$("#list-item-"+formID).animate({ backgroundColor: "#fff" }, 100,function(){
			$("#list-item-"+formID).animate({ backgroundColor: '#eaeaea' }, 200);
		});
		$('#i-want-this-button-'+formID).html('added').removeClass('button-want').addClass('wanted');
	}); 
	
	$(".button-delete").click(function(){
		var formID = $(this).attr("fID");
		$.post('delete_item.php',{item_id: formID,hash: $(this).attr("hash")},function(data){ 
		});
		$("#list-item-"+formID).stop().hide("puff",{},400);
	});
	
	// discard ALL changes if pressing esc 
	$(document).keydown(function(e) {
		if (e.keyCode == 27) {
			$(".edit-2").hide();
			$(".edit-1").show();
			$("li.editing").removeClass('editing');
			$(".list-modify").stop().animate({opacity:0}, 400)
			$(".add-comment-div").hide();
			$(".mark-purchased-div").hide();
		}
	});
	
	$("#wishlist-items").sortable({
			handle : '.handle', 
			revert: true,
			stop: function(event,ui) {
				var this_order_array = $('#wishlist-items').sortable('serialize');
				$.get('reorder_items_ajax.php?'+this_order_array,{},function(data){ 
				});
			},
			opacity: .6
	});
	
	$('#no_comments_dialog').dialog({'autoOpen': false});
	$('#must_be_followed_comments_dialog').dialog({'autoOpen': false});
	$('#must_be_logged_in_comments_dialog').dialog({'autoOpen': false});
	$('#must_be_logged_in_mark_purchased_dialog').dialog({'autoOpen': false});
	$('#must_be_followed_mark_purchased_dialog').dialog({'autoOpen': false});
	
	$(".cancel-comment").click(function(){
		var fID = $(this).attr("fID");
		$("#add-comment-"+fID).hide("blind",{},350);
		return false;
	});
	
	$(".cancel-mark").click(function(){
		var fID = $(this).attr("fID");
		$("#mark-purchased-"+fID).hide("blind",{},350);
		return false;
	});

	$(".add-comment-button").click(function(){
		var fID = $(this).attr("fID");
		if ($(this).attr("u") > 0) {
			if ($(this).attr("c") == 0) {
				//user doesn't allow anyone to comment
				$('#no_comments_dialog').dialog('open');
			}
			if ($(this).attr("c") == 1 && $(this).attr("f") == 0) {
				//this user must be following you to comment
				$('#must_be_followed_comments_dialog').dialog('open');
				
			}
			if ($(this).attr("c") == 2 || ($(this).attr("c") == 1 && $(this).attr("f") == 1)) {
				$("#add-comment-"+fID).toggle("blind",{},350);
			}
		} else {
			//you must be logged in to do this
			$('#must_be_logged_in_comments_dialog').dialog('open');
		}
		return false;
	});
	
	function setup_delete_comment_button() {
		$(".delete-comment-button").click(function(){
			$("#item-comment-"+$(this).attr("cID")).hide();
			$.get("delete_comment_ajax.php", { comment_id: $(this).attr("cID") });
			return false;
		});
	}
	setup_delete_comment_button();
	setup_hide_affiliate_button();
	
	$(".add-comment-form").submit(function(){
		var fID = $(this).attr("fID");
		$("#add-comment-form-submit-"+fID).attr("disabled",true);
		if ($("#clt"+fID).length == 0) {
			$(this).append('<input type="hidden" id="clt'+fID+'" name="comment_location_type" value="1" /><input type="hidden" name="comment_location_id" value="'+fID+'" />');
		}
		$.post($(this).attr('action'),$(this).serializeArray(),function(data){ 
			if (data != 'false') {
				//clear the comment form
				$("#comment-text-"+fID).val('');
				$("#add-comment-form-submit-"+fID).attr("disabled",false);
				$("#item-comments-div-"+fID).html(data).animate({opacity:1}, 400,function(){
					setup_delete_comment_button();
				});
			}
		});
		$("#add-comment-"+fID).hide("blind",{},350);
		return false;
	});
	
	$(".mark-purchased-button").click(function(){
		var fID = $(this).attr("fID");
		if ($(this).attr("u") > 0) {
			if ($(this).attr("f") == 0) {
				//this user must be following you to mark
				$('#must_be_followed_mark_purchased_dialog').dialog('open');
			} else {
				if ($(this).attr("liuhm") == "yes") {
					$(this).attr("disabled",true);
					if ($(this).attr("m") < 2) {
						$("#list-item-"+fID).removeClass("purchased");
					}
					$(this).attr("liuhm","no");
					$("#mark-as-purchased-button-"+fID).attr("m",$("#mark-as-purchased-button-"+fID).attr("m")-1);
					$(this).html("Mark As Purchased");
					$.get("mark_purchased_ajax.php", { hash: $("#mark-hash-"+fID).attr("value"), item_id: fID, action: "remove" }, function(data) {
						$("#item-marked-info-"+fID).html(data).animate({opacity:1}, 400)
						$("#mark-as-purchased-button-"+fID).attr("disabled",false);
					});
				} else {
					$("#mark-purchased-"+fID).toggle("blind",{},350);
				}
			}
		} else {
			//you must be logged in to do this
			$('#must_be_logged_in_mark_purchased_dialog').dialog('open');
		}
		return false;
	});
	
	$(".mark-purchased-form").submit(function(){
		var fID = $(this).attr("fID");
		$("#mark-purchased-form-submit-"+fID).attr("disabled",true);
		$("#list-item-"+fID).addClass("purchased");
		$.post($(this).attr('action'),$(this).serializeArray(),function(data){ 
			if (data != 'false') {
				//clear the comment form
				$("#mark-text-"+fID).val('');
				$("#mark-purchased-form-submit-"+fID).attr("disabled",false);
				$("#mark-as-purchased-button-"+fID).html("Remove Purchase Mark");
				$("#mark-as-purchased-button-"+fID).attr("liuhm","yes");
				$("#mark-as-purchased-button-"+fID).attr("m",$("#mark-as-purchased-button-"+fID).attr("m")+1);
				var data_array = data.split('|||||', 2);
				$("#item-marked-info-"+fID).html(data_array[0]).animate({opacity:1}, 400)
				$("#item-comments-div-"+fID).html(data_array[1]).animate({opacity:1}, 400)
			}
		});
		$("#mark-purchased-"+fID).hide("blind",{},350);
		return false;
	});	
	
	$(".sort_link").click(function(){
		var sort_key = $(this).attr("o");
		if (sort_key =='date_desc') {
			$("ol#wishlist-items>li").tsort({attr:"item_id",order:"desc"});
		} else {
			if (sort_key =='date_asc') {
				$("ol#wishlist-items>li").tsort({attr:"item_id",order:"asc"});
			} else {
				$("ol#wishlist-items>li").tsort({attr:sort_key});
			}
		}
		if (sort_key == 'priority') {
			$("#wishlist-items").sortable('enable');
		//	$(".list-item").css({"cursor": "move"});
		} else {
			$("#wishlist-items").sortable('disable');
			//above sets the opacity to 0 in addition to disabling the drag and drop functionality, so we need to make opacity 1 again
			$("#wishlist-items").css({"opacity":1});
		//	$(".list-item").css({"cursor": "auto"});
		}
		$(".sort_link").css({"text-decoration":"none","font-weight":"normal"});
		$("#sort_link_"+sort_key).css({"text-decoration":"underline","font-weight":"bold"});
		return false;
	});
	
	// sort links
	$("#sort_links ul").hide();
	$("#sort_links h6").click(function(){ 
		$("#sort_links ul").toggle("blind",{}, 200).stop();
		$(this).toggleClass("active"); return false;
	});

	$("html").click(function(event){
		$("sort_links ul").hide();
	});
	
	//comments
	$(".add-comment-div").hide();
	
	//mark as purchased
	$(".mark-purchased-div").hide();
	
	//create print link
	$('.share-print a').click(function() {
		window.print();
		return false;
	});
	
	$('.external').click(function() {
		if (typeof(_gaq) !== "object") {
			return true;
		} else {
			_gaq.push(['_setAccount', 'UA-10801459-1'],['_setDomain', '.wantsthis.com'],['_setDomainName', '.wantsthis.com'],['_setAllowHash', false],['_trackPageview','outgoing/external.html']);
			return true;
		}
	});
	
	// graph popups

   $('.display-price img').each(function(){
      var content = '<img src="';
      content += $(this).attr('id');
      content += '" alt="price graph" height="180" width="400" />';
      
	// Setup the tooltip with the content
      $(this).qtip({
		content: content,
   		position: {
      		corner: {
         		target: 'rightMiddle',
         		tooltip: 'leftMiddle'
      		}
   		},
		style: { 
			width: 400,
			padding: 5,
			background: '#fff',
			color: 'black',
			textAlign: 'center',
			border: {
				width: 3,
				radius: 5,
				color: '#ccc'
			},
      	tip: 'leftMiddle',
		name: 'dark' // Inherit the rest of the attributes from the preset dark style
		}
		});
	});
	
	$("#settings-submit").click(function(){
		$('#settings-submit').attr("disabled", true);
		$("#settings-form").submit();
	})
	
	$('.preferences_checkbox').checkbox({
	  empty: 't/default/img/empty.png'
	});
	$('.preferences_checkbox').click(function() {
		var this_value = 0;
		if ($(this).attr('checked')) {
			this_value = 0;
		} else {
			this_value = $(this).attr('value');
		}
		$.get("set_pref_ajax.php", { id: $(this).attr("name"), val: this_value } );
	});

	$('.preferences_select_menu').change(function() {
		$.get("set_pref_ajax.php", { id: $(this).attr("name"), val: $(this).val() } );
	});
	
	$("#friend-button").click(function(){
		$("#friend-button").attr("disabled",true);
		$.get("add_friend_ajax.php",{type: $(this).attr("friendType"), user_id: $(this).attr("userID"), hash: $(this).attr("hash")},function(data) {
			$("#friend-button").attr("disabled",false);
		});
		if ($("#friend-button").attr("friendType") == "add") {
				$("#friend-button").html($("#friend-button").attr("stopFollowingText"));
				$("#friend-button").attr("friendType","remove")
		} else {
			if ($("#friend-button").attr("friendType") == "remove") {
				$("#friend-button").html($("#friend-button").attr("followText"));
				$("#friend-button").attr("friendType","add")
			}
		}
	});
	
	$("#wishlist-name-textbox").change(function(){check_subdomain_availability()});
	
	$("#check-subdomain-button").click(function(){check_subdomain_availability()});
	
	function check_subdomain_availability() {
		$("#check-subdomain-response").slideUp("fast");
		$('#check-subdomain-button').attr("disabled",true);
		$('#check-subdomain-button').attr("value", "Checking...");
		$("#check-subdomain-response").load("check_subdomain_availability.php", {subdomain: $('#wishlist-name-textbox').val()}, function(){
			$("#check-subdomain-response").slideDown("fast");
			$('#check-subdomain-button').removeAttr("disabled");
			$('#check-subdomain-button').attr("value", "Check it, baby!");
		});
	}
	
	$("#rename-wishlist").submit(function(){
		$('#rename-wishlist-submit').attr("disabled",true);
		$('#password-field-response').append("");
		if ($('#wishlist-name-textbox').val() != '') {
			if ($('#password-textbox1').val() == $('#password-textbox2').val()) {
				$("#rename-wishlist-feedback").html('Please wait, this will take about 10 seconds...');
			} else {
				//highlight the password boxes,need to make this look better. Also, instead of adding style attr, it should probably add a class
				$('#password-textbox1').addClass("error_highlight");
				$('#password-textbox2').addClass("error_highlight");
				//$('#box_error_message').addClass("error");
				//$('#box_error_message').append("Oops! The password fields need to match");
				alert("Oops! The password fields need to match");
				$('#rename-wishlist-submit').attr("disabled",false);
				return false;
			}
		} else {
			//highlight the password boxes,need to make this look better. Also, instead of adding style attr, it should probably add a class
			$('#wishlist-name-textbox').addClass("error_highlight");
			//$('#box_error_message').addClass("error");
			//$("#box_error_message").append("Swing and a miss there Howard. You need to choose a name.");
			alert("Swing and a miss there Howard. You need to choose a name.");
			$('#rename-wishlist-submit').attr("disabled",false);
			return false;
		}
	});
	
	$("#submit-blogger-form").click(function(){
		$("#blogger-form").submit();
	});
	
	if ($("#member-search-textbox").length > 0) {
		$("#member-search-textbox").autocomplete('search.php', {
			multiple: false,
			dataType: "json",
			minChars: 2,
			selectFirst: false,
			parse: function(data) {
				return $.map(data, function(row) {
					return {
						data: row,
						value: row.full_name,
						result: row.full_name
					}
				});
			},
			formatItem: function(item) {
				return item.text;
			}
		}).result(function(event, item) {
			location.href = item.url;
		});
	}
	if ($("#add-item-textbox").length > 0) {
		$("#add-item-textbox").autocomplete('item_search_autocomplete_ajax.php', {
			multiple: false,
			dataType: "json",
			minChars: 2,
			selectFirst: false,
			parse: function(data) {
				return $.map(data, function(row) {
					return {
						data: row,
						value: row.search_text,
						result: row.search_text
					}
				});
			},
			formatItem: function(item) {
				return item.search_text;
			}
		}).result(function(event, item) {
			$("#add-item-textbox").val(item.search_text);
			$("#add-item").submit();
		});
	}
	$(".item_search_text").click(function(){
		$('#add-item-textbox').val($(this).attr('value'));
		$("#add-item").submit();
		return true;
	});
	
	//Max Length for user input textareas
	
	setMaxLength();     
    $("textarea.checkMax").bind("click mouseover keyup change", function(){checkMaxLength(this.id); })

	function setMaxLength() {
    	$("textarea.checkMax").each(function(i){
        	intMax = $(this).attr("maxlength");
        	$(this).after("<div><span id='"+this.id+"Counter'>"+intMax+"</span> remaining</div>");
        });
    }
	function checkMaxLength(strID){
        intCount = $("#"+strID).val().length;
        intMax = $("#"+strID).attr("maxlength");
        strID = "#"+strID+"Counter";
        $(strID).text(parseInt(intMax) - parseInt(intCount));
        if (intCount < (intMax * .8)) {$(strID).css("color", "#006600"); } //good
        if (intCount > (intMax * .8)) { $(strID).css("color", "#FF9933"); } //warning at 80%
        if (intCount > (intMax)) { $(strID).text(0).css("color", "#990000"); } //over
    }
});
