dojo.registerModulePath("wc","wc");
dojo.require("dojo.io.*");
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="";
}
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="";
if(_2.baseContentHTML==null||_2.baseContentHTML==""){
if(_2.smallImageSrc==""){
_2.smallImageSrc=_6+"NoImageIcon_sm45.jpg";
}
if(_2.mediumImageSrc==""){
_2.mediumImageSrc=_6+"NoImageIcon_sm.jpg";
}
var _c=(_7=="image")?_2.mediumImageSrc:_2.smallImageSrc;
var _d="";
var _e="";
var _f="";
if(_7=="image"){
_d=""+"<td id='"+_a+"Td' align='center' >\n"+"\t<div id='"+_a+"' align='center' >\n"+"\t\t<a id='imgcatBrowse"+_a+"' href='"+_2.productDisplayURL+"' >\n"+"\t\t\t<img src='"+_c+"' alt='"+_2.shortDescription+"' border='0' />\n"+"\t\t</a>\n"+"\t</div>\n"+"\t<div id='"+_a+"NamePriceDiv' style='padding-top:4px;'>\n"+"\t\t"+_2.name+"\n"+"\t\t<br/>\n"+"\t\t"+_2.displayPrice+"\n"+"\t</div>\n"+"</td>\n";
}else{
if(_7=="detailed"){
_d=""+"\t<td id='"+_a+"Td' align='left' width='10%'>\n"+"\t\t<div id='"+_a+"' align='left' >\n"+"\t\t\t<a id='imgcatBrowse"+_a+"' href='"+_2.productDisplayURL+"' >\n"+"\t\t\t\t<img src='"+_c+"' alt='"+_2.shortDescription+"' border='0' />\n"+"\t\t\t</a>\n"+"\t\t</div>\n"+"\t</td>\n"+"\t<td id='"+_a+"NameTd'>\n"+"\t\t"+_2.name+"\n"+"\t\t<br/>\n"+"\t\t"+_2.shortDescription+"\n"+"\t</td>\n"+"\t<td id='"+_a+"PriceTd' align='right'>\n"+"\t\t"+_2.displayPrice+"\n"+"\t</td>\n";
}
}
_b=""+"\t\t\t<table width='100%'>\n"+"\t\t\t\t<tbody id='"+_a+"Table' >\n"+"\t\t\t\t\t<tr id='"+_a+"Tr' >\n"+"\t\t\t\t\t\t"+_d+"\t\t\t\t\t</tr>\n"+"\t\t\t\t</tbody>\n"+"\t\t\t</table>\n";
}else{
_b=_2.baseContentHTML;
}
var div=document.createElement("div");
_1.appendChild(div);
var _11=dojo.widget.createWidget("ProductQuickView",{id:"productQuickView"+_2.identifierCounter,defaultContent:false,identifier:_a},div);
var _12=document.createElement("div");
_11.domNode.appendChild(_12);
var _13=dojo.widget.createWidget("BaseContent",{id:"productQuickViewBase"+_2.identifierCounter,dragSourceId:_a,dragSourceType:_2.dragSourceType,catentryId:_2.catentryId,userInnerHtml:_b},_12);
var _14=this.createProductToolTipWidget(_11.domNode,_2,_3,_5,_6,_8,_9);
},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);
},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.dragSourceType=_2d;
_31.features=_2e;
_31.baseContentHTML=_2f;
_31.toolTipHTML=_30;
_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));
}
var _3b=document.getElementById("viewTypeTD2");
var _3c=document.getElementById("viewTypeTD1");
if(_3b!=null&&_3c!=null){
if(this.viewType=="image"){
dojo.html.hide(_3b);
dojo.html.show(_3c);
}else{
if(this.viewType=="detailed"){
dojo.html.hide(_3c);
dojo.html.show(_3b);
}
}
}
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(_3d){
document.FastFinderForm.pageView.value=_3d;
this.viewType=_3d;
document.FastFinderForm.initialState.value="false";
var _3e=document.getElementById("viewTypeTD1");
var _3f=document.getElementById("viewTypeTD2");
if(this.viewType=="image"){
dojo.html.hide(_3f);
dojo.html.show(_3e);
}else{
if(this.viewType=="detailed"){
dojo.html.hide(_3e);
dojo.html.show(_3f);
}
}
this.showResults("view");
},processBookmarkURL:function(){
var _40=location.hash;
if(_40){
_40=_40.substring(1,_40.length);
}
if(_40){
var _41=_40.indexOf("identifier",0);
if(_41>=0){
var _42=_40.substring(0,_41-1);
}
}
if(_40==null||_40==""){
}
},initCategoryHistory:function(){
var _43=new Object();
_43["pageView"]=this.viewType;
_43["beginIndex"]=this.beginIndex;
_43["pageSize"]=this.pageSize;
var _44="&identifier="+(new Date()).getTime();
var _45=new Object();
_45["action"]="filterResults";
_45["actionNameSpace"]=null;
_45["actionParameter"]=_43;
var _46=new categoryDisplayJS.HistoryTracker(_45,_44);
dojo.undo.browser.setInitialState(_46);
},goBack:function(){
if(this.workAreaModeValue.action!=null&&this.workAreaModeValue.action!=""){
if(this.workAreaModeValue.actionNameSpace!=null&&this.workAreaModeValue.actionNameSpace!=""){
this.workAreaModeValue.actionNameSpace=null;
}
var _47=eval(this.workAreaModeValue.action);
_47.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 _48=eval(this.workAreaModeValue.action);
_48.call(this.workAreaModeValue.actionNameSpace,this.workAreaModeValue.actionParameter);
}
},HistoryTracker:function(_49,_4a){
this.workAreaModeValue=null;
this.workAreaModeValue=_49;
this.changeUrl=_4a;
}};
function onLoad(){
categoryDisplayJS.initCategoryHistory();
categoryDisplayJS.showResults();
}
dojo.addOnLoad(onLoad);
categoryDisplayJS.HistoryTracker.prototype.back=categoryDisplayJS.goBack;
categoryDisplayJS.HistoryTracker.prototype.forward=categoryDisplayJS.goForward;

