dojo.registerModulePath("wc","wc");
dojo.require("dojo.io.*");
dojo.require("wc.widget.ProductQuickView");
dojo.require("wc.widget.BaseContent");
dojo.require("wc.widget.ToolTipContent");
dojo.require("dojo.widget.Button");
dojo.require("dojo.widget.Menu2");
dojo.require("wc.widget.RangeSlider");
dojo.require("dojo.xml.Parse");
dojo.require("dojo.event.*");
dojo.require("dojo.undo.browser");
dojo.require("wc.widget.ScrollablePane");
dojo.require("dojo.animation.*");
dojo.require("dojo.lfx.*");
dojo.require("dojo.string.extras");
dojo.require("dojo.collections.ArrayList");
var beginIndex=0;
var prevIndex=null;
var nextIndex=null;
function WCProduct(){
this.catentryId="";
this.SKU="";
this.name="";
this.identifierCounter="";
this.shortDescription="";
this.smallImageSrc="";
this.mediumImageSrc="";
this.price="";
this.brand="";
this.features=new Array();
this.productDisplayURL="";
this.dragSourceType="";
this.baseContentHTML="";
this.toolTipHTML="";
this.category="category display";
};
categoryDisplayJS={catalogEntriesResultSet:new Vector(),catalogEntriesByPrice:new Vector(),pageSize:12,resultsPerRow:4,displayCounter:0,displayRowCounter:0,productIdentifierString:"catBrowse",catalogEntriesResultSetTotal:0,catalogEntriesResultSetTotalPages:0,catalogEntriesResultSetCurrentPageNumber:0,displayTotal:this.pageSize,beginIndex:0,prevIndex:null,nextIndex:null,imagePath:"UNDEFINED",viewType:"image",storeId:"UNDEFINED",catalogId:"UNDEFINED",createProductWidget:function(_1,_2,_3,_4,_5,_6,_7,_8,_9){
var _a=_3+_2.identifierCounter;
var _b="";
var _c=_2.identifierCounter;
if(_2.baseContentHTML==null||_2.baseContentHTML==""){
if(_2.smallImageSrc==""){
_2.smallImageSrc=_6+"NoImageIcon_sm45.jpg";
}
if(_2.mediumImageSrc==""){
_2.mediumImageSrc=_6+"no_image.gif";
}
var _d=(_7=="image")?_2.mediumImageSrc:_2.smallImageSrc;
var _e="";
var _f="";
var _10="";
if(_7=="image"){
if(_2.price==""){
_e=""+"\t<div id='"+_a+"NamePriceDiv' >\n"+"\t\t<b>"+"\t\t"+_2.displayPrice+"\n"+"\t\t</b>"+"\t\t<br/>\n"+"\t\t"+_2.name+"\n"+"\t</div>\n"+"\t<img src='"+_6+"wtb-li.jpg"+"'/>&nbsp;&nbsp;<a href='"+_2.productDisplayURL+"'>View Product Details</a>";
}else{
_e=""+"\t<div id='"+_a+"NamePriceDiv' >\n"+"\t\t<b>"+"\t\tRegular Price:"+"\t\t"+_2.displayPrice+"\n"+"\t\tSale Price:"+"\t\t"+_2.price+"\n"+"\t\t</b>"+"\t\t<br/>\n"+"\t\t"+_2.name+"\n"+"\t</div>\n"+"\t<img src='"+_6+"wtb-li.jpg"+"'/>&nbsp;&nbsp;<a href='"+_2.productDisplayURL+"'>View Product Details</a>";
}
}else{
if(_7=="detailed"){
_e=""+"\t\t<b>"+"\t\t"+_2.displayPrice+"\n"+"\t\t</b>"+"\t\t<br />"+"\t\t"+_2.name+"\n"+"\t\t<br />";
}
}
if(_c%2==0){
_b=""+"\t\t\t<div class='wtb-container-r'>\n"+"\t\t\t<div class='wtb-content-l'><input type='checkbox' id='"+_2.catentryId+"' onclick='compare(this)'/>"+"\t\t\t<div id='"+_a+"' >\n"+"\t\t\t<img src='"+_2.mediumImageSrc+"'  width='132' height='81' />\n"+"\t\t\t</div>\n"+"\t\t\t</div>\n"+"\t\t\t<div class='wtb-content-r'>\n"+"\t\t\t\t\t\t"+_e+"\t\t\t</div><br style='clear:both;' /><br style='clear:both;' />"+"\t\t\t<b>"+_2.shortDescription+"</b>\n"+"\t\t\t</div>";
}else{
_b=""+"\t\t\t<div class='wtb-container-l'>\n"+"\t\t\t<div class='wtb-content-l'><input type='checkbox' id='"+_2.catentryId+"' onclick='compare(this)'/>"+"\t\t\t<div id='"+_a+"' >\n"+"\t\t\t<img src='"+_2.mediumImageSrc+"'  width='132' height='81' />\n"+"\t\t\t</div>\n"+"\t\t\t</div>\n"+"\t\t\t<div class='wtb-content-r'>\n"+"\t\t\t\t\t\t"+_e+"\t\t\t</div><br style='clear:both;' /><br style='clear:both;' />"+"\t\t\t<b>"+_2.shortDescription+"</b>\n"+"\t\t\t</div>";
}
}else{
_b=_2.baseContentHTML;
}
var div=document.createElement("div");
_1.appendChild(div);
var _12=dojo.widget.createWidget("ProductQuickView",{id:"productQuickView"+_2.identifierCounter,defaultContent:false,identifier:_a},div);
var _13=document.createElement("div");
_12.domNode.appendChild(_13);
var _14=dojo.widget.createWidget("BaseContent",{id:"productQuickViewBase"+_2.identifierCounter,dragSourceId:_a,dragSourceType:_2.dragSourceType,catentryId:_2.catentryId,userInnerHtml:_b},_13);
},createProductToolTipWidget:function(_15,_16,_17,_18,_19,_1a,_1b){
var _id=_17+_16.identifierCounter;
var _1d="";
if(_16.toolTipHTML==null||_16.toolTipHTML==""){
var _1e="";
if(_18){
_1e=""+"\t<a id='comparelink"+_16.identifierCounter+"' href='javascript: Add2CompareAjax(\""+_16.catentryId+"\");'  >\n"+"\t\t<img src='"+_19+"compare.gif' alt='compare' border='0' className='popup_iconimages' class='popup_iconimages' />\n"+"\t</a>\n";
}
_1d=""+"\t\t\t<div>\n"+"\t\t\t\t<div id='tooltipHeaderDiv"+_16.identifierCounter+"' className='popup_header' class='popup_header' >\n"+"\t\t\t\t\t<div id='tooltipHeaderNameDiv"+_16.identifierCounter+"' className='popup_headerTitle' class='popup_headerTitle' >\n"+"\t\t\t\t\t\tProduct Details"+"\t\t\t\t\t</div>\n"+"\t\t\t\t</div>\n"+"\t\t\t\t<div id='tooltipContentDiv"+_16.identifierCounter+"' className='popup_content' class='popup_content' >\n"+"\t\t\t\t\t<table border='0' width='285'>\n"+"\t\t\t\t\t\t<tbody id='"+_id+"TTTable' >\n"+"\t\t\t\t\t\t\t<tr id='"+_id+"TTTr' >\n"+"\t\t\t\t\t\t\t\t<td id='"+_id+"TTTd' align='center' valign='top' width='90' style='padding-top:4px;padding-left:10px;'>\n"+"\t\t\t\t\t\t\t\t\t<a id='imgcatBrowse"+_16.identifierCounter+"' href='"+_16.productDisplayURL+"' >\n"+"\t\t\t\t\t\t\t\t\t\t<img src='"+_16.mediumImageSrc+"' alt='"+_16.shortDescription+"' border='0' className='popup_iconimages' class='popup_iconimages' style='margin-bottom:3px;' />\n"+"\t\t\t\t\t\t\t\t\t</a>\n"+"\t\t\t\t\t\t\t\t\t<br/>\n"+"\t\t\t\t\t\t\t\t\t<a id='cartlink"+_16.identifierCounter+"' href='javascript: Add2ShopCartAjax(\""+_16.catentryId+"\");'  >\n"+"\t\t\t\t\t\t\t\t\t\t<img src='"+_19+"quickcart.gif' alt='add to cart' border='0' className='popup_iconimages' class='popup_iconimages' />\n"+"\t\t\t\t\t\t\t\t\t</a>\n"+"\t\t\t\t\t\t\t\t\t<a id='listlink"+_16.identifierCounter+"' href='javascript: Add2WishListAjax(\""+_16.catentryId+"\");'  >\n"+"\t\t\t\t\t\t\t\t\t\t<img src='"+_19+"wishlist.gif' alt='add to list' border='0' className='popup_iconimages' class='popup_iconimages' />\n"+"\t\t\t\t\t\t\t\t\t</a>\n"+"\t\t\t\t\t\t\t\t\t"+_1e+"\t\t\t\t\t\t\t\t</td>\n"+"\t\t\t\t\t\t\t\t<td id='"+_id+"TTTd2' valign='top' style='padding-top:5px;padding-left:0px;'>\n"+"\t\t\t\t\t\t\t\t\t<div id='"+_id+"NameDiv' className='popup_productname' class='popup_productname' >\n"+"\t\t\t\t\t\t\t\t\t\t"+_16.name+"\n"+"\t\t\t\t\t\t\t\t\t</div>\n"+"\t\t\t\t\t\t\t\t\t<div id='"+_id+"PriceDiv' className='popup_productprice' class='popup_productprice' >\n"+"\t\t\t\t\t\t\t\t\t\t"+_16.displayPrice+"\n"+"\t\t\t\t\t\t\t\t\t</div>\n"+"\t\t\t\t\t\t\t\t\t<div id='"+_id+"SDescDiv' className='popup_productother' class='popup_productother' >\n"+"\t\t\t\t\t\t\t\t\t\t"+_16.shortDescription+"\n"+"\t\t\t\t\t\t\t\t\t</div>\n"+"\t\t\t\t\t\t\t\t\t<input id='formParamsCatEntryId_"+_id+"' name='formParamsCatEntryId_"+_id+"' type='hidden' value='"+_16.catentryId+"' />"+"\t\t\t\t\t\t\t\t</td>\n"+"\t\t\t\t\t\t\t</tr>\n"+"\t\t\t\t\t\t</tbody>\n"+"\t\t\t\t\t</table>\n"+"\t\t\t\t</div>\n"+"\t\t\t\t<div id='tooltipFooterDiv"+_16.identifierCounter+"' className='popup_footer' class='popup_footer' >\n"+"\t\t\t\t</div>\n"+"\t\t\t</div>\n";
}else{
_1d=_16.toolTipHTML;
}
var div=document.createElement("div");
_15.appendChild(div);
var _20=dojo.widget.createWidget("ToolTipContent",{id:"productToolTip"+_16.identifierCounter,connectId:_id,toggleDuration:"250",userInnerHtml:_1d},div);
_20.productObj=_16;
},addElementToVector:function(_21,_22,SKU,_24,_25,_26,_27,_28,_29,_2a,_2b,_2c,_2d,_2e,_2f,_30){
var _31=new WCProduct();
_31.catentryId=_22;
_31.SKU=SKU;
_31.name=_24;
_31.identifierCounter=_25;
_31.shortDescription=_26;
_31.smallImageSrc=_27;
_31.mediumImageSrc=_28;
_31.price=_29;
_31.displayPrice=_2a;
_31.brand=_2b;
_31.productDisplayURL=_2c;
_31.features=_2e;
_31.baseContentHTML=_2f;
_21.addElement(_31);
},showResults:function(_32){
cursor_wait();
dojo.lang.forEach(dojo.widget.byType("ProductQuickView"),function(_33){
tempStr=_33.identifier;
tempStr=tempStr.substring(0,9);
if(tempStr==this.productIdentifierString){
_33.destroy();
}
});
var _34=null;
var _35=document.getElementById("fastFinderResults");
if(_35!=null){
for(j=0;j<_35.childNodes.length;j++){
_35.removeChild(_35.childNodes[j]);
}
this.displayCounter=0;
this.displayRowCounter=0;
this.generateResultSet(_32);
for(i=beginIndex;i<(beginIndex+this.displayTotal);i++){
this.displayCounter++;
_34=this.catalogEntriesResultSet.elementAt(i);
var td1=document.createElement("td");
td1.setAttribute("id","browseCatEntry"+i);
if(this.viewType=="image"){
if(((this.displayCounter-1)%this.resultsPerRow)==0){
this.displayRowCounter++;
var tr1=document.createElement("tr");
tr1.setAttribute("id","displayRow"+this.displayRowCounter);
}else{
var tr1=document.getElementById("displayRow"+this.displayRowCounter);
}
}else{
if(this.viewType=="detailed"){
this.displayRowCounter++;
var tr1=document.createElement("tr");
tr1.setAttribute("id","displayRow"+this.displayRowCounter);
}
}
tr1.appendChild(td1);
if(i%this.pageSize==0){
var _38=document.createElement("table");
_38.setAttribute("width","100%");
var _39=document.createElement("tbody");
_39.setAttribute("id","displayItemsTable");
_38.appendChild(_39);
_39.appendChild(tr1);
_35.appendChild(_38);
}else{
var _39=document.getElementById("displayItemsTable");
_39.appendChild(tr1);
}
this.createProductWidget(td1,_34,this.productIdentifierString,"medium",false,this.imagePath,this.viewType,this.storeId,this.catalogId);
}
}
cursor_clear();
},generateResultSet:function(_3a){
this.catalogEntriesResultSet=new Vector();
for(k=0;k<this.catalogEntriesByPrice.size();k++){
this.catalogEntriesResultSet.addElement(this.catalogEntriesByPrice.elementAt(k));
}
this.catalogEntriesResultSetTotal=this.catalogEntriesResultSet.size();
this.catalogEntriesResultSetTotalPages=Math.ceil(this.catalogEntriesResultSetTotal/this.pageSize);
this.catalogEntriesResultSetCurrentPageNumber=Math.floor(beginIndex/this.pageSize)+1;
if(this.catalogEntriesResultSetTotal<(this.catalogEntriesResultSetCurrentPageNumber*this.pageSize)){
this.displayTotal=(this.catalogEntriesResultSetTotal-beginIndex);
}else{
this.displayTotal=this.pageSize;
}
if(beginIndex==0){
prevIndex=0;
}else{
prevIndex=beginIndex-this.pageSize;
}
if((beginIndex+this.displayTotal)>=this.catalogEntriesResultSetTotal){
nextIndex=beginIndex;
}else{
nextIndex=beginIndex+this.displayTotal;
}
},filterResultsWithView:function(_3b){
document.FastFinderForm.pageView.value=_3b;
this.viewType=_3b;
document.FastFinderForm.initialState.value="false";
this.showResults("view");
},processBookmarkURL:function(){
var _3c=location.hash;
if(_3c){
_3c=_3c.substring(1,_3c.length);
}
if(_3c){
var _3d=_3c.indexOf("identifier",0);
if(_3d>=0){
var _3e=_3c.substring(0,_3d-1);
}
}
if(_3c==null||_3c==""){
}
},initCategoryHistory:function(){
var _3f=new Object();
_3f["pageView"]=this.viewType;
_3f["beginIndex"]=this.beginIndex;
_3f["pageSize"]=this.pageSize;
var _40="&identifier="+(new Date()).getTime();
var _41=new Object();
_41["action"]="filterResults";
_41["actionNameSpace"]=null;
_41["actionParameter"]=_3f;
var _42=new categoryDisplayJS.HistoryTracker(_41,_40);
dojo.undo.browser.setInitialState(_42);
},goBack:function(){
if(this.workAreaModeValue.action!=null&&this.workAreaModeValue.action!=""){
if(this.workAreaModeValue.actionNameSpace!=null&&this.workAreaModeValue.actionNameSpace!=""){
this.workAreaModeValue.actionNameSpace=null;
}
var _43=eval(this.workAreaModeValue.action);
_43.call(this.workAreaModeValue.actionNameSpace,this.workAreaModeValue.actionParameter);
}
},goForward:function(){
if(this.workAreaModeValue.action!=null&&this.workAreaModeValue.action!=""){
if(this.workAreaModeValue.actionNameSpace!=null&&this.workAreaModeValue.actionNameSpace!=""){
this.workAreaModeValue.actionNameSpace=null;
}
var _44=eval(this.workAreaModeValue.action);
_44.call(this.workAreaModeValue.actionNameSpace,this.workAreaModeValue.actionParameter);
}
},HistoryTracker:function(_45,_46){
this.workAreaModeValue=null;
this.workAreaModeValue=_45;
this.changeUrl=_46;
}};
function onLoad(){
categoryDisplayJS.initCategoryHistory();
categoryDisplayJS.showResults();
};
dojo.addOnLoad(onLoad);
categoryDisplayJS.HistoryTracker.prototype.back=categoryDisplayJS.goBack;
categoryDisplayJS.HistoryTracker.prototype.forward=categoryDisplayJS.goForward;

