var RRUtil={showCompareImage:true,showWishListImage:true,showWishListPrices:true,dragging:false,compareRequests:[],wishListRequests:[],dropDown:-1,dropDownTimeout:null,products:function(E,D,A){if(E!=null){this.showCompareImage=E}if(D!=null){this.showWishListImage=D}if(A!=null){this.showWishListPrices=A}var F=$("#product_list > div.product, #product_list2 > div.product").bind("mouseenter",function(){var G=this;var H=(this.sActionBar==null);this.sActionBar="open";if(!RRUtil.dragging&&H){$(this).find(".action_bar").slideDown("slow",function(){if(G.sActionBar=="open"){$(this).slideDown("slow")}else{if(G.sActionBar=="close"){$(this).slideUp("slow")}}G.sActionBar=null})}}).bind("mouseleave",function(){var G=this;var H=(this.sActionBar==null);this.sActionBar="close";if(!RRUtil.dragging&&H){$(this).find(".action_bar").slideUp("slow",function(){if(G.sActionBar=="open"){$(this).slideDown("slow")}else{if(G.sActionBar=="close"){$(this).slideUp("slow")}}G.sActionBar=null})}}).bind("click",function(){if(!RRUtil.dragging){window.location=$(this).find(".more_info > a").attr("href")}return false}).css("cursor","pointer");var C=($("#product_list > div.product .compare > a, #product_list2 > div.product .compare > a, #compare_link").bind("click",function(){if(!RRUtil.dragging){$(this).parents(".product").rrTransfer({to:"#compare_embed .scroll"});RRUtil.addToCompare(this.href)}return false}).length>0);var B=($("#product_list > div.product .wishlist > a, #product_list2 > div.product .wishlist > a, #wish_list_link").bind("click",function(){if(!RRUtil.dragging){$(this).parents(".product").rrTransfer({to:"#wish_list_embed .scroll"});RRUtil.addToWishList(this.href)}return false}).length>0);if(window.bDisableDragDrop!=true&&(C||B)){$(".image a, .more_info a",F).bind("click",function(){return !RRUtil.dragging});F.draggable({revert:true,opacity:0.25,zIndex:1000,distance:8,cursorAt:{left:true,top:true},start:function(G,H){RRUtil.dragging=true},stop:function(G,H){this.sActionBar=null;$(this).find(".action_bar").hide();RRUtil.dragging=false}});$("#compare_embed").droppable({accept:".product",tolerance:"pointer",hoverClass:"hover",drop:function(G,H){RRUtil.addToCompare(H.draggable.find(".compare > a").attr("href"))}});$("#wish_list_embed").droppable({accept:".product",tolerance:"pointer",hoverClass:"hover",drop:function(G,H){RRUtil.addToWishList(H.draggable.find(".wishlist > a").attr("href"))}});$("#filter_message").text("Drag to "+(B?"Wish List":"")+(B&&C?" or ":"")+(C?"Compare":""))}$("#product_list > div.product .remove > a").bind("click",RRUtil.onRemoveClick)},addToCompare:function(A){if(A==null){return false}var C=A.indexOf("add=")+4;var B=A.substr(C,A.indexOf("&",C)-C);if(this.compareRequests[B]==true){return false}this.compareRequests[B]=true;$.get(A+"&f=json",{},function(G){if(G.product){var E=$("#compare_embed .scroll");var J="#compare_embed_g"+G.group.id;var K=$(J);if(K.length==0){$("p.empty",E).fadeOut();E.prepend('<p id="'+J.substr(1)+'" style="display:none"><a href="'+G.group.url+'" class="active"><strong></strong></a></p><ul></ul>');$(J+" strong").text(G.group.name+" ("+G.group.total+")");K=$(J).slideDown("normal");var I=E.siblings("p.link");if(I.length==0){E.after('<p class="link" style="display:none"><a href="'+G.group.url+'">Compare Now</a></p>');E.siblings("p.link").slideDown("normal")}else{I.html('<a href="'+G.group.url+'">Compare Now</a>').css({display:"none"}).fadeIn()}}else{$("strong",K).text(G.group.name+" ("+G.group.total+")")}$("#compare_embed > h1 span").text("Compare Items ("+G.total+")");if(RRUtil.showCompareImage){var F=$("#embed_panels.horizontal > div");var D=(G.group.total>3?3:(G.group.total>1?G.group.total:1));if((D>1&&F.hasClass("h1"))||(D>2&&F.hasClass("h2"))){F.removeClass().addClass("h"+D)}}else{if(G.group.total==4){E.height(E.height())}}var H="#compare_embed_p"+G.product.id;$(H).attr("id","").slideUp("normal",function(){$(this).remove()});$("ul",E).prepend('<li id="'+H.substr(1)+'" style="display:none"><a href="'+G.product.url+'">'+(RRUtil.showCompareImage?('<span class="image" style="background-image:url('+G.product.image+')"></span>'):"")+'<span class="name"><br></span></a></li>');$(H+" .name").text(G.product.name);$(H).slideDown("normal");RRUtil.compareRequests[G.product.id]=false}},"json")},addToWishList:function(A){if(A==null){return false}var C=A.indexOf("add=")+4;var B=A.substr(C,A.indexOf("&",C)-C);if(this.wishListRequests[B]==true){return false}this.wishListRequests[B]=true;$.get(A+"&f=json",{},function(G){if(G.product){var E=$("#wish_list_embed .scroll");$("#wish_list_embed > h1 span").text("Wish List ("+G.total+")");$("p.empty",E).fadeOut();var I="#wish_list_embed_p"+G.product.id;$(I).attr("id","").slideUp("normal",function(){$(this).remove()});if(RRUtil.showWishListImage){var F=$("#embed_panels.horizontal > div");var D=(G.total>3?3:(G.total>1?G.total:1));if((D>1&&F.hasClass("h1"))||(D>2&&F.hasClass("h2"))){F.removeClass().addClass("h"+D)}}else{if(G.total==4){E.height(E.height())}}var H=$("ul",E);if(H.length==0){E.append("<ul></ul>");H=$("ul",E)}H.prepend('<li id="'+I.substr(1)+'" style="display:none"><a href="'+G.product.url+'"><span class="name"></span>'+(RRUtil.showWishListPrices?('<span class="prices"></span>'):"")+(RRUtil.showWishListImage?('<span class="image" style="background-image:url('+G.product.image+')"></span>'):"")+(RRUtil.showWishListPrices||RRUtil.showWishListImage?'<span class="clear"></span>':"")+"</a></li>");$(I+" .name").text(G.product.name);$(I+" .prices").html(G.product.prices);$(I).slideDown("normal");if(RRUtil.showWishListPrices){var J=E.siblings("p.total");if(J.length==0){E.after('<p class="total" style="display:none"><span class="label">Total: </span><span class="value"></span></p>');J=E.siblings("p.total").fadeIn()}J.find(".value").text(G.totalPrice)}RRUtil.wishListRequests[G.product.id]=false}},"json")},onRemoveClick:function(){var A=$(this).parents("div.product");A.fadeOut("normal",function(){$(this).remove()});$.get(this.href+"&f=json&p="+RRFilter.page+"&c="+escape($('#filter_page_controls > .items_per_page input[name="c"]').val()),{},function(B){var C=$("#page_title h1");var D=C.text();if(D.indexOf("(")>0){D=jQuery.trim(D.substr(0,D.indexOf("(")))}C.text(D+(B.total==0?"":(" ("+B.total+")")));if(B.total==0){$("#products > div.products > *").remove();$("#products > div.products").html(B.html)}else{if(B.page==RRFilter.page&&B.product){$(B.product.html).insertBefore("#product_list > div.clear").fadeIn().find(".remove > a").bind("click",RRUtil.onRemoveClick)}}if(B.controls){RRFilter.pageCount=B.pageCount;$("#filter_page_controls a").unbind("click");$('#filter_page_controls > .items_per_page input[name="c"]').unbind("keyup");$("#filter_page_controls").unbind("submit");$("#filter_page_controls").html(B.controls);if(B.page>=RRFilter.page){RRFilter.updatePageLinks(B.page)}else{if(B.total>0){RRFilter.submit(true,B.page,null,true)}}}},"json");return false},slider:function(H){var C=$("#"+H+" .scroll");if(C.slider==null){return }var F=C.outerWidth();var D=$("ul",C);var B=0-F;$("li",D).each(function(){B+=$(this).width()});if(B<0){B=0}var A=true;var G=false;var E=$("#"+H+" .scrollbar").slider({min:0,max:B,handle:".handle",stop:function(I,J){D.animate({left:J.value*-1},500,function(){A=true})},slide:function(I,J){if(G){if(A){D.css("left",J.value*-1)}}else{G=true;$("#"+H+" .next").append('<a href="javascript:void(0)" style="display:none"></a>').children().bind("click",function(){var N=C.offset();var M=D.offset();var L=N.left-M.left+F;var K=-1;$("li",D).each(function(){var P=$(this);var O=P.offset().left-M.left;K=O-F+P.width();if(O>=L){return false}return true});if(K>=0){A=false;E.slider("moveTo",K)}}).fadeIn();$("#"+H+" .previous").append('<a href="javascript:void(0)" style="display:none"></a>').children().bind("click",function(){var N=C.offset();var M=D.offset();var L=N.left-M.left;var K=-1;$("li",D).each(function(){var P=$(this);var O=P.offset().left-M.left;if(O>=L){return false}K=O;return true});if(K>=0){A=false;E.slider("moveTo",K)}}).fadeIn()}}}).slider("propagate","slide")},initDropDown:function(A){var B=$(A);this.ddLists=[];this.ddElements=[];$("p, .list",B).bind("mouseover",function(){RRUtil.showDropDown(this.nSectionID)}).bind("mouseout",function(){RRUtil.hideDropDown(this.nSectionID)}).each(function(E){var D=(this.className=="list"?"ddLists":"ddElements");this.nSectionID=RRUtil[D].length;RRUtil[D][this.nSectionID]=this});for(var C=this.ddElements.length-1;C>=0;C--){$(this.ddLists[C]).width($(this.ddElements[C]).width())}},hideDropDown:function(){if(this.dropDownTimeout){window.clearTimeout(this.dropDownTimeout)}this.dropDownTimeout=window.setTimeout("RRUtil.showDropDown();",250)},showDropDown:function(A){if(this.dropDownTimeout){window.clearTimeout(this.dropDownTimeout);this.dropDownTimeout=null}if(this.dropDown!=A){if(this.dropDown>=0){this.ddLists[this.dropDown].style.visibility="hidden";this.ddElements[this.dropDown].className="";this.dropDown=-1}if(this.ddElements[A]){this.ddLists[A].style.visibility="visible";this.ddElements[A].className="collapse";this.dropDown=A}}}};$(document).ready(function(){for(var A=window.p$f.length-1;A>=0;A--){window.p$f[A]()}if(window.CSSMenu){window.CSSMenu.init({firstOffsetX:0,firstOffsetY:2,offsetX:1,maxItems:15})}$("#related_websites p").bind("click",function(){$("#related_websites_content").slideToggle("normal",function(){var B=($(this).css("display")=="none"?"removeClass":"addClass");$("#related_websites p")[B]("collapse")})}).css("cursor","pointer");$("#member_login_panel p").bind("click",function(){$("#member_login_content").slideToggle("normal",function(){var B=($(this).css("display")=="none"?"removeClass":"addClass");$("#member_login p")[B]("collapse")})}).css("cursor","pointer")});