function trim(stringToTrim){if(stringToTrim){return stringToTrim.replace(/^\s+|\s+$/g,"");}}function ltrim(stringToTrim){if(stringToTrim){return stringToTrim.replace(/^\s+/,"");}}function rtrim(stringToTrim){if(stringToTrim){return stringToTrim.replace(/\s+$/,"");}}function openResizeWindow(url){window.open(url,"Resize","toolbar=yes,location=yes,scrollbars=yes,resizable=yes,width=800");}function Add2ShopCart(form){quantity=parseInt(form.quantity.value);if(form.maxQuantity!=null&&quantity>0&&quantity>parseInt(form.maxQuantity.value)){alert("There is a maximum quantity limit on this item.");}else{form.URL.value="OrderCalculate?calculationUsageId=-5&orderItemId*=&quantity*=&URL=OrderItemDisplay";form.addItem.value="true";form.submit();}}function Add2Favorites(form,encodedURL){form.action=encodedURL;form.URL.value="InterestItemDisplay";form.submit();}function MM_openBrWindow(theURL,winName,features){window.open(theURL,winName,features);}function openShippingInfoWindow(theURL){window.open(theURL,"ShippingInfoWindow","scrollbars=yes,height=600,width=600,resizable=yes");}function popUpEmailToFriend(url){emailToFriendWin=window.open(url,"emailwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=700,height=450");emailToFriendWin.focus();}function checkNumOfComparedItem(form,totalItemDisplayed){var count=0;form.compareItems.value="";for(var i=0;i<totalItemDisplayed;i++){box=eval("document."+form.name+".compareItem"+i);if(box.checked){count++;if(count>3){alert("Only 3 items can be compared at the same time!");box.checked=false;}else{form.compareItems.value=form.compareItems.value+box.value+"_";}}}}function checkNumOfComparedItemChked(form,totalItemDisplayed){var count=0;form.compareItems.value="";for(var i=0;i<totalItemDisplayed;i++){box=eval("document."+form.name+".compareItem"+i);if(box.checked){count++;}}return count;}function openLibraryWindow(){window.open("Swanson/html/SHPLib_main.html","LibraryWindow","scrollbars=yes,toolbar=yes,height=400,width=450,resizable=yes");}function openGSpopupWindow(theURL){window.open(theURL,"GSpopupWindow","scrollbars=yes,toolbar=no,height=500,width=500,resizable=yes");}function isNotEmpty(elem){var str=elem.value;var re=/.+/;if(!str.match()){alert("Please fill");return false;}else{return true;}}function isLen7(elem){var str=elem.value;var re=/\d{7}/;if(re.test(str)){return true;}else{return false;}}function isLen4(elem){var str=elem.value;var re=/\d{4}/;if(re.test(str)){return true;}else{return false;}}function isMatchPatten(elem,patten){var str=trim(elem.value);if(patten.test(str)){return true;}else{return false;}}function PartnerPageAdd2ShopCart(form,qty,partNumber){form.URL.value="OrderCalculate?calculationUsageId=-5&orderItemId*=&quantity*=&URL=OrderItemDisplay";form.partNumber_1.value=partNumber.toUpperCase();form.quantity_1.value=qty;form.addAllItemsQB.value="true";form.submit();}function prepareSubmitOrderStatusEntry(form){var lenthMatch=isMatchPatten(form.order,/(^\d{7}$|^\d{8}$)/);var stringMatch=isMatchPatten(form.lastName,/.+/);if(!lenthMatch){alert("Order number must only contain 7 or 8 digits!");}else{if(!stringMatch||form.lastName.value==""){alert("Please fill out your last name!");}else{form.order.value=trim(form.order.value);form.lastName.value=trim(form.lastName.value);form.submit();}}}function getProductRecs(recItems,targetNode,template){if(!template){template="layout.default";}for(x=0;x<recItems.length;x++){$.post("/omniture.ajax.do?ajax=true&t="+template+"&in="+recItems[x],function(data){$(targetNode).append(data);});}}function fetchRecs(recItems,targetNode,template){if(!template){template="layout.default";}var html='<ul class="rec-list">';var d=new Date();d=d.getTime();for(var x=0;x<recItems.length;x++){var i=x+d;html+="<li id=pr"+i+' class="rec-progress"></li>';getRec(recItems[x],i);}html+="</ul>";$(targetNode).append(html);function getRec(rec,x){$.post("/omniture.ajax.do?ajax=true&t="+template+"&in="+rec,function(data){$(targetNode+" #pr"+x).removeClass("rec-progress");if(data.length>50){$(targetNode+" #pr"+x).append(data);}else{$(targetNode+" #pr"+x).append("<p>Item "+rec+" is no longer available.</p>");$(targetNode+" #pr"+x).addClass("unavailable");}});}}function createProductList(skus,slots,node,template){if(!template){template="layout.default";}var node_jqt="#"+node;var pages=1;var this_page=1;var page_array=new Array();var first_sku_array=new Array();var sku_total=skus.length;if(sku_total>slots){if(sku_total%slots){skus.splice(Math.floor(sku_total/slots)*slots);sku_total=skus.length;}if(sku_total>slots){pages=Math.floor(sku_total/slots);$(node_jqt).append('<div class="rec-stepper"><a class="prev-btn" href="#prev"></a><a class="next-btn" href="#next"></a></div><div class="rec-pagination">Page 1 of '+pages+"</div>");$(node_jqt+" a.next-btn").bind("click",nextItem);$(node_jqt+" a.prev-btn").bind("click",prevItem).addClass("disabled");}first_sku_array=skus.slice(0,slots);}else{first_sku_array=skus;}createSKUList(first_sku_array);function createSKUList(sku_array){var html='<ul id="'+node+"-page-"+this_page+'" class="rec-list s'+slots+'">';var d=new Date();d=d.getTime();for(var x=0;x<sku_array.length;x++){var i=x+d;html+='<li id="sku'+i+'" class="rec-progress"></li>';postSKU(sku_array[x],i);}html+="</ul>";$(node_jqt).append(html);}function postSKU(sku,i){var jqt="#sku"+i;$.post("/omniture.ajax.do?t="+template+"&in="+sku,function(data){if(data.length>50){$(jqt).append(data).removeClass("rec-progress");}else{$(jqt).append("<p>Item "+sku+" is no longer available.</p>").addClass("unavailable").removeClass("rec-progress");}});}function nextItem(){if(this_page<pages){this_page++;$(node_jqt+" ul.rec-list").replaceWith(createSKUList(skus.slice((this_page-1)*slots,this_page*slots)));$(node_jqt+" div.rec-pagination").html("Page "+this_page+" of "+pages);$(node_jqt+" a.prev-btn").removeClass("disabled");if(this_page==pages){$(node_jqt+" a.next-btn").addClass("disabled");}}return false;}function prevItem(){if(this_page>1){this_page--;$(node_jqt+" ul.rec-list").replaceWith(createSKUList(skus.slice(((this_page)*slots)-slots,((this_page+1)*slots)-slots)));$(node_jqt+" div.rec-pagination").html("Page "+this_page+" of "+pages);$(node_jqt+" a.next-btn").removeClass("disabled");if(this_page==1){$(node_jqt+" a.prev-btn").addClass("disabled");}}return false;}}(function($){var options={AJAX_DATA:{},AJAX_TIMEOUT:6000,AJAX_URL:"/cart.ajax.do",DELAY_HIDE:1000,DELAY_LOAD:100,MSG_FAIL:'<div class="reveal-body"><p class="fail">Sorry, we\'re unable to load your cart items at this time.</p></div><div class="reveal-foot"></div>',MSG_LOAD:'<div class="reveal-body"><p class="loading">Loading Cart...</p></div><div class="reveal-foot"></div>',NO_SHOW_PAGES:["/OrderRecap","/Payment","/ShippingGuest","/BillingGuest","/BillingUser","/ShippingUser","checkoutShipping","checkoutBilling"],REVEAL_BODY:"#cart-reveal",REVEAL_BUTTON:"#cart-btn",REVEAL_PARENT:"#cart-btn-parent"};var cart_reveal_data;var cart_reveal_timer=null;var load_delay_timer=null;var reveal_is_loading=false;var ajax_is_req=true;function revealCart(){$(options.REVEAL_BUTTON).unbind("mouseenter",revealCart);if(ajax_is_req){for(var x=0;x<options.NO_SHOW_PAGES.length;x++){if(document.URL.indexOf(options.NO_SHOW_PAGES[x])>0){return false;}}cart_reveal_data=options.MSG_LOAD;showCart();updateCart();$(options.REVEAL_BUTTON).bind("mouseleave",hideCart);if(!load_delay_timer){load_delay_timer=setTimeout(function(){$.ajax({type:"POST",url:options.AJAX_URL,data:options.AJAX_DATA,timeout:options.AJAX_TIMEOUT,error:function(XMLHttpRequest,textStatus,errorThrown){cart_reveal_data=options.MSG_FAIL;},success:function(data){ajax_is_req=false;cart_reveal_data=data;},complete:function(XMLHttpRequest,textStatus){updateCart();$(options.REVEAL_PARENT).bind("mouseenter",showCart);$(options.REVEAL_PARENT).bind("mouseleave",hideCart);$(options.REVEAL_BUTTON).unbind("mouseleave",hideCart);$("#cart-reveal-items a",options.REVEAL_PARENT).bind("click",function(){trackCart("Product");});$("#cart-btn",options.REVEAL_PARENT).bind("click",function(){trackCart("Shopping Cart");});$("#cart-reveal a.cart-edit",options.REVEAL_PARENT).bind("click",function(){trackCart("View/Edit Cart");});$("#cart-reveal a.cart-checkout",options.REVEAL_PARENT).bind("click",function(){trackCart("Checkout");});$("#cart-reveal a.entrust",options.REVEAL_PARENT).bind("click",function(){trackCart("Entrust");});$("#cart-reveal a.sevenleaf",options.REVEAL_PARENT).bind("click",function(){trackCart("Seven Leaf");});}});load_delay_timer=null;},options.DELAY_LOAD);}}else{showCart();}}function hideCart(){cart_reveal_timer=setTimeout(function(){$(options.REVEAL_BODY).hide();$(options.REVEAL_PARENT).removeClass("active");$("#cart-btn").bind("mouseenter",revealCart);cart_reveal_timer=null;},options.DELAY_HIDE);}function showCart(){if(cart_reveal_timer){clearTimeout(cart_reveal_timer);cart_reveal_timer=null;return false;}$(options.REVEAL_PARENT).addClass("active");$(options.REVEAL_BODY).show();}function updateCart(){$(options.REVEAL_BODY).html(cart_reveal_data);}function trackCart(name){cmCreatePageElementTag(name,"Cart Reveal");}$(document).ready(function(){$(options.REVEAL_BUTTON).bind("mouseenter",revealCart);});})(jQuery);function showCookieReq(){var errHTML='<div class="error-msg"><h3 class="error-header">Important Message</h3><p>Cookies are required to continue, please enable cookies in your web browser. <br />Learn more about <a href="/html/SHPsecurity_privacy.html#cookies">cookies and how to enable them</a>.</p></div>';$("#innerStoreContent").prepend(errHTML);}jQuery(function(){$(document).ready(function(){if(document.URL.indexOf("ShoppingBag")>0||document.URL.indexOf("LoginForm")>0||document.URL.indexOf("Register")>0){document.cookie="_shp_req=t";var pos=document.cookie.indexOf("_shp_req=");if(pos<0){showCookieReq();}}});});(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);(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){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:if(selectCurrent()){event.preventDefault();blockSubmit=false;return false;}break;case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=false;$("#searchForm").submit();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){v=words.slice(0,words.length-1).join(options.multipleSeparator)+options.multipleSeparator+v;}v+=options.multipleSeparator;}$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true;}function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL){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[""];}var words=value.split(options.multipleSeparator);var result=[];$.each(words,function(i,value){if($.trim(value)){result[i]=$.trim(value);}});return result;}function lastWord(value){if(!options.multiple){return value;}var words=trimWords(value);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));$.Autocompleter.Selection(input,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("");}}});}if(wasVisible){$.Autocompleter.Selection(input,input.value.length,input.value.length);}}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:false,formatItem:function(row){return row[0];},formatMatch:null,autoFill:false,width:330,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:400};$.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();$("#searchForm").submit();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();}};};$.Autocompleter.Selection=function(field,start,end){if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else{if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}}field.focus();};})(jQuery);
/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.3
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type)){fn2=fn,fn=type,type=undefined;}$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)){return(q=query)&&false;}});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type)){fn2=fn,fn=type,type=undefined;}$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped){$.livequery.stop(query.id);}});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2){fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;}return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type){this.elements.unbind(this.type,this.fn);}else{if(this.fn2){this.elements.each(function(i,el){query.fn2.apply(el);});}}this.elements=[];this.stopped=true;},run:function(){if(this.stopped){return;}var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){$.event.remove(el,query.type,query.fn);}});}}else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){query.fn2.apply(el);}});}}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--){$.livequery.queries[$.livequery.queue.shift()].run();}}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n]){return;}var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;};});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id);}}else{$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id);}});}if($.livequery.timeout){clearTimeout($.livequery.timeout);}$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined){$.livequery.queries[id].stop();}else{$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}}});$.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove");$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector){r.context=a.context,r.selector=a.selector;}if(typeof a=="string"){r.context=c||document,r.selector=a;}return r;};$.prototype.init.prototype=$.prototype;})(jQuery);(function($){$.prettyPhoto={version:"2.5.6"};$.fn.prettyPhoto=function(settings){settings=jQuery.extend({animationSpeed:"normal",opacity:0.5,showTitle:true,allowresize:true,default_width:500,default_height:344,counter_separator_label:"/",theme:"light_rounded",hideflash:false,wmode:"opaque",autoplay:true,modal:false,changepicturecallback:function(){},callback:function(){},markup:'<div class="pp_pic_holder">       <div class="pp_top">        <div class="pp_left"></div>        <div class="pp_middle"></div>        <div class="pp_right"></div>       </div>       <div class="pp_content_container">        <div class="pp_left">        <div class="pp_right">         <div class="pp_content">          <div class="pp_loaderIcon"></div>          <div class="pp_fade">           <div class="pp_hoverContainer">           </div>           <div id="pp_full_res"></div>           <div class="pp_details clearfix">            <p class="pp_description"></p>            <div class="pp_nav">             <p class="currentTextHolder">0/0</p>            </div>           </div><span class="closeCopy"><a href="#" class="closeIt">Close</a> or \'Esc\' Key</span>         </div>         </div>        </div>        </div>       </div>       <div class="pp_bottom">        <div class="pp_left"></div>        <div class="pp_middle"></div>        <div class="pp_right"></div>       </div>      </div>      <div class="pp_overlay"></div>      ',image_markup:'<img id="fullResImage" src="" />'},settings);if($.browser.msie&&parseInt($.browser.version)==6){settings.theme="light_square";}if($(".pp_overlay").size()==0){_buildOverlay();}var doresize=true,percentBased=false,correctSizes,$pp_pic_holder,$ppt,$pp_overlay,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),setPosition=0,scrollPos=_getScroll();$(window).scroll(function(){scrollPos=_getScroll();_centerOverlay();_resizeOverlay();});$(window).resize(function(){_centerOverlay();_resizeOverlay();});$(document).keydown(function(e){if($pp_pic_holder.is(":visible")){switch(e.keyCode){case 37:$.prettyPhoto.changePage("previous");break;case 39:$.prettyPhoto.changePage("next");break;case 27:if(!settings.modal){$.prettyPhoto.close();}break;}}});$(this).each(function(){$(this).bind("click",function(){_self=this;theRel=$(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var images=new Array(),titles=new Array(),descriptions=new Array();if(theGallery){$("a[rel*="+theGallery+"]").each(function(i){if($(this)[0]===$(_self)[0]){setPosition=i;}images.push($(this).attr("href"));titles.push($(this).find("img").attr("alt"));descriptions.push($(this).attr("title"));});}else{images=$(this).attr("href");titles=($(this).find("img").attr("alt"))?$(this).find("img").attr("alt"):"";descriptions=($(this).attr("title"))?$(this).attr("title"):"";}$.prettyPhoto.open(images,titles,descriptions);return false;});});$.prettyPhoto.open=function(gallery_images,gallery_titles,gallery_descriptions){if($.browser.msie&&$.browser.version==6){$("select").css("visibility","hidden");}if(settings.hideflash){$("object,embed").css("visibility","hidden");}images=$.makeArray(gallery_images);titles=$.makeArray(gallery_titles);descriptions=$.makeArray(gallery_descriptions);image_set=($(images).size()>0)?true:false;_checkPosition($(images).size());$(".pp_loaderIcon").show();$pp_overlay.show().fadeTo(settings.animationSpeed,settings.opacity);$pp_pic_holder.find(".currentTextHolder").text((setPosition+1)+settings.counter_separator_label+$(images).size());if(descriptions[setPosition]){$pp_pic_holder.find(".pp_description").show().html(unescape(descriptions[setPosition]));}else{$pp_pic_holder.find(".pp_description").hide().text("");}if(titles[setPosition]&&settings.showTitle){hasTitle=true;$ppt.html(unescape(titles[setPosition]));}else{hasTitle=false;}movie_width=(parseFloat(grab_param("width",images[setPosition])))?grab_param("width",images[setPosition]):settings.default_width.toString();movie_height=(parseFloat(grab_param("height",images[setPosition])))?grab_param("height",images[setPosition]):settings.default_height.toString();if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-100);movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-100);percentBased=true;}$pp_pic_holder.fadeIn(function(){imgPreloader="";switch(_getFileType(images[setPosition])){case"image":imgPreloader=new Image();nextImage=new Image();if(image_set&&setPosition>$(images).size()){nextImage.src=images[setPosition+1];}prevImage=new Image();if(image_set&&images[setPosition-1]){prevImage.src=images[setPosition-1];}$pp_pic_holder.find("#pp_full_res")[0].innerHTML=settings.image_markup;$pp_pic_holder.find("#fullResImage").attr("src",images[setPosition]);imgPreloader.onload=function(){correctSizes=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist.");$.prettyPhoto.close();};imgPreloader.src=images[setPosition];break;case"youtube":correctSizes=_fitToViewport(movie_width,movie_height);movie="http://www.youtube.com/v/"+grab_param("v",images[setPosition]);if(settings.autoplay){movie+="&autoplay=1";}toInject=settings.flash_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":correctSizes=_fitToViewport(movie_width,movie_height);movie_id=images[setPosition];movie="http://vimeo.com/moogaloop.swf?clip_id="+movie_id.replace("http://vimeo.com/","");if(settings.autoplay){movie+="&autoplay=1";}toInject=settings.flash_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"quicktime":correctSizes=_fitToViewport(movie_width,movie_height);correctSizes.height+=15;correctSizes.contentHeight+=15;correctSizes.containerHeight+=15;toInject=settings.quicktime_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,images[setPosition]).replace(/{autoplay}/g,settings.autoplay);break;case"flash":correctSizes=_fitToViewport(movie_width,movie_height);flash_vars=images[setPosition];flash_vars=flash_vars.substring(images[setPosition].indexOf("flashvars")+10,images[setPosition].length);filename=images[setPosition];filename=filename.substring(0,filename.indexOf("?"));toInject=settings.flash_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":correctSizes=_fitToViewport(movie_width,movie_height);frame_url=images[setPosition];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=settings.iframe_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{path}/g,frame_url);break;case"inline":myClone=$(images[setPosition]).clone().css({width:settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo($("body"));correctSizes=_fitToViewport($(myClone).width(),$(myClone).height());$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(images[setPosition]).html());break;}if(!imgPreloader){$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject;_showContent();}});};$.prettyPhoto.changePage=function(direction){if(direction=="previous"){setPosition--;if(setPosition<0){setPosition=0;return;}}else{if($(".pp_arrow_next").is(".disabled")){return;}setPosition++;}if(!doresize){doresize=true;}_hideContent(function(){$.prettyPhoto.open(images,titles,descriptions);});$("a.pp_expand,a.pp_contract").fadeOut(settings.animationSpeed);};$.prettyPhoto.close=function(){$pp_pic_holder.find("object,embed").css("visibility","hidden");$("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animationSpeed);$pp_overlay.fadeOut(settings.animationSpeed,function(){$("#pp_full_res").html("");$pp_pic_holder.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");_centerOverlay();if($.browser.msie&&$.browser.version==6){$("select").css("visibility","visible");}if(settings.hideflash){$("object,embed").css("visibility","visible");}setPosition=0;settings.callback();});doresize=true;};_showContent=function(){$(".pp_loaderIcon").hide();projectedTop=scrollPos.scrollTop+((windowHeight/2)-(correctSizes.containerHeight/2));if(projectedTop<0){projectedTop=0+$ppt.height();}$pp_pic_holder.find(".pp_content").animate({height:correctSizes.contentHeight},settings.animationSpeed);$pp_pic_holder.animate({top:projectedTop,left:(windowWidth/2)-(correctSizes.containerWidth/2),width:correctSizes.containerWidth},settings.animationSpeed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(correctSizes.height).width(correctSizes.width);$pp_pic_holder.find(".pp_fade").fadeIn(settings.animationSpeed);if(image_set&&_getFileType(images[setPosition])=="image"){$pp_pic_holder.find(".pp_hoverContainer").show();}else{$pp_pic_holder.find(".pp_hoverContainer").hide();}if(settings.showTitle&&hasTitle){$ppt.css({top:$pp_pic_holder.offset().top-25,left:$pp_pic_holder.offset().left+20,display:"none"});$ppt.fadeIn(settings.animationSpeed);}if(correctSizes.resized){$("a.pp_expand,a.pp_contract").fadeIn(settings.animationSpeed);}settings.changepicturecallback();});};function _hideContent(callback){$pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");$pp_pic_holder.find(".pp_fade").fadeOut(settings.animationSpeed,function(){$(".pp_loaderIcon").show();if(callback){callback();}});$ppt.fadeOut(settings.animationSpeed);}function _checkPosition(setCount){if(setPosition==setCount-1){$pp_pic_holder.find("a.pp_next").css("visibility","hidden");$pp_pic_holder.find("a.pp_arrow_next").addClass("disabled").unbind("click");}else{$pp_pic_holder.find("a.pp_next").css("visibility","visible");$pp_pic_holder.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){$.prettyPhoto.changePage("next");return false;});}if(setPosition==0){$pp_pic_holder.find("a.pp_previous").css("visibility","hidden");$pp_pic_holder.find("a.pp_arrow_previous").addClass("disabled").unbind("click");}else{$pp_pic_holder.find("a.pp_previous").css("visibility","visible");$pp_pic_holder.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){$.prettyPhoto.changePage("previous");return false;});}if(setCount>1){$(".pp_nav").show();}else{$(".pp_nav").hide();}}function _fitToViewport(width,height){hasBeenResized=false;_getDimensions(width,height);imageWidth=width;imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allowresize&&!percentBased){hasBeenResized=true;notFitting=true;while(notFitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else{if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{notFitting=false;}}pp_containerHeight=imageHeight;pp_containerWidth=imageWidth;}_getDimensions(imageWidth,imageHeight);}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+40,contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:hasBeenResized};}function _getDimensions(width,height){width=parseFloat(width);height=parseFloat(height);$pp_details=$pp_pic_holder.find(".pp_details");$pp_details.width(width);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().appendTo($("body")).css({position:"absolute",top:-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if($.browser.msie&&$.browser.version==7){detailsHeight+=8;}$pp_details.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+$ppt.height()+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height();pp_containerWidth=width;}function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)){return"youtube";}else{if(itemSrc.match(/vimeo\.com/i)){return"vimeo";}else{if(itemSrc.indexOf(".mov")!=-1){return"quicktime";}else{if(itemSrc.indexOf(".swf")!=-1){return"flash";}else{if(itemSrc.indexOf("iframe")!=-1){return"iframe";}else{if(itemSrc.substr(0,1)=="#"){return"inline";}else{return"image";}}}}}}}function _centerOverlay(){if(doresize){titleHeight=$ppt.height();contentHeight=$pp_pic_holder.height();contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scrollPos.scrollTop-((contentHeight+titleHeight)/2);$pp_pic_holder.css({top:projectedTop,left:(windowWidth/2)+scrollPos.scrollLeft-(contentwidth/2)});$ppt.css({top:projectedTop-titleHeight,left:(windowWidth/2)+scrollPos.scrollLeft-(contentwidth/2)+20});}}function _getScroll(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};}else{if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};}else{if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};}}}}function _resizeOverlay(){windowHeight=$(window).height();windowWidth=$(window).width();$pp_overlay.css({height:$(document).height()});}function _buildOverlay(){$("body").append(settings.markup);$pp_pic_holder=$(".pp_pic_holder");$ppt=$(".ppt");$pp_overlay=$("div.pp_overlay");$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme);$pp_overlay.css({opacity:0,height:$(document).height()}).bind("click",function(){if(!settings.modal){$.prettyPhoto.close();}});$("a.closeIt").bind("click",function(){$.prettyPhoto.close();return false;});$("a.pp_expand").bind("click",function(){$this=$(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");doresize=false;}else{$this.removeClass("pp_contract").addClass("pp_expand");doresize=true;}_hideContent(function(){$.prettyPhoto.open(images,titles,descriptions);});$pp_pic_holder.find(".pp_fade").fadeOut(settings.animationSpeed);return false;});$pp_pic_holder.find(".pp_previous, .pp_arrow_previous").bind("click",function(){$.prettyPhoto.changePage("previous");return false;});$pp_pic_holder.find(".pp_next, .pp_arrow_next").bind("click",function(){$.prettyPhoto.changePage("next");return false;});}_centerOverlay();};function grab_param(name,url){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);if(results==null){return"";}else{return results[1];}}})(jQuery);
