//<script language="javascript">
var FramedWindow;
var ReffererItemID;
var ReffererCategoryID;
var ShowCloseWindowTitle;
nav = navigator.userAgent;
var compareView;
var tm;
var StoneID,ItemPriceForPreset,ItemPriceForPreset;
compareView = 1;
moz = false;
var msie = (navigator.userAgent.toLowerCase().indexOf('msie')!=-1);
var IE7andMOZ = window.XMLHttpRequest;
if ((nav.indexOf("Firefox") != -1)||(nav.indexOf("Netscape") != -1))
	moz = true;


if(!msie)
	var xmlDoc = document.implementation.createDocument("", "", null);
else
	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");


function TrackMyPage(p)
{
	if(pageTracker)
	{
		pageTracker._trackPageview(p);
	}
	return false;
}	
	
var imgLoader = document.createElement("IMG");
imgLoader.src = "_images/Loading25X25.gif";
imgLoader.style.position = 'absolute';
function ShowImage(objImg,newImg)
{
	objImg.src = newImg;
}
// For Item Page
var PointerArrow;
function setArrow(obj)
{
var xP,yP;
	xP =  getX(obj) - getX($('tblMainLayout'));
	yP = getY(obj);
	   
	if (!PointerArrow) 
	{
		PointerArrow = document.createElement('IMG')
		$('ItemZoom').appendChild(PointerArrow)
		
	}
	PointerArrow.src = "_images/zoom/arrow.png";
	PointerArrow.style.position='absolute';
	
	PointerArrow.style.top = yP+80;
	PointerArrow.style.left = xP+20;
  
}

 var status = '';
 function DOnClick()
 {
  document.getElementById('hand').src='_images/zoom/hand_off.jpg';
  document.getElementById('3d').src='_images/zoom/3d_on.png';
  status = '1';
 }
 
 function HandOnClick()
 {
  document.getElementById('hand').src='_images/zoom/hand_on.png';
  document.getElementById('3d').src='_images/zoom/3d_off.png';
  status = '2';
 }
 
 function Pic3dOut(obj)
 {
    a = status;
	if (a=='1')
	 {document.getElementById('3d').src='_images/zoom/3d_on.png';}
	else if (a=='2')
	 {document.getElementById('3d').src='_images/zoom/3d_off.png';}
	else if (a=='')
	 {document.getElementById('3d').src='_images/zoom/3d_off.png';} 
 }
  
  function PicHandOut(obj)
 {
	a = status;
	if (a=='2') 	
	 {document.getElementById('hand').src='_images/zoom/hand_on.png';}
	else if (a=='1') 
	 {document.getElementById('hand').src='_images/zoom/hand_off.png';} 
	else if (a=='') 
	 {document.getElementById('hand').src='_images/zoom/hand_off.png';} 
 }
 
 function PicsRestore()
 {
	document.getElementById('hand').src='_images/zoom/hand_off.png';
	document.getElementById('3d').src='_images/zoom/3d_off.png';
	status = '';
 }


function ViewHD(item,type)
{
	if($('ItemZoom'))
	{
		xpos = getX($('tblMainLayout'));
		var sendInfo = GetSourceHtml("zoomitem.asp?itemid="+item+"&type="+type,"");
		$('ItemZoom').innerHTML = sendInfo;
		$('ItemZoom').style.left = xpos
		$('ItemZoom').style.top = document.body.scrollTop;		
		$('ItemZoom').style.display='block';
	}
	return false;
	
}
function InsertMovie(flvFile,sType,item)
{
	$('shapes').style.display = 'none';
	$('ItemZoomContainer').innerHTML = "<iframe frameborder=0 width =940 height=710 scrolling=No src = '"+ site +"/video_item.asp?itemid="+item+"&type="+sType+"'></iframe>" 
}
function ViewImage(srcImage,sid)
{
	$('shapes').style.display = (sid!= undefined) ? 'block':'none';
	$('ItemZoomContainer').innerHTML = "<img id='"+sid+"' src='"+srcImage+"'>"
}
// End 	
	
function DoSelect() { if(CheckSize()==false) return false;alert(document.forms[5].name);document.frmItem.submit(); }
	
function $(objID){return document.getElementById(objID);}

function TrackModule(m,l)
{
pic1= new Image(1,1);
pic1.src="TrackModule.asp?m="+m+'&l='+l;
}

var rsize;
function CheckSize()
{
	if($('ringsize'))
	{
		rsize = document.getElementsByName('ringsize')[0].value;
		if(rsize=='')
		{
			alert("Please select ring size");
			document.getElementsByName('ringsize')[0].focus();
			return false
		}
	}
}


function LoadImage(obj,StnID,ha,ImageType)
{
StoneID = (StnID != undefined)?StnID:StoneID;
ha = (ha == undefined)?'':ha;
ImageType = (ImageType==undefined)?'': ImageType;
	hs.swfOptions = {
		version:              "8",
		expressInstallSwfurl: null,
		flashvars:            {xmlPath: "Loupe/LoupeData.asp?id="+StoneID+"|"+ImageType },
		params:               {wmode: "transparent"},
		attributes:           {}
	};
	/*
	var so = new SWFObject("Loupe/image_viewer_advanced.swf", "my-flash", "583", "359", "7", "#FFFFFF");
	so.addParam("wmode", "transparent");
	so.addVariable("xmlPath", "loupe/LoupeData.asp?id="+StoneID);
	*/
	//if(!msie) hs.minWidth=583;
	if(ha==1)
		return hs.htmlExpand(obj, { objectType: 'swf', width: 720, objectWidth: 720, objectHeight: 359, maincontentText: 'You need to upgrade your Flash player'  } )
	else
		return hs.htmlExpand(obj, { objectType: 'swf', width: 583, objectWidth: 583, objectHeight: 359, maincontentText: 'You need to upgrade your Flash player'  } )
}



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 );
//return (((sign)?'':'-') + '$' + num + '.' + cents);
}
	
function RefreshRingsA(cat,metal,actionPage){
	if(cat!="")
	{
		document.location = cat;
		return;
	}
	if(metal!="") metal = metal + "=1";
	var surl = actionPage + '?' + metal ;
	document.location = surl;
}

function show(actio) { 
	var xpos = getX(document.getElementById('MainImage'));
	var ypos = getY(document.getElementById('MainImage'));
	ypos +=240;
	xpos -=22;
	if(actio==0)
	{
		document.getElementById('yourlayer').style.top = ypos;
		document.getElementById('yourlayer').style.left = xpos;
		document.getElementById('yourlayer').style.visibility='visible'; 
	}
	else
	{
		document.getElementById('myRing').style.top = ypos;
		document.getElementById('myRing').style.left = xpos;
		document.getElementById('myRing').style.visibility='visible'; 
	}
} 
function hide() { 
document.getElementById('yourlayer').style.visibility='hidden'; 
document.getElementById('myRing').style.visibility='hidden'; 
} 
			

function verify() 
{ 
 // 0 Object is not initialized 
 // 1 Loading object is loading data 
 // 2 Loaded object has loaded data 
 // 3 Data from object can be worked with 
 // 4 Object completely initialized 
 if (xmlDoc.readyState != 4) 	
 { 
   return false; 
 } 
}




function PostData(frm,tpage,msgElmName,popupIDtoClose,popDivClose,clear_form,showMessage){
var str= "";
if(msgElmName != '')
	var msg = eval("document.getElementById('"+msgElmName + "')");
else
	var msg = document.getElementById("msg");

for(i=0;i<frm.length;i++){
	switch (frm[i].type) {
		case "text" : {str += frm[i].name + "=" + escape(frm[i].value) + "&" } break;
		case "Text" : {str += frm[i].name + "=" + escape(frm[i].value) + "&" } break;
		case "textarea" : {str += frm[i].name + "=" + escape(frm[i].value) + "&"}break;
		case "hidden" :{str += frm[i].name + "=" + escape(frm[i].value) + "&"}break;
		case "radio" :	{if(frm[i].checked==true) str += frm[i].name + "=" + escape(frm[i].value) + "&"} break;
		case "checkbox" :{str += frm[i].name + "=" + escape(frm[i].checked) + "&"}break;
		case "select-one" :{
							str += frm[i].name + "=" + escape(frm[i].options[frm[i].selectedIndex].text) + "&"
							str += frm[i].name + "_value=" + escape(frm[i].options[frm[i].selectedIndex].value)  + "&"
							}
					break;
	}
}
var sendInfo = GetSourceHtml(tpage,str);
if(document.getElementById("frmWrap"))	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>"

if(popupIDtoClose==9)
{
	if(clear_form) clearform(frm);
	alert(sendInfo);
	if(sendInfo.indexOf("correct") > 0)
	{
		return false;	
	}
	$("popup").style.display = "none";
	return false;
}
	
if(popupIDtoClose==3)
{
	if(clear_form) clearform(frm);
	alert(sendInfo);
	if($('capt'))
	{
       	$('capt').src = '_Captcha/aspcaptcha.asp?' + Math.random();
	}
	close_win1();
	return false;
}

if(popDivClose==4)
{
	if(clear_form) clearform(frm);
	alert(sendInfo);
	if($('msgReq1'))
	{
		$('capt5').src = '_Captcha/aspcaptcha.asp?' + Math.random();
	}
}

if(showMessage!=undefined)	alert(sendInfo);
	
if(sendInfo.indexOf("correct")>0) return false;
if(popupIDtoClose!=undefined){
	var element = eval("document.getElementById('" + popupIDtoClose + "')");
	element.style.display = element.style.display == 'block' ? 'none':'block';
}
else 
	msg.innerHTML = sendInfo;

	if(clear_form) clearform(frm);
	return false;
}



function clearform(frm){
for(i=0;i<frm.length;i++){
	switch (frm[i].type) {
	case "text" : {frm[i].value = ""} break;
	case "textarea" : {frm[i].value = ""}break;
	}
}
}

function close_win1(){
	parent.document.getElementById('main_div').style.display='none';
	var image1 = new Image();
}

function PrintIFRM(obj){
window.print(obj);
}

function ZoomIn(obj){
	var zomVal = parseInt(obj.style.zoom) + 10;
	if(zomVal <= 100)
	obj.style.zoom = zomVal + "%";
}
function ZoomOut(obj){
	var zomVal = parseInt(obj.style.zoom) - 10;
	if(zomVal >= 50)
	obj.style.zoom = zomVal + "%";
}

function displayElement(elmName,obj,eImage1,eImage2)
{
	if(document.getElementById("commentsfinish"))
	{
		document.getElementById("commentsfinish").style.display = document.getElementById("commentsfinish").style.display == 'inline' ? 'none':'inline';
		document.getElementById("3commentPoints").style.display = "none";
		
	}
	var element = eval("document.getElementById('" + elmName + "')");
	if(element)
	{
		element.style.display = element.style.display == 'block' ? 'none':'block';
		if(eImage1!=undefined) document.getElementById("plus").src = element.style.display == 'block' ? eImage2:eImage1;
		if(document.getElementById("read_review")) document.getElementById("read_review").style.display = element.style.display == 'block' ? 'none':'block';
	}
}
function displayElementBG(elmName,obj,bgOn,bgOff)
{
	var element = eval("top.document.getElementById('" + elmName + "')");
	element.style.display = element.style.display == 'block' ? 'none':'block';
}

function more_search_options(obj)
{
document.getElementById('tblCC').style.display = document.getElementById('tblCC').style.display == 'block' ? 'none':'block';
document.getElementById('tblcut').style.display = document.getElementById('tblcut').style.display == 'block' ? 'none':'block';
obj.src = document.getElementById('tblcut').style.display == 'block' ? '_images/but_search_more_close.jpg':'_images/but-search-more.jpg';
}

function replace_pic_src(obj,srcURL,itemid){
	eval("document.getElementById('pic_"+ itemid +"').src='_images/jewelry/" + srcURL + "'");
} 

function replace_pic_src1(item_id,pid){
	last_div_id = 0;
	if(objDoc.getElementById('div'+last_div_id))
	{
		var oldy = objDoc.getElementById("div"+last_div_id);
		objDoc.body.removeChild(oldy);
	}
	objDoc.frm1.pic.src = "_images/jewelry/" + srcURL;
} 
function hide_shapes(act){
	if (document.getElementById('shapes')){
	if(act == 0){document.getElementById('shapes').style.visibility ="hidden";}else document.getElementById('shapes').style.visibility ="visible";} 
}
function AddItems(itemid) {
	var slots = itemid + ",";
	xmlDoc.async="false"; 
	xmlDoc.onreadystatechange=verify;
	xmlFile = site+ "/AddToCart.asp?cart=" + slots ;
	xmlDoc.load(xmlFile); 
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div(site + "/Messages.asp?MsgType=1&ToShop=1&Info=" + xmlDoc.text,300,200);
}

var StartTop = 0 ;
var StartLeft = screen.width ;
var ElementTop ;
var ElementLeft ;
var idII;

function getX(obj)
{
return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
}


function getY(obj)
{
return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
}       

function remove(){
	dv.style.visibility = 'hidden';
	window.clearInterval(idIII)
}

function runElement(direction){
var nval = -30;
if (direction == 1) nval = 30;
	StartLeft = StartLeft + nval;
	
	if(direction == 0)
	{
		if(ElementLeft > StartLeft ) 
		{
		window.clearInterval(idII);
		idIII = window.setInterval("remove()", 10000);
		}
	}
	else
	{
		if(ElementLeft < StartLeft ) 
		{
		window.clearInterval(idII);
		idIII = window.setInterval("remove()", 10000);
		}
	}
	
	
	dv.style.left = StartLeft;
}

function AddItem(act) {
	if(act == 0){
		var numofitems = ""
		xmlDoc.async="false"; 
		xmlDoc.onreadystatechange=verify;
		xmlFile = site + "/CheckItemsInShoppingBag.asp";
		xmlDoc.load(xmlFile); 
		if(xmlDoc.text=="0"){
			StartTop = 0 ;
			StartLeft = screen.width ;
			Ypos = getY(document.getElementById("but_shop"))- 130;
			Xpos = getX(document.getElementById("but_shop"))+ 150;
			ElementTop = Ypos; 
			ElementLeft = Xpos;
			StartTop = ElementTop;
			dv = document.getElementById("lyr4");
			dv.style.top = ElementTop;
			dv.style.visibility = 'visible';
			idII = window.setInterval("runElement(0)", 1);
			return false;
		}
		else{
		document.location=site + "/Shop_Bag.asp";return false;}
		
	}
	var slots = "";
	if (document.frm_search.cart[1])
		for(i=0;i<document.frm_search.cart.length;i++)
		{
			if(document.frm_search.cart[i].checked==true)
			slots = slots + document.frm_search.cart[i].value + ",";
		}
	else
		{
			if(document.frm_search.cart.checked==true)
			slots = slots + document.frm_search.cart.value + ",";
		}
	if(slots == "")
		{
			var msg="<b>Please add a stone <br>first <input type='checkbox' checked='checked'/>and then press</b><br>";
			msg+="<img src='_images/butsmall_add.gif'/>";
			DrMsg.Show(msg,"add",250,96);
			return false;
		}
	else{
			xmlDoc.async="false"; 
			xmlDoc.onreadystatechange=verify;
			xmlFile = site + "/AddToCart.asp?cart=" + slots ;
			xmlDoc.load(xmlFile); 
			document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>"
			open_div(site + "/Messages.asp?MsgType=1&ToShop=1&Info=" + xmlDoc.text,300,200)
		}
}

function add_to_wish(slot,nItemID) {

	xmlDoc.async="false"; 
	xmlDoc.onreadystatechange=verify;
	if(nItemID==undefined)
		xmlFile = site + "/AddToWishList.asp?cart=" + slot;
	else
		xmlFile = site + "/AddToWishList.asp?ItemID="+nItemID;
	xmlDoc.load(xmlFile); 
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div(site + "/Messages.asp?MsgType=1&Info=" + xmlDoc.text,300,200);
}

function add_to_wish_jewelry(sitem) {
	xmlDoc.async="false"; 
	xmlDoc.onreadystatechange=verify;
	xmlFile = site + "/AddToWishList.asp?ItemID="+sitem;
	xmlDoc.load(xmlFile); 
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div(site + "/Messages.asp?MsgType=2&Info=" + xmlDoc.text,300,200);
}

function ClickBox(obj,ItemID,Shape,from){
	if( ((from==0)||(moz)) || (from == undefined) ) 
	if(!((moz) && from==1))	obj.checked = (obj.checked == true) ? false:true;
}

var shape_br = 0;
function CheckShape(obj){
	document.getElementById("HaTD").style.display = ((obj.value!='BR')) ? 'none':'block';
	if ((obj.value!='BR')&&(shape_br==0))
		document.getElementById('shape_Round').checked=false;
		shape_br++;
}

var num_clicks_color = 0;
var num_clicks_clarity = 0;

function CheckRange(obj,sname){
var sflag = false;
var sstart = -1;
var send = -1;


if(sname=='clarity')
	{
		var objlist = document.all["clarity"];
		num_clicks_clarity = num_clicks_clarity + 1;
	}
else
	{
		var objlist = document.all["color"];
		num_clicks_color = num_clicks_color + 1;
	}

if(obj.checked == false) return;
	for(i=0;i<objlist.length;i++){
		if (sflag == true)  
		objlist[i].checked=false;
		if(objlist[i].id == obj.id) sflag = true; 
	}
	
	for(i=0;i<objlist.length;i++){
		if (objlist[i].checked == true &&  sstart == -1 ) sstart = i;
		if (objlist[i].checked == true && sstart != -1) send = i;
	}
	
	if(sstart!=-1 && send != -1)
		for(i=0;i<objlist.length;i++){
			if (i>=sstart && i<= send) 
				objlist[i].checked=true;
			else
				objlist.checked=false;

		}
}
var dv;

function show_carat_alert(){
	dv = document.getElementById("lyr1");
	StartTop = 0;
	StartLeft = screen.width;
	if((document.form1.cid.value == '335')||(document.form1.cid.value == '322')){
		Ypos = getY(document.form1.carat_to)-70;
		Xpos = getX(document.form1.carat_to) + 80;
	}
	else
	{
		Ypos = getY(document.form1.carat_to)-20;
		Xpos = getX(document.form1.carat_to) + 80;
	}
	ElementTop = Ypos; 
	ElementLeft = Xpos;
	StartTop = ElementTop;
	dv.style.top = ElementTop;
	dv.style.visibility = 'visible';
	idII = window.setInterval("runElement(0)", 1);
	return false;
}
function check_submit(){
	var is_checked = true;
	if (is_checked == false) 
	{ 
			DrMsg.Show("<b>Please don't forget<br>to select a Shape.</b>",document.form1.shape[0].id,220,60);
			return false;
	}
	
	if(document.form1.carat_from)
	{
		//replacing ',' with '.' so even 1,4 will be accepted as 1.4
		document.form1.carat_from.value=document.form1.carat_from.value.replace(",",".");
		document.form1.carat_to.value=document.form1.carat_to.value.replace(",",".");
		
		var carat_from = document.form1.carat_from.value;
		var carat_to = document.form1.carat_to.value;

			if(isNaN(carat_from)){
				DrMsg.ShowFx("<b>Please enter only numbers <br>in carat from field</b>",document.form1.carat_from);
				document.form1.carat_from.value = "";
				document.form1.carat_from.focus();
				return false;
			}
			if(isNaN(carat_to))
			{
				DrMsg.ShowFx("<b>Please enter only numbers <br>in carat to field</b>",document.form1.carat_to);
				document.form1.carat_to.value = "";
				document.form1.carat_to.focus();
				return false;
			}

			var minCarat = 0.2;
			var maxCarat = 12;
				
			if((document.form1.cid.value == '335')||(document.form1.cid.value == '322'))
			{
				minCarat = 0.5;maxCarat = 12;
				
			}
			
			//checking to see if any values were eneterd
			if(carat_from=='') {carat_from=document.form1.carat_from.value=minCarat;}
			if(carat_to=='') {carat_to=document.form1.carat_to.value=maxCarat;}
			
			

			//switching if from is bigger then to
			if(parseFloat(carat_from) > parseFloat(carat_to))
			{
				document.form1.carat_from.value=carat_to;
				document.form1.carat_to.value=carat_from;
				
				carat_from = document.form1.carat_from.value;
				carat_to = document.form1.carat_to.value;
			}
			//croping rangers
			document.form1.carat_from.value=Math.min(Math.max(minCarat,carat_from),maxCarat);
			document.form1.carat_to.value=Math.min( Math.max(minCarat,carat_to),maxCarat);							
	}
	
	return true;
}

function openNewWin(num){
	document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div(site + "/diamond_info.asp?id="+num,580,450);
}	


function openNewWindow(num,tp,crt,supp){
	var oDetails = new Object();
	oDetails.SessionEnd = "";
	if(crt<=0.69){
	var swidth = 700;
	var sheight = 500;
	}
	else
	{
	var swidth = 700;
	var sheight = 600;
	}

	if(crt>=0.7){
	if(tp == 'GIA'){
		swidth = 614 //screen.width * 0.6;
		sheight = 550;
	}
	else{
		swidth = 973 //screen.width * 0.95;
		sheight = 600;
	}
	}
	document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div(site + "/show_pics.asp?supp="+ supp +"&crt="+ crt +"&type="+tp+"&pic=" + num,swidth,sheight);
}



function search_finder(ind){
	if(ind==0)
	{
		document.quick.price.value = "";
		document.quick.submit();
	}
	else
	{
		document.quick.carat_from.value = "";
		document.quick.carat_to.value = "";
		document.quick.color_from.selectedIndex = 0;
		document.quick.color_to.selectedIndex = 0;
		document.quick.clarity_from.selectedIndex = 0;
		document.quick.clarity_to.selectedIndex = 0;
		document.quick.submit();
	}
}

function replace_shape(item_id,obj,sFile){
obj.src = "_images/"+item_id+"/"+sFile;
}


function open_float(str,n_width,n_height,ypos,xpos){
	top.document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div(str,n_width,n_height,ypos,xpos);
	return;
}

function check_search(){
	document.form1.submit();
}
var xmlhttp;


	//var record_count = 6004;
	var bflag = 0;
	var end_page;
	var curr_page;
	var nVal = 0;
	function PinPage(current_page)
	{
		//alert("2");
		var i = 0;
		var j = 0;
		if(isNaN(current_page)) current_page = 1;
		curr_page = current_page;
		bflag = 2;
		nVal = 1;
		if(current_page<15){
		p_start = 1;nVal = 0;}
		else
		p_start = parseInt((current_page)/15) * 15;
		end_page=15;
		if(p_start==1) end_page = 14;
		
		for(i=p_start ; i <= record_count && j<=(end_page) ; i++,j++)
		{
			if(eval("document.all['td" + j + "']"))
			
			if(current_page == i) {
				eval("document.all['td" + j + "'].innerHTML = '<a class = avi href=javascript:Browsing("+i+",0)>"+i+"</a>'");
				eval("document.all['td" + j + "'].className = 'PageNumberOn'");
			}
			else{
				eval("document.all['td" + j + "'].innerHTML = '<a href=javascript:Browsing("+i+",0)>"+i+"</a>'");
				eval("document.all['td" + j + "'].className = 'PageNumberOff'");
			}
			
		}
	}

function changePageSize(page_size)
{
	document.paging.pageSize.value=page_size;
	document.paging.submit();
}

function jewel_sort(obj){	
	if((obj.name=='sortway')&&(obj.value!=''))
	{
		document.paging.sortway.value=obj.value;
		document.paging.submit();
		return;
	}
	else
	{
		document.paging.catfilter.value=obj.value;
		document.paging.submit();
		return;
	}
}

function Browsing(currect_page,page,aPage){
	document.paging.page_num.value=page;
 	document.paging.currect_page.value=currect_page;
	document.paging.submit();
	return;
}

function xmlhttpChange()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {

  		document.getElementById('search_table').innerHTML = "";
		document.getElementById('search_table').innerHTML = xmlhttp.responseText;
  if (xmlhttp.status==200)
    {
    // ...some code here...
    }
  else
    {
    alert("Problem retrieving XML data");
    }
  }
}



function goToPrevPage(page,pageLength)
{
	document.paging.currect_page.value=(1+page)*pageLength;
	document.paging.page_num.value=page;
	document.paging.submit();
}
function goToNextPage(page,pageLength)
{
	document.paging.currect_page.value=page*pageLength+1;
	document.paging.page_num.value=page;
	document.paging.submit();
}
function goToPage(page,pageLength)
{
	document.paging.currect_page.value=page*pageLength+1;
	document.paging.page_num.value=page;
	document.paging.submit();
}

function go_search(q_id){
	document.form1.query.value=q_id;
	document.form1.submit();
}

function rem_compare(cid,rem_id){
	ChangeDiamondTabData("dc",cid,'','rem='+rem_id);
}

function compare_diamond(){
	document.frm_search.submit();
}



function rem_compare_diamond(slink,rem_id){
	document.general_frm.action = "DiamondFrame.asp?action=dc&compare=1&rem="+ rem_id;
	document.general_frm.target = "frmData";
	document.general_frm.rem.value = rem_id;
	document.general_frm.submit();
}

function SetTab(sTab){
	parent.document.getElementById("liPD").className = "off";
	parent.document.getElementById("liSD").className = "off";
	parent.document.getElementById("liDC").className = "off";
	eval("parent.document.getElementById('"+ sTab +"').className = ''");
}

var z_index = 100;
var items_count = 0;
function run1(shp,cat){
	for (i=0;i<=items.length-1;i++){
	if(items[i]){
		str = items[i].src;
		str = str.replace(/small0/, "");
		str = str.replace(/.gif/, "_s"+ shp +".jpg");
		str = str.split('_s')[0] +"_s"+ shp +".jpg";
		items[i].src = str;
	}
}

return;

}

function show_div(cat_id,nIndex,ind,obj,set_shape,img_id,ImageURL)
{

if (ImageURL!=undefined){
	obj.src = site + "/" + ImageURL;
	return;
}
	
	if ((cat_id == 295) || (cat_id == 294) || (cat_id == 301)|| (cat_id == 159)) return;
	document.general_frm.shape_selected.value = set_shape;
	if ((cat_id == 180)||(cat_id == 164))
	{
		obj.src = site+"/_images/"+img_id+"_"+set_shape+".gif";
		return;
	}
	
	if ((cat_id == 260)||(cat_id == 164)||(cat_id == 159)||(cat_id == 181)||(cat_id == 165))
	{
		obj.src = site + "/" + ImageURL;
		return;
	}
	
	var img = new Image();
	img.src='set_image.asp?shape='+ set_shape;
	
	if(obj.src != site+"/image.asp?col=3&ItemId="+obj.name)
		obj.src = site+"/image.asp?col=3&ItemId="+obj.name;

items_count = ind;
if(document.getElementById("div_-1_"+nIndex)){
		var oldy = document.getElementById("div_-1_"+nIndex);
		document.body.removeChild(oldy);
	}
if(document.getElementById("div_" + nIndex + "_" + ind)){
		var oldy = document.getElementById("div_" + nIndex + "_" + ind);
		document.body.removeChild(oldy);
	}
	
	var top = 0 ;
	var left = 0 ;
	rootElement = obj;
	if (!rootElement) return;
	while(rootElement.tagName.toLowerCase() != 'body') {
		top += rootElement.offsetTop;
		left += rootElement.offsetLeft;	
		rootElement = rootElement.offsetParent;
		}
	
	var slink = (moz==true)?obj.parentNode.href:obj.parentElement.href;

	if(slink.indexOf("java") == -1) slink = slink + '&shape='+document.general_frm.shape_selected.value;
	
	newNote = document.createElement("div");
	newNote.id = "div_" + nIndex + "_" + ind;
	newNote.style.cursor='hand';
	
	if(slink.indexOf("java") == -1)
	newNote.onclick=function goto_location(){document.location=slink;};
	else
	newNote.onclick=function goto_location(){eval(slink);};
	newNote.innerHTML = "<img border=0 src='_images/"+set_shape+"_D.gif'>";
	newNote.style.position = 'absolute';
	newNote.style.zindex = z_index;

	if(cat_id==164) // for pendants
	{
		newNote.style.top = top+76;
		newNote.style.left = left+52;
	}
	else
	{
		newNote.style.top = top-2;
		newNote.style.left = left+28;
	}
	newNote.style.visibility = 'visible';
	document.body.appendChild(newNote);
	
	
}

function show_div_shop_bag(cat_id,nIndex,ind,obj,set_shape,img_id)
{
	if ((cat_id == 295) || (cat_id == 294) || (cat_id == 301)|| (cat_id == 159)) return;
	
	document.general_frm.shape_selected.value = set_shape;
	if ((cat_id == 180))
	{
		obj.src = "_images/"+img_id+"_"+set_shape+".gif";
		return;
		
	}
	if ((cat_id == 260)||(cat_id == 164)||(cat_id == 159)||(cat_id == 181)||(cat_id == 165))
	{
		obj.src = "image.asp?col=3&itemid=" + img_id;
		return;
	}
	
	
	if(obj.src != "image.asp?col=3&ItemId="+obj.name)
		obj.src = "image.asp?col=3&ItemId="+obj.name;
	
	items_count = ind;
	var top = 0 ;
	var left = 0 ;
	rootElement = obj;
	if (!rootElement) return;
	while(rootElement.tagName.toLowerCase() != 'body') {
		top += rootElement.offsetTop;
		left += rootElement.offsetLeft;	
		rootElement = rootElement.offsetParent;
		}
	
	
	var slink = (moz==true)?obj.parentNode.href:obj.parentElement.href;
	
	if(slink.indexOf("java") == -1) slink = slink + '&shape='+document.general_frm.shape_selected.value;
	
	newNote = document.createElement("div");
	newNote.id = "div_" + nIndex + "_" + ind;
	//alert(newNote.id)
	newNote.style.cursor='hand';
	
	/*********************************************************************************************************************************************************/
	
	if(slink.indexOf("java") == -1)
	newNote.onclick=function goto_location(){document.location=slink;};
	else
	newNote.onclick=function goto_location(){eval(slink);};
	newNote.innerHTML = "<img border=0 src='_images/"+set_shape+"_D.gif'>";
	newNote.style.position = 'absolute';
	newNote.style.zindex = z_index;


	if(cat_id==164) // for pendants
	{
		newNote.style.top = top+76;
		newNote.style.left = left+52;
	}
	else
	{
		newNote.style.top = top+2;
		newNote.style.left = left+30;
	}
	newNote.style.visibility = 'visible';
	document.body.appendChild(newNote);
	
}


var rootElement;
var isFirst = true;
function show_div1(obj){
var top = 0 ;
var left = 0 ;
	rootElement = obj;
	while(rootElement.tagName.toLowerCase() != 'body') {
		top += rootElement.offsetTop;
		left += rootElement.offsetLeft;
		rootElement = rootElement.offsetParent;
		}
		document.all['itemmenu'].style.visibility='visible';
		document.all['itemmenu'].style.top = top + 20 ;
		document.all['itemmenu'].style.left = left;
		isFirst = true;
}


function clear_shapes_big(){
for(i=0;i<10;i++)
if(document.all['div'+i]){
	var oldy = document.getElementById("div"+i);
	document.body.removeChild(oldy);
}

}

var last_div_id;
last_div_id = 0;



function show_div_big(cat_id,ind,obj,set_shape,img_id,srcURL)
{
	if (srcURL!=undefined)
	{
		obj.src = site + "/" + srcURL;
		return;
	}
	if ((cat_id == 180)||(cat_id == 164))
	{
		obj.src = site+"/_images/jewelry/"+img_id+"_"+set_shape+"_b.gif";
		return;
	}
	
	if ((cat_id == 260)||(cat_id == 164)||(cat_id == 159)||(cat_id == 181)||(cat_id == 165))
	{
		obj.src = "_images/jewelry/" + srcURL;
		return;
	}
	
	var str = srcURL;
	str = str.replace(/small0/, "");
	str = str.replace(/.gif/, "_bbr.jpg");
	obj.src = "_images/jewelry/shapes/" + str;
}


var rootElement;
var isFirst = true;

function show_div1(obj){
	var top = 0 ;
	var left = 0 ;
	rootElement = obj;
	while(rootElement.tagName.toLowerCase() != 'body') {
		top += rootElement.offsetTop;
		left += rootElement.offsetLeft;
		rootElement = rootElement.offsetParent;
		}
		document.all['itemmenu'].style.visibility='visible';
		document.all['itemmenu'].style.top = top + 20 ;
		document.all['itemmenu'].style.left = left;
		isFirst = true;
}

var isShow = false;

function hide_menu(obj){
	if(event.srcElement.id == 'itemmenu')
	{
		if (!isFirst) document.all['avi'].value = event.srcElement.id;
		isFirst = false;
	}
}

function MouseOver(obj)
{
	oldbgcolor = obj.bgColor;
	obj.style.color='#000000';
	obj.bgColor='#FFF1D7';
}
function MouseOut(obj)
{
	obj.style.color='#000000';
	obj.bgColor= oldbgcolor;
}

function help_popup(stext){window.open("help_page.asp?help="+stext,"openNew","scrollbars=yes,left=0,top=0,resizable=yes,toolbar=no,height=500,width=350");}
function show_cert(name){window.open("show_cert.asp?file="+name,"openNew","scrollbars=yes,left=0,top=0,resizable=yes,toolbar=no,height=600,width=750");}
function show_pic(name){window.open("show_pic.asp?file="+name,"openNew","scrollbars=yes,left=0,top=0,resizable=yes,toolbar=no,height=650,width=750");}

function diamond_to_compare(cat_id,ItemID){
	ReffererCategoryID = "";
	ReffererItemID = "";
	FramedWindow = "";
	ShowCloseWindowTitle = "1";
	ChangeDiamondTabData("dc",cat_id,"-1","ShowCloseWindowTitle=1&compare="+ItemID);
}


function view_compare(cat_id,order_field,sort_way,framed){
	var order_by = "";
	var sortway = "";
	if (order_field != undefined) order_by = "sortfield="+order_field;
	if (sort_way != undefined) sortway = "&sortway="+sort_way;
	if(cat_id == undefined) cat_id = "130";
	compareView = 0;
	ShowCloseWindowTitle = 1
	if(framed!=undefined) ShowCloseWindowTitle = 0;
	ChangeDiamondTabData("dc",cat_id,'',order_by+sortway);
}

function compare_win(cat_id,item_id,useDynamic){
	document.frm_search.target = "_parent";
	var slots = "";
	for(i=0;i<document.frm_search.compare.length;i++)
	{
		if(document.frm_search.compare[i].checked==true)
		slots = slots + document.frm_search.compare[i].value + ",";
	}
	
	if(slots == "")
	{
			alert("Please check diamond to compare.")
			return false;
	}
	else
		slots = slots + '-1'
		
	compareView = 1;
	ShowCloseWindowTitle = 0;
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>";
	ChangeDiamondTabData("dc",cat_id,''+slots+'','');
	return;
}

function compare(cat_id,useDynamic)
{
	document.frm_search.target = "_parent";
	var slots = "";
	for(i=0;i<document.frm_search.compare.length;i++)
	{
		if(document.frm_search.compare[i].checked==true)
		slots = slots + document.frm_search.compare[i].value + ",";
	}
	
	if(slots == "")
	{
			var msg="<b>Please add a stone <br>first <input type='checkbox' checked='checked'/>and then press</b><br>";
			msg+="<img src='_images/but_compare.gif'/>";
			DrMsg.Show(msg,"comp",275,83);
			return false;
	}
	else
		slots = slots + '-1';
		ChangeDiamondTabData("dc",cat_id,''+slots+'','');
}

function compare_diamonds(cat_id,sfrom,sitem){
	if((cat_id == "130") || (cat_id == "131") || (cat_id == "53"))
		document.frm_search.action = "compare.asp";
	else
		document.frm_search.action = "compare.asp?cid=" + cat_id + "&compare_diamonds=1";
	if (sfrom!= "frame")
		document.frm_search.target = "_parent";
	else
		{
		document.frm_search.target = "_self";
		document.frm_search.action = "DiamondFrame.asp?itemid="+ sitem +"&cid="+ cat_id +"&action=dc";
		}
		document.frm_search.submit();
}



function get_image(obj){
	for(j=0;j<=obj.childNodes.length-1;j++){
		if(obj.childNodes[j].tagName == "IMG"){
			return  obj.childNodes[j];
			}
		else{
			return get_image(obj.childNodes[0]);
			}
		}
}


function ReplaceItemImage(target_obj,src_pic){
	target_obj.src =  site+"/" + src_pic;
} 

function replace_pic(src_pic,target_obj){
	if(!moz)
		image_obj = get_image(eval("document.getElementById('"+target_obj+"')"));
	else
		image_obj = eval("document.getElementById('"+target_obj+"')");
	image_obj.src =  site+"/_uploads/" + src_pic
} 


function replace_image(obj_name,pic_src){
	eval("document.getElementById('"+obj_name+"').src = pic_src");
} 

 
function doTab(tab_id){
	document.paging.page_num.value= "";
 	document.paging.currect_page.value="";
	document.paging.tab.value = tab_id;
	document.paging.submit();
	
	
} 
function add_earring(){
var bool_checked = false;
	for(i=0;i<=document.all['ItemID'].length-1;i++)
		if(document.all['ItemID'][i].checked==true)
			bool_checked = true;
if(bool_checked == false){
	alert("Please select your style.");
	return false;
	}
else
	return true;
}


function zoom_in_item(cid,item,col){
	var width = 610;
	var height = 550;
	var s_shape ;
	s_shape = document.general_frm.shape_selected.value;
	
	if((cid==59)) // pendants
    {        
		width = 630;
		height = 550;
    }
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='No' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div("zoom_item.asp?col="+ col +"&cid=" + cid + "&shape="+ s_shape +"&itemid="+item,width,height);
}


function zoom_in(cid,item,enableSelect){
	var width = 670;
	var height = 550;
	var s_shape ;
	s_shape = document.general_frm.shape_selected.value;
	if((cid==59)) // pendants
    	{        
		width = 670;
		height = 550;
    	}
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='No' frameborder='0'  id='main_ifrm' src='https://www.jamesallen.com/blank.htm'></iframe>";
	open_div("zoom_item.asp?cid=" + cid + "&shape="+ s_shape +"&itemid="+item+"&ens="+enableSelect,width,height);
}

function view_item(slink){
	top.document.location = site + "/" + slink; // + "&shape="+document.general_frm.shape_selected.value;
}

function sorttable(field,sort,page){
	document.paging.sortfield.value=field;
	document.paging.sortway.value=sort;
	document.paging.submit();
}

function set_style(val){
	document.paging.cid.value = val ; 
	document.paging.currect_page.value = "1" ; 
	document.paging.action = "build_your_ring.asp?cid=" + val + "&cmb=1";
	document.paging.submit();
}

function set_style_3d(val){
	document.paging.cid.value = val ; 
	document.paging.currect_page.value = "1" ; 
	document.paging.submit();
}

function view_compare_diamonds(stype){
	var DiamStr = new Array(2);
	DiamStr[0] = new String("");
	DiamStr[1] = new String("");
	
	var counter = 0;
	for(i=0;i<document.frm_search.compare.length;i++)
	{
		if(document.frm_search.compare[i].checked==true)
		{
			counter ++;
			DiamStr[counter-1] = document.frm_search.compare[i].value;
			if(counter == 3)
			{
				dv = document.getElementById("lyr5");
				Ypos = getY(document.getElementById("comp"));
				Xpos = getX(document.getElementById("comp")) - 250;
				ElementTop = Ypos; 
				ElementLeft = Xpos;
				StartTop = Ypos;
				StartLeft = 0 ;
				dv.style.top = ElementTop;
				dv.style.visibility = 'visible';
				idII = window.setInterval("runElement(1)", 1);
				return false;
			}
		}
	}
	if(counter != 2) {
		dv = document.getElementById("lyr5");
		Ypos = getY(document.getElementById("comp")) ;
		Xpos = getX(document.getElementById("comp")) - 250;
		ElementTop = Ypos; 
		ElementLeft = Xpos;
		StartTop = Ypos;
		StartLeft = 0;
		dv.style.top = ElementTop;
		dv.style.visibility = 'visible';
		idII = window.setInterval("runElement(1)", 1);
		return false;
	
	}
	var sDiam1 = DiamStr[0].split("-");
	var sDiam2 = DiamStr[1].split("-");
	if(stype == 'certificates') view_certificates(sDiam1[0],sDiam2[0]);
	if(stype == 'pictures') view_pictures(sDiam1[0],sDiam2[0]);
	return;

}

function open_grading(num,stype,frame,url)
{
	var site_url = site;
		if(url!=undefined) site_url = url;
	if(stype == '2')
	{
		top.document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='https://www.jamesallen.com/blank.htm'></iframe>";
		open_div("grading_report.asp?pic=" + num + "&type="+stype ,600,380);
	}
	else{
		if(frame=='1')
			open_win(site_url+"/grading_report.asp?pic=" + num + "&type="+stype,750,500);
		else
		{
			top.document.getElementById("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='https://www.jamesallen.com/blank.htm'></iframe>";
			open_div("grading_report.asp?pic=" + num + "&type="+stype ,750,500);
		}
	}
}

function print_item(ntype,item_id,cat_id)
{
	
	str = site + "/PrintItem.asp?cid="+cat_id+"&item=" + item_id + "&type="+ ntype + "&print=1";
	open_win_1(str,900,7000);
		
}

function item_print(){window.print();}

function open_help(str,nWidth,nHeight,cid){
	if(isNaN(nWidth)) nWidth = 480;
	if(isNaN(nHeight)) nHeight = 400;
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='https://www.jamesallen.com/blank.htm'></iframe>";
	open_div("help.asp?cid="+ cid +"&help=" + str,nWidth,nHeight);
	return;
}


function openlayer(str,n_width,n_height){
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm'  src='https://www.jamesallen.com/blank.htm'></iframe>";
	open_div(str,n_width,n_height);
}

function open_win_1(str,n_width,n_height){window.open(str,"myWindow","scrollbars=yes,left=0,top=0,toolbar=yes,height="+n_height+",width="+n_width);}
function open_win(str,n_width,n_height){window.open(str,"myWindow","scrollbars=1,left=0,top=0,toolbar=no,resizable=yes,height="+n_height+",width="+n_width);}
function open_modal(str,Args){window.showModalDialog(str,"myWindow",Args);}
function open_print(){window.open("PrintOrder.asp","displayWindow","scrollbars=1,toolbar=no,width=800,height=500,top=0,left=0'");}


function open_help_self(str){
	var sArgs = "help: No;scroll:yes;status:yes;center:yes;resizable:yes;dialogWidth:500px;dialogLeft:0;dialogTop:0;dialogHeight:400px";
	window.showModalDialog("help.asp?help="+str,"displayWindow",sArgs);
	return;
}

function open3D(osrc,owidth,oheight,nitem){
	if(IE7andMOZ){DWidth = 575;DHeight=490}
	else{DWidth = 595;DHeight=520}
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div(site + "/" + osrc,DWidth,DHeight);
}


function open_div(osrc,owidth,oheight,nTop,nLeft){

	top.document.getElementById('main_div').style.display='block';
	top.document.getElementById('main_div').style.width = owidth;
	top.document.getElementById('main_div').style.height = oheight;
	top.document.getElementById('main_ifrm').src = osrc;
	top.document.getElementById('main_ifrm').width= owidth;
	top.document.getElementById('main_ifrm').height = oheight;
	top.document.getElementById('main_div').style.visibility = 'visible';
	
	top.document.getElementById('main_div').style.top = (nTop!=undefined)?nTop:top.document.body.scrollTop;
	var TbLeft = getX(top.document.getElementById("MainTBL"))+top.document.getElementById('main_div').offsetWidth;// top.document.getElementById("MainTBL").offsetWidth;
	top.document.getElementById('main_div').style.left = (nLeft!=undefined)?nLeft:(TbLeft - top.document.getElementById('main_div').offsetWidth);
	
}

function video_clip(item){
	var sArgs = "help: No;scroll:no;edge:raised;unadorned:on;status:yes;center:yes;resizable:no;dialogWidth:576px;dialogLeft:0;dialogTop:0;dialogHeight:513px";
	window.showModalDialog("video_item.asp?itemid="+item,"displayWindow",sArgs);
}



function cleanString(str) {
	for (; str.charAt(str.length-1) == " ";) {
		str = str.slice(0,(str.length-2));
	}
	for (; str.charAt(0) == " ";) {
		str = str.slice(1,(str.length-1));
	}
	return str;
}

function checkEmail(strCheck) {
var isValidField = true;
if (strCheck != "" && (((strCheck.lastIndexOf('@')<1)||(strCheck.lastIndexOf('.')<1)||(strCheck.lastIndexOf('.')<2+strCheck.lastIndexOf('@'))||(strCheck.lastIndexOf('.')>strCheck.length-3)||(strCheck.lastIndexOf('.')<strCheck.length-5)||(strCheck.lastIndexOf(' ')!=-1)||(strCheck.lastIndexOf('.@')!=-1)||(strCheck.lastIndexOf('@.')!=-1)))) {
	alert("The eMail inserted in is not valid");
	isValidField = false;
	return isValidField;
}
else
	return true;
}
					
					
function check_fields(){
	var isValid = true;
	var email1 = cleanString(document.frm1.FreindEmail1.value);
	var email2 = cleanString(document.frm1.FreindEmail2.value);
	var yname = cleanString(document.frm1.YourName.value);
	var yEmail = cleanString(document.frm1.YourEmail.value);

	if (email1 != "")
		if(checkEmail(document.frm1.FreindEmail1.value) == false)
			{
				alert("Please insert correct email address.");
				document.frm1.FreindEmail1.focus();
				return false;
			}
	if (email2 != "")
		if(checkEmail(document.frm1.FreindEmail2.value) == false)
			{
				alert("Please insert correct email address.");
				document.frm1.FreindEmail2.focus();
				return false;
			}
	
	if ((email1 == "")&&(email2 == ""))
		{
			alert("Please insert email address.");
			return false;
		}
	if (yname=="")
		{
			alert("Please insert your name.");
			document.frm1.YourName.focus();
			return false;
		}
	if (yEmail=="")
		{
			alert("Please insert your email.");
			document.frm1.YourEmail.focus();
			return false;
		}
	if (yEmail != "")
		if(checkEmail(document.frm1.YourEmail.value) == false)
			{
				alert("Please insert correct email address.")
				document.frm1.YourEmail.focus()
				return false;
			}
	
	return true;
}


function open_new() {
	document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src=''></iframe>";
	open_div("feedback-item.asp",500,500);
	return;
	var is_one_checked = false;
	for(i=0;i<document.frmFeedBack.length;i++)
	{
		if(document.frmFeedBack[i].checked==true)
		is_one_checked = true;
	}
	if(is_one_checked == false){
		alert("Please rate this item before clicking 'Send'.");
		return false;
	}
	var myWindow = window.open ('', 'myWindow', 'scrollbars=1,toolbar=no,width=300,height=200,top=100,left=100');
	document.frmFeedBack.submit();
}

function AddShopping()
{
	if(document.all['ringsize'])
	if(document.frm1.ringsize.value==''){
		alert("Please select Ring Size");
		return;
	}
	document.frm1.submit();
}

function select_ring(slink){
	if(document.all['ringsize'])
	if(document.all['ringsize'].value==''){
		alert("Please select Ring Size");
		document.all['ringsize'].focus();
		return;
	}
	if(document.all['ringsize'])
	document.location= slink + "&ringsize=" + document.all['ringsize'].value;
	else
	document.location= slink;
}

function openNewWin3d(){window.open(site+"/show3d.asp","displayWindow","left=100,top=50,resizable=yes,scrollbars=no,toolbar=no,height=460,width=950");}

function fieldValidate(strInputName, intType, strUserName, bolIsMust) {
	this.inputName = strInputName;
	this.type = intType;
	this.userName = strUserName;
	this.isMust = bolIsMust;
}



function cleanString(str) {
	for (; str.charAt(str.length-1) == " ";) {
		str = str.slice(0,(str.length-2));
	}
	for (; str.charAt(0) == " ";) {
		str = str.slice(1,(str.length-1));
	}
	return str;
}

function cleanSpace(str) {
	var arrTemp = str.split(" ");
	str = arrTemp.join("");
	arrTemp = str.split("-");
	str = arrTemp.join("");
	return str;
}

function isValidCharacter(str, strType) {
	var isMail = false;
	var isURL = false;
	var isFile = false;
	if (strType == "eMail") 
		isMail = true;
	else if (strType == "URL")
		isURL = true;
	else if (strType == "file")
		isFile = true;
	for (i=0; i<str.length; i++) {
		if (!isMail && str.charCodeAt(i) == 64)
			return false;
		if (!isURL && !isFile && (str.charCodeAt(i) == 58 || str.charCodeAt(i) == 41 || str.charCodeAt(i) == 40))
			return false;
		if (!isURL && str.charCodeAt(i) == 47)
			return false;
		if (!isFile && str.charCodeAt(i) == 92)
			return false;
		if (str.charCodeAt(i)<45 || str.charCodeAt(i)>122 || str.charCodeAt(i)==96 || (str.charCodeAt(i)>58 && str.charCodeAt(i)<63) || (str.charCodeAt(i)>90 && str.charCodeAt(i)<92) || (str.charCodeAt(i)>92 && str.charCodeAt(i)<95)) {
			return false;
		}
	}
	return true;
}


function IsValidData(objForm,oArrInputs) {
	var strCheck = "";
	var isValid = true;
	
	if(oArrInputs){
		var arrInputs = new Array();
		for (count=0; count<oArrInputs.length; count++) 
			arrInputs[count] = oArrInputs[count];
	}
	
	for (count=0; count<arrInputs.length; count++) {
		if (objForm[arrInputs[count].inputName]) {
			strCheck = cleanString(""+objForm[arrInputs[count].inputName].value).toLowerCase();
			switch (arrInputs[count].type) {
				case 0: {						// Text
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter "  + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 17: {						// Credit Card
					if (arrInputs[count].isMust && Mod10(strCheck) == false) {
						alert("The card number you have entered is invalid.");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 1: {						// Number
					var arrTempValue = strCheck.split(".");
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter a valid " + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if (arrTempValue.length > 2) {
						alert("Please enter a valid " + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					else {
						for (iCounter=0; iCounter < arrTempValue.length; iCounter++) {
							if (isNaN(arrTempValue[iCounter])) {
								alert("Please enter a valid " + arrInputs[count].userName + " is not valid !");
								objForm[arrInputs[count].inputName].focus();
								objForm[arrInputs[count].inputName].select();
								isValid = false;
								return isValid;
							}
						}
					}
					break;
				}
				case 2: {						// TextArea
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter " + arrInputs[count].userName);
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 3: {						// Radio Button
					if (arrInputs[count].isMust) {
						var bSelected = false;
						var oControl = objForm[arrInputs[count].inputName];
						if (oControl.length) {
							for (nIndex = 0; nIndex < oControl.length; nIndex++) {
								if (oControl[nIndex].checked) {
									bSelected = true;
									break;
								}
							}
						}
						else {
							bSelected = oControl.checked;
						}
						
						if (!bSelected) {
							alert("" + arrInputs[count].userName + ".");
							return bSelected;
						}
					}
					break;
				}
				case 4: {						// Checkbox
					if (arrInputs[count].isMust) {
						var bSelected = false;
						var oControl = objForm[arrInputs[count].inputName];
						if (oControl.length) {
							for (nIndex = 0; nIndex < oControl.length; nIndex++) {
								if (oControl[nIndex].checked) {
									bSelected = true;
									break;
								}
							}
						}
						else {
							bSelected = oControl.checked;
						}
						
						if (!bSelected) {
							alert("Please select a " + arrInputs[count].userName + ".");
							return bSelected;
						}
					}
					break;
				}
				case 5: {						// Select
					if (arrInputs[count].isMust && (objForm[arrInputs[count].inputName].selectedIndex == -1 || objForm[arrInputs[count].inputName].value == "")) {
						alert("No " + arrInputs[count].userName + " was selected !");
						objForm[arrInputs[count].inputName].focus();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 6: {						// Hidden
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter " + arrInputs[count].userName + " !");
						isValid = false;
						return isValid;
					}
					break;
				}
				case 7: {						// File
					if (arrInputs[count].isMust && (strCheck == "" && !(objForm["Exist_"+arrInputs[count].inputName]))){
						alert("No " + arrInputs[count].userName + " was selected !");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					var arrFilePath = strCheck.split("\\");
					var strFileName = arrFilePath[arrFilePath.length-1];
					if (!isValidCharacter(strFileName, "file")) {
						alert("File name is not valid !");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 8: {						// Date
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter " + arrInputs[count].userName + " !");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if (!isValidDate(strCheck) && strCheck != "") {
						alert("The date inserted in " + arrInputs[count].userName + " is not valid");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 9: {						// eMail
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter " + arrInputs[count].userName + " !");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if (strCheck != "" && (((strCheck.lastIndexOf('@')<1)||(strCheck.lastIndexOf('.')<1)||(strCheck.lastIndexOf('.')<2+strCheck.lastIndexOf('@'))||(strCheck.lastIndexOf('.')>strCheck.length-3)||(strCheck.lastIndexOf('.')<strCheck.length-5)||(strCheck.lastIndexOf(' ')!=-1)||(strCheck.lastIndexOf('.@')!=-1)||(strCheck.lastIndexOf('@.')!=-1)))) {
						alert("Please enter a valid " + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 10: {						// Currency
					var arrTempValue = strCheck.split(".");
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter a valid " + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if (arrTempValue.length > 2) {
						alert("Please enter a valid " + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					else {
						if (arrTempValue.length > 1) {
							if (isNaN(arrTempValue[arrTempValue.length-1]) || arrTempValue[arrTempValue.length-1].length > 2) {
								alert("Please enter a valid " + arrInputs[count].userName + "");
								objForm[arrInputs[count].inputName].focus();
								objForm[arrInputs[count].inputName].select();
								isValid = false;
								return isValid;
							}
						}
						var arrTempValue = arrTempValue[0].split(",");
						if (isNaN(arrTempValue[0])) {
							alert("Please enter a valid " + arrInputs[count].userName + " is not valid !");
							objForm[arrInputs[count].inputName].focus();
							objForm[arrInputs[count].inputName].select();
							isValid = false;
							return isValid;
						}
						for (iCounter=1; iCounter < arrTempValue.length; iCounter++) {
							if (isNaN(arrTempValue[iCounter]) || arrTempValue[iCounter].length != 3) {
								alert("Please enter a valid " + arrInputs[count].userName + "");
								objForm[arrInputs[count].inputName].focus();
								objForm[arrInputs[count].inputName].select();
								isValid = false;
								return isValid;
							}
						}
					}
					break;
				}
				case 11: {						// URL
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter " + arrInputs[count].userName + " !");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if ((arrInputs[count].isMust || strCheck != "") && (strCheck.indexOf("http://") != 0 || !isValidCharacter(strCheck, "URL") || strCheck=="http://") || strCheck=="http://www.") {
					//if ((arrInputs[count].isMust || strCheck != "") && ((strCheck.indexOf("www.") != 0 && strCheck.indexOf("http://www.") != 0) || strCheck.lastIndexOf(".")<strCheck.indexOf("www.")+6 || !isValidCharacter(strCheck, "URL"))) {
						alert("The URL inserted in " + arrInputs[count].userName + " is not valid");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				case 12: {						// Select Multiple
					if (arrInputs[count].isMust && strCheck == "") {
						alert("No " + arrInputs[count].userName + " was selected !");
						isValid = false;
						return isValid;
					}
					break;
				}
				case 13: {						// Counter
					break;
				}
				case 14: {						// DHTML control
					objForm[arrInputs[count].inputName].value = document.all[arrInputs[count].inputName+"Control"].Dom.body.innerHTML;
					strCheck = objForm[arrInputs[count].inputName].value
					if (arrInputs[count].isMust && strCheck == "") {
						alert("No " + arrInputs[count].userName + " was selected !");
						isValid = false;
						return isValid;
					}
					break;
				}
				case 15: {						// Phone - Pax
					if (arrInputs[count].isMust && strCheck == "") {
						alert("Please enter " + arrInputs[count].userName + " !");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if (isNaN(cleanSpace(strCheck))) {
						alert("Please enter a valid " + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if (strCheck.length <10) {
						alert("Phone number is a required field and must include the area code");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				
				case 16: {						// Password
					if (strCheck == "") {
						alert("Please enter " + arrInputs[count].userName + " !");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					if (strCheck.length < 2 || strCheck.length > 10 || strCheck.indexOf(" ") != -1) {
						alert("Please enter a valid " + arrInputs[count].userName + "");
						objForm[arrInputs[count].inputName].focus();
						objForm[arrInputs[count].inputName].select();
						isValid = false;
						return isValid;
					}
					break;
				}
				default: {						// Custom
					if (!customCheck(objForm, arrInputs[count], strCheck))
						return false;
					else
						continue;
				}
			}
		}
	}
	return isValid;
}







function Mod10(ccNumb) {  // v2.0
var valid = "0123456789"  // Valid digits in a credit card number
var len = ccNumb.length;  // The length of the submitted cc number
var iCCN = parseInt(ccNumb);  // integer of ccNumb
var sCCN = ccNumb.toString();  // string of ccNumb
sCCN = sCCN.replace (/^\s+|\s+$/g,'');  // strip spaces
var iTotal = 0;  // integer total set at zero
var bNum = true;  // by default assume it is a number
var bResult = false;  // by default assume it is NOT a valid cc
var temp;  // temp variable for parsing string
var calc;  // used for calculation of each digit

// Determine if the ccNumb is in fact all numbers
for (var j=0; j<len; j++) {
  temp = "" + sCCN.substring(j, j+1);
  if (valid.indexOf(temp) == "-1"){bNum = false;}
}
// if it is NOT a number, you can either alert to the fact, or just pass a failure
if(!bNum){
	bResult = false;
}
// Determine if it is the proper length 
if((len == 0)&&(bResult)){  // nothing, field is blank AND passed above # check
  bResult = false;
} else{  // ccNumb is a number and the proper length - let's see if it is a valid card number
  if(len >= 15){  // 15 or 16 for Amex or V/MC
    for(var i=len;i>0;i--){  // LOOP throught the digits of the card
      calc = parseInt(iCCN) % 10;  // right most digit
      calc = parseInt(calc);  // assure it is an integer
      iTotal += calc;  // running total of the card number as we loop - Do Nothing to first digit
      i--;  // decrement the count - move to the next digit in the card
      iCCN = iCCN / 10;                               // subtracts right most digit from ccNumb
      calc = parseInt(iCCN) % 10 ;    // NEXT right most digit
      calc = calc *2;                                 // multiply the digit by two
      // Instead of some screwy method of converting 16 to a string and then parsing 1 and 6 and then adding them to make 7,
      // I use a simple switch statement to change the value of calc2 to 7 if 16 is the multiple.
      switch(calc){
        case 10: calc = 1; break;       //5*2=10 & 1+0 = 1
        case 12: calc = 3; break;       //6*2=12 & 1+2 = 3
        case 14: calc = 5; break;       //7*2=14 & 1+4 = 5
        case 16: calc = 7; break;       //8*2=16 & 1+6 = 7
        case 18: calc = 9; break;       //9*2=18 & 1+8 = 9
        default: calc = calc;           //4*2= 8 &   8 = 8  -same for all lower numbers
      }                                               
    iCCN = iCCN / 10;  // subtracts right most digit from ccNum
    iTotal += calc;  // running total of the card number as we loop
  }  // END OF LOOP
  if ((iTotal%10)==0){  // check to see if the sum Mod 10 is zero
    bResult = true;  // This IS (or could be) a valid credit card number.
  } else {
    bResult = false;  // This could NOT be a valid credit card number
    }
  }
}
  return bResult; // Return the results
}



function re_order(fld){
	var last_sort_fld = document.paging.sortfield.value;
	var last_sort_way = document.paging.sortway.value;
	if (fld == last_sort_fld)
		document.paging.sortway.value = (last_sort_way == "asc")?"desc":"asc";
	else
		document.paging.sortway.value = "asc";
	if ((fld == 'carat') && (last_sort_fld == '')) document.paging.sortway.value = "desc";
	document.paging.sortfield.value = fld;
	document.paging.submit();

}


function re_order_compare(fld,ItemID){
	var last_sort_fld = document.paging.sortfield.value;
	var last_sort_way = document.paging.sortway.value;
	if (fld == last_sort_fld)
		document.paging.sortway.value = (last_sort_way == "asc")?"desc":"asc";
	else
		document.paging.sortway.value = "asc";
	if ((fld == 'carat') && (last_sort_fld == '')) document.paging.sortway.value = "desc";
	var sort_way = (last_sort_way == "asc")?"desc":"asc";
	
	extraData = "sortway="  + sort_way;
	extraData = extraData + "&sortfield=" + fld;
	ChangeDiamondTabData("fsd","130",ItemID,extraData);
}


function move_to(dest){
	if(aff_id!="0")
	top.location.href = dest+"&aff_id="+aff_id;
	else
	top.location.href = dest;
}

var startPos = 0;
function check()
{
	if (document.getElementById('main_div'))
		document.getElementById('main_div').style.top = document.body.scrollTop + startPos ;
	if (document.getElementById('main_div')){
		var TbLeft = getX(document.getElementById("MainTBL")) + document.getElementById("MainTBL").offsetWidth;
		top.document.getElementById('main_div').style.left = (TbLeft - top.document.getElementById('main_div').offsetWidth);
	}
}


function view_diamond(item_id){document.getElementById("DiamondPage").innerHTML=GetSourceHtml("diamond_clean.asp?item="+item_id);}

function ShowMetalMenu(divID,obj)
{
	var objMenu = document.getElementById("dropMetal"+divID);
	objMenu.style.visibility = objMenu.style.visibility == 'visible' ? 'hidden':'visible';
	obj.src = objMenu.style.visibility == 'visible' ? '_images/dropdownboxclose.gif':'_images/dropdownbox.gif';
}

var idI;
var LoadingMenu = false;
function ShowMetalMenu1(item_id,obj,sku,ContainerID,ItemCounter)
{
	var ProngSelector = document.getElementById("ProngSelector");
	var ringsize = document.getElementById("ringsize");
	
	if (ItemCounter == undefined)
	{
		var objMenu = document.getElementById("dropMetal"+item_id);
		objMenu.style.visibility = objMenu.style.visibility == 'visible' ? 'hidden':'visible';
		objMenu.style.left = getX(document.getElementById("MetalSelectionTable"));
		obj.src = objMenu.style.visibility == 'visible' ? '_images/dropdownboxclose.gif':'_images/dropdownbox.gif';
		if(ProngSelector)
		{
			ProngSelector.style.visibility = objMenu.style.visibility == 'visible' ? 'hidden':'visible';
			ringsize.style.visibility = objMenu.style.visibility == 'visible' ? 'hidden':'visible';
		}
	}
	else
	{
		if (LoadingMenu==false)
		{
			LoadingMenu=true;
			var objMenu = document.getElementById("dropMetal"+item_id);
			objMenu.style.visibility = objMenu.style.visibility == 'visible' ? 'hidden':'visible';
			if(ProngSelector)
			{
				ProngSelector.style.visibility = objMenu.style.visibility == 'visible' ? 'hidden':'visible';
				ringsize.style.visibility = objMenu.style.visibility == 'visible' ? 'hidden':'visible';
			}
			obj.src = objMenu.style.visibility == 'visible' ? '_images/dropdownboxclose.gif':'_images/dropdownbox.gif';
			sLink = "ItemBox.asp?sku="+sku+"&item="+item_id+"&ItemCounter="+ItemCounter+"&ContainerID="+ContainerID;
			objMenu.innerHTML= "<b style='color:#a02d2d'>Loading Menu ...</b>";
			idI = window.setInterval("openMenu('"+ sLink +"',"+item_id+")", 100);
		}	
	}
	
}

function openMenu(linking,item_id)
{
	var objMenu = document.getElementById("dropMetal"+item_id);
	objMenu.innerHTML=GetSourceHtml(linking);
	window.clearInterval(idI);
	LoadingMenu=false;
}

function GetItemBox(item_id,ContainerID,ItemCounter)
{
	if(isNaN(ItemCounter))
	{
		document.location = site + '/'+ ItemCounter;
	}
	else
	{	
		var obj = document.getElementById("ItemBox"+ContainerID); 
		if(msie) obj.filters[0].apply();
		obj.innerHTML=GetSourceHtml("ItemBox.asp?item="+item_id+'&ItemCounter='+ItemCounter+'&ContainerID='+ContainerID);	
		if(msie) obj.filters[0].play();
	}
	 
}


//===================================================================================================================



//===================================================================================================================
//	This function gets a url and opens a Xml HTTP object that will call execute this url and 
//	returns it's output.
//===================================================================================================================
function GetSourceHtml(url,sData)
{
	if(sData==undefined) sData = "a";
	var xmlhttpObj;
	//Mozila's XML HTTP Object
	if (window.XMLHttpRequest)
	{
		try {
			//netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
			xmlhttpObj=new XMLHttpRequest();
			xmlhttpObj.open("POST",url,false);
			xmlhttpObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    		//xmlhttpObj.setRequestHeader('Content-length', '10000');
			xmlhttpObj.send(sData);
			
		}
		catch (e) 
		{
			alert("(Mozilla) - " + e);
			return null;
		}
	}//end Mozila
	else if (window.ActiveXObject)	// IE's XML HTTP Object
	{
		

		xmlhttpObj=new ActiveXObject("Microsoft.XMLHTTP")
		if (xmlhttpObj)
		{
			//xmlhttpObj.onreadystatechange=AAS;
			xmlhttpObj.open("POST",url,false);
			xmlhttpObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
      			//xmlhttpObj.setRequestHeader('Content-length', '1000');
			xmlhttpObj.send(sData);
		}
		
	}//end IE
		
	return xmlhttpObj.responseText;
}

//===================================================================================================================
//	This function is responsible for the tab in the diamond information page to chage in client side.
//	it gets a chageTo var where:
//	"pd" 	= Product Details
//	"fsd" 	= Find Similar Diamonds
//	"dc"	= Diamond Comparison 
//===================================================================================================================

function show_diamond(DiamondObject,evt)
{
	var tbObj = parent.document.getElementById("RecentlyViewedTB");
	var diamObj = parent.document.getElementById("DiamondDetails1");
	if(DiamondObject==-1)
	{
		diamObj.style.visibility  = 'hidden';
		return;
	}
	
	
	var sTable;
	sTable = "";
	
			
	sTable = sTable +'<table width=240 height=227 cellpadding=0 cellspacing=0 background="_images/diamond-detail-bg.png">';
	sTable = sTable + "<tr><td width=5>&nbsp;</td>";
	sTable = sTable + "<td valign=top align=left>";
	sTable = sTable + "<table width=200 style='font: normal normal 9px/1.2em Geneva, Verdana, Arial;' cellpadding=1 cellspacing=0> ";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td colspan=2 height=38 valign=middle><strong style='color:#625895;'>"+ DiamondObject.dtitle +"</strong></td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td style='height:2px' colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td colspan=2 bgcolor=f0f0f0><strong>Diamond Information</strong></td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td width='70' style='color:#625895;'>Depth:</td>";
	sTable = sTable + "	<td width='130'>"+DiamondObject.ddepth+"%</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td style='color:#625895;'>Table:</td>";
	sTable = sTable + "	<td>"+DiamondObject.dtable+"%</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td style='color:#625895;'>Polish:</td>";
	sTable = sTable + "	<td>"+DiamondObject.dpolish+"</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td style='color:#625895;'>Symmetry:</td>";
	sTable = sTable + "	<td>"+DiamondObject.dsymetry+"</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td style='color:#625895;'>Girdle:</td>";
	sTable = sTable + "	<td>"+DiamondObject.dgirdle+"</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td style='color:#625895;'>Fluorescence:</td>";
	sTable = sTable + "	<td>"+DiamondObject.dfluor+"</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td style='color:#625895;'>Measurement:</td>";
	sTable = sTable + "	<td>"+DiamondObject.dmeasur+"</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=4 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td colspan=2 bgcolor=f0f0f0><strong>Shipping Information</strong>&nbsp;&nbsp;<img src='_images/truck2.gif' width='26' height='13' style='margin-bottom:-2px;'></td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td style='height:3px' colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td style='color:#625895;'>Order By:</td>";
	sTable = sTable + "	<td>"+DiamondObject.orderby+"</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "<tr><td height=1 bgcolor=e7e7e7 colspan=2></td></tr>";
	sTable = sTable + "<tr>";
	sTable = sTable + "	<td valign='top' style='color:#625895;'>Receive on:</td>";
	sTable = sTable + "	<td>"+DiamondObject.receiveon+"</td>";
	sTable = sTable + "</tr>";
	sTable = sTable + "</table>";
	sTable = sTable + "</td>";
	sTable = sTable + "<td width=7>&nbsp;</td>";
	sTable = sTable + "</tr></table></div";

	diamObj.innerHTML = sTable;
	var xpos = getX(tbObj);
	var ypos = getY(tbObj);
	diamObj.style.top  = ypos - (diamObj.offsetHeight/2);
	diamObj.style.left  = xpos - (diamObj.offsetWidth)+ evt.clientX ;
	diamObj.style.visibility  = 'visible';

}


var cursor;
function getPosition(e) {
    e = e || window.event;
    cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}

/*
if(!window.captureEvents) document.onmousemove=getPosition
if (window.captureEvents) {
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=getPosition //e should not be defined
}
*/

function ChangeDiamondTabData(action,categoryID,itemID,extraData)
{
	
	if (document.getElementById("dividerin"))
		var tabDiv=document.getElementById("dividerin");
	else
		var tabDiv=document.getElementById("dividerin_out");
	
	urlReferer = "";
	
	if (isNaN(itemID))
		tabDiv.innerHTML=GetSourceHtml(site+"/diamond_Tab.asp?src_url="+urlReferer+"&compare="+itemID+"&cid="+categoryID+"&act="+action+"&cview="+ compareView +"&"+extraData);	
	else
		tabDiv.innerHTML=GetSourceHtml(site+"/diamond_Tab.asp?frame="+ FramedWindow +"&ItemID="+ReffererItemID+"&ccid="+ReffererCategoryID+"&item="+itemID+"&cid="+categoryID+"&act="+action+"&cview="+ compareView +"&"+extraData);	
	return;
}

function ChangeDiamondTabSwitchCompare(action,categoryID,itemID,t,click)
{
	if(click==undefined) click = "0";
	if (document.getElementById("dividerin"))
		var tabDiv=document.getElementById("dividerin");
	else
		var tabDiv=document.getElementById("dividerin_out");
	
	compareView++;
	compareView%=2;
	//changing tab data
	//src_url="+urlReferer+"&
	tabDiv.innerHTML=GetSourceHtml(site+"/diamond_Tab.asp?click="+ click +"&ShowCloseWindowTitle="+ShowCloseWindowTitle+"&frame="+ FramedWindow +"&ItemID="+ReffererItemID+"&ccid="+ReffererCategoryID+"&item="+itemID+"&cid="+categoryID+"&act=dc&cview="+compareView);
}

//===================================================================================================================
//	This function loads a flash movie
//===================================================================================================================
function LoadBanner(flashMovie)
{
	//creating the container for the banner
	var FlashBannerContainer = document.createElement("div");
	var contents=document.getElementById("contents");
	FlashBannerContainer.id="FlashBannerContainerContainer";
	FlashBannerContainer.style.width=488;
	//FlashBannerContainer.align='left';
	contents.appendChild(FlashBannerContainer);
	var flashCode="";
	flashCode+= "	<div id='FlashBannerContainer' >" + "<br>";
	flashCode+= "		<div id='FlashBanner' >" + "<br>";
	flashCode+= "		<OBJECT name='flashBanner1' id='flashBanner1' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'  " ;
	flashCode+= "				codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'" ;
	flashCode+= "				WIDTH='100%' HEIGHT='100%' ALIGN='Top' VIEWASTEXT >"  + "<br>";
	flashCode+= "			<PARAM NAME=movie VALUE=" + flashMovie + " <br>";
	flashCode+= "			<PARAM NAME=quality VALUE=high>"  + "<br>";
	flashCode+= "			<PARAM NAME=bgcolor VALUE=#fcfaf5>"  + "<br>";
	flashCode+= "			<param name='wmode' value='transparent'>"  + "<br>";
	flashCode+= "			<EMBED src='"   +flashMovie+ "' wmode='transparent' name='flashBanner1' quality=high WIDTH='100%' HEIGHT='100%' ALIGN='right' "
	flashCode+= "				TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED>"  + "<br>";
	flashCode+= "	 	 </OBJECT>"  + "<br>";
	flashCode+= "		</div>";
	flashCode+= "	</div>";
	
	FlashBannerContainer.innerHTML=flashCode;
}

//===================================================================================================
//	This function lets showModelDialog to function even in browsers other the IE.
//	Note: the 'center' feature must be declared last (after 'dialogHeight' and 'dialogWidth'
//===================================================================================================
function xShowModalDialog( sURL, vArguments, sFeatures ) 
    { 
    if (sURL==null||sURL=='') 
    { 
        alert ("Invalid URL input."); 
        return false; 
    } 
    if (vArguments==null||vArguments=='') 
    { 
        vArguments=''; 
    } 
    if (sFeatures==null||sFeatures=='') 
    { 
        sFeatures=dFeatures; 
    } 
    if (window.navigator.appVersion.indexOf("MSIE")!=-1) 
    { 
        window.showModalDialog ( sURL, vArguments, sFeatures ); 
        return false; 
    } 
    sFeatures = sFeatures.replace(/ /gi,''); 
    aFeatures = sFeatures.split(";"); 
    sWinFeat = "directories=0,menubar=0,titlebar=0,toolbar=0,"; 
    for ( x in aFeatures ) 
    { 
        aTmp = aFeatures[x].split(":"); 
        sKey = aTmp[0].toLowerCase(); 
        sVal = aTmp[1]; 
        switch (sKey) 
        { 
            case "dialogheight": 
                sWinFeat += "height="+sVal+","; 
                pHeight = sVal; 
                break; 
            case "dialogwidth": 
                sWinFeat += "width="+sVal+","; 
                pWidth = sVal; 
                break; 
            case "dialogtop": 
                sWinFeat += "screenY="+sVal+","; 
                break; 
            case "dialogleft": 
                sWinFeat += "screenX="+sVal+","; 
                break; 
            case "resizable": 
                sWinFeat += "resizable="+sVal+","; 
                break; 
            case "status": 
                sWinFeat += "status="+sVal+","; 
                break; 
            case "center": 
                if ( sVal.toLowerCase() == "yes" ) 
                { 
                    sWinFeat += "screenY="+((screen.availHeight-pHeight)/2)+","; 
                    sWinFeat += "screenX="+((screen.availWidth-pWidth)/2)+","; 
                } 
                break; 
        } 
    } 
    modalWin=window.open(String(sURL),"",sWinFeat); 
    if (vArguments!=null&&vArguments!='') 
    { 
        modalWin.dialogArguments=vArguments; 
    } 
}


//===================================================================================================
//	This function dynamcly loads a flash movie into the inputed div
//===================================================================================================
function LoadFlashObject(flashMovie,nWidth,nHeight,divID,params,wmode)
{
	 //creating the container for the banner
	 var FlashBannerContainer = document.getElementById(divID); 
	 var flashCode="";
	 flashCode+= "<OBJECT style='top:0px;vertical-align:top;float:inherit' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'  " ;
	 flashCode+= "codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'" ;
	 flashCode+= "WIDTH='"+nWidth+"' HEIGHT='"+ nHeight +"' ALIGN='Top' VIEWASTEXT float='top' margin-left='15' >"  + "<br>";
	 flashCode+= "<PARAM NAME=movie VALUE='" + flashMovie + "'<br>";
	 flashCode+= "<PARAM NAME=quality VALUE=high>"  + "<br>";
	 flashCode+= "<param name=flashVars value='strVideoPath="+params+"&bAutoLoop=true'/>";
	 if(wmode!=undefined) flashCode+= "<param name='wmode' value='transparent'>"
	 flashCode+= "<EMBED  flashVars='strVideoPath="+ params +"&bAutoLoop=true' style='margin-top:-45' src='"   +flashMovie+ "' name='"+flashMovie+"' quality='high' WIDTH='"+(nWidth+1)+"' HEIGHT='"+ (nHeight+1) +"' ALIGN='Top' "
	 if(wmode!=undefined) flashCode+= " wmode='transparent' ";
	 flashCode+= "TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED>"  + "<br>";
	 flashCode+= "</OBJECT>";
	 FlashBannerContainer.innerHTML=flashCode;
}

// function to open div in compare //
function SwitchMenu(obj)
	{
	try{
		if ($('sub_' + obj).style.display == 'none')
			$('sub_' + obj).style.display = '';
		else
			$('sub_' + obj).style.display = 'none';
		}
	catch(e){}
	}

function GoToSelect(url)
	{
     a = document.getElementById(url).value;
     window.open(a);
	}

//</script>




