if (top != self) top.location.href = location.href;
function addbookmark(){
	var url="http://www.discountpiercingjewelry.com/";
	var title="Discount Piercing Jewelry";
	addBookmark(title,url);
}

function addBookmark(title,url) {

  var msg_netscape = "NetScape message";
  var msg_opera    = "This function does not work with this version of Opera.  Please bookmark us manually.";
  var msg_other    = "Your browser does not support automatic bookmarks.  Please bookmark us manually.";
  var agt          = navigator.userAgent.toLowerCase();


  if (agt.indexOf("opera") != -1) 
  {
    if (window.opera && window.print)
    {
      return true;
    } else 
    {
      alert(msg_other);
    }
  }    
  else if (agt.indexOf("firefox") != -1) window.sidebar.addPanel(title,url,"");
  else if ((agt.indexOf("msie") != -1) && (parseInt(navigator.appVersion) >=4)) window.external.AddFavorite(url,title); 
  else if (agt.indexOf("netscape") != -1) window.sidebar.addPanel(title,url,"");
  else if (window.sidebar && window.sidebar.addPanel) window.sidebar.addPanel(title,url,""); 
  else alert(msg_other);
}


function openLagerImage(path){
	var winl = (screen.width - 400) / 2;
	var wint = (screen.height - 600) / 2;
	newWindow = window.open('','','height=400,width=600,top='+wint+',left='+winl+',scrollbars=no,resizable=yes');
	newWindow.document.open();
	var content = "<html><head><script>var isNav4, isIE4; if (parseInt(navigator.appVersion.charAt(0)) >= 4) { isNav4 = (navigator.appName == \'Netscape\') ? 1 : 0; isIE4 = (navigator.appName.indexOf(\'Microsoft\') != -1) ? 1 : 0; }";
	content += "function fitWindowSize() { if (isNav4) {window.innerWidth = document.images[0].width; window.innerHeight = document.images[0].height; } if (isIE4) { window.resizeTo(500, 500); width = 500 - (document.body.clientWidth -  document.images[0].width); height = 500 - (document.body.clientHeight -  document.images[0].height); window.resizeTo(width, height); } } </script>";
	content += "<BODY onLoad=\'fitWindowSize()\'><div style=\'position:absolute; left:0px; top:0px\'>";
	content += "<img src=\'"+path+"\' border=0></div></body></html>";
	newWindow.document.write(content);
	newWindow.document.close();
	return false;
}

function buildRvi(count, _count, ar){
	if (ar.length == 0 || ar.length - _count == 0 || (ar.length == 1 && nodeid == ar[0].id))
		return "";
	var str = _buildRviStart();
	for(var i=_count, y=0; i< ar.length; i++){
		if (nodeid == ar[i].id){
			continue;
		}
		str += _buildRvi(count, ar[i]);
		y++;
		if (y >= count)
			break;
	}
	str += _buildRviEnd();
	return str;
}


function _buildRvi(count, prod){
	if (count == 0) return "";	
	var width = 100/count;
	var content = '<td class="itemlist" width="'+width+'%">';
	if (prod.img.length > 0){
		content +='<a href="'+prod.url+'">';
		content +='<img src="'+prod.img+'" alt="' + prod.title + '"';
		if (prod.width > 0)
			content +=' width="'+prod.width+'"';
		if (prod.height > 0)
			content +=' height="'+prod.height+'"';
		content +=' border="0"></a>';
	}
	content +='<br>';
	content +='<a href="'+prod.url+'"class="prodlink">';
	content +=prod.title+'</a><br>';
    content +='<span class="pricesmall">Your Price: $'+prod.price+'</span></td>';
	return content;
}

function _buildRviStart(){
	return '<table border="0" cellpadding="0" cellspacing="0" style="border:#eeeee5 1px solid">'+
        '<tr>'+
                '<td class="m0h">Recently Viewed</td>'+
        '</tr>'+
        '<tr>'+
          '<td align="center"><table border="0" cellpadding="2" cellspacing="2" width="100%">'+
              '<tr>';
}

function _buildRviEnd(){
	return '</tr>'+
            '</table></td>'+
        '</tr>'+
      '</table><br>';
}

function onFocusSearch(ctrl, msg){
	if (ctrl.value == msg)
		ctrl.value="";
}
