 
 var ALL_JEWELRY = "-- All Items --";
 var NEW_ARRIVALS = "New Arrivals";
 var NECKLACES = "Necklaces";
 var RINGS = "Rings";
 var BRACELETS = "Bracelets";
 var EARRINGS = "Earrings";
 var WITH_RUBIES = "With Rubies";
 var NO_RUBIES = "Without Rubies";
 var LEATHER = "Leather";
 var LT100 = "$100 and Under";
 var LT500 = "$500 and Under";
 var GT500 = "$500 and Over";
 
 var i = 0;
 var ALL_FILTERS = new Array();
 ALL_FILTERS[i++] = ALL_JEWELRY;
 ALL_FILTERS[i++] = NECKLACES;
 ALL_FILTERS[i++] = RINGS;
 ALL_FILTERS[i++] = BRACELETS;
 ALL_FILTERS[i++] = EARRINGS;
 ALL_FILTERS[i++] = WITH_RUBIES;
 ALL_FILTERS[i++] = NO_RUBIES;
 ALL_FILTERS[i++] = LEATHER;
 ALL_FILTERS[i++] = LT100;
 ALL_FILTERS[i++] = LT500;
 ALL_FILTERS[i++] = GT500;
 ALL_FILTERS[i++] = NEW_ARRIVALS;

function getFilterValue ( ) {
   var queryString = window.top.location.search.substring(1);
   // Add "=" to the parameter name (i.e. parameterName=value)
   var parameterName = "filter=";
   if ( queryString.length > 0 ) {
      // Find the beginning of the string
      begin = queryString.indexOf ( parameterName );
      // If the parameter name is not found, skip it, otherwise return the value
      if ( begin != -1 ) {
         // Add the length (integer) to the beginning
         begin += parameterName.length;
         // Multiple parameters are separated by the "&" sign
         end = queryString.indexOf ( "&" , begin );
      if ( end == -1 ) {
         end = queryString.length
      }
      // Return the string
      
      return ALL_FILTERS[parseInt(queryString.substring ( begin, end ))];
   }
   }
   return ALL_JEWELRY;
}

function getBreadcrumb() {
  var filterVal = getFilterValue();
  document.write("<a style=\"color:white\" href=\"collection.html\">All Jewelry</a>");
  if (filterVal == ALL_JEWELRY) {
    return;
  } else {
    document.write(" :: ");
    document.write(filterVal);
  }
}

 var PRODUCT_INFO_URL = "http://www.lovepeaceandhope.com/Product/ProductInfo.aspx?";
 var VIEW_MORE_URL = "http://www.lovepeaceandhope.com/Home/ZoomOnTBProduct.aspx?"; 
 var SHOP_NOW_URL = "http://www.lovepeaceandhope.com/catalog/CatalogView.aspx?page=1&catx=x521x";


 function product(image, desc, price, link, category, hboLink) {
  this.image = image;
  this.desc = desc;
  this.price = price;
  this.link = link;
  this.category = category;
  this.hboLink = hboLink;
 } 

 function viewMore(url) {
   var link = VIEW_MORE_URL + url;
   //link = "popup/product" + url + ".html";
   window.open(link, "_blank", "menubar=0,resizable=0,width=600,height=500");
 } 

 var catalog = new Array();
 i=0;

 catalog[i++] = new product("catalog/TB032.jpg","Black Leather Wrap Bracelet with Silver Fang Clasp","$99.00","id=9852",BRACELETS,"");
 catalog[i++] = new product("catalog/TB033.jpg","Red Leather Wrap Bracelet with Silver Fang Clasp","$99.00","id=9853",BRACELETS,"");
 catalog[i++] = new product("catalog/TB034.jpg","Black Leather Bracelet with Silver Fang Clasp","$95.00","id=9854",BRACELETS,"");
 catalog[i++] = new product("catalog/TB035.jpg","Red Leather Bracelet with Silver Fang Clasp","$95.00","id=9855",BRACELETS,"");
 catalog[i++] = new product("catalog/TB030.jpg","Black Leather Wrap Necklace with Large Genuine Rubies","$299.00","id=9850",NECKLACES,"");
 catalog[i++] = new product("catalog/TB031.jpg","Red Leather Wrap Necklace with Large Genuine Rubies","$299.00","id=9851",NECKLACES,"");
 catalog[i++] = new product("catalog/TB039.jpg","Stainless Steel Wrap Necklace with Large Genuine Rubies","$299.00","id=9859",NECKLACES,"");
 catalog[i++] = new product("catalog/TB036.jpg","Four Layer Stainless Steel Chain Necklace","$99.00","id=9856",NECKLACES,"");
 catalog[i++] = new product("catalog/TB037.jpg","Stainless Steel Thick Chain Necklace","$99.00","id=9857",NECKLACES,"");
 catalog[i++] = new product("catalog/TB038.jpg","Stainless Steel Thin Chain Necklace with Silver Fang Clasp","$99.00","id=9858",NECKLACES,"");
 catalog[i++] = new product("catalog/TB040.jpg","Stainless Steel Chain Necklace with Large Genuine Rubies","$299.00","id=9860",NECKLACES,"");
 catalog[i++] = new product("catalog/TB041.jpg","Stainless Steel Necklace with Large Genuine Ruby Extension","$245.00","id=9861",NECKLACES,"");
  
catalog[i++] = new product("catalog/TB005.jpg", "Sandblasted Silver Double Ring with Two Rubies in the Center", "$299.00", "id=8730", RINGS, "http://store.hbo.com/detail.php?p=109326&ecid=PRF-TV2-800864&PA=PRF-TV2-800864");
 catalog[i++] = new product("catalog/TB006.jpg", "Sandblasted Silver Double Ring with Rubies", "$199.00", "id=8733", RINGS, "http://store.hbo.com/detail.php?p=109327&ecid=PRF-TV2-800865&PA=PRF-TV2-800865");
 catalog[i++] = new product("catalog/TB007.jpg", "Silver Double Ring with Leather", "$149.00", "id=8734", RINGS, "http://store.hbo.com/detail.php?p=109328&ecid=PRF-TV2-800866&PA=PRF-TV2-800866");
 catalog[i++] = new product("catalog/TB008.jpg", "Sandblasted Silver Double Ring with Black Sapphires", "$149.00", "id=8736", RINGS, "http://store.hbo.com/detail.php?p=109329&ecid=PRF-TV2-800867&PA=PRF-TV2-800867");
 catalog[i++] = new product("catalog/tb018.jpg", "Stainless Steel Double Chain Bracelet with Large Genuine Ruby Charm", "$395.00", "id=8747", BRACELETS, "http://store.hbo.com/detail.php?p=109337&ecid=PRF-TV2-800877&PA=PRF-TV2-800877");
 catalog[i++] = new product("catalog/TB019.jpg", "Stainless Steel Double Chain Bracelet with Silver Accent", "$99.00", "id=8744", BRACELETS, "http://store.hbo.com/detail.php?p=109338&ecid=PRF-TV2-800878&PA=PRF-TV2-800878");
 catalog[i++] = new product("catalog/TB020.jpg", "Stainless Steel Multi-Chain Arm Band with Large Genuine Rubies", "$399.00", "id=8742", BRACELETS, "http://store.hbo.com/detail.php?p=109339&ecid=PRF-TV2-800879&PA=PRF-TV2-800879");
 catalog[i++] = new product("catalog/TB023.jpg", "Leather Bracelet with Silver Chain and Ruby", "$195.00", "id=8735", BRACELETS, "http://store.hbo.com/detail.php?p=109342&ecid=PRF-TV2-800882&PA=PRF-TV2-800882");
 catalog[i++] = new product("catalog/TB013.jpg", "Stainless Steel Invisible Clasp Necklace with Large Genuine Rubies", "$1,295.00", "id=8745", NECKLACES, "http://store.hbo.com/detail.php?p=109349&ecid=PRF-TV2-800872&PA=PRF-TV2-800872");
 catalog[i++] = new product("catalog/TB014.jpg", "Three Layer Stainless Steel Chain with Rubies", "$229.00", "id=8746", NECKLACES, "http://store.hbo.com/detail.php?p=109334&ecid=PRF-TV2-800873&PA=PRF-TV2-800873");
 catalog[i++] = new product("catalog/TB015.jpg", "Seven Layer Stainless Steel Chain with Large Genuine Rubies", "$1,249.00", "id=8750", NECKLACES, "http://store.hbo.com/detail.php?p=109350&ecid=PRF-TV2-800874&PA=PRF-TV2-800874");
 catalog[i++] = new product("catalog/TB016.jpg", "Stainless Steel Chain Necklace with Extension", "$249.00", "id=8751", NECKLACES, "http://store.hbo.com/detail.php?p=109335&ecid=PRF-TV2-800875&PA=PRF-TV2-800875");
 catalog[i++] = new product("catalog/TB026.jpg", "Silver Infinity Hoop Earrings", "$85.00", "id=8728", EARRINGS, "http://store.hbo.com/detail.php?p=109345&ecid=PRF-TV2-800885&PA=PRF-TV2-800885");
 catalog[i++] = new product("catalog/TB027.jpg", "Silver Infinity Hoop Earrings with Rubies", "$199.00", "id=8726", EARRINGS, "http://store.hbo.com/detail.php?p=109346&ecid=PRF-TV2-800886&PA=PRF-TV2-800886");
 catalog[i++] = new product("catalog/TB028.jpg", "Silver Infinity Hoop Earrings with Large Genuine Rubies", "$295.00", "id=8725", EARRINGS, "http://store.hbo.com/detail.php?p=109347&ecid=PRF-TV2-800887&PA=PRF-TV2-800887");
 catalog[i++] = new product("catalog/TB029.jpg", "Silver Infinity Hoop Earrings with Large Genuine Rubies", "$395.00", "id=8723", EARRINGS, "http://store.hbo.com/detail.php?p=109348&ecid=PRF-TV2-800888&PA=PRF-TV2-800888");
 catalog[i++] = new product("catalog/TB001.jpg", "Sandblasted Silver Double Ring", "$299.00", "id=8722", RINGS, "http://store.hbo.com/detail.php?p=109322&ecid=PRF-TV2-800860&PA=PRF-TV2-800860"); 
 catalog[i++] = new product("catalog/TB002.jpg", "Sandblasted Silver Double Ring with Rubies on Edges", "$295.00", "id=8724", RINGS, "http://store.hbo.com/detail.php?p=109323&ecid=PRF-TV2-800861&PA=PRF-TV2-800861"); 
 catalog[i++] = new product("catalog/TB003.jpg", "Silver Double Ring with Channel Set Rubies", "$245.00", "id=8727", RINGS, "http://store.hbo.com/detail.php?p=109324&ecid=PRF-TV2-800862&PA=PRF-TV2-800862");
 catalog[i++] = new product("catalog/TB004.jpg", "Silver Double Ring with Two Rubies In the Center", "$149.00", "id=8729", RINGS, "http://store.hbo.com/detail.php?p=109325&ecid=PRF-TV2-800863&PA=PRF-TV2-800863");
 catalog[i++] = new product("catalog/TB009.jpg", "Silver Infinity Ring with Black Studs", "$59.00", "id=8737", RINGS, "http://store.hbo.com/detail.php?p=109330&ecid=PRF-TV2-800868&PA=PRF-TV2-800868");
 catalog[i++] = new product("catalog/TB010.jpg", "Silver Infinity Ring with Large Genuine Rubies", "$169.00", "id=8739", RINGS, "http://store.hbo.com/detail.php?p=109331&ecid=PRF-TV2-800869&PA=PRF-TV2-800869");
 catalog[i++] = new product("catalog/TB011.jpg", "Silver Infinity Ring", "$59.00", "id=8741", RINGS, "http://store.hbo.com/detail.php?p=109332&ecid=PRF-TV2-800870&PA=PRF-TV2-800870");
 catalog[i++] = new product("catalog/TB017.jpg", "Stainless Steel Chain Necklace with Large Genuine Ruby and Back Extension", "$995.00", "id=8749", NECKLACES, "http://store.hbo.com/detail.php?p=109336&ecid=PRF-TV2-800876&PA=PRF-TV2-800876");
 catalog[i++] = new product("catalog/TB021.jpg", "Leather Cuff Bracelet with Large Silver Studs", "$195.00", "id=8740", BRACELETS, "http://store.hbo.com/detail.php?p=109340&ecid=PRF-TV2-800880&PA=PRF-TV2-800880");
 catalog[i++] = new product("catalog/tb022.jpg", "Leather Cuff Bracelet with Small Silver Studs", "$195.00", "id=8738", BRACELETS, "http://store.hbo.com/detail.php?p=109341&ecid=PRF-TV2-800881&PA=PRF-TV2-800881");
 catalog[i++] = new product("catalog/TB024.jpg", "Silver Infinity Bangle Bracelet", "$99.00", "id=8732", BRACELETS, "http://store.hbo.com/detail.php?p=109343&ecid=PRF-TV2-800883&PA=PRF-TV2-800883");
 catalog[i++] = new product("catalog/TB025.jpg", "Silver Infinity Bangle Bracelet With Rubies", "$169.00", "id=8731", BRACELETS, "http://store.hbo.com/detail.php?p=109344&ecid=PRF-TV2-800884&PA=PRF-TV2-800884");
 catalog[i++] = new product("catalog/TB012.jpg", "Stainless Steel Necklace with Long Front Extension with Large Genuine Ruby", "$875.00", "id=8743", NECKLACES, "http://store.hbo.com/detail.php?p=109333&ecid=PRF-TV2-800871&PA=PRF-TV2-800871");

 
 
function filterCatalog() {
  var filter = getFilterValue();  //document.getElementById("filter").value;

  var buf = "";
  var c = 0;
  for (pid in catalog) {
    product = catalog[pid];
    if (filter != ALL_JEWELRY && filter != product.category) {
      if (filter == LT500 || filter == LT100 || filter == GT500) {
        var px = parseFloat(product.price.replace(",","").substring(1));
        if (filter == LT500 && px>500) {
             continue;
        } else if (filter==LT100 && px>100) {
             continue;
        } else if (filter==GT500 && px<500) {
             continue;
        }
      } else if (filter==LEATHER) {
          if (product.desc.indexOf("Leather")==-1) {
            continue;
          }
      } else if (filter == WITH_RUBIES) {
          if (product.desc.search(/Ruby|Rubies/)==-1) {
            continue;
          }
      } else if (filter == NO_RUBIES) {
          if (product.desc.search(/Ruby|Rubies/)!=-1) {
            continue;
          }
      } else if (filter == NEW_ARRIVALS) {
        if (pid > 11) {
          continue;
        }
      } else {
        continue;
      }
    }
    var prodName = "product" + pid;
    if (c % 4 == 0) {
      buf += '<div style="clear:both"></div>';
    }
    c++;
    buf += "\n<div class=product>\n";
    
    buf += '  <div class="productImg" style="background-image:url(' + product.image + ')"> <a class="viewMoreLink" href="javascript:viewMore(\'' + product.link + '\')"><img src="images/transparent.gif" height=165 width=165><BR/><div class="viewMore">+ VIEW MORE</div></a></div>\n';
    //buf += '  <div class="productImg" style="background-image:url(' + product.image + ')"> <a class="viewMoreLink" target="_blank" href="' + product.hboLink + '"><img src="images/transparent.gif" height=165 width=165><BR/><div class="viewMore">+ VIEW MORE</div></a></div>\n';

    buf += "  <div class=prodDesc>" + product.desc + "</div>\n";
    buf += '  <div style="margin-bottom:10px">\n';
    buf += "  <span class=price>" + product.price + "</span>\n";
    buf += '  <a class="productLink" target="_blank" href=' + PRODUCT_INFO_URL + product.link +'>Shop Now</a></div>\n';
   // buf += '  <a target="_blank" class="productLink" href=' + product.hboLink +'>Shop Now</a></div>\n';
    buf += "  </div>";
    buf += "</div>\n";
  }

  document.getElementById("catalog").innerHTML=buf;

}


var win= null;
function newWindow(mypage, myname, w, h) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    var settings = "height=" + h + ",";
    settings += "width=" + w + ",";
    settings += "top=" + wint + ",";
    settings += "left=" + winl + ",";
    settings += "scrollbars=no" + ",";
    settings += "resizable=no";
    win = window.open(mypage, myname, settings);
    if (parseInt(navigator.appVersion) >= 4) {
        win.window.focus();
    }
}



