if(typeof deconcept=="undefined"){var deconcept=new Object()}if(typeof deconcept.util=="undefined"){deconcept.util=new Object()}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object()}deconcept.SWFObject=function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return}this.DETECT_KEY=detectKey?detectKey:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(swf){this.setAttribute("swf",swf)}if(id){this.setAttribute("id",id)}if(w){this.setAttribute("width",w)}if(h){this.setAttribute("height",h)}if(ver){this.setAttribute("version",new deconcept.PlayerVersion(ver.toString().split(".")))}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true}if(c){this.addParam("bgcolor",c)}var q=quality?quality:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute("xiRedirectUrl",xir);this.setAttribute("redirectUrl","");if(redirectUrl){this.setAttribute("redirectUrl",redirectUrl)}};deconcept.SWFObject.prototype={useExpressInstall:function(path){this.xiSWFPath=!path?"expressinstall.swf":path;this.setAttribute("useExpressInstall",true)},setAttribute:function(name,value){this.attributes[name]=value},getAttribute:function(name){return this.attributes[name]},addParam:function(name,value){this.params[name]=value},getParams:function(){return this.params},addVariable:function(name,value){this.variables[name]=value},getVariable:function(name){return this.variables[name]},getVariables:function(){return this.variables},getVariablePairs:function(){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs[variablePairs.length]=key+"="+variables[key]}return variablePairs},getSWFHTML:function(){var swfNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath)}swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'"';swfNode+=' id="'+this.getAttribute("id")+'" name="'+this.getAttribute("id")+'" ';var params=this.getParams();for(var key in params){swfNode+=[key]+'="'+params[key]+'" '}var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashvars="'+pairs+'"'}swfNode+="/>"}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath)}swfNode='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'">';swfNode+='<param name="movie" value="'+this.getAttribute("swf")+'" />';var params=this.getParams();for(var key in params){swfNode+='<param name="'+key+'" value="'+params[key]+'" />'}var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />'}swfNode+="</object>"}return swfNode},write:function(elementId){if(this.getAttribute("useExpressInstall")){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof elementId=="string")?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"))}}return false}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var counter=3;while(axo){try{counter++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+counter);PlayerVersion=new deconcept.PlayerVersion([counter,0,0])}catch(e){axo=null}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always"}catch(e){if(PlayerVersion.major==6){return PlayerVersion}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}}if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","))}}}return PlayerVersion};deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false}if(this.major>fv.major){return true}if(this.minor<fv.minor){return false}if(this.minor>fv.minor){return true}if(this.rev<fv.rev){return false}return true};deconcept.util={getRequestParameter:function(param){var q=document.location.search||document.location.hash;if(param==null){return q}if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1))}}}return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var objects=document.getElementsByTagName("OBJECT");for(var i=objects.length-1;i>=0;i--){objects[i].style.display="none";for(var x in objects[i]){if(typeof objects[i][x]=="function"){objects[i][x]=function(){}}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id]}}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

var http_request=false;var cnt;function makeRequest(url,form,nodeID,binName,count,useAllArgs){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}}if(!http_request){return false}var str=getFormValues(form);str=str+"&node="+nodeID;str=str+"&binId="+escape(binName);str=str+"&count="+count;str=str+"&useAllArgs="+useAllArgs;cnt=count;http_request.onreadystatechange=alertContents;http_request.open("POST",url,true);http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");http_request.send(str)}function alertContents(){var docName="childFinderForm"+cnt;if(http_request.readyState==4){if(http_request.status==200){document.getElementById(docName).innerHTML=http_request.responseText}}}function getFormValues(fobj){var str="";var valueArr=null;var val="";var cmd="";for(var i=0;i<fobj.elements.length;i++){switch(fobj.elements[i].type){case"text":str+=escape(fobj.elements[i].name)+"="+escape(fobj.elements[i].value)+"&";break;case"select-one":str+=escape(fobj.elements[i].name)+"="+fobj.elements[i].options[fobj.elements[i].selectedIndex].value+"&";break}}str=str.substr(0,(str.length-1));return str};

var absStr="Position:Absolute;Top:0;Left:0";function srch_js_PopWin(url,name,options){var ContextWindow=window.open(url,name,options);ContextWindow.opener=this;ContextWindow.focus()}function RefreshOriginalWindow(url){if((window.opener==null)||(window.opener.closed)){var OriginalWindow=window.open(url);OriginalWindow.opener=this}else{window.opener.location=url}}function n2sShowAdvancedView(){if(typeof goN2Search=="object"&&goN2Search.isInitialized()){goN2Search.showAdvancedView()}}function n2sShowBasicView(){if(typeof goN2Search=="object"&&goN2Search.isInitialized()){goN2Search.showBasicView()}}function n2sGotoPage(n){if(typeof goN2Search=="object"&&goN2Search.isInitialized()){goN2Search.gotoPage(n)}}function n2sChangeSortOrder(sSort){if(typeof goN2Search=="object"&&goN2Search.isInitialized()){goN2Search.changeSortOrder(sSort)}}function _n2sAllCatToggle(sIdElemContainer,sIdElemInner){if(goN2U.hasClass(sIdElemContainer,"state0")){goN2U.removeClass(sIdElemContainer,"state0");goN2U.addClass(sIdElemContainer,"state1");goN2U.display(sIdElemInner)}else{goN2U.removeClass(sIdElemContainer,"state1");goN2U.addClass(sIdElemContainer,"state0");goN2U.undisplay(sIdElemInner)}}function n2sAllCatToggle(){if(typeof goN2Search=="object"&&goN2Search.isInitialized()){_n2sAllCatToggle("n2sAllCatBasic","n2sAllCatBasicInner");_n2sAllCatToggle("n2sAllCatAdv","n2sAllCatAdvInner")}}function n2sAllCatMouseOver(oElemOver){if(typeof goN2Search=="object"&&goN2Search.isInitialized()){if(goN2U.bIsIE){if(!goN2U.hasClass(oElemOver,"hover")){goN2U.addClass(oElemOver,"hover")}return true}}return false}function n2sAllCatMouseOut(oElemOver){if(typeof goN2Search=="object"&&goN2Search.isInitialized()){if(goN2U.bIsIE){if(!goN2U.elementIsContainedBy(window.event.toElement,oElemOver)){goN2U.removeClass(oElemOver,"hover")}return true}}return false}function n2sInitEvent(sEvent){if(typeof goN2Search!="object"||!goN2Search.initEvent(sEvent)){if(!window.gaN2InitEvents){gaN2InitEvents=[]}gaN2InitEvents[gaN2InitEvents.length]=sEvent}}function n2sRetryError(){if(typeof goN2Search=="object"&&goN2Search.retryError){goN2Search.retryError()}}function browseAddItemSubmit(f){var formNumber=f.id.split(".")[1];var quantityField=f["quantity."+formNumber];var quantity=quantityField.options[quantityField.selectedIndex];var offeringID=f["offeringID."+formNumber].value;var asin=f["asin."+formNumber].value;var catalogNumber=f["catalogNumber."+formNumber].value;var partNumber=f["partNumber."+formNumber].value;if(asin&&quantity&&quantity.value&&quantity.value!=="0"){var data={};data["item.0.asin"]=asin;data["item.0.qty"]=quantity.value;if(offeringID){data["item.0.offerId"]=offeringID}jQuery.ajax({type:"POST",url:"/secureAjaxCart?cartAction=ADD",data:data,cache:false,error:function(html,status){},success:function(html,status){updateMiniBasket(html);window.scroll(0,0);miniCartHandler.renderAsync(html);updateToOmniture(asin,catalogNumber,partNumber)},timeout:10000})}return false}function updateToOmniture(asin,catalogNumber,partNumber){if(typeof(s)!="undefined"){s.prop22=partNumber;s.eVar22=partNumber;s.products=s.prop18+";"+catalogNumber;s.linkTrackVars="products,prop22,eVar22,events";s.linkTrackEvents="scAdd";s.events="scAdd";s.tl(this,"o","ATC")}}function showBrowsePopover(formNumber,closeOthers){var popover;var fld=document.getElementById("displayedItemsCount");if(fld&&closeOthers){var displayedItemsCount=fld.value;for(var i=1;i<=displayedItemsCount;i++){if(i!=formNumber){hideBrowsePopover(i)}}}popover=document.getElementById("popover."+formNumber);if(popover){var dropdown=document.getElementById("quantity."+formNumber);if(dropdown){dropdown.style.visibility="hidden"}popover.style.display="block"}return popover}function hideBrowsePopover(formNumber){var popover=document.getElementById("popover."+formNumber);if(popover){popover.style.display="none";var dropdown=document.getElementById("quantity."+formNumber);if(dropdown){dropdown.style.visibility="visible"}}return popover}function getTempDiv(preserveInnerHtml){var tempDiv=document.getElementById("tempDiv");if(!tempDiv){tempDiv=document.createElement("div");tempDiv.id="tempDiv";tempDiv.style.display="none";var body=document.getElementsByTagName("body")[0];body.appendChild(tempDiv)}else{if(!preserveInnerHtml){tempDiv.innerHTML=""}}return tempDiv};

var divId;var reqProductDetails;var http_request;var refUrl;if(window.XMLHttpRequest){reqProductDetails=new XMLHttpRequest();reqAddToCart=new XMLHttpRequest();http_request=new XMLHttpRequest()}else{if(window.ActiveXObject){reqProductDetails=new ActiveXObject("Microsoft.XMLHTTP");reqAddToCart=new ActiveXObject("Microsoft.XMLHTTP");http_request=new ActiveXObject("Microsoft.XMLHTTP")}}function fnShowProductDetails(url){divId="displayProductDetails";refUrl=url;reqProductDetails.open("GET",url,true);document.getElementById(divId).innerHTML=waitMessage;reqProductDetails.onreadystatechange=handleShowProductDetailsResponse;reqProductDetails.send(null)}function handleShowProductDetailsResponse(){if(reqProductDetails.readyState==4){if(reqProductDetails.status==200){var responseContent=reqProductDetails.responseText;if(!responseContent.match("collectionList")){var splitUrl=refUrl.split("/product");var errorUrl=splitUrl[0]+"/errors/404";window.location.replace(errorUrl)}document.getElementById(divId).innerHTML="";document.getElementById(divId).insertAdjacentHTML("beforeBegin",responseContent)}}}function addToCart(item,isRec){var urlAddToCart=addToCartURL;var result=createUrlForCart(item,isRec);if(result=="error"){return}result=result.replace(/^&/,"");var popupOptions="toolbar=no,scrollbars=yes,width=475,height=200,resizable=yes,top=200";reqAddToCart.open("POST",urlAddToCart,false);reqAddToCart.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");reqAddToCart.send(result);if(reqAddToCart.status==200){addToCartResult=reqAddToCart.responseText}document.getElementById("minidpDiv"+(isRec-1)).style.display="none";document.getElementById("miniCartDiv").innerHTML=addToCartResult;document.getElementById("miniCartDiv").style.display="block";updateInlineCartCount()}function createUrlForCart(asin,isRec){var urlPart="&ASIN="+document.getElementById("asin."+isRec).value;urlPart+="&offerListingID="+document.getElementById("offeringID."+isRec).value;var qty=document.getElementById("quantity."+asin+isRec);urlPart+="&quantity=";urlPart+=qty?qty.value:"1";urlPart+="&nodeID="+document.getElementById("node").value;urlPart+="&merchantID="+document.getElementById("merchantID").value;urlPart+="&marketplaceID="+document.getElementById("marketplaceID").value;urlPart+="&sessionID="+document.getElementById("sessionID").value;urlPart+="&viewID=quickview";var dimensionKeys=document.getElementById("dimensionKeys."+asin);if(dimensionKeys!=null){dimensionKeys=dimensionKeys.value;if(dimensionKeys!=""){dimensionKeys=dimensionKeys.replace(/\|/,",");urlPart+="&variationDimensionKeys="+dimensionKeys;var variations=dimensionKeys.split(/,|\|/);for(var i=0;i<variations.length;i++){var selectedValue=encodeURIComponent(document.getElementById("dimensions."+asin+"."+variations[i]+"PopUp").value);if(selectedValue==""){alert("Please select a variation and then add to basket.");return"error"}urlPart+="&"+variations[i]+"="+selectedValue}}}return urlPart}function updateInlineCartCount(){var url=itemCountURL;var newCount;var spanElement=document.getElementById("inlineCart");if(spanElement==undefined){return}var itemsCountField=document.getElementById("currentCartItemsCount");if(itemsCountField){newCount=itemsCountField.value}else{http_request.open("POST",url,false);http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");http_request.send(null);if(http_request.status==200){newCount=http_request.responseText}}newCount=newCount.replace(/(\n)|(\s)/g,"");spanElement.innerHTML=newCount}function addToCartSr(asin,formNumber){var urlAddToCart=addToCartURL;var result=createUrlForCartSr(asin,formNumber);if(result=="error"){return}result=result.replace(/^&/,"");reqAddToCart.open("POST",urlAddToCart,false);reqAddToCart.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");reqAddToCart.send(result);if(reqAddToCart.status==200){addToCartResult=reqAddToCart.responseText}var tempDiv=getTempDiv();tempDiv.innerHTML=addToCartResult;var popupMessageNew=document.getElementById("popupMessageNew");var popoverContent=document.getElementById("popoverContent."+formNumber);if(popoverContent&&popupMessageNew){popoverContent.innerHTML=popupMessageNew.innerHTML;showBrowsePopover(formNumber,true)}updateInlineCartCount()}function createUrlForCartSr(asin,formNumber){var urlPart="&ASIN="+asin;urlPart+="&offerListingID="+document.getElementById("offeringID."+formNumber).value;var qty=document.getElementById("quantity."+formNumber);urlPart+="&quantity=";urlPart+=qty?qty.value:"1";urlPart+="&viewID=quickview";urlPart+="&sessionID="+document.getElementById("sessionID").value;return urlPart};

jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyIframeSrc:undefined,historyNeedIframe:jQuery.browser.msie&&(jQuery.browser.version<8||document.documentMode<8),historyInit:function(callback,src){jQuery.historyCallback=callback;if(src){jQuery.historyIframeSrc=src}var current_hash=location.hash.replace(/\?.*$/,"");jQuery.historyCurrentHash=current_hash;if(jQuery.historyNeedIframe){if(jQuery.historyCurrentHash==""){jQuery.historyCurrentHash="#"}jQuery("body").prepend('<iframe id="jQuery_history" style="display: none;" src="javascript:false;"></iframe>');var ihistory=jQuery("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=current_hash}else{if(jQuery.browser.safari){jQuery.historyBackStack=[];jQuery.historyBackStack.length=history.length;jQuery.historyForwardStack=[];jQuery.lastHistoryLength=history.length;jQuery.isFirst=true}}if(current_hash){jQuery.historyCallback(current_hash.replace(/^#/,""))}setInterval(jQuery.historyCheck,100)},historyAddHistory:function(hash){jQuery.historyBackStack.push(hash);jQuery.historyForwardStack.length=0;this.isFirst=true},historyCheck:function(){if(jQuery.historyNeedIframe){var ihistory=jQuery("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;var current_hash=iframe.location.hash.replace(/\?.*$/,"");if(current_hash!=jQuery.historyCurrentHash){location.hash=current_hash;jQuery.historyCurrentHash=current_hash;jQuery.historyCallback(current_hash.replace(/^#/,""))}}else{if(jQuery.browser.safari){if(jQuery.lastHistoryLength==history.length&&jQuery.historyBackStack.length>jQuery.lastHistoryLength){jQuery.historyBackStack.shift()}if(!jQuery.dontCheck){var historyDelta=history.length-jQuery.historyBackStack.length;jQuery.lastHistoryLength=history.length;if(historyDelta){jQuery.isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++){jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop())}}else{for(var i=0;i<historyDelta;i++){jQuery.historyBackStack.push(jQuery.historyForwardStack.shift())}}var cachedHash=jQuery.historyBackStack[jQuery.historyBackStack.length-1];if(cachedHash!=undefined){jQuery.historyCurrentHash=location.hash.replace(/\?.*$/,"");jQuery.historyCallback(cachedHash)}}else{if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(location.hash){var current_hash=location.hash;jQuery.historyCallback(location.hash.replace(/^#/,""))}else{var current_hash="";jQuery.historyCallback("")}jQuery.isFirst=true}}}}else{var current_hash=location.hash.replace(/\?.*$/,"");if(current_hash!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=current_hash;jQuery.historyCallback(current_hash.replace(/^#/,""))}}}},historyLoad:function(hash){var newhash;hash=decodeURIComponent(hash.replace(/\?.*$/,""));if(jQuery.browser.safari){newhash=hash}else{newhash="#"+hash;location.hash=newhash}jQuery.historyCurrentHash=newhash;if(jQuery.historyNeedIframe){var ihistory=jQuery("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=newhash;jQuery.lastHistoryLength=history.length;jQuery.historyCallback(hash)}else{if(jQuery.browser.safari){jQuery.dontCheck=true;this.historyAddHistory(hash);var fn=function(){jQuery.dontCheck=false};window.setTimeout(fn,200);jQuery.historyCallback(hash);location.hash=newhash}else{jQuery.historyCallback(hash)}}}});

jQuery(document).ready(function(){if(jQuery("div.compareButton").length==0){embeddedSearchComponent.initialize()}});var embeddedSearchComponent={container:null,paginationLinksContainer:null,sessionId:null,browseNodeId:null,sortByForm:null,sortByDropDown:null,ajaxPageUrl:null,loadingComponent:null,errorComponent:null,hash:null,changingHash:false,embeddedSearchContent:null,initialize:function(){this.container=jQuery("#embeddedSearchResults");if(this.container.length>0){if(typeof(itemCompare)!="undefined"){itemCompare.initialize()}this.paginationLinksContainer=this.container.find(".paginationDetail");this.sessionId=sessionId;this.browseNodeId=browseNodeId;this.ajaxPageUrl=ajaxPageUrl;this.sortByForm=this.container.find(".sortByForm");this.sortByDropDown=this.sortByForm.find("#sort");this.sortByDropDown.attr("onchange","");this.errorComponent=this.container.find(".embeddedSearchError");this.hash=this.getBrowserHash();if(this.loadingComponent==null){this.loadingComponent=this.createLoadingComponent();jQuery("body").append(this.loadingComponent);var parentThis=this;this.loadingComponent.fadeTo("normal",0.6,function(){parentThis.loadingComponent.fadeTo("normal",0)});jQuery.historyInit(function(){})}this.bindEvents();this.detectAndProcessChangeInHash()}},getBrowserHash:function(){var currentHash=window.location.href;if(currentHash.indexOf("#")>-1){currentHash=currentHash.substring(currentHash.indexOf("#")+1);return currentHash}return""},setLocalHash:function(data){this.changingHash=true;this.hash=data;this.changingHash=false},detectAndProcessChangeInHash:function(){var parentThis=this;var currentHash=this.getBrowserHash();if(currentHash!=this.hash&&!this.changingHash){this.hash=currentHash;this.loadAjaxSearchContent(currentHash)}else{window.setTimeout(function(){parentThis.detectAndProcessChangeInHash()},100)}},createLoadingComponent:function(){if(this.loadingComponent==null){var loadingComponent=jQuery("<iframe></iframe>");loadingComponent.attr("id","embeddedSearchFrame");loadingComponent.attr("frameBorder","0");loadingComponent.attr("src","");return loadingComponent}return this.loadingComponent},bindEvents:function(){var parentThis=this;this.paginationLinksContainer.find("a").click(function(){if(typeof(itemCompare)!="undefined"){itemCompare.nextPage(this)}var jObj=jQuery(this);var thisElementUrl=jObj.attr("href");var data="";if(thisElementUrl.indexOf("?")>-1){data=thisElementUrl.substring(thisElementUrl.indexOf("?")+1)}parentThis.loadAjaxSearchContent(data);jQuery.historyLoad(data);parentThis.setLocalHash(parentThis.getBrowserHash());return false});this.sortByDropDown.change(function(){var data=parentThis.sortByForm.serialize();parentThis.loadAjaxSearchContent(data);jQuery.historyLoad(data);parentThis.setLocalHash(parentThis.getBrowserHash())});this.sortByForm.submit(function(){return false})},loadAjaxSearchContent:function(data){this.errorComponent.hide();var parentThis=this;this.loadingComponent.css("top",this.container.offset().top);this.loadingComponent.css("left",this.container.offset().left);this.loadingComponent.height(this.container.height());this.loadingComponent.width(this.container.width());this.loadingComponent.fadeTo("normal",0.6,function(){parentThis.makeAjaxRequest(data)})},makeAjaxRequest:function(data,callBackOnSuccess,callBackOnError){if(typeof(data)=="undefined"||data==null){data=""}if(data.length>0){data=data+"&"}data=data+"browseNodeId="+this.browseNodeId+"&sessionID="+this.sessionId+"&isAjaxRequest=1";var parentThis=this;jQuery.ajax({type:"GET",url:parentThis.ajaxPageUrl,data:data,cache:true,error:function(html,status){if(callBackOnError){callBackOnError()}else{parentThis.errorComponent.show();parentThis.loadingComponent.fadeTo("normal",0);parentThis.loadingComponent.height(0);parentThis.loadingComponent.width(0)}},success:function(html,status){parentThis.embeddedSearchContent=html;if(callBackOnSuccess){callBackOnSuccess()}else{parentThis.container.html(html);parentThis.initialize();parentThis.loadingComponent.fadeTo("normal",0);parentThis.loadingComponent.height(0);parentThis.loadingComponent.width(0)}},timeout:20000})},populateAjaxContentOnLoad:function(){if(window.location.href&&window.location.href.indexOf("#")>-1){var data=window.location.href;data=data.substring(data.indexOf("#")+1);this.makeAjaxRequest(data,function(){jQuery("#embeddedSearchResults").html(embeddedSearchComponent.embeddedSearchContent);jQuery(".embeddedSearchBackDiv").show();if(typeof(embeddedSearchComponent)!="undefined"){embeddedSearchComponent.initialize()}},function(){jQuery(".embeddedSearchBackDiv").show();if(typeof(embeddedSearchComponent)!="undefined"){embeddedSearchComponent.initialize()}})}}};

jQuery.noConflict();jQuery(document).ready(function(){if(jQuery("div.compareButton").length!=0){itemCompare.initialize()}});var itemCompare={maxItems:5,selectedObjectCount:0,selectedObjects:new Array(),lastSelectedObject:null,justAddedText:'Added to Compare<br/>You can add upto REPLACE_N_MORE more products or <a href="#">compare now</a>.',youreDoneText:'You have selected 5 products to compare <a href="#">compare now</a>',noMoreAllowedText:'<span style="color: #FF0000">Only 5 items can be compared at one time. <a href="#">compare now</a></span>',compareThisText:"Compare",postURL:"/gp/comparison",paginationLinks:null,initialize:function(){var parentThis=this;this.checkboxes=jQuery("#content").find(".itemComparison > input.compCheckbox");this.paginationLinks=jQuery("#content").find(".paginationDetail").find("a");this.addHandlers();var itemDisplayList=new Array();var preSelectedAsins=this.getParamsFromQS("itemDisplayList");if(preSelectedAsins!=null&&preSelectedAsins.length!=0){itemDisplayList=preSelectedAsins.split(",")}this.selectedObjectCount=(itemDisplayList.length>this.maxItems)?this.maxItems:itemDisplayList.length;for(i=0;i<this.selectedObjectCount;i++){this.selectedObjects[itemDisplayList[i]]=true}this.checkboxes.each(function(idx,domEl){var asin=parentThis.getAsinFromDomEl(domEl);if(parentThis.selectedObjects[asin]){domEl.checked=true;parentThis.lastSelectedObject=domEl}else{parentThis.selectedObjects[asin]=false}});if(this.lastSelectedObject!=null){var msg=this.justAddedText.replace("REPLACE_N_MORE",this.maxItems-this.selectedObjectCount);if(this.selectedObjectCount==this.maxItems){msg=this.youreDoneText}this.showMessageOnItem(this.lastSelectedObject,msg)}},addHandlers:function(){var parentThis=this;this.checkboxes.each(function(idx,domEl){jQuery(domEl).click(function(){parentThis.checkBoxHit(domEl)})});this.paginationLinks.click(function(){parentThis.nextPage(this)});jQuery("#content > form").submit(function(){return false});jQuery("div.compareButton > input").click(function(){parentThis.compare()})},checkBoxHit:function(checkbox){var returnable=false;var asin=this.getAsinFromDomEl(checkbox);if(!this.selectedObjects[asin]){if(this.selectedObjectCount==this.maxItems-1){this.selectedObjectCount++;this.highlightItem(checkbox);this.showMessageOnItem(checkbox,this.youreDoneText)}else{if(this.selectedObjectCount==this.maxItems){this.showMessageOnItem(checkbox,this.noMoreAllowedText);jQuery(checkbox).attr("checked",false);returnable=true}else{this.selectedObjectCount++;this.highlightItem(checkbox);this.showMessageOnItem(checkbox,this.justAddedText.replace("REPLACE_N_MORE",this.maxItems-this.selectedObjectCount))}}if(this.lastSelectedObject!=null){this.showMessageOnItem(this.lastSelectedObject,this.compareThisText)}this.lastSelectedObject=checkbox;if(returnable){return}}else{this.selectedObjectCount--;this.unhighlightItem(checkbox);this.showMessageOnItem(this.checkbox,this.compareThisText);if(this.lastSelectedObject!=null){this.showMessageOnItem(this.lastSelectedObject,this.compareThisText)}var allHighlighted=jQuery("#content").find("div.itemCompHighlight");if(allHighlighted.length!=0){var firstHighlighted=allHighlighted[0];var firstCheckbox=jQuery(firstHighlighted).find("input.compCheckbox");this.showMessageOnItem(firstCheckbox,this.justAddedText.replace("REPLACE_N_MORE",this.maxItems-this.selectedObjectCount));this.lastSelectedObject=firstCheckbox}}this.selectedObjects[asin]=!this.selectedObjects[asin]},getAsinFromDomEl:function(checkbox){return jQuery(checkbox).attr("value")},getParamsFromQS:function(keyRequired){var qs=window.location.search.substring(1).split("&");for(i=0;i<qs.length;i++){var key=qs[i].split("=")[0];var value=qs[i].split("=")[1];if(key==keyRequired){return unescape(value)}}return null},highlightItem:function(checkbox){var itemDiv=this.getItem(checkbox);itemDiv.removeClass("item");itemDiv.addClass("itemCompHighlight")},unhighlightItem:function(checkbox){var itemDiv=jQuery(checkbox).parent().parent().parent();itemDiv.removeClass("itemCompHighlight");itemDiv.addClass("item")},getItem:function(checkbox){return jQuery(checkbox).parent().parent().parent()},showMessageOnItem:function(checkbox,string){var parentThis=this;var itemDiv=this.getItem(checkbox);itemDiv.find("span.compareTitle").html(string);itemDiv.find("span.compareTitle").find("a").click(function(){parentThis.compare();return false})},compare:function(){if(this.selectedObjectCount<=1){jQuery("div#impMsgBox").show();return}else{jQuery("div#impMsgBox").hide()}window.location.href=this.getURL()},getItemDisplayListString:function(){var selectedAsins=new Array();for(var asin in this.selectedObjects){if(this.selectedObjects[asin]){selectedAsins.push(asin)}}return selectedAsins.join(",")},getURL:function(){var queryParams="itemDisplayList="+this.getItemDisplayListString()+"&";queryParams+="nodeID="+nodeID+"&";queryParams+="refLink="+escape(location.href)+"&";queryParams+="category="+category;return this.postURL+"?"+queryParams},nextPage:function(link){var jObj=jQuery(link);var href=jObj.attr("href");href+="&itemDisplayList="+this.getItemDisplayListString();jObj.attr("href",href)}};


