﻿// JScript File
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 showMap(e,wd,ht)
{
   try
   {
        var objDiv=document.getElementById('divMap');
        if (objDiv!=null)
        {   
            var theTop                    
            if (document.documentElement && document.documentElement.scrollTop)
            {
                theTop = document.documentElement.scrollTop;	                    
            }
            else if (document.body)
            {
                theTop = document.body.scrollTop;	                    
            }
            else
            {
                theTop=0;
            }            
            
            var y = e.clientY + theTop - ht;
            objDiv.style.display='block';
            objDiv.style.left=e.clientX + wd + 'px';
                        
            objDiv.style.top = y  + 'px';            
        }
    }
    catch(err)
    {
        alert(err);
    }
}

function ShowPopup1(objTR,eve,dimage)
{ 
    ShowToolTip1('divLogo',objTR,eve,dimage);
}

function HidePopup1()
{
    document.getElementById("divLogo").style.display="none";
}    
           
function ShowToolTip1(TDiv,objTR,e,img)
{    
    var objDiv = document.getElementById(TDiv);
    var objRow = objTR;           
    var objImg = document.getElementById("imgSelLogo");
    objImg .src="http://www.gemfind.net/dealerid_display/dealerimages/"+img;
    objDiv.style.display = 'block'; 
    var yPos;
    var xPos; 
  
       var yPos=getAbsTop(objRow) + 15;
        var xPos=getAbsLeft(objRow) + 20; 
  
        objDiv.style.left = xPos + 'px';										
        objDiv.style.top =yPos + 'px';
} 

function getAbsLeft(o) 
{
		var oLeft = o.offsetLeft
		while(o.offsetParent!=null) 
		{
			oParent = o.offsetParent
			oLeft += oParent.offsetLeft
			o = oParent
		}
		return oLeft
}
function getAbsTop(o) 
{
	var oTop = o.offsetTop
	while(o.offsetParent!=null) 
	{
		oParent = o.offsetParent
		oTop += oParent.offsetTop
		o = oParent
	}
	return oTop
}

function validateZipcode()
{
    var RegExpr = new RegExp('\d{5}');
    var txtZ = objZip;
    
   if(txtZ.value =='' || txtZ.value =="Enter Zip Code")
   {
       alert("Enter Zip Code");
       return false;
    }
   else if(!(/^\d{5}$/.test(txtZ.value)))
   {            
        alert("Enter valid Zip Code");
        return false;
   }
   HideZip();
   return true;
}
function ShowZip(objSource,strURL,yAdd,xAdd)
{    
      //alert(objSource);
      var dealerlink = DealerId;
      if (dealerlink == "")
      {
          ShowZipToolTip('divZipcode',objSource,yAdd,xAdd);
          objZip.value="Enter Zip Code";
          objID.value=strURL;
         return false;
      }
     return true;
}
function HideZip()
{
    document.getElementById("divZipcode").style.display="none";
}
function ShowZipToolTip(ZDiv,objSource,yAdd,xAdd)
{      
    var objDiv = document.getElementById(ZDiv);
    var objRow = objSource;
    objDiv.style.display = 'block'; 
    var yPos;
    var xPos;  
    var yPos=getAbsTop(objRow)+yAdd;
    var xPos=getAbsLeft(objRow)-xAdd;
    objDiv.style.left = xPos + 'px';										
    objDiv.style.top = yPos + 'px';
}
///////////////////////////////////////////////////////////////////////
function ShowToolTip(TDiv,objTR,e)
{    
    var objDiv = document.getElementById(TDiv);
    var objRow = objTR;
    objDiv.style.display = 'block'; 
    var yPos=getAbsTop(objRow) - 180;
    var xPos=getAbsLeft(objRow) + 295;
        objDiv.style.left = xPos + 'px';										
        objDiv.style.top = yPos + 'px';
    
    if(document.getElementById('trSimiler') != null)
    {
		if(getAbsTop(document.getElementById('trSimiler')) -  getAbsTop(objDiv) <425)
		{
			document.getElementById('trSimiler').style.height="400px";
		}
		else
		{
			document.getElementById('trSimiler').style.height="250px";
		}
	}
	
}

function ShowToolTipForShowMap(TDiv,objTR,e,IsLast)
{    
    var objDiv = document.getElementById(TDiv);
    var objRow = objTR;
    objDiv.style.display = 'block'; 
    if(IsLast=='false')
    {
        var yPos=getAbsTop(objRow) - 180;
        var xPos=getAbsLeft(objRow) + 300;
    }
    else
    {
        var yPos=getAbsTop(objRow) - 380;
        var xPos=getAbsLeft(objRow) + 300;
    }
    objDiv.style.left = xPos + 'px';										
    objDiv.style.top = yPos + 'px';
}

function TogglePageContent(divID,linkID) 
{
    if(document.getElementById(divID).style.display == 'none')  
    {    	
        document.getElementById(divID).style.display = 'inline';    	
        document.getElementById(linkID).innerHTML = 'close';  	
    }  	
    else 
    {    	
        document.getElementById(divID).style.display = 'none';    	
        document.getElementById(linkID).innerHTML = 'more &raquo;';  	
    }
}
///////////////////////////////////////////////////////////////////////
function fnTaskSubmit(img,j)
{
	var objPopup = new PopupWindow("apDiv1");					
	if(navigator.userAgent.indexOf("Firefox") != -1) // If Browser is Mozilla
	{        
		if(j==1)
		    objPopup.offsetX -= 240;
		else if(j==2)
		    objPopup.offsetX = 180;						
		else if(j==4 || j==3)
			{
			    var objPopup = new PopupWindow("diviteminfoLast");
				objPopup.offsetX = -303; 
			}
	}
	else
	{
		if(j==4 || j==3)
		{
			var objPopup = new PopupWindow("diviteminfoLast");
			objPopup.offsetX = -303; 
		}
		else
		    objPopup.offsetX -=240;
	}
	    
    objPopup.offsetY =-50;
	objPopup.showPopup(img);
}

function fnTaskSubmitRing(img,j)
{
	var objPopup = new PopupWindow("apDiv2");					
	if(navigator.userAgent.indexOf("Firefox") != -1) // If Browser is Mozilla
	{        
		if(j==1)
		    objPopup.offsetX -= 240;
		else if(j==2)
		    objPopup.offsetX = 180;						
		else if(j==4 || j==3)
			{
			    var objPopup = new PopupWindow("diviteminfoLast");
				objPopup.offsetX = -303; 
			}
	}
	else
	{
		if(j==4 || j==3)
		{
			var objPopup = new PopupWindow("diviteminfoLast");
			objPopup.offsetX = -303; 
		}
		else
		    objPopup.offsetX -=240;
	}
	    
    objPopup.offsetY =-50;
	objPopup.showPopup(img);
}

function fnTaskSubmitWatch(img,j)
{
	var objPopup = new PopupWindow("apDiv3");					
	if(navigator.userAgent.indexOf("Firefox") != -1) // If Browser is Mozilla
	{        
		if(j==1)
		    objPopup.offsetX -= 240;
		else if(j==2)
		    objPopup.offsetX = 180;						
		else if(j==4 || j==3)
			{
			    var objPopup = new PopupWindow("diviteminfoLast");
				objPopup.offsetX = -303; 
			}
	}
	else
	{
		if(j==4 || j==3)
		{
			var objPopup = new PopupWindow("diviteminfoLast");
			objPopup.offsetX = -303; 
		}
		else
		    objPopup.offsetX -=240;
	}
	    
    objPopup.offsetY =-50;
	objPopup.showPopup(img);
}

function showLocalJewelerInfo(iid,e,posLeft)
{
    var divJeweler=document.getElementById('divLocalJeweler');
    divJeweler.style.display='block';
    var theTop
    if (document.documentElement && document.documentElement.scrollTop)
        {
        theTop = document.documentElement.scrollTop;	                    
        }
    else if (document.body)
        {
        theTop = document.body.scrollTop;	                    
        }
    else
        {
        theTop=0;	                    
        }
        y = e.clientY + theTop // get the mouse top position 
       // alert(y);	                	
    divJeweler.style.left = getAbsLeftV2(iid.offsetParent) +posLeft + 'px';				
    divJeweler.style.top =getAbsTopV2(iid) + 'px';                               
}

function hideLocalJewelerInfo()
{
    var divJeweler=document.getElementById('divLocalJeweler');
    divJeweler.style.display='none';
}

getAbsLeftV2=function (o) 
{
	oLeft = o.offsetLeft
	while(o.offsetParent!=null) 
	{
		oParent = o.offsetParent
		oLeft += oParent.offsetLeft
		o = oParent
	}
	return oLeft
}
	
getAbsTopV2=function (o) 
{
	oTop = o.offsetTop
	while(o.offsetParent!=null) 
	{
		oParent = o.offsetParent
		oTop += oParent.offsetTop
		o = oParent
	}
	return oTop
}

/*
function goBack()
{
    window.history.go(-1);
}
*/
///////////////////////////////////////////////////////////////////////

function ShowPopupForWeHateSpam(iid,e)
{
    divPopup=document.getElementById('divDetail');
    divPopup.style.display='block';
    
    divPopup.innerHTML='<div class="grid_tit" style="width:100%"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td align="center" style="width:80%">We Hate Spam Also</td><td align="right" style="width:20%;padding-right:5px;"><input type="button" id="btnCloseDiv" value="X" onclick="HidePopup()"  style="border:none;background-color:Transparent;color:White; font-weight:bold;"/></td></tr></table>  </div><div style="padding:5px 5px 5px 5px;" class="text_normal"> We know you hate getting spam - we hate it as well. We ask for your e-mail only so that we may reply to your inquiry or if you\'re requesting a local jeweler, they may reply to your inquiry. We never have, and never will, sell any e-mail addresses to any third party. <p>We may from time to time send you special offers of our own, which you may opt out of at any time, no questions asked.</div>';                      
    
    var theTop
    if (document.documentElement && document.documentElement.scrollTop)
    {
        theTop = document.documentElement.scrollTop;	                    
    }
    else if (document.body)
    {
        theTop = document.body.scrollTop;	                    
    }
    else
    {
        theTop=0;	                    
    }
    y = e.clientY + theTop // get the mouse top position
    // alert(y);
	divPopup.style.left = getAbsLeftV2(iid.offsetParent) - 128 + 'px';
    divPopup.style.top =getAbsTopV2(iid) + 'px';
    
}


function ShowPopup(num,iid,e)
{
    divPopup=document.getElementById('divDetail');
    divPopup.style.display='block';
    if(num==1)            
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Shape</div><div style="padding:5px 5px 5px 5px;" class="text_normal">Refers to the geometric proportions of a gemstone. The shape of a gemstone is one of the most important factors in determining how much sparkle a gemstone produces. For more information, read our education on diamond shape. </div>';
    else if(num==2)
    {
        if(ClarityText=="VVS2")
        {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Clarity: Very, Very Slightly Included (VVS2)</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has very few, very tiny inclusions. The inclusions in this diamond are virtually unidentifiable even when viewed under a microscope at 30x power magnification. Diamonds of this grade of clarity are extremely rare. </div>';
        } else if(ClarityText=="VS2") 
        {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Clarity: Very Slightly Included (VS2)</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has few, very small inclusions. The inclusions are very difficult to see under a 10x power magnification, and are almost never visible to the unaided eye. VS2 grade diamonds present an excellent value in clarity because they are typically free of visible blemishes, and they are less expensive than higher clarity grades. </div>';
        } else if(ClarityText=="SI1") 
        {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Clarity: Slightly Included (SI1)</div><div style="padding:5px 5px 5px 5px;" class="text_normal">The inclusions in this diamond can be visible at 10x power magnification. Inclusions in diamonds with SI grade clarity might be visible to the unaided eye. SI1 grade diamonds are not as rare as VS1 and VS2 grade diamonds, so they are less expensive and present a great value. </div>';
        } else if(ClarityText=="VS1") 
        {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Clarity: Very Slightly Included (VS1)</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has few, very small inclusions. The inclusions are very difficult to see under a 10x power magnification, and are almost never visible to the unaided eye. VS1 grade diamonds present an excellent value in clarity because they are typically free of visible blemishes, and they are less expensive than higher clarity grades. </div>';
        } else if(ClarityText=="IF") 
        {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Clarity: Internally Flawless (IF)</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has no internal identifying characteristics, even when viewed under a microscope at extreme magnification. These diamonds are not graded flawless usually because of very slight surface markings or minor details in their polish. Diamonds of this grade of clarity are extremely rare. </div>';
        } else if(ClarityText=="VVS1") 
        {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Clarity: Very, Very Slightly Included (VVS1)</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has very few, very tiny inclusions. The inclusions in this diamond are virtually unidentifiable even when viewed under a microscope at 30x power magnification. Diamonds of this grade of clarity are extremely rare. </div>';
        } else if(ClarityText=="SI2") 
        {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Clarity: Slightly Included (SI2)</div><div style="padding:5px 5px 5px 5px;" class="text_normal">The inclusions in this diamond can be visible at 10x power magnification. Inclusions in diamonds with SI grade clarity might be visible to the unaided eye. SI2 grade diamonds are not as rare as SI1 and VS2 grade diamonds, so they are less expensive and present a great value. </div>';                
        } else
        {
        divPopup.innerHTML='<div class="grid_tit" style" width:100%">Clarity</div><div style="padding:5px 5px 5px 5px;" class="text_normal">The clarity scale is used to describe how few inclusions a gemstone has. Though items may come with even better clarity grades, Stein Diamonds lists the minimum clarity grades a customer may receive for each piece of jewelry containing a diamond or gemstone. For diamonds, the clarity scale ranges from flawless (FL), meaning a gemstone has no internal or external flaws, to severely included (I3), meaning there are many flaws clearly visible to the unaided eye. For more information, read our education on diamond clarity.</div>';
        }    
    }
    else if(num==3)
    {
        if(Color=="D")
        {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Color: D</div><div style="padding:5px 5px 5px 5px;" class="text_normal">A diamond of this color grade is highly prized, as a diamond with less color has never been found. This grade of diamond is absolutely colorless. </div>';
        } else if(Color=="E") 
        {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Color: E</div><div style="padding:5px 5px 5px 5px;" class="text_normal">An E-color diamond is colorless to the unaided eye. Only a trained gemologist using special equipment can determine any color difference between a D- and an E-color diamond. </div>';
        } else if(Color=="F") 
        {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Color: F</div><div style="padding:5px 5px 5px 5px;" class="text_normal">No color is visible to an untrained eye in an F-color diamond. As the least expensive diamond color in the colorless range, F-color diamonds display minimal color difference from D- or E-color diamonds and offer a lower price. </div>';
        } else if(Color=="G") 
        {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Color: G</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond is nearly colorless. A diamond with G-color has an extremely faint tint that is only noticeable to a trained gemologist. G-color diamonds make for beautiful jewelry and they offer an outstanding value, since they are less expensive than the colorless grades, but appear to the eye to be colorless when mounted. </div>';
        } else if(Color=="H") 
        {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Color: H</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond offers an exceptional balance of color and cost in the near-colorless range. If you choose an H-color grade diamond, you can buy a larger diamond for the same the price as a higher color grade. The very slight tint is generally not noticeable. </div>';
        } else if(Color=="I")
        {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Color: I</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond, when cut to ideal proportions, produces a warm brilliancy not found in the higher grade colors. I-color diamonds are less expensive than other diamonds, so you can buy a larger diamond for the same price as a higher color grade. Note: If this diamond has medium or strong blue fluorescence, its slight tint will be partially masked, making the diamond appear whiter to the eye. </div>';
        } else if(Color=="J") 
        {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Color: J</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond, when cut to ideal proportions, produces a warm brilliancy not found in the higher grade colors. As the least expensive diamonds in the near-colorless range, J-color diamonds present the best value in diamond color, so you can buy a larger diamond for the price. Note: If this diamond has medium or strong blue fluorescence, its slight tint will be partially masked, making the diamond appear whiter to the eye. </div>';
        } else 
        {
            divPopup.innerHTML='<div class="grid_tit" style" width:100%">Color</div><div style="padding:5px 5px 5px 5px;" class="text_normal"> The color scale is used to describe the color present within a diamond or gemstone. Though items may come with even better color grades, Stein Diamonds lists the minimum color grades a customer may receive for each piece of jewelry containing a diamond or gemstone. For diamonds, the color scale ranges from D, indicating complete colorlessness, to Z, which indicates a distinct yellow-brown or grayish cast.</div>'; 
        }
    }
    else if(num==4) 
        divPopup.innerHTML='<div class="grid_tit" style" width:100%">Certificate(in diamonds)</div><div style="padding:5px 5px 5px 5px;" class="text_normal"> A diamond certificate, s a report created by a gemologist, or gemologists, who have scrutinized the diamond and placed it under a microscope to analyze its dimensions, clarity, cut, color, finish, symmetry, and other characteristics.</div>';             
    else if(num==5) 
        divPopup.innerHTML='<div class="grid_tit" style="width:100%">Depth</div><div style="padding:5px 5px 5px 5px;" class="text_normal"> The height of a gemstone measured from the culet to the table. For more information, read our education on diamond cut.</div>'; 
    else if(num==6) 
        divPopup.innerHTML='<div class="grid_tit" style="width:100%">Table Percentage</div><div style="padding:5px 5px 5px 5px;" class="text_normal"> The width of the table divided by the diameter of the gemstone. The table percentage is critical to creating sparkle in a gemstone; a gemstone with a table percentage too low or too high will lack sparkle.</div>'; 
    else if(num==7) 
        divPopup.innerHTML='<div class="grid_tit" style="width:100%">Polish</div><div style="padding:5px 5px 5px 5px;" class="text_normal"> Polish describes how smoothly the facets of a diamond have been polished, whether any marks are visible from the polishing wheel, and how defined the edges of each facet are. Since Stein Diamonds defines cut grade based on the depth and table percentages, a diamond can have an ideal cut, despite the polish grade. Polish marks are almost always invisible to the unaided eye, but they have a slight effect on the overall brilliance. For the highest grade of polish, look for an ideal (ID), excellent (EX), or very good (VG) AGSL graded diamond, and an excellent (EX) or very good (VG) GIA graded diamond. For the best balance of price and quality, look for a GIA or AGSL polish grade of good (G). Avoid diamonds with polish grades of fair (F) or poor (P), as the quality of their polish may affect the brilliance of the diamond.</div>'; 
    else if(num==8) 
        divPopup.innerHTML='<div class="grid_tit" style="width:100%">Symmetry</div><div style="padding:5px 5px 5px 5px;" class="text_normal"> Symmetry refers to the alignment of the diamond facets - whether all like facets are the same size and shape, and whether the facets on the bottom, or pavilion, match up with the facets on the top, or crown. Since Stein Diamonds defines cut grade based on the depth and table percentages, a diamond can have an ideal cut, despite the symmetry grade. For the highest grade of symmetry, look for an ideal (ID), excellent (EX), or very good (VG) AGSL graded diamond, and an excellent (EX) or very good (VG) GIA graded diamond. For the best balance of price and quality, look for a GIA or AGSL symmetry grade of good (G). Avoid diamonds with symmetry grades of fair (F) or poor (P), as the alignment of their facets may misdirect light so severely that it affects the brilliance of the diamond.</div>'; 
    else if(num==9) 
        divPopup.innerHTML='<div class="grid_tit" style="width:100%">Fluorescence</div><div style="padding:5px 5px 5px 5px;" class="text_normal"> The visible effects of fluorescence grades of faint, or medium can only be detected by a trained gemologist with specific UV light. A fluorescence grade of strong or very strong can make a diamond with a near-colorless grade look even whiter.</div>';                      
    else if(num==10)
    {      
      if(thecutgrade.toUpperCase()=="VERY GOOD" || thecutgrade.toUpperCase()=="VG")
      {
            divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Cut: Very Good</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has been cut and proportioned to allow it to reflect nearly all light as sparkle and fire. This is an outstanding cut with a negligible visible difference from an ideal-cut diamond, but at a lower price.</div>';
      } else if(thecutgrade.toUpperCase()=="GOOD" || thecutgrade.toUpperCase()=="G") 
      {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Cut: Good</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has been cut and proportioned to allow it to reflect most light that enters. A good cut is often significantly less expensive than a very good cut and is a very acceptable choice for most jewelry. </div>';
      } else if(thecutgrade.toUpperCase()=="EXCELLENT" || thecutgrade.toUpperCase()=="EX") 
      {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Cut: Excellent</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond is cut to the finest table and depth proportions, allowing it to reflect nearly all light as sparkle and fire. By these proportions, Stein Diamonds qualifies this diamond as an Excellent cut. </div>';
      } else if(thecutgrade.toUpperCase()=="FAIR" || thecutgrade.toUpperCase()=="F") 
      {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%">Cut: Fair</div><div style="padding:5px 5px 5px 5px;" class="text_normal">This diamond has been cut to proportions that will yield more carat weight from the diamond rough. A fair cut will produce beautiful sparkle, but will not be as brilliant as a higher grade of cut. </div>';
      } else 
      {
        divPopup.innerHTML='<div class="grid_tit" style=" width:100%"></div><div style="padding:5px 5px 5px 5px;" class="text_normal"></div>';
      }
    }
   
    
    var theTop
    if (document.documentElement && document.documentElement.scrollTop)
    {
        theTop = document.documentElement.scrollTop;	                    
    }
    else if (document.body)
    {
        theTop = document.body.scrollTop;	                    
    }
    else
    {
        theTop=0;	                    
    }
    y = e.clientY + theTop // get the mouse top position
    // alert(y);
	divPopup.style.left = getAbsLeftV2(iid.offsetParent) - 228 + 'px';
    divPopup.style.top =getAbsTopV2(iid) + 'px';
}        
function HidePopup()
{
    divPopup=document.getElementById('divDetail');
    divPopup.style.display='none';
}

function SelectRow(DID,MID,e)
{
    var cond;
    if(navigator.appName == "Netscape")
    {   
        cond = e.target.className;
        if (cond != "grid_link_in")
            location.href = 'Diamonds/ViewDetails.aspx?DID=' + DID;
            
        if(MID!="")
			location.href = 'Diamonds/ViewDetails.aspx?DID=' + DID + '&brd=' + MID;
    }
    if(navigator.appName == "Microsoft Internet Explorer")
    {
        cond = e.srcElement.className;
        if (cond != "grid_link_in")
            location.href('Diamonds/ViewDetails.aspx?DID=' + DID);
        
        if(MID!="")
			location.href('Diamonds/ViewDetails.aspx?DID=' + DID + '&brd=' + MID);
    }
}

function ShowPopup_Diamond(intDiamondId,txtShape,fltCarat,txtColor,txtClarity,fltPrice,fltDepth,fltTable,txtPolish,txtSymmetry,txtFluorescence,
    fltCrown,txtMeasurements,PriceDisabled,strCutGrade,txtCertNo,objTR,eve)
{               
   var alttext = "true";
   
   ContentText="<table width='250' border='0' cellpadding='0' cellspacing='0'>";
   ContentText+="<tr>";
   ContentText+="<td width='6%' rowspan='2' valign='top' background='../images/width_pop/left.png'><img src='../images/width_pop/espace.png' width='18' height='10' /></td>";
   ContentText+="<td height='37' background='../images/width_pop/top2.png'></td>";
   ContentText+="<td width='2%' rowspan='2' background='../images/width_pop/right.png'><img src='../images/width_pop/espace.png' width='33' height='70' /></td>";
   ContentText+="</tr>";
   ContentText+="<tr>";
   ContentText+="<td width='92%' valign='top' bgcolor='#FFFFFF'><table width='100%' cellspacing='0' cellpadding='0'>";
   ContentText+="<tr>";
   ContentText+="<td height='130' valign='top' bgcolor='#FFFFFF'><table width='95%' border='0' align='center' cellpadding='0' cellspacing='0'>";
   ContentText+="<tr>";
   ContentText+="<td></td>";
   ContentText+="<td colspan='3'>&nbsp;</td>";
   ContentText+="</tr>";
   ContentText+="<tr>";
   ContentText+="<td>&nbsp;</td>";
   ContentText+="<td colspan='2' class='pd_details_tit'>Diamond Information</td>";
   ContentText+="</tr>";
   ContentText+="<tr>";              
   ContentText+="<td>&nbsp;</td>";
   ContentText+="<td colspan='2'></td>";
   ContentText+="</tr>";              
   if (intDiamondId.toString() != "" && intDiamondId.toString() != "%") 
   {                   
       if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td width='8%'>&nbsp;</td>";
       ContentText+="<td width='48%'>Stock #: </td>";
       ContentText+="<td>" + intDiamondId + "</td>";
       ContentText+="</tr>";
              
   }           
   if (txtShape.toString() != "" && txtShape.toString() != "%") 
   {               
       
       if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Shape: </td>";
       ContentText+="<td>" + txtShape + "</td>";
       ContentText+="</tr>";
              
   }
   if (fltCarat.toString() != "" && fltCarat.toString() != "%") 
   {   
     
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td >Carat: </td>";
       ContentText+="<td>" + fltCarat + "</td>";
       ContentText+="</tr>";
              
   }
   if (txtColor.toString() != "" && txtColor.toString() != "%") 
   {   
     
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td >&nbsp;</td>";
       ContentText+="<td >Color:</td>";
       ContentText+="<td>" + txtColor + "</td>";
       ContentText+="</tr>";                      
   }
   if (strCutGrade.toString() != "" && strCutGrade.toString() != "%") 
   {   
     
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td >&nbsp;</td>";
       ContentText+="<td >Cut Grade:</td>";
       ContentText+="<td>" + strCutGrade + "</td>";
       ContentText+="</tr>";                      
   }
   if (txtClarity.toString() != "" && txtClarity.toString() != "%") 
   {
      
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Clarity: </td>";
       ContentText+="<td>" + txtClarity + "</td>";
       ContentText+="</tr>";
              
   }
   if (fltPrice.toString() != "" && fltPrice.toString() != "%") 
   {
       
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Price: </td>";
       ContentText+="<td>" + (PriceDisabled.toString() == "0"? fltPrice : "&nbsp;") + "</td>";
       ContentText+="</tr>";
              
       
   }   
   if (fltDepth.toString() != "" && fltDepth.toString() != "%") 
   {               
       if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Depth: </td>";
       ContentText+="<td>" + fltDepth + "</td>";
       ContentText+="</tr>";
              
       
   }
   if (fltTable.toString() != "" && fltTable.toString() != "%") 
   {               
       if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Table: </td>";
       ContentText+="<td>" + fltTable + "</td>";
       ContentText+="</tr>";
              
       
   }
   if (txtPolish.toString() != "" && txtPolish.toString() != "%") 
   {
       
       if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Polish: </td>";
       ContentText+="<td>" + txtPolish + "</td>";
       ContentText+="</tr>";
              
   }
   if (txtSymmetry.toString() != "" && txtSymmetry.toString() != "%") 
   {
       
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Symmetry: </td>";
       ContentText+="<td>" + txtSymmetry + "</td>";
       ContentText+="</tr>";
              
   }
   if (txtFluorescence.toString() != "" && txtFluorescence.toString() != "%")
   {               
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Fluorescence: </td>";
       ContentText+="<td>" + txtFluorescence + "</td>";
       ContentText+="</tr>";
       
                          
   }      
   if (fltCrown.toString() != "" && fltCrown.toString() != "%")
   {
    
      if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }               
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Crown: </td>";
       ContentText+="<td>" + fltCrown + "</td>";
       ContentText+="</tr>";                             
           
   }
   if (txtMeasurements.toString() != "" && txtMeasurements.toString() != "%")
   {   if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Measurements: </td>";
       ContentText+="<td>" + txtMeasurements + "</td>";
       ContentText+="</tr>";               
                                   
   }
   if (txtCertNo.toString() != "" && txtCertNo.toString() != "%")
   {   if (alttext.toString()=="true") 
       {
            ContentText+="<tr class='pd_text_alt'>";
            alttext = "false";
       }
       else
       {
            ContentText+="<tr class='pd_text_alt1'>";
            alttext = "true";
        }
       ContentText+="<td>&nbsp;</td>";
       ContentText+="<td>Certificate No.: </td>";
       ContentText+="<td>" + txtCertNo + "</td>";
       ContentText+="</tr>";               
                                   
   }
   ContentText+="<tr>";                    
   ContentText+="<td colspan='3'>&nbsp;</td>";
   ContentText+="</tr>";
   if (DealerId != "863" &&  DealerId != "")
   {
       ContentText+="<tr>";              
       ContentText+="<td class='pd_details_tit'>&nbsp;</td>";
       ContentText+="<td colspan='2' class='pd_details_tit'>SEE IT FIRST AT </td>";
       ContentText+="</tr>";
       ContentText+="<tr>";              
       ContentText+="<td class='pd_text_alt1'>&nbsp;</td>";       
       ContentText+="<td colspan='2' class='pd_text_alt1'>" + DealerCompany + "</strong><br />" + DealerAddress + "<br/>" + DealerPhone + "</td>";
       ContentText+="</tr>";
    }
    ContentText+="</table></td>";
    ContentText+="</tr>";
    ContentText+="</table></td>";
    ContentText+="</tr>";
    ContentText+="<tr>";
    ContentText+="<td colspan='2' valign='top' background='../images/width_pop/e.png'><img src='../images/width_pop/espace.png' width='33' height='41' /></td>";
    ContentText+="<td background='../images/width_pop/bright.png'></td>";
    ContentText+="</tr>";
    ContentText+="</table>";

    document.getElementById("divToolTip").innerHTML=ContentText;
    ShowToolTip_Diamond('divToolTip',objTR,eve);
}

function ShowToolTip_Diamond(TDiv,objTR,e)
{
    var objDiv = document.getElementById(TDiv);
    var objRow = objTR;           
    objDiv.style.display = 'block'; 
    var yPos=getAbsTop(objRow) - 100;
    var xPos=getAbsLeft(objRow) - 232;
    objDiv.style.left = xPos + 'px';										
    objDiv.style.top =yPos + 'px';
}

function HidePopup_Diamond()
{
    document.getElementById("divToolTip").style.display="none";            
}
////////////////////////////////////////////////////////////////////////////
function ShowPopup_Designer(objImage,eve,did,info,price)
{
    ShowToolTip_Designer('divInfo',objImage,eve,did,info,price);                  
}

// 25 % Discount
function ShowPopup_Designer(objImage,eve,did,info,price, newPrice)
{
    ShowToolTip_Designer('divInfo',objImage,eve,did,info,price,newPrice);                  
}

function HidePopup_Designer()
{
    document.getElementById("divInfo").style.display="none";
}

function ShowToolTip_Designer(IDiv,objImage,e,did,info,price, newPrice)
{
    var objDiv = document.getElementById(IDiv);
    var objRow = objImage;
    objDiv.style.display = 'block';
    var yPos;
    var xPos;
    
    if(navigator.appName == "Netscape")
    { 
        if(objImage.id.indexOf("ibtnLargeImage") >= 0)
        {
           yPos=getAbsTop(objImage)+205;
           xPos=getAbsLeft(objImage)+60; 
        }
        else
         {
             yPos=getAbsTop(objImage)+100;
             xPos=getAbsLeft(objImage)-17; 
         }         
    }
    else
    {
        if(objImage.id.indexOf("ibtnLargeImage") >= 0)
        {
           yPos=getAbsTop(objImage)+208;
           xPos=getAbsLeft(objImage)+65; 
        }
        else
        {
           yPos=getAbsTop(objImage)+100;
           xPos=getAbsLeft(objImage)-16; 
        }
    }
    
    objDiv.style.left = xPos + 'px';
    objDiv.style.top = yPos + 'px';
    
    document.getElementById("hidID").value = did;
    document.getElementById("tdInfo").innerHTML = info;
    document.getElementById("tdPrice").innerHTML = "<span style='text-decoration: line-through;'>"+ price +"</span><br><strong style='color:Red;'>"+ newPrice +"<strong>" ;
    document.getElementById("lnkMoreInfo").href = NormalURL + "Designers/DesignerJewelry-" + did + ".aspx";
}

function GoBack()
{
    location.href = goBackURL;
}

function ClearText(txtFriendEmails)
{
    //alert(txtFriendEmails.value);
    var FriendEmails = txtFriendEmails.value;
    if (FriendEmails == "Enter up to 5 different e-mail addresses, separated by commas")
    {
        txtFriendEmails.value = "";
        return false;
    }
    else if (FriendEmails != "")
    {                
        var mySplitResult = FriendEmails.split(",");
        if (mySplitResult.length > 5)
        {
            alert('Enter up to 5 different e-mail addresses');
            return false;
        }
        else
        {
            exp = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
            for (var i=0; i<mySplitResult.length; i++)
            {
                var emailAdd = trim(mySplitResult[i]);
                if (exp.test(emailAdd) != true)
                {
                    alert('Enter valid E-mail Address');
                    txtFriendEmails.focus();
                    return false;
                }
            }
        }
    }
}
function trim(stringToTrim)
{
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function showShapeTitle(objShape)
{
    var yPos=getAbsTop(objShape);
    var xPos=getAbsLeft(objShape); 
   
   var objDiv= document.getElementById("divShapeTitle");
   objDiv.style.display='block';
   objDiv.style.left = xPos + 'px';
   objDiv.style.top =yPos + 32 + 'px'; 
   document.getElementById("lblTitle").innerHTML =objShape.className;   
}

function hideShapeTitle(objShape)
{
    var objDiv= document.getElementById("divShapeTitle");
    objDiv.style.display='none';
}

function FormatPhone(txtContactPhone)
{
    var ContactPhone = txtContactPhone.value;
    //alert(ContactPhone);
    if (ContactPhone != "")
    {
        var FinalPhoneNo = "";
        exp = /^(((\(\d{3}\)(\s)? ?)|(\d{3}-))?\d{3}-\d{4})|\d{10}$/
        var phoneNo = trim(ContactPhone);
        if (exp.test(phoneNo) == true)
        {
            exp1 = /^((\(\d{3}\)(\s)? ?))?\d{3}-\d{4}$/  //Format like "(123) 456-7890"
            exp2 = /^\d{10}$/                            //Format like "1234567890"
            exp3 = /^(\d{3}-)?\d{3}-\d{4}$/              //Format like "123-456-7890"
            if (exp1.test(phoneNo) == true)
            {
                //alert('1');
                phoneNo = phoneNo.replace(" ","");                        
                var myResult = phoneNo.split(")");
                if (myResult.length > 0)
                    FinalPhoneNo = myResult[0] + ") " + myResult[1];                        
            }
            else if (exp2.test(phoneNo) == true)
            {
                //alert('2');
                var ph = "(" + phoneNo.substring(0,3) + ") " + phoneNo.substring(3,6) + "-" + phoneNo.substring(6,10);
                FinalPhoneNo = ph;
            }
            else if (exp3.test(phoneNo) == true)
            {
                //alert('3');
                var myResult = phoneNo.split("-");
                if (myResult.length > 0)
                    FinalPhoneNo = "(" + myResult[0] + ") " + myResult[1] + "-" + myResult[2];
            }
            
            if (FinalPhoneNo != "")
                txtContactPhone.value = FinalPhoneNo;                                                            
            return true;
        }
    }
}

function manageText(texttocheck,objSource)
{
	
	if(objSource.value.indexOf(texttocheck)>=0)
	{	
		objSource.value='';
	}
	else if(objSource.value.replace(' ','')=='')
	{
		objSource.value=texttocheck;
	}	
	
}