function popIt(width,height,scrollbars){if(!width)width=
"335"
;if(!height)height=
"460"
;var windowString=
'width='
+width+
',height='
+height+
',resizable=1,status=0,toolbar=no,scrollbars='
+scrollbars+
',scrolling=auto'
;var popItWindow=open(
''
,
"popIt"
,windowString);return false;}
function trim(str){str=String(str);return str.replace(
/^\s+/g,
''
).replace(
/\s+$/g,
''
);}
function renderPreviousNextProductButtons(currentProductId){var html=
""
;var productListString=pdGetCookie(
"pd_currentProductList"
);if(!isBlank(productListString)){if(String(productListString).indexOf(currentProductId)>-1){var productArray=String(productListString).split(
","
);var item=new Object();var i=0;for(item in productArray){if(currentProductId==productArray[item])break;i++}if(i>0){html+=
'<a href="#" onclick="return(jumpToUrl(\''
+productArray[i-1]+
'.html\'))" class="previousNextLink">Previous Item</a><span class="previousNextLink"> &nbsp;|&nbsp; </span>'
}if(i+1<productArray.length){html+=
'<a href="#" onclick="return(jumpToUrl(\''
+productArray[i+1]+
'.html\'))" class="previousNextLink">Next Item</a>'
}}}document.getElementById(
"previousNextProductButtons"
).innerHTML=html;return false}
function pdGetCookie(cookieName){var allCookies=document.cookie;var cookieStart=allCookies.indexOf(cookieName);if(cookieStart==-1)return
""
;cookieStart+=cookieName.length+1;var cookieEnd=allCookies.indexOf(
";"
,cookieStart);if(cookieEnd==-1)cookieEnd=allCookies.length;var cookieValue=unescape(allCookies.substring(cookieStart,cookieEnd));return cookieValue}
function pdSetCookie(cookieName,cookieValue,cookieDomain,cookiePath,expirationDate){if(isBlank(cookieDomain))cookieDomain=getCurrentDomainName();if(isBlank(cookiePath))cookiePath=
"/"
;var cookieString=cookieName+
"="
+escape(cookieValue)+
";domain="
+cookieDomain+
";path="
+cookiePath;if(!isBlank(expirationDate)){cookieString+=
";expires="
+expirationDate.toGMTString();}document.cookie=cookieString;return true}
function getCurrentDomainName(){var url=String(location);var domainName=extractDomain(url);return domainName}
function extractDomain(url){var url=url.replace(
"http://"
,
""
);var slashIndex=url.indexOf(
"/"
);if(slashIndex==-1)slashIndex=url.length;var url=url.substring(0,slashIndex);var urlSectionArray=url.split(
'.'
);var urlSectionArrayLength=urlSectionArray.length;var domainName=
""
;for(var i=urlSectionArrayLength-2;i<urlSectionArrayLength;i++){domainName+=
"."
+urlSectionArray[i]}return domainName}
function isBlank(item){item=String(item).toLowerCase();if(item==
"undefined"
||item==
""
||item==
"null"
)return true;else return false}
function jumpToUrl(url){if(url!=
""
&&String(url)!=
"undefined"
) location=url;return false;}
function showOrderButtons(){document.getElementById(
'divorderdisable'
).style.display=
'none'
;document.getElementById(
'divorderenable'
).style.display=
'inline'
;document.getElementById(
'divwishlistdisable'
).style.display=
'none'
;document.getElementById(
'divwishlistenable'
).style.display=
'inline'
;}
function hideOrderButtons(){document.getElementById(
'divorderenable'
).style.display=
'none'
;document.getElementById(
'divorderdisable'
).style.display=
'inline'
;document.getElementById(
'divwishlistenable'
).style.display=
'none'
;document.getElementById(
'divwishlistdisable'
).style.display=
'inline'
;}
function checkRequestSize(){if(document.forms.orderForm.Size.value==
"needSize"
){hideOrderButtons();showSizeRequestForm();}}
function hideSizeRequestForm(){document.getElementById(
"sizeRequestFormWrapper"
).className=
"sizeRequestFormHidden"
;document.forms.orderForm.Size.selectedIndex=0;showOrderButtons();return false;}
function showSizeRequestForm(){document.getElementById(
"sizeRequestFormWrapper"
).className=
"sizeRequestForm"
;return false;}
function showSizeRequestThankYou(){document.getElementById(
"sizeRequestFormThankYou"
).className=
"sizeRequestForm"
;return false;}
function hideSizeRequestThankYou(){document.getElementById(
"sizeRequestFormThankYou"
).className=
"sizeRequestFormHidden"
;return false;}
function sendSizeRequestForm(){document.getElementById(
"sizeRequestForm"
).submit();hideSizeRequestForm();showSizeRequestThankYou();return false;}
function addSizeRequestOption(){try {document.forms.orderForm.Size[document.forms.orderForm.Size.length]=new Option(
"Need Another Size"
,
"needSize"
,false);pdAddEvent(document.forms.orderForm.Size,
"change"
,checkRequestSize);} catch(e){
}}
function pdAddEvent(obj,evType,fn){if (obj.addEventListener){obj.addEventListener(evType,fn,false);return true;} else if (obj.attachEvent){var r=obj.attachEvent(
"on"
+evType,fn);return r;} else {return false;}}
function pdRemoveEvent(obj,type,fn){if (obj.detachEvent){obj.detachEvent(
'on'
+type,fn);obj[type+fn]=null;} else {obj.removeEventListener(type,fn,false);}}
if(isBlank(pd_itemsPerPage)) var pd_itemsPerPage=25;if(isBlank(pd_itemsPerRow)) var pd_itemsPerRow=1;if(isBlank(pd_sortBy)) var pd_sortBy=
""
;var pd_lastSection=pdGetCookie(
"pd_lastSection"
);var pd_refreshId=
""
;var pd_debugFlag=false;var pd_currentPageNumber=getCurrentPageNumber();var pd_pagesToDisplay=5;var pd_searchFirstRun=true;var pd_sortMethod=
"title"
var pd_filterSearchDelay=650;var pd_searchText=
""
;var pd_brandSelected=
""
;var pd_sizeSelected=
""
;var pd_priceRange=
""
;var pd_filteredDisplayList=new Array();function parseDisplayList(){
var i=0;var displayList=new Array();
var productIdString=
""
;var listWrapper=
""
;try {listWrapper=document.getElementById(
"productWrapper"
);} catch(e){
}
debug(
"listWrapper = "
+listWrapper);if(!isBlank(listWrapper)){if(listWrapper.firstChild){
var oChild=listWrapper.firstChild;while(oChild){if(oChild.nodeType==1&&String(oChild.id).indexOf(
"productDisplay"
)>-1){displayList[i]=new Object();displayList[i].id=oChild.id;displayList[i].html=document.getElementById(oChild.id).innerHTML;
var subChild=oChild.firstChild;while(subChild){if(subChild.nodeType==1){if(subChild.id==
"id"
) displayList[i].id=String(subChild.title);if(subChild.id==
"ha-name"
) displayList[i].haName=String(subChild.title);if(subChild.id==
"name"
) displayList[i].title=String(subChild.title);if(subChild.id==
"brand"
) displayList[i].brand=String(subChild.title).toUpperCase();if(subChild.id==
"sizeForm"
) displayList[i].sizeForm=String(subChild.title);if(subChild.id==
"price"
) displayList[i].price=subChild.title-0;if(subChild.id==
"rating"
) displayList[i].rating=subChild.title-0;if(subChild.id==
"bestseller"
) displayList[i].bestseller=subChild.title;if(subChild.id==
"sizeList"
) displayList[i].sizeList=subChild.title;if(subChild.id==
"sizeColorList"
) displayList[i].sizeColorList=subChild.title;}
displayList[i].defaultOrder=i;
if(!isBlank(displayList[i].haName)) displayList[i].title=displayList[i].haName;subChild=subChild.nextSibling;}
displayList[i].searchIndex=
""
;if(displayList[i].title) displayList[i].searchIndex+=String(displayList[i].title).toLowerCase();if(displayList[i].name) displayList[i].searchIndex+=
" "
+String(displayList[i].name).toLowerCase();if(displayList[i].brand) displayList[i].searchIndex+=
" "
+String(displayList[i].brand).toLowerCase();
if(displayList[i].id&&i<200) productIdString+=displayList[i].id+
","
;i++;}
oChild=oChild.nextSibling;}}} else {displayList=false;}
if(!isBlank(productIdString)){productIdString=String(productIdString).substring(0,productIdString.length-1);
pdSetCookie(
"pd_currentProductList"
,productIdString,
""
,
""
,
""
);}
pd_filteredDisplayList=displayList;
return displayList;}
function renderProductArray(){debug(
"renderProductArray"
);var productArray=pd_filteredDisplayList;var html=
""
;var pageNumber=1;var i=1;var item=new Object();var tempHtml=
""
;var tempProductHtml=
""
;var rowItemCount=1;var isOpen=false;var productIdList=
""
;var shade=true;debug(
"pd_currentPageNumber render = "
+pd_currentPageNumber);for(item in productArray){productIdList+=productArray[item].id;tempHtml=
""
;if(pageNumber==pd_currentPageNumber||pd_currentPageNumber==
"all"
){if(rowItemCount==1){tempHtml+=
'<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>\r\n'
;isOpen=true;}
tempHtml+=
'<td valign="top"><div id="'
+productArray[item].id+
'" class="displayDiv">'
;if(!shade){tempProductHtml=String(productArray[item].html).replace(
/pagedItemTable/g,
"pagedItemTableOn"
);} else {tempProductHtml=String(productArray[item].html).replace(
/pagedItemTableOff/g,
"pagedItemTable"
);}
tempHtml+=tempProductHtml;tempHtml+=
'</div></td>'
;rowItemCount++;if(rowItemCount>pd_itemsPerRow){tempHtml+=
'</tr></table>'
;rowItemCount=1;isOpen=false;}
shade=!shade;}
i++;pageNumber=Math.ceil(i / pd_itemsPerPage);html+=tempHtml;}
if(isOpen){for(var jj=rowItemCount-1;jj<pd_itemsPerRow;jj++){html+=
'<td width="160">&nbsp;</td>'
;}
html+=
'\r\n</tr></table>\r\n'
;}
return html;}
function displayProductArray(){debug(
"displayProductArray - pd_currentPageNumber = "
+pd_currentPageNumber);
if(!pd_filteredDisplayList) return false;if(pd_filteredDisplayList.length==0){document.getElementById(
"productWrapper"
).innerHTML=
'<div style="text-align:center"><br><br><b>No Items Found.</b><br><br><br><br><br></div>'
;return false;}
pdSetCookie(
"pd_currentPageNumber"
,pd_currentPageNumber);pdSetCookie(
"pd_pagingSortBy"
,pd_sortBy);
if(pd_sortBy==
"default"
) sortProductArrayByDefault();else if(pd_sortBy==
"title"
) sortProductArrayByTitle();else if(pd_sortBy==
"brand"
) sortProductArrayByBrand();else if(pd_sortBy==
"sizeForm"
) sortProductArrayBySizeForm();else if(pd_sortBy==
"price"
) sortProductArrayByPrice();else if(pd_sortBy==
"rating"
) sortProductArrayByRating();else if(pd_sortBy==
"bestseller"
) sortProductArrayByBestseller();
if(isBlank(pd_currentPageNumber)){debug(
"could not find pd_currentPageNumber "
+pd_currentPageNumber+
": setting = 1"
);pd_currentPageNumber=1;}
document.getElementById(
"productWrapper"
).innerHTML=renderProductArray();
document.getElementById(
"previousButton"
).innerHTML=renderPreviousButton(pd_filteredDisplayList.length);document.getElementById(
"pageNumberLinks"
).innerHTML=renderPageNumberLinks(pd_filteredDisplayList.length,
'top'
);document.getElementById(
"nextButton"
).innerHTML=renderNextButton(pd_filteredDisplayList.length);document.getElementById(
"viewAllButton"
).innerHTML=renderViewAllButton(pd_filteredDisplayList.length);document.getElementById(
"previousButtonBottom"
).innerHTML=renderPreviousButton(pd_filteredDisplayList.length);document.getElementById(
"pageNumberLinksBottom"
).innerHTML=renderPageNumberLinks(pd_filteredDisplayList.length,
'top'
);document.getElementById(
"nextButtonBottom"
).innerHTML=renderNextButton(pd_filteredDisplayList.length);document.getElementById(
"viewAllButtonBottom"
).innerHTML=renderViewAllButton(pd_filteredDisplayList.length);
document.getElementById(
"sortLinks"
).innerHTML=renderSortLinks();
document.getElementById(
"filterBySize"
).innerHTML=renderSizeList();
return false;}
function renderSortLinks(){
var html=
""
;if(pd_sortBy==
"default"
){html+=
'<font class="sortLinkOn">Sort By Default</font>'
} else {html+=
'<img src="http://files.duematernity.com/v4/pd_paging/images/pageSortArrows.gif">&nbsp;<a href="#" class="sortLink" onClick="return(doSortBy(\'default\'))">Sort By Default</a>'
}
html+=
'  &nbsp;&nbsp;&nbsp;'
;if(pd_sortBy==
"price"
){html+=
'<font class="sortLinkOn">Sort By Price</font>'
} else {html+=
'<img src="http://files.duematernity.com/v4/pd_paging/images/pageSortArrows.gif">&nbsp;<a href="#" class="sortLink" onClick="return(doSortBy(\'price\'))">Sort By Price</a>'
;}
return html;}
function performFilter(pageNumber,reset){debug(
"performFilter("
+pageNumber+
","
+reset+
")"
);pd_filteredDisplayList=pd_displayList;if(isBlank(pageNumber)) pd_currentPageNumber=1;else pd_currentPageNumber=pageNumber;if(isBlank(reset)) reset=false;if(reset==true){pd_brandSelected=
""
;pd_sizeSelected=
""
;pd_priceRange=
"0to100000"
;pd_searchText=
""
;} else {
pd_sizeSelected=document.forms.filterBySizeForm.filterBySizeSelect.options[document.forms.filterBySizeForm.filterBySizeSelect.selectedIndex].value;
}
pd_filteredDisplayList=getFilteredDisplayListByBrand(pd_brandSelected);pd_filteredDisplayList=getFilteredDisplayListBySize(pd_sizeSelected);
var success=displayProductArray();return false;}
function renderItemCountInfo(productCount){var html=
""
;html+=
'<table border="0" cellpadding="0" cellspacing="0" width="175"><tr valign="middle">'
;if(productCount==1) html+=
'<td class="catPageInfo">'
+productCount+
' Available Model</td>'
;else html+=
'<td class="catPageInfo">'
+productCount+
' Available Models</td>'
;html+=
'<td><img src="/images/spacer.gif" width="25" height="1"></td>'
;html+=
'</tr></table>'
;return html;}
function renderPageNumberLinks(productCount,position){debug(
"renderPageNumberLinks"
);var pageCount=Math.ceil(productCount/pd_itemsPerPage);if(pageCount==1) return
""
;var html=
""
;html+=
'<table border="0" cellpadding="0" cellspacing="0"><tr>'
;if(pd_currentPageNumber !=
"all"
){
var pagesToDisplay=pd_pagesToDisplay;var extraPages=0;var firstPageNumber=pd_currentPageNumber-Math.floor(pagesToDisplay / 2);if(firstPageNumber<1){extraPages=1-firstPageNumber;firstPageNumber=1;}
var lastPageNumber=(pd_currentPageNumber-0)+Math.floor(pagesToDisplay / 2)+extraPages;if(lastPageNumber>pageCount) lastPageNumber=pageCount;for(var i=firstPageNumber;i<=lastPageNumber;i++){if(pd_currentPageNumber==i){html+=
'<td><font class="pageNumOn">'
+i+
'</font>'
;if(i<lastPageNumber) html+=
'<font class="filterBarText">&nbsp;&nbsp;|&nbsp;&nbsp;</font></td>'
;} else {html+=
'<td><a href="#" class="pageNum" onClick="return(viewPage('
+i+
'))">'
+i+
'</a>'
;if(i<lastPageNumber) html+=
'<font class="filterBarText">&nbsp;&nbsp;|&nbsp;&nbsp;</font></td>'
;}}} else {
}
html+=
'</tr></table>'
;return html;}
function viewAll(){
var result=performFilter(
"all"
,false);
return false;}
function viewPage(pageNumber){debug(
"viewPage, setting pageNumber = "
+pageNumber);pd_currentPageNumber=pageNumber;var result=performFilter(pageNumber);return false;}
function renderBrandList(){var brandList=getBrandList();var html=
'<form id="filterByBrandForm" style="display:inline">'
;html+=
'Brand&nbsp;'
;html+=
'<select name="filterByBrandSelect" onChange="return(performFilter())">'
;html+=
'<option value="">-- All Brands --</option>'
;var item=new Object();for(item in brandList){html+=
'<option value="'
+brandList[item].name+
'"'
;if(brandList[item].name==pd_brandSelected) html+=
' SELECTED'
;html+=
'>'
+brandList[item].name+
' ('
+brandList[item].count+
')</option>'
;}
html+=
'</select></form>'
;return html;}
function renderSizeList(){var sizeList=getSizeList();var html=
'<form id="filterBySizeForm" style="display:inline">'
;html+=
'<span class="filterBarText">Size&nbsp;</span>'
;html+=
'<span style="width:100px">'
;html+=
'<select name="filterBySizeSelect" onChange="return(performFilter())" style="border:1px #AD4A72 solid;font-size:10px;color:#AD2E61;">'
;html+=
'<option value="">-- All Sizes --</option>'
;var item=new Object();for(item in sizeList){html+=
'<option value="'
+sizeList[item].size+
'"'
;if(sizeList[item].size==pd_sizeSelected) html+=
' SELECTED'
;html+=
'>'
+sizeList[item].size+
'</option>'
;}
html+=
'</select></span></form>'
;return html;}
function renderPriceFilter(){var html=
'<form id="filterByPriceRangeForm" style="display:inline">'
;html+=
'Price&nbsp;'
;html+=
'<select name="filterByPriceRangeSelect" onChange="return(performFilter())">'
;html+=
'<option value="0to100000">-- All Prices --</option>'
;html+=
'<option value="0to49"'
;if(pd_priceRange==
"0to49"
) html+=
' SELECTED'
;html+=
'>$0 - $49</option>'
;html+=
'<option value="50to99"'
;if(pd_priceRange==
"50to99"
) html+=
' SELECTED'
;html+=
'>$50 - $99</option>'
;html+=
'<option value="100to199"'
;if(pd_priceRange==
"100to199"
) html+=
' SELECTED'
;html+=
'>$100 - $199</option>'
;html+=
'<option value="200to299"'
;if(pd_priceRange==
"200to299"
) html+=
' SELECTED'
;html+=
'>$200 - $299</option>'
;html+=
'<option value="300to499"'
;if(pd_priceRange==
"300to499"
) html+=
' SELECTED'
;html+=
'>$300 - $499</option>'
;html+=
'<option value="500to999"'
;if(pd_priceRange==
"500to999"
) html+=
' SELECTED'
;html+=
'>$500 - $999</option>'
;html+=
'<option value="1000to2500"'
;if(pd_priceRange==
"1000to2500"
) html+=
' SELECTED'
;html+=
'>$1000 - $2500</option>'
;html+=
'<option value="2500to100000"'
;if(pd_priceRange==
"2500to100000"
) html+=
' SELECTED'
;html+=
'>$2500+</option>'
;html+=
'</select></form>'
;return html;}
function renderSortByDropdown(){var html=
'<form style="display:inline">'
;html+=
'Sort By&nbsp;'
;html+=
'<select name="sortBy" onChange="return(doSortBy(this.options[this.selectedIndex].value))">'
;html+=
'<option value="title"'
;if(pd_sortBy==
"title"
) html+=
' SELECTED'
;html+=
'>Name</option>'
;html+=
'<option value="brand"'
;if(pd_sortBy==
"brand"
) html+=
' SELECTED'
;html+=
'>Brand</option>'
;html+=
'<option value="price"'
;if(pd_sortBy==
"price"
) html+=
' SELECTED'
;html+=
'>Price</option>'
;html+=
'</select></form>'
;return html;}
function doSortBy(sortBy){pd_sortBy=sortBy;var result=displayProductArray();return false;}
function renderPageInfo(productCount){debug(
"renderPageInfo"
);var pageCount=Math.ceil(productCount/pd_itemsPerPage);if(pageCount==1||pageCount==0) return
""
;var html=
""
;if(pd_currentPageNumber !=
"all"
){html+=
'<span class="catPageInfo"><nobr>Page '
+pd_currentPageNumber+
' of '
+pageCount+
'&nbsp; &nbsp;</nobr></span>'
;}
return html;}
function renderPreviousButton(productCount){debug(
"pd_currentPageNumber = "
+pd_currentPageNumber);var html=
""
;if(pd_currentPageNumber!=
"all"
){if(pd_currentPageNumber>1){var previousPage=pd_currentPageNumber-1;html+=
'&nbsp;&nbsp;'
;html+=
'<a href="#" onClick="return(viewPage('
+previousPage+
'))"><img src="http://files.duematernity.com/v4/pd_paging/images/pageArrowPrevious.gif" border="0"></a>'
;} else {html+=
''
;}}
debug(
"pd_currentPageNumber = "
+pd_currentPageNumber);return html;}
function renderNextButton(productCount){var pageCount=Math.ceil(productCount/pd_itemsPerPage);var html=
""
;if(pd_currentPageNumber!=
"all"
){var nextPage=pd_currentPageNumber+1;if(nextPage<=pageCount){html+=
'<a href="#" onClick="return(viewPage('
+nextPage+
'))"><img src="http://files.duematernity.com/v4/pd_paging/images/pageArrowNext.gif" border="0"></a>'
;} else {html+=
''
;}}
return html;}
function renderViewAllButton(productCount){debug(
"renderViewAllButton"
);var pageCount=Math.ceil(productCount/pd_itemsPerPage);if(pageCount==1) return
""
;var html=
""
;if(pd_currentPageNumber==
"all"
){html+=
'<nobr>&nbsp;<a href="#" onClick="return(viewPage(1))" class="viewAllLink">Return to Paged View</a>&nbsp;</nobr>'
;} else {html+=
'<nobr>&nbsp;<a href="#" onClick="return(viewAll())" class="viewAllLink">View All Items</a>&nbsp;</nobr>'
;}
return html;}
function sortByBrandClick(){debug(
"sortByBrandClick"
);return(displayProductArray(
'brand'
));}
function sortByTitleClick(){debug(
"sortByTitleClick"
);return(displayProductArray(
'title'
));}
function sortBySizeFormClick(){debug(
"sortBySizeFormClick"
);return(displayProductArray(
'sizeForm'
));}
function sortByPriceClick(){debug(
"sortByPriceClick"
);return(displayProductArray(
'price'
));}
function filterProductArrayByBrand(brand){debug(
"filterProductArrayByBrand:"
+brand);pd_brandSelected=brand;pd_filteredDisplayList=getFilteredDisplayListByBrand(brand);pd_currentPageNumber=1;var success=displayProductArray();return false;}
function filterProductArrayByPriceRange(priceRange){pd_priceRange=priceRange;pd_filteredDisplayList=getFilteredDisplayListByPriceRange(priceRange);pd_currentPageNumber=1;var success=displayProductArray();return false;}
function getFilteredDisplayListByBrand(brand){debug(
"getFilteredDisplayList"
);var productArray=pd_filteredDisplayList;debug(
"productArray.length = "
+productArray.length);brand=String(brand).toLowerCase();var filteredHash=new Array();var item=new Object();for(item in productArray){var found=true;if(String(productArray[item].brand).toLowerCase() !=brand&&brand !=
""
) found=false;if(found==true){filteredHash[productArray[item].id]=productArray[item];}}
var item=new Object();var filteredList=new Array();var i=0;for(item in filteredHash){filteredList[i]=filteredHash[item];i++;}
debug(
"filteredList.length = "
+filteredList.length);return filteredList;}
function getFilteredDisplayListBySize(size){debug(
"getFilteredDisplayListBySize"
);var productArray=pd_filteredDisplayList;debug(
"productArray.length = "
+productArray.length);size=String(size).toLowerCase();var filteredHash=new Array();var item=new Object();for(item in productArray){var found=false;var tempSizeListString=String(productArray[item].sizeList)+
","
+String(productArray[item].sizeColorList);
var tempArray=tempSizeListString.split(
","
);var item2=new Object();for(item2 in tempArray){if((String(tempArray[item2]).toLowerCase()).indexOf(size)>-1){found=true;
if((size==
"small"
||size==
"large"
)&&(String(tempArray[item2]).toLowerCase()).indexOf(
"x"
)>-1){found=false;
}}
if(isBlank(size)) found=true;}
if(found==true){filteredHash[productArray[item].id]=productArray[item];}}
var item=new Object();var filteredList=new Array();var i=0;for(item in filteredHash){filteredList[i]=filteredHash[item];i++;}
debug(
"filteredList.length = "
+filteredList.length);return filteredList;}
function getFilteredDisplayListByPriceRange(priceRange){debug(
"getFilteredDisplayListByPriceRange"
);var productArray=pd_filteredDisplayList;var priceRangeComponents=priceRange.split(
"to"
);var lowPrice=priceRangeComponents[0];var highPrice=priceRangeComponents[1];var filteredList=new Array();var item=new Object();var j=0;for(item in productArray){var found=false;if(productArray[item].price>=lowPrice&&productArray[item].price<=highPrice) found=true;if(found==true){filteredList[j]=productArray[item];j++;}}
debug(
"filteredList.length = "
+filteredList.length);return filteredList;}
function getFilteredDisplayListByTitleFirstLetterIsNumber(){debug(
"getFilteredDisplayListByTitleFirstLetterIsNumber"
);var productArray=pd_displayList;var filteredList=new Array();var item=new Object();var i=0;for(item in productArray){if(startsWithNumber(productArray[item].title)){filteredList[i]=productArray[item];i++;}}
return filteredList;}
function getFilteredDisplayListByBrandFirstLetterIsNumber(){debug(
"getFilteredDisplayListByBrandFirstLetterIsNumber"
);var productArray=pd_displayList;var filteredList=new Array();var item=new Object();var i=0;for(item in productArray){if(startsWithNumber(productArray[item].brand)){filteredList[i]=productArray[item];i++;}}
return filteredList;}
function getFilteredDisplayListByTitleFirstLetter(firstLetter){debug(
"getFilteredDisplayListByTitleFirstLetter"
);var productArray=pd_displayList;var filteredList=new Array();var item=new Object();var i=0;for(item in productArray){if((String(productArray[item].title).substring(0,1)).toLowerCase()==String(firstLetter).toLowerCase()){filteredList[i]=productArray[item];i++;}}
return filteredList;}
function getFilteredDisplayListByBrandFirstLetter(firstLetter){debug(
"getFilteredDisplayListByBrandFirstLetter"
);var productArray=pd_displayList;var filteredList=new Array();var item=new Object();var i=0;for(item in productArray){if((String(productArray[item].brand).substring(0,1)).toLowerCase()==String(firstLetter).toLowerCase()){filteredList[i]=productArray[item];i++;}}
return filteredList;}
function getFirstLetterListByBrand(){debug(
"getFirstLetterListByBrand"
);var productArray=pd_displayList;var firstLetterHash=new Array();var item=new Object();var firstLetter=
""
;for(item in productArray){firstLetter=(String(productArray[item].brand).substring(0,1)).toUpperCase();firstLetterHash[firstLetter]=firstLetter;}
return firstLetterHash;}
function getFirstLetterListByTitle(){debug(
"getFirstLetterListByTitle"
);var productArray=pd_displayList;var firstLetterHash=new Array();var item=new Object();var firstLetter=
""
;for(item in productArray){firstLetter=(String(productArray[item].title).substring(0,1)).toUpperCase();firstLetterHash[firstLetter]=firstLetter;}
return firstLetterHash;}
function getBrandList(){var productArray=pd_displayList;var brandList=new Array();var item=new Object();for(item in productArray){if(!brandList[productArray[item].brand]){brandList[productArray[item].brand]=new Object();brandList[productArray[item].brand].name=productArray[item].brand;brandList[productArray[item].brand].count=1;} else {brandList[productArray[item].brand].count++;}}
var i=0;var tempArray=new Array();for(item in brandList){tempArray[i]=brandList[item];i++;}
brandList=tempArray;brandList.sort(compareBrandListName);return brandList;}
function getSizeList(){var productArray=pd_displayList;var sizeList=new Array();var item=new Object();var item2=new Object();for(item in productArray){var tempList=productArray[item].sizeList.split(
","
);for(item2 in tempList){if(!isBlank(tempList[item2])){sizeList[tempList[item2]]=new Object();sizeList[tempList[item2]].size=tempList[item2];}}}
var i=0;var tempArray=new Array();for(item in sizeList){tempArray[i]=sizeList[item];i++;}
sizeList=tempArray;sizeList.sort(compareSize);return sizeList;}
function startsWithNumber(input){if(String(input).substring(0,1)==
"0"
||String(input).substring(0,1)==
"1"
||String(input).substring(0,1)==
"2"
||String(input).substring(0,1)==
"3"
||String(input).substring(0,1)==
"4"
||String(input).substring(0,1)==
"5"
||String(input).substring(0,1)==
"6"
||String(input).substring(0,1)==
"7"
||String(input).substring(0,1)==
"8"
||String(input).substring(0,1)==
"9"
){return true;} else {return false;}}
function getCurrentPageNumber(){debug(
"initialize : getCurrentPageNumber"
);var pageNumber=1;var currentSection=pdGetCookie(
"pd_stickyBreadcrumbSection"
);if(pd_lastSection==currentSection){pageNumber=pdGetCookie(
"pd_currentPageNumber"
);}
pdSetCookie(
"pd_lastPageNumber"
,pageNumber);pdSetCookie(
"pd_lastSection"
,currentSection);if(isBlank(pageNumber)) pageNumber=1;return pageNumber;}
function getCurrentSortBy(){debug(
"initialize : getCurrentSortBy"
);var pd_sortBy=
""
;var currentSection=
""
;if(pd_lastSection==currentSection){pd_sortBy=pdGetCookie(
"pd_pagingSortBy"
);}
if(isBlank(pd_sortBy)) pd_sortBy=
""
;return pd_sortBy;}
function sortProductArrayByPrice(){debug(
"sortProductArrayByPrice"
);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareDefault);pd_filteredDisplayList=pd_filteredDisplayList.sort(comparePrice);pd_sortBy=
"price"
;return true;}
function sortProductArrayByDefault(){debug(
"sortProductArrayByDefault"
);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareDefault);pd_sortBy=
"default"
;return false;}
function sortProductArrayByTitle(){debug(
"sortProductArrayByTitle"
);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareDefault);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareTitle);pd_sortBy=
"title"
;return false;}
function sortProductArrayByBrand(){debug(
"sortProductArrayByBrand"
);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareDefault);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareBrand);pd_sortBy=
"brand"
;return false;}
function sortProductArrayBySizeForm(){debug(
"parseDisplayListBySizeForm"
);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareDefault);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareSizeForm);pd_sortBy=
"sizeForm"
;return false;}
function sortProductArrayByRating(){debug(
"sortProductArrayByRating"
);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareDefault);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareRating);pd_sortBy=
"rating"
;return false;}
function sortProductArrayByBestseller(){debug(
"sortProductArrayByBestseller"
);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareDefault);pd_filteredDisplayList=pd_filteredDisplayList.sort(compareBestseller);pd_sortBy=
"bestseller"
;return false;}
function compareDefault(item1,item2){if(item1.defaultOrder>item2.defaultOrder) return 1;else if(item1.defaultOrder<item2.defaultOrder) return-1;else return 0;}
function compareId(item1,item2){if(item1.id>item2.id) return 1;else if(item1.id<item2.id) return-1;else return 0;}
function compareTitle(item1,item2){if(item1.title>item2.title) return 1;else if(item1.title<item2.title) return-1;else return 0;}
function compareBrand(item1,item2){if(item1.brand>item2.brand) return 1;else if(item1.brand<item2.brand) return-1;else return 0;}
function compareSizeForm(item1,item2){if(item1.sizeForm>item2.sizeForm) return 1;else if(item1.sizeForm<item2.sizeForm) return-1;else return 0;}
function comparePrice(item1,item2){if(item1.price>item2.price) return 1;else if(item1.price<item2.price) return-1;else return 0;}
function compareBestseller(item1,item2){if(item1.bestseller>item2.bestseller) return-1;else if(item1.bestseller<item2.bestseller) return 1;else return 0;}
function compareRating(item1,item2){if(item1.rating>item2.rating) return-1;else if(item1.rating<item2.rating) return 1;else return 0;}
function compareBrandListName(item1,item2){if(item1.name>item2.name) return 1;else if(item1.name<item2.name) return-1;else return 0;}
function compareSize(item1,item2){if(getSizeSortValue(item1.size)>getSizeSortValue(item2.size)) return 1;else if(getSizeSortValue(item1.size)<getSizeSortValue(item2.size)) return-1;else return 0;}
function getSizeSortValue(size){size=size.toUpperCase();if(size==
"XS"
||size==
"X-SMALL"
||size==
"EXTRA SMALL"
) sizeScore=0;else if(size==
"S"
||size==
"SMALL"
) sizeScore=2;else if(size==
"M"
||size==
"MEDIUM"
) sizeScore=6;else if(size==
"L"
||size==
"LARGE"
) sizeScore=8;else if(size==
"XL"
||size==
"EXTRA LARGE"
||size==
"X-LARGE"
) sizeScore=10;else if(size-0==size) sizeScore=size;else sizeScore=999;return sizeScore;}
function debug(message){if(pd_debugFlag==true){alert(message);}
return false;}
