if (top != self) top.location.href = location.href;
function addbookmark(){
	var url="http://www.earpiercingjewelry.com/";
	var title="Ear & Body 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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

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 +='<span class="pricesmall">Your Price: $'+prod.price+'</span><br>';
	content +='<a href="'+prod.url+'"class="prodlink">';
	content +=prod.title+'</a></td>';
	return content;
}

function _buildRviStart(){
	return '<br><table width="99%" border="0" cellpadding="0" cellspacing="0" align="center">'+
        '<tr>'+
          '<td valign="top" height="18" width="100%"><table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" height="18">'+
              '<tr>'+
                '<td width="9" height="18" align="left"><img src="/themes/earpiercingjewelry/imgs/border_lt.jpg" width="9" height="18"></td>'+
                '<td class="highlitedblock">Recently Viewed Products</td>'+
                '<td width="8" height="18" align="right"><img src="/themes/earpiercingjewelry/imgs/border_rt.jpg" width="8" height="18" alt=""></td>'+
              '</tr>'+
            '</table></td>'+
        '</tr>'+
        '<tr>'+
          '<td valign="top" height="4"><table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" height="4">'+
              '<tr>'+
                '<td align="left" height="4" width="71"><img src="/themes/earpiercingjewelry/imgs/border_lt2.jpg" width="71" height="4" alt=""></td>'+
                '<td><img src="/themes/earpiercingjewelry/imgs/spacer.gif"></td>'+
                '<td align="right" height="4" style="border-right: #c8c8c8 1px solid;"></td>'+
              '</tr>'+
            '</table></td>'+
        '</tr>'+
        '<tr>'+
          '<td align="center"><table width="100%" border="0" cellpadding="3" cellspacing="0" align="center">'+
              '<tr>'+
	 		    '<td class="itemlist_border_left"></td>';
}

function _buildRviEnd(){
	return '<td class="itemlist_border_right"></td>'+
              '</tr>'+
            '</table></td>'+
        '</tr>'+
        '<tr>'+
          '<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">'+
              '<tr>'+
                '<td align="left" height="10" width="10"><img src="/themes/earpiercingjewelry/imgs/border_lb.gif" width="10" height="10"></td>'+
                '<td style="border-bottom: #c8c8c8 1px solid;"><img src="/themes/earpiercingjewelry/imgs/spacer.gif"></td>'+
                '<td align="right" height="10" width="10"><img src="/themes/earpiercingjewelry/imgs/border_rb.gif" width="10" height="10"></td>'+
              '</tr>'+
            '</table></td>'+
        '</tr>'+
      '</table>';
}