var ItemsPerPage=20;
var curPage=1;
var ItemID=0;
var scriptLocation="/ecommerce/menustyles/products_filtered/i_menustyle_display_dev-ajax.cfm?ItemID="+ItemID;
var AttributeTypeID1=0;
var AttributeTypeName1="";
var AttributeTypeID2=0;
var AttributeTypeName2="";
var AccountID=0;
var CurrItemPath="";
var LinkPrefix="";
var LinkSuffix="";
var DisplayEditorMenu=false;
var _Start=0;
var _NumItems=0;
function getFilteredAttributeValues(_1){
if(_1==0){
document.forms["AttributeValues"].AttributeValueID2.disabled=true;
while(document.forms["AttributeValues"].AttributeValueID2.options.length>0){
document.forms["AttributeValues"].AttributeValueID2.options[0]=null;
}
newOption=document.createElement("OPTION");
newOption.setAttribute("value",0);
newOption.innerHTML="Select "+AttributeTypeName2;
document.forms["AttributeValues"].AttributeValueID2.appendChild(newOption);
gotoPage(1);
}else{
if(AttributeTypeID2!=0&&_1!=0){
trace("Getting AttributeValues for AttributeType "+AttributeTypeID2);
DWREngine._execute(scriptLocation,null,"getFilteredAttributeValues",AttributeTypeID1,_1,AttributeTypeID2,ItemID,getFilteredAttributeValuesResult);
}
}
}
function getFilteredAttributeValuesResult(_2){
trace("Got AttributeValues.");
document.forms["AttributeValues"].AttributeValueID2.disabled=false;
while(document.forms["AttributeValues"].AttributeValueID2.options.length>0){
document.forms["AttributeValues"].AttributeValueID2.options[0]=null;
}
newOption=document.createElement("OPTION");
newOption.setAttribute("value",0);
newOption.innerHTML="Select "+AttributeTypeName2;
document.forms["AttributeValues"].AttributeValueID2.appendChild(newOption);
for(i=0;i<_2.length;i++){
newOption=document.createElement("OPTION");
newOption.setAttribute("value",_2[i].ATTRIBUTEVALUEID);
newOption.innerHTML=_2[i].ATTRIBUTEVALUE;
document.forms["AttributeValues"].AttributeValueID2.appendChild(newOption);
}
}
function getProducts(_3,_4,_5){
if(DWRUtil.SupportsXMLHttp()){
trace("Getting products");
_Start=_5;
loadingScreen(true);
DWREngine._execute(scriptLocation,null,"getProducts",AttributeTypeID1,_3,AttributeTypeID2,_4!=null?_4:0,ItemID,_5,ItemsPerPage,getProductsResult);
window.scrollTo(0,0);
return false;
}else{
return true;
}
}
var currMenuItems;
function loadingScreen(_6){
products=document.getElementById("ec_menu_product");
loading=document.getElementById("ec_menu_product_loading");
topPaging=document.getElementById("ec_menu_paging_top");
bottomPaging=document.getElementById("ec_menu_paging_bottom");
if(_6){
products.style.visibility="hidden";
topPaging.style.visibility="hidden";
bottomPaging.style.visibility="hidden";
loading.style.visibility="visible";
}else{
products.style.visibility="visible";
topPaging.style.visibility="visible";
bottomPaging.style.visibility="visible";
loading.style.visibility="hidden";
}
}
function getProductsResult(_7){
trace("Got products");
clearItems(document.getElementById("ec_menu_product"));
clearItems(document.getElementById("ec_menu_paging_top"));
clearItems(document.getElementById("ec_menu_paging_bottom"));
currMenuItems=_7.CURRMENUITEMS;
_NumItems=_7.ITEMCOUNT;
refreshPaging(_7.ITEMCOUNT);
updateProducts(_7);
loadingScreen(0);
}
function refreshPaging(_8){
numPages=Math.ceil(_8/ItemsPerPage);
if(numPages>1){
topPaging=document.getElementById("ec_menu_paging_top");
bottomPaging=document.getElementById("ec_menu_paging_bottom");
addPageLinks(topPaging);
addPageLinks(bottomPaging);
}
}
function clearItems(_9){
while(_9.childNodes.length>0){
_9.removeChild(_9.childNodes[0]);
}
}
function addPageLinks(_a){
if(_Start-ItemsPerPage>=0){
pageLink=document.createElement("a");
pageLink.setAttribute("href",LinkPrefix+"Start="+(_Start-ItemsPerPage)+LinkSuffix);
pageLink.onclick=Function("return gotoPage("+(curPage-1)+");");
pageLink.innerHTML="&lt; Previous";
pageLink.className="prev";
_a.appendChild(pageLink);
_a.appendChild(document.createTextNode(" "));
}
for(i=1;i<=numPages;i++){
if(i>curPage-10&&i<curPage+10){
pageLink=document.createElement("a");
pageLink.setAttribute("href",LinkPrefix+"Start="+(ItemsPerPage*(i-1))+LinkSuffix);
pageLink.onclick=Function("return gotoPage("+i+");");
if(i==curPage){
pageLink.style.fontWeight="bold";
}
pageLink.innerHTML=i;
_a.appendChild(pageLink);
_a.appendChild(document.createTextNode(" "));
}
}
if(_Start+ItemsPerPage<=_NumItems){
pageLink=document.createElement("a");
pageLink.setAttribute("href",LinkPrefix+"Start="+(_Start+ItemsPerPage)+LinkSuffix);
pageLink.onclick=Function("return gotoPage("+(curPage+1)+");");
pageLink.innerHTML="Next &gt;";
pageLink.className="next";
_a.appendChild(pageLink);
_a.appendChild(document.createTextNode(" "));
}
}
function updateProducts(_b){
trace("Got "+currMenuItems.length+" products");
parentObj=document.getElementById("ec_menu_product");
isEven=true;
for(productIndex=0;productIndex<currMenuItems.length;productIndex++){
currMenuItem=currMenuItems[productIndex];
trace("Adding "+currMenuItem.ITEMID);
isEven=!isEven;
isCollectionItem=(currMenuItem.PARENTITEMTYPECLASSID==2);
isRelatedItem=(currMenuItem.POSITIONID==6);
trace("Getting Pricing Levels.");
pricingLevels=_b["PRICINGLEVELS"+String(currMenuItem.ITEMID)];
trace("Getting Attributes.");
attributes=_b["ATTRIBUTES"+String(currMenuItem.ITEMID)];
trace("Getting Data.");
productData=_b["DATA"+String(currMenuItem.ITEMID)][0];
productUrl="/cms/index.cfm/path/"+CurrItemPath+"/"+ItemID+"/"+currMenuItem.ITEMID+"/";
imageUrl="/images/"+AccountID+"/typeclasses/products/"+currMenuItem.ITEMID+"_thumb.jpg";
productForm=document.createElement("form");
productForm.method="POST";
productForm.action="/ecommerce/order/shopping_cart.cfm";
productForm.name="Product"+currMenuItem.ITEMID;
productForm.appendChild(HiddenInput("ContinueShopping",ReturnToURL));
productForm.appendChild(HiddenInput("NoOrderAllowed"+currMenuItem.ITEMID,0));
productForm.appendChild(HiddenInput("AddItemID",currMenuItem.ITEMID));
productForm.appendChild(HiddenInput("IsWishList",0));
parentObj.appendChild(productForm);
baseClassName="ec_"+(isCollectionItem?"collection":"menu")+"_product";
product=document.createElement("div");
product.className=baseClassName+"_"+(isEven?"0":"1");
productThumb=document.createElement("div");
productThumb.className=baseClassName+"_thumbnail";
if(currMenuItem.THUMBNAILEXISTS!="NO"){
productThumb.innerHTML="<a href=\""+productUrl+"\"><img src=\""+imageUrl+"\" border=\"0\"></a>";
}
productInfo=document.createElement("div");
productInfo.className=baseClassName+"_info";
productTitle=document.createElement("div");
productTitle.className=baseClassName+"_title";
productTitle.innerHTML="<a href=\""+productUrl+"\">"+currMenuItem.FULLTITLE+"</a>";
if(!pricingLevels||pricingLevels.length==0){
productPrice=document.createElement("div");
productPrice.className=baseClassName+"_price";
productPriceLabel=document.createElement("div");
productPriceLabel.className=baseClassName+"_price_label";
productPriceLabel.innerHTML="Price: ";
productPrice.appendChild(productPriceLabel);
productPriceValue=document.createElement("div");
productPriceValue.className=baseClassName+"_price_value";
productPrice.appendChild(productPriceValue);
if(currMenuItem.ISSALE||currMenuItem.ISCLEARANCE){
productPriceValue.className+=" "+baseClassName+"_price_value_original";
productPriceSpecial=document.createElement("div");
productPriceSpecial.className=baseClassName+"_price_special";
if(currMenuItem.ISSALE==1){
productPriceSpecial.innerHTML="Sale: ";
}
if(currMenuItem.ISCLEARANCE==1){
productPriceSpecial.innerHTML="Clearance: ";
}
if(currMenuItem.ISSALE==1&&currMenuItem.ISCLEARANCE==1){
productPriceSpecial.innerHTML="Sale / Clearance: ";
}
productPrice.appendChild(productPriceSpecial);
productPriceValueNew=document.createElement("div");
productPriceValueNew.className=baseClassName+"_price_value "+baseClassName+"_price_value_sale";
if(currMenuItem.DISPLAYPRICEASPER!=0&&currMenuItem.DISPLAYPRICEASPER!=undefined){
priceSpan=document.createElement("span");
priceSpan.innerHTML=formatCurrency(currMenuItem.PRICE*currMenuItem.DISPLAYPRICEASPER);
priceSpan.setAttribute("id","Price_"+currMenuItem.ITEMID);
productPriceValueNew.appendChild(priceSpan);
productPriceValueNew.appendChild(document.createTextNode(" (per "));
perSpan=document.createElement("span");
perSpan.innerHTML=currMenuItem.DISPLAYPRICEASPER;
perSpan.setAttribute("id","Per_"+currMenuItem.ITEMID);
productPriceValueNew.appendChild(perSpan);
productPriceValueNew.appendChild(document.createTextNode(")"));
}else{
productPriceValueNew.setAttribute("id","Price_"+currMenuItem.ITEMID);
productPriceValueNew.innerHTML=formatCurrency(currMenuItem.PRICE);
}
productPrice.appendChild(productPriceValueNew);
}else{
productPriceValue.setAttribute("id","Price_"+currMenuItem.ITEMID);
if(currMenuItem.DISPLAYPRICEASPER){
productPriceValue.innerHTML=formatCurrency(currMenuItem.PRICE*currMenuItem.DISPLAYPRICEASPER);
}else{
productPriceValue.innerHTML=formatCurrency(currMenuItem.PRICE);
}
}
}
productMoreInfo=document.createElement("div");
productMoreInfo.className=baseClassName+"_moreinfo";
productMoreInfo.innerHTML="<input type=\"button\" name=\"button_moreinfo\" class=\"button\" value=\"More Info\" onclick=\"window.location = '"+productUrl+"';\">";
productDescription=document.createElement("div");
productDescription.className=baseClassName+"_description";
noBreaks=currMenuItem.DESCRIPTION.replace(/\r\n/g,"<br />");
noBreaks=noBreaks.replace(/\n/g,"<br />");
noBreaks=noBreaks.replace(/\r/g,"<br />");
productDescription.innerHTML=noBreaks;
productID=document.createElement("div");
productID.className=baseClassName+"_id";
productID_Label=document.createElement("div");
productID_Label.className=baseClassName+"_id_label";
productID_Label.setAttribute("id","IDLabel_"+currMenuItem.ITEMID);
productID_Value=document.createElement("div");
productID_Value.className=baseClassName+"_id_value";
productID_Value.setAttribute("id","IDValue_"+currMenuItem.ITEMID);
if(productData){
if(productData.PRODUCTCODE!=""){
productID_Label.innerHTML="Item: ";
productID_Value.innerHTML=productData.PRODUCTCODE;
}else{
if(productData.SKU!=""){
productID_Label.innerHTML="SKU: ";
productID_Value.innerHTML=productData.SKU;
}else{
if(productData.UPC!=""){
productID_Label.innerHTML="UPC: ";
productID_Value.innerHTML=productData.UPC;
}
}
}
}
productID.appendChild(productID_Label);
productID.appendChild(productID_Value);
productQty=document.createElement("div");
productQty.className=baseClassName+"_qty";
productQty.innerHTML="<div class=\""+baseClassName+"_qty_label\">Qty: </div>";
productQty.innerHTML+="<input type=\"text\" class=\"text listitemright\" name=\"Quantity\" value=\"1\" size=\"1\" onclick=\"this.select()\">";
productAddToCart=document.createElement("div");
productAddToCart.className=baseClassName+"_addtocart";
productAddToCart.innerHTML="<input type=\"submit\" name=\"btn_submit\" class=\"button\" value=\"Add to Cart\">";
productAddToCartImage=document.createElement("div");
productAddToCartImage.className=baseClassName+"_addtocart";
productAddToCartImage.innerHTML="<input type=\"image\" name=\"btn_submit\" src=\"/images/"+AccountID+"/ecommerce/menustyles/products_filtered/addToCart.png\" alt=\"Add to Cart\">";
productWishList=document.createElement("div");
productWishList.className=baseClassName+"_wishlist";
productWishList.innerHTML="<input type=\"submit\" name=\"btn_submit2\" class=\"button\" value=\"Add to Wish List\">";
if(pricingLevels&&pricingLevels.length>0){
productPricingLevels=document.createElement("div");
productPricingLevels.className=baseClassName+"_pricinglevels";
productPricingLevels.setAttribute("id","PricingLevels_"+currMenuItem.ITEMID);
grid=eval("var grid"+currMenuItem.ITEMID+" = new CNSDataGrid(); grid"+currMenuItem.ITEMID+";");
grid.Columns.Add(new DataGridColumn("Quantity",function(_c){
return _c.MINQUANTITY;
}));
grid.Columns.Add(new DataGridColumn("Price",function(_d){
return formatCurrency(_d.PRICE*currMenuItem.DISPLAYPRICEASPER);
},null,"price"));
grid.setCustomHeader("Pricing Levels");
grid.bind(pricingLevels);
productPricingLevels.appendChild(grid.table);
}
productAttributes=document.createElement("div");
productAttributes.className=baseClassName+"_attributes";
if(attributes){
lastAttributeTypeID=0;
isEvenAttrib=true;
for(attributeIndex=0;attributeIndex<attributes.length;attributeIndex++){
currentAttrib=attributes[attributeIndex];
if(lastAttributeTypeID!=currentAttrib.ATTRIBUTETYPEID&&currentAttrib.ATTRIBUTEVALUEID!=""){
isEvenAttrib=!isEvenAttrib;
lastAttributeTypeID=currentAttrib.ATTRIBUTETYPEID;
currentElement=document.createElement("div");
currentElement.className=baseClassName+"_attribute "+baseClassName+"_attribute_"+(isEvenAttrib?"0":"1");
currentLabel=document.createElement("div");
currentLabel.className=baseClassName+"_attribute_label";
currentLabel.innerHTML=currentAttrib.ATTRIBUTENAME+":";
currentElement.appendChild(currentLabel);
currentValue=document.createElement("div");
currentValue.className=baseClassName+"_attribute_value";
currentElement.appendChild(currentValue);
if(countAttributeValues(attributes,currentAttrib.ATTRIBUTETYPEID)>1){
eval("var Product"+currMenuItem.ITEMID+"_Attrib"+currentAttrib.ATTRIBUTETYPEID+" = document.createElement(\"select\");");
currentSelect=eval("Product"+currMenuItem.ITEMID+"_Attrib"+currentAttrib.ATTRIBUTETYPEID);
currentSelect=document.createElement("select");
currentSelect.className="listitemleft";
currentSelect.setAttribute("name","AttributeValue_TypeID"+currentAttrib.ATTRIBUTETYPEID);
currentSelect.setAttribute("style","margin-left: 0px; margin-right: 0px;");
currentSelect.setAttribute("onchange","attributeSelectChange(this, "+currMenuItem.ITEMID+");");
currentValue.appendChild(currentSelect);
for(attribValueIndex=0;attribValueIndex<attributes.length;attribValueIndex++){
currentAttribVal=attributes[attribValueIndex];
if(currentAttribVal.ATTRIBUTETYPEID==currentAttrib.ATTRIBUTETYPEID){
createAttributeValue(currentAttribVal,currentSelect);
}
}
}else{
currentAcronym=document.createElement("acronym");
currentAcronym.innerHTML=currentAttrib.ATTRIBUTEVALUE;
currentAcronym.title=currentAttrib.DESCRIPTION;
currentValue.appendChild(currentAcronym);
currentValue.appendChild(HiddenInput("AttributeValue_TypeID"+currentAttrib.ATTRIBUTETYPEID,currentAttrib.ATTRIBUTEVALUEID));
}
productAttributes.appendChild(currentElement);
}
}
}else{
trace("Item "+currMenuItem.ITEMID+" has no attributes.");
}
if(DisplayEditorMenu){
productMenu=document.createElement("div");
productMenu.className=baseClassName+"_menu";
productMenu.innerHTML="<a onclick=\"return cmsHelper.showEditorMenu(event, "+currMenuItem.ITEMID+", "+currMenuItem.ITEMTYPEID+");\" href=\"#\"><img border=\"0\" align=\"absmiddle\" src=\"/cns/icons/SHOWMENU.GIF\"/></a>";
}
if(DisplayEditorMenu){
productInfo.appendChild(productMenu);
}
product.appendChild(productThumb);
productInfo.appendChild(productTitle);
product.appendChild(productInfo);
productForm.appendChild(product);
}
productEnd=document.createElement("div");
productEnd.className="ec_menu_product_end";
parentObj.appendChild(productEnd);
}
function createAttributeValue(_e,_f){
valueName=document.createElement("OPTION");
_f.options.add(valueName);
valueName.value=_e.ATTRIBUTEVALUEID;
valueName.text=_e.ATTRIBUTEVALUE;
if(AttributeTypeID1!=0&&_e.ATTRIBUTEVALUE==document.forms["AttributeValues"].AttributeValueID1.options[document.forms["AttributeValues"].AttributeValueID1.selectedIndex].text){
valueName.selected=true;
}
if(AttributeTypeID2!=0&&_e.ATTRIBUTEVALUE==document.forms["AttributeValues"].AttributeValueID2.options[document.forms["AttributeValues"].AttributeValueID2.selectedIndex].text){
valueName.selected=true;
}
if(_e.DESCRIPTION!=""){
valueDesc=document.createElement("OPTION");
valueDesc.className="listitemright";
valueDesc.text="   "+_e.DESCRIPTION;
_f.options.add(valueDesc);
}
if(_e.ISPRICINGATTRIBUTE=="1"){
valuePrice=document.createElement("OPTION");
valuePrice.text="   ";
valuePrice.className="listitemright";
if(currMenuItem.DISPLAYPRICEASPER){
valuePrice.text+=formatCurrency(_e.PRICE*currMenuItem.DISPLAYPRICEASPER)+" (per "+currMenuItem.DISPLAYPRICEASPER+")";
}else{
valuePrice.text+=formatCurrency(_e.PRICE);
}
_f.options.add(valuePrice);
}
}
function countAttributeValues(_10,_11){
valueCount=0;
for(i2=0;i2<_10.length;i2++){
if(_10[i2].ATTRIBUTETYPEID==_11){
valueCount++;
}
}
return valueCount;
}
function HiddenInput(_12,_13){
tempObj=document.createElement("input");
tempObj.setAttribute("type","hidden");
tempObj.name=_12;
tempObj.value=_13;
return tempObj;
}
function gotoPage(_14){
curPage=_14;
if(AttributeTypeID1!=0){
if(AttributeTypeID2!=0){
return getProducts(document.forms["AttributeValues"].AttributeValueID1.value,document.forms["AttributeValues"].AttributeValueID2.value,(_14-1)*ItemsPerPage);
}else{
return getProducts(document.forms["AttributeValues"].AttributeValueID1.value,0,(_14-1)*ItemsPerPage);
}
}else{
return getProducts(0,0,(_14-1)*ItemsPerPage);
}
}
function attributeSelectChange(_15,_16){
AttributeTypeID=_15.name.substr(_15.name.indexOf("TypeID")+6);
trace("Attribute "+AttributeTypeID+" changed.");
if(isNaN(_15.options[_15.selectedIndex].value)||_15.options[_15.selectedIndex].value==""){
_15.selectedIndex--;
}
if(isNaN(_15.options[_15.selectedIndex].value)||_15.options[_15.selectedIndex].value==""){
_15.selectedIndex--;
}
descElement=document.getElementById("DescriptionText_"+ItemID+"_"+AttributeTypeID);
if(descElement){
trace("Updating attribute description");
descElement.innerHTML=(_15.options[_15.selectedIndex+1].value.charAt(0)=="("?_15.options[_15.selectedIndex+1].value:"");
}
if(DWRUtil.SupportsXMLHttp()){
values=_15.form.elements;
attributeValues="";
for(i=0;i<values.length;i++){
if(values[i].name.indexOf("TypeID")>=0){
typeID=values[i].name.substr(values[i].name.indexOf("TypeID")+6);
valueID=values[i].value;
attributeValues+=","+valueID;
}
}
attributeValues=attributeValues.substr(1);
trace("Getting new product data.");
DWREngine._execute(scriptLocation,null,"getProductInfo",_16,attributeValues,getDataResult);
return false;
}else{
return true;
}
}
function getDataResult(_17){
trace("Got new product data.");
currItemID=_17.PRODUCTDATA[0].ITEMID;
trace("Got new product data for item "+currItemID);
if(_17.PRICELEVELS.length>0){
trace("Updating pricing levels.");
productPricingLevels=document.getElementById("PricingLevels_"+currItemID);
grid=eval("var grid"+currItemID+" = new CNSDataGrid(); grid"+currItemID+";");
grid.Columns.Add(new DataGridColumn("Quantity",function(_18){
return _18.MINQUANTITY;
}));
grid.Columns.Add(new DataGridColumn("Price",function(_19){
return formatCurrency(_19.PRICE*_17.PRODUCTDATA[0].DISPLAYPRICEASPER);
},null,"price"));
grid.setCustomHeader("Pricing Levels");
grid.bind(_17.PRICELEVELS);
while(productPricingLevels.childNodes.length>0){
productPricingLevels.removeChild(productPricingLevels.childNodes[0]);
}
productPricingLevels.appendChild(grid.table);
}
ProductCode=_17.PRODUCTDATA[0].PRODUCTCODE;
UPC=_17.PRODUCTDATA[0].UPC;
SKU=_17.PRODUCTDATA[0].SKU;
idLabel=document.getElementById("IDLabel_"+currItemID);
idValue=document.getElementById("IDValue_"+currItemID);
if(idLabel&&idValue){
if(ProductCode!=""){
trace("Updating ProductCode.");
idLabel.innerHTML="Item: ";
idValue.innerHTML=ProductCode;
}else{
if(UPC!=""){
trace("Updating UPC.");
idLabelbel.innerHTML="UPC: ";
idValue.innerHTML=UPC;
}else{
if(SKU!=""){
trace("Updating SKU.");
idLabel.innerHTML="SKU: ";
idValue.innerHTML=SKU;
}
}
}
}
trace("Updating price.");
priceElement=document.getElementById("Price_"+currItemID);
if(priceElement!=null){
if(_17.PRODUCTDATA[0].DISPLAYPRICEASPER){
priceElement.innerHTML=formatCurrency(_17.PRODUCTDATA[0].PRICE*_17.PRODUCTDATA[0].DISPLAYPRICEASPER);
}else{
priceElement.innerHTML=formatCurrency(_17.PRODUCTDATA[0].PRICE);
}
}
}
function showmenu(e,_1b,_1c){
hidemenu();
menu=document.createElement("div");
menu.setAttribute("id","editormenu");
menu.className="popupinfoborder";
menu.innerHTML="<div class=\"popupinfohead\">Editor Options</div>";
navList=document.createElement("div");
navList.setAttribute("class","navlist");
navList.style.background="#FFF";
navList.innerHTML+="<a href=\"#\" onMouseUp=\"openProperties("+_1b+");\"><img border=\"0\" align=\"absmiddle\" src=\"/cns/icons/pencil_paper.gif\">&nbsp;General Properties</a><br>";
navList.innerHTML+="<a href=\"#\" onMouseUp=\"openContents("+_1b+");\"><img border=\"0\" align=\"absmiddle\" src=\"/cns/icons/pencil_paper.gif\">&nbsp;Contents</a><br>";
navList.innerHTML+="<a href=\"#\" onMouseUp=\"typeProperties("+_1b+", "+_1c+");\"><img border=\"0\" align=\"absmiddle\" src=\"/cns/icons/pencil_paper.gif\">&nbsp;Product Properties</a><br>";
navList.innerHTML+="<a href=\"#\" onMouseUp=\"removeItem("+_1b+");\"><img border=\"0\" align=\"absmiddle\" src=\"/cns/icons/redx.GIF\">&nbsp;Remove</a><br>";
navList.innerHTML+="<a href=\"#\" onMouseUp=\"deleteItem("+_1b+");\"><img border=\"0\" align=\"absmiddle\" src=\"/cns/icons/redx.GIF\">&nbsp;Delete</a><br>";
menu.appendChild(navList);
menu.style.zIndex=100;
menu.style.position="absolute";
menu.style.padding="1px";
menu.style.left=(e.pageX?e.pageX:e.x)+"px";
menu.style.top=(e.pageY?e.pageY:e.y)+"px";
document.body.appendChild(menu);
document.onclick=hidemenu;
e.cancelBubble=true;
return false;
}
function hidemenu(e){
if(document.getElementById("editormenu")){
document.body.removeChild(document.getElementById("editormenu"));
}
document.onclick=null;
}
function openProperties(_1e){
location.href="/cmsitems/item_addedit_step1.cfm?ItemID="+_1e+"&Returntopage="+ReturnToURL;
}
function openContents(_1f){
location.href="/cmsitems/item_addedit_step2.cfm?ItemID="+_1f+"&Returntopage="+ReturnToURL;
}
function typeProperties(_20,_21){
location.href="/ecommerce/typeclasses/products/item_addedit.cfm?ItemID="+_20+"&Returntopage="+ReturnToURL;
}
function removeItem(_22){
location.href="/cms/index.cfm?DoneInclude=cms2%2Fitems%2F%5Fitem%5Fremovechildren%2Di%2Ecfm&ItemIDList="+_22+"&RemoveFromParentItemID="+ItemID+"&Returntopage="+ReturnToURL;
}
function deleteItem(_23){
if(confirm("Are you sure you want to delete this item?")){
if(confirm("Please confirm deletion again. You will not be able to undo this action!")){
location.href="/cms/?ParentItemIDList=&ItemID="+_23+"&mode=delete";
}else{
alert("Deletion cancelled");
}
}else{
alert("Deletion cancelled");
}
}
function init(){
DWREngine._errorHandler=errorHandler;
}
function formatCurrency(num){
num=num.toString().replace(/\$|\,/g,"");
if(isNaN(num)){
num="0";
}
sign=(num==(num=Math.abs(num)));
num=Math.floor(num*100+0.50000000001);
cents=num%100;
num=Math.floor(num/100).toString();
if(cents<10){
cents="0"+cents;
}
for(var i=0;i<Math.floor((num.length-(1+i))/3);i++){
num=num.substring(0,num.length-(4*i+3))+","+num.substring(num.length-(4*i+3));
}
return (((sign)?"":"-")+"$"+num+"."+cents);
}

