﻿// JScript File

//for custom diamond search from crete-your-own.aspx
// also called from search-diamonds.aspx for Diamond listing filtering using ajax
var strfrompage;
function showprice(id,ob)
{
    if(ob==1)
    {
        if(window.document.getElementById("check"+id).checked)
            window.document.getElementById("check"+id).checked = false;
        else
            window.document.getElementById("check"+id).checked = true;
    }
    if(window.document.getElementById("check"+id).checked)
    {
        var idstones = window.document.getElementById("idstones").value;
        idstones = idstones.substr(1,idstones.length-2)
        if(idstones != "") idstones = idstones + ",";
        idstones = idstones + window.document.getElementById("check"+id).value;
        window.document.getElementById("idstones").value = "(" + idstones + ")";
    }
    else
    {
        var idstones = window.document.getElementById("idstones").value;
        var id = window.document.getElementById("check"+id).value;
        if(idstones.indexOf(id)>0)
        {
            idstones = idstones.replace("(" + id + ")","");
            idstones = idstones.replace("," + id + ")","");
            idstones = idstones.replace("(" + id + ",","");
            idstones = idstones.replace("," + id + ",",",");
        }
        idstones = idstones.replace("(","");
        idstones = idstones.replace(")","");
        window.document.getElementById("idstones").value = "(" + idstones + ")";
    }
    GetPriceStringViaAJAX(idstones);
}
//for diamond search from diamond-search.aspx
function showpricesearch(idstones)
{
    var totcheck = window.document.searchdiamond.check.length;
   
    for(i=0;i<totcheck;i++)
    { 
        if(window.document.searchdiamond.check[i].value == idstones)
            window.document.searchdiamond.check[i].checked=true;
        else
            window.document.searchdiamond.check[i].checked=false;
    }
    window.document.getElementById("idstones").value  = idstones
    GetPriceStringViaAJAX(idstones);
}

function GetPriceStringViaAJAX(idstones)
{
    try
	{
    	obj=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj = null;
		}
	}
	if(obj!=null)
	{
		if(idstones!="")
		{
		    obj.onreadystatechange = PriceProcessResponse;
		    obj.open("GET", "priceajax.aspx?drpstones=" + idstones ,  true);
    		obj.send(null);         
    	}
    	else
		    window.document.getElementById('divPriceText').innerHTML = "";
	}
	return false;
}
function PriceProcessResponse()
{
    if(obj.readyState == 4)
	{   
		if(obj.status == 200)
		{
		    if (obj.responseText!="")
		        window.document.getElementById('divPriceText').innerHTML = obj.responseText;
		    else
		        window.document.getElementById('divPriceText').innerHTML = "";
		}
	}
}	

function setradiostatus(idstones)
{
    if(idstones != "")
    {
        var totcheck = window.document.searchdiamond.check.length;
        for(i=0;i<totcheck;i++)
        { 
            if(window.document.searchdiamond.check[i].value == idstones)
                window.document.searchdiamond.check[i].checked=true;
            
        }
    }
}
function setcheckstatus(idstones)
{
    if(idstones != "")
    {
        var totcheck = idstones.split(",")
        for(i=0;i<totcheck.length;i++)
        { 
            if(window.document.getElementById("check"+totcheck[i]).value == totcheck[i])
                window.document.getElementById("check"+totcheck[i]).checked=true;
            
        }
    }
}

function searchdiamondstop(frompage)
{
    window.document.getElementById("npricefrom").value = window.document.getElementById("tpricefrom").value
    window.document.getElementById("npriceto").value = window.document.getElementById("tpriceto").value
    window.document.getElementById("ncaratfrom").value = window.document.getElementById("tcaratfrom").value
    window.document.getElementById("ncaratto").value = window.document.getElementById("tcaratto").value
    if(document.getElementById("tradioPrStatus_1").checked)
    {
        document.getElementById("radioPrStatus_1").checked = true;
    }
    else
        document.getElementById("radioPrStatus_0").checked = true;
    GetTotalrecords(frompage)
    
}
var obj;
function GetTotalrecords(frompage)
{
    window.document.getElementById("tpricefrom").value = window.document.getElementById("npricefrom").value
    window.document.getElementById("tpriceto").value = window.document.getElementById("npriceto").value
    window.document.getElementById("tcaratfrom").value = window.document.getElementById("ncaratfrom").value
    window.document.getElementById("tcaratto").value = window.document.getElementById("ncaratto").value
    
    strfrompage = frompage;
	try
	{
	//	obj = new ActiveXObject("Msxml2.XMLHTTP");
	obj=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj = new ActiveXObject("Microsoft.XMLHTTP");
			
		}
		catch(e1)
		{
			obj = null;
		}
	}
	if(obj!=null)
	{   
	    var prstatus=0;
		if(document.getElementById("radioPrStatus_1").checked)
		{
		prstatus = 1
		}
		obj.onreadystatechange = getNoofrecords;
		obj.open("GET", "getnoofrecords.aspx?drpstones=" + document.getElementById("hididstones").value + "&pricefrom=" + document.getElementById("npricefrom").value + "&priceto=" + document.getElementById("npriceto").value + "&drpCutFrom=" + document.getElementById("drpCutFrom").value+"&drpCutTo=" + document.getElementById("drpCutTo").value+ "&drpClarityFrom=" + document.getElementById("drpClarityFrom").value+ "&drpClarityTo=" + document.getElementById("drpClarityTo").value+ "&drpColorFrom=" + document.getElementById("drpColorFrom").value+ "&drpColorTo=" + document.getElementById("drpColorTo").value+ "&drpCaratFrom=" + document.getElementById("ncaratfrom").value+ "&drpCaratTo=" + document.getElementById("ncaratto").value + "&status=" + prstatus,  true);
		obj.send(null);    
	}
	return false;
}
function getNoofrecords()
{   
    if(obj.readyState == 4)
	{
		if(obj.status == 200)
		{
		    var rowCount = obj.responseText;
		    obj = null;
		    var pageno = parseInt(rowCount/20);
		    if(rowCount-(pageno*20) > 0)
		        pageno = pageno + 1
		    window.document.getElementById("totpages").value = pageno;
		    if(window.document.getElementById("pagecnts"))
		    window.document.getElementById("pagecnts").value = pageno;
		    if(window.document.getElementById("pagecnts1"))
		    window.document.getElementById("pagecnts1").value = pageno;
		    
		    window.document.getElementById("strsearchdiv").innerHTML = "Your search results: "+ rowCount +"&nbsp; Diamonds"
		    GetDiamondsListViaAJAX(strfrompage);
		}
	}

}
function GetDiamondsListViaAJAX(frompage)
{   
    window.document.getElementById("tpricefrom").value = window.document.getElementById("npricefrom").value
    window.document.getElementById("tpriceto").value = window.document.getElementById("npriceto").value
    window.document.getElementById("tcaratfrom").value = window.document.getElementById("ncaratfrom").value
    window.document.getElementById("tcaratto").value = window.document.getElementById("ncaratto").value
    if(document.getElementById("radioPrStatus_1").checked)
    {
        document.getElementById("tradioPrStatus_1").checked = true;
    }
    strfrompage = frompage;
	try
	{
	//	obj = new ActiveXObject("Msxml2.XMLHTTP");
	obj=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj = new ActiveXObject("Microsoft.XMLHTTP");
			
		}
		catch(e1)
		{
			obj = null;
		}
	}
	if(obj!=null)
	{   
	    var prstatus=0;
		if(document.getElementById("radioPrStatus_1").checked)
		{
		prstatus = 1
		}
    
		obj.onreadystatechange = ProcessResponse;
		obj.open("GET", "ajax.aspx?drpstones=" + document.getElementById("hididstones").value + "&pricefrom=" + document.getElementById("npricefrom").value + "&priceto=" + document.getElementById("npriceto").value + "&drpCutFrom=" + document.getElementById("drpCutFrom").value+"&drpCutTo=" + document.getElementById("drpCutTo").value+ "&drpClarityFrom=" + document.getElementById("drpClarityFrom").value+ "&drpClarityTo=" + document.getElementById("drpClarityTo").value+ "&drpColorFrom=" + document.getElementById("drpColorFrom").value+ "&drpColorTo=" + document.getElementById("drpColorTo").value+ "&drpCaratFrom=" + document.getElementById("ncaratfrom").value+ "&drpCaratTo=" + document.getElementById("ncaratto").value + "&status=" + prstatus,  true);
		obj.send(null);         
	}
	return false;
}

function ProcessResponse()
{		

	if(obj.readyState == 4)
	{
		if(obj.status == 200)
		{
		    var strTable="";
		    
		            pagecnts = 0;
		            if(window.document.getElementById("pagecnts"))
		            pagecnts=window.document.getElementById("pagecnts").value;
		    
		    
			        strTable="<table cellspacing=0 cellpadding=4 border=0 style=color:#333333;width:580px;border-collapse:collapse;>";
                    strTable=strTable + " <tr><td colspan=8 align=right>"
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','first');\" class=visiblelinkselected>&lt;&lt; First</a>&nbsp;&nbsp;"
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','prev');\" class=visiblelinkselected>&lt; Prev</a>&nbsp;&nbsp;"
                    strTable=strTable + " <input type=text readonly id=curpage class=pagetext value=1 />&nbsp;&nbsp;of"
                    
                    strTable=strTable + " <input type=text readonly id=pagecnts class=pagetext value="+pagecnts+" />&nbsp;&nbsp;"
                   
                   
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','next');\" class=visiblelink>Next &gt;</a>&nbsp;&nbsp;"
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','last');\" class=visiblelink>Last &gt;&gt;</a>&nbsp;&nbsp;"
                    strTable=strTable + " </td></tr>"
                    strTable=strTable + " <tr style=color:White;background-color:#507CD1;font-weight:bold;>";
                    //strTable=strTable + "<td class=tit-bar>#ID</td>";
                    strTable=strTable + "<td class=tit-bar>Item</td>";
                    strTable=strTable + "<td class=tit-bar>Carat</td><td class=tit-bar>Cut</td>";
                    strTable=strTable + "<td class=tit-bar>Color</td><td class=tit-bar>Clarity</td>"
                    strTable=strTable + "<td class=tit-bar>Price</td><td class=tit-bar></td></tr>";
					
		
			//alert(obj.responseText);
			var dsRoot=obj.responseXML.documentElement; 
			
		//	alert(dsRoot);
		    
			var idProduct       = dsRoot.getElementsByTagName('idproduct');
			var pTitle          = dsRoot.getElementsByTagName('title');
			var plistPrice      = dsRoot.getElementsByTagName('listprice');
			var pCarat          = dsRoot.getElementsByTagName('carat');
			var pCut            = dsRoot.getElementsByTagName('cut');
			var pStoneColor     = dsRoot.getElementsByTagName('stonecolor');
			var pStoneClarity   = dsRoot.getElementsByTagName('stoneclarity');
			var pPrivelege      = dsRoot.getElementsByTagName('Privelege');
			
			//for pop up diamond details
			var pstrSku          = dsRoot.getElementsByTagName('sku');
			var pstrDepth        = dsRoot.getElementsByTagName('Depth');
			var pstrTable1       = dsRoot.getElementsByTagName('Table1');
			var pstrSymmetry     = dsRoot.getElementsByTagName('Symmetry');
			var pstrPolish       = dsRoot.getElementsByTagName('Polish');
			var pstrCulet        = dsRoot.getElementsByTagName('Culet');
			var pstrFluorescence = dsRoot.getElementsByTagName('Fluorescence');
			var pstrMeas         = dsRoot.getElementsByTagName('Meas');
			var pstrLengthWidth  = dsRoot.getElementsByTagName('LengthWidth');
			var pshipinf          = dsRoot.getElementsByTagName('intshippinginfo');
						
			var pFoldePath  = dsRoot.getElementsByTagName('folderpath');
			var rowCount    = idProduct.length;
			//alert(rowCount)
			bg = "item-bg1";
			if(idProduct.length > 0)
			{
			    for(var count = 0; count < idProduct.length; count++)
			    {
    			
			       // alert(idProduct[count].text);
			       try
				        {	
				            if(idProduct[count].innerText!= undefined || idProduct[count].text != undefined)
				            {
					        idProdVal=(idProduct[count].textContent || idProduct[count].innerText || idProduct[count].text);
					         }
				            else
				            {
				            idProdVal=(idProduct[count].textContent);
    				        
				            }
				        }
			        catch(e)
				        {
				    	    idProdVal="";
				        }
				        //alert(count);
				        if(count == 0)
				            strTable=strTable + " <input type=hidden id=firstid value="+ idProdVal +" />" ; 
                    try
				        {	
    				    
				        if( pTitle[count].innerText!= undefined || pTitle[count].text!= undefined)
				        {
				            titleVal=(pTitle[count].textContent || pTitle[count].innerText || pTitle[count].text);
					    }
					    else
					    {
					        titleVal=(pTitle[count].textContent);
					    }    
    					    
    					    
				        }
			        catch(e)
				        {
				    	    titleVal="";
				        }

                    try
				        {	
    				    
				        if(plistPrice[count].innerText!= undefined || plistPrice[count].text!= undefined)
				        {
					        listPriceVal=(plistPrice[count].textContent || plistPrice[count].innerText || plistPrice[count].text);
					     }
					     else
					     {
					      listPriceVal=(plistPrice[count].textContent);
					     }   
    					    
    					    
				        }
			        catch(e)
				        {
				    	    listPriceVal="";
				        }

                    try
				        {	
    				    
				        if(plistPrice[count].innerText!= undefined || plistPrice[count].text!= undefined)
				        {
					        listPriceVal=(plistPrice[count].textContent || plistPrice[count].innerText || plistPrice[count].text);
					        }
					        else
					        {
					        listPriceVal=(plistPrice[count].textContent);
					        }
				        }
			        catch(e)
				        {
				    	    listPriceVal="";
				        }
			         try
				        {	
    				    
				        if(pCarat[count].innerText!= undefined || pCarat[count].text!= undefined)
				        {
    				    
					        caratVal=(pCarat[count].textContent || pCarat[count].innerText || pCarat[count].text);
					        }
					        else
					        {
					         caratVal=(pCarat[count].textContent);
    					    
					        }
				        }
			        catch(e)
				        {
				    	    caratVal="";
				        }
    				    
				    try
				        {	
				        if(pCut[count].innerText!= undefined  || pCut[count].text!= undefined )
				        {
					        cutVal=(pCut[count].textContent || pCut[count].innerText || pCut[count].text);
					     }
					     else
					     {
					     cutVal=(pCut[count].textContent);
					     }   
    					    
				        }
			        catch(e)
				        {
				    	    cutVal="";
				        }
    				    
			       try
				        {	
    				    
				        if(pStoneColor[count].innerText!= undefined || pStoneColor[count].text!= undefined)
				        {
					        stoneVal=(pStoneColor[count].textContent || pStoneColor[count].innerText || pStoneColor[count].text);
					        }
					        else
					        {
					        stoneVal=(pStoneColor[count].textContent);
					        }
				        }
			        catch(e)
				        {
				    	    stoneVal="";
				        }
				      try
				        {	
				        if(pStoneClarity[count].innerText!= undefined || pStoneClarity[count].text!= undefined)
				        {
    				    
					        stoneCalrityVal=(pStoneClarity[count].textContent || pStoneClarity[count].innerText || pStoneClarity[count].text);
					        }
					        else
					        {
					        stoneCalrityVal=(pStoneClarity[count].textContent);
					        }
				        }
			        catch(e)
				        {
				    	    stoneCalrityVal="";
				        }
    				    
    				    
    				    
    				    
    				    
			        try
				        {	
				        if(pFoldePath[count].innerText!= undefined || pFoldePath[count].text!= undefined)
				        {
					        foldepathVal=(pFoldePath[count].textContent || pFoldePath[count].innerText || pFoldePath[count].text);
					     }
					     else
					     {
					     foldepathVal=(pFoldePath[count].textContent);
					     }   
    					    
				        }
			        catch(e)
				        {
				    	    foldepathVal="";
				        }

                    try
				        {	
				            if(pPrivelege[count].innerText!= undefined || pPrivelege[count].text != undefined)
				            {
					        Privelege=(pPrivelege[count].textContent || pPrivelege[count].innerText || pPrivelege[count].text);
					         }
				            else
				            {
				            Privelege=(pPrivelege[count].textContent);
    				        
				            }
				        }
			        catch(e)
				        {
				    	    Privelege="";
				        }
                        //onmouseover=" + showdetailsdiv(idProdVal) + "

                        strTable=strTable + "<tr class="+ bg +" id='tdid"+ idProdVal +"' onmouseover='showdetaildiv("+ idProdVal +")' onmouseout='hidedetaildiv("+ idProdVal +")'>"
                        //strTable=strTable + "<td>" + (count+1) + "</td>"
                        strTable=strTable + "<td >"
                        strTable=strTable + "<a class=commonlink href=" + foldepathVal + "?id="+ idProdVal + "&frmpage=" + strfrompage + "&uploaddesign=" + document.getElementById("txtuploaddesign").value + " >";
                        strTable=strTable + ""+ titleVal + "</a>"
                        if( Privelege == 1 )
                            strTable=strTable + "<img src=/images/privileged-icon.gif border=0 alt='Privelege Diamond' style='vertical-align:middle'/>"
                        strTable=strTable + "</td>"
                        strTable=strTable + "<td>"+ caratVal +"</td>";									
			            strTable=strTable + "<td>" + cutVal + "";
        			    strTable=strTable + "</td><td>";
			            strTable=strTable + ""+ stoneVal +"";
        			    strTable=strTable + "</td><td>"+ stoneCalrityVal + "</td>";
					    strTable=strTable + "<td>$" + listPriceVal +"</td><td>";
			            strTable=strTable + "<a class=commonlink href=" + foldepathVal + "?id="+ idProdVal + "&frmpage=" + strfrompage + "&uploaddesign=" + document.getElementById("txtuploaddesign").value + " >";
        			    strTable=strTable + "<img src=/images/viewdiamond.gif border=0 alt=" + titleVal + " /></a>";
                        strTable=strTable + " </td></tr>"

                        //<!--starts Showing diamond details on side of listing as div pop up -->
                        try
				        {	
				            if(pstrSku[count].innerText!= undefined || pstrSku[count].text!= undefined)
				            {
					            strSku=(pstrSku[count].textContent || pstrSku[count].innerText || pstrSku[count].text);
					        }
					        else
					        {
					            strSku=(pstrSku[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strSku="";
			            }
			            try
				        {	
				            if(pstrDepth[count].innerText!= undefined || pstrDepth[count].text!= undefined)
				            {
					            strDepth=(pstrDepth[count].textContent || pstrDepth[count].innerText || pstrDepth[count].text);
					        }
					        else
					        {
					            strDepth=(pstrDepth[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strDepth="";
			            }
			            try
				        {	
				            if(pstrTable1[count].innerText!= undefined || pstrTable1[count].text!= undefined)
				            {
					            strTable1=(pstrTable1[count].textContent || pstrTable1[count].innerText || pstrTable1[count].text);
					        }
					        else
					        {
					            strTable1=(pstrTable1[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strTable1="";
			            }
			            try
				        {	
				            if(pstrSymmetry[count].innerText!= undefined || pstrSymmetry[count].text!= undefined)
				            {
					            strSymmetry=(pstrSymmetry[count].textContent || pstrSymmetry[count].innerText || pstrSymmetry[count].text);
					        }
					        else
					        {
					            strSymmetry=(pstrSymmetry[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strSymmetry="";
			            }
			            try
				        {	
				            if(pstrPolish[count].innerText!= undefined || pstrPolish[count].text!= undefined)
				            {
					            strPolish=(pstrPolish[count].textContent || pstrPolish[count].innerText || pstrPolish[count].text);
					        }
					        else
					        {
					            strPolish=(pstrPolish[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strPolish="";
			            }
			            try
				        {	
				            if(pstrCulet[count].innerText!= undefined || pstrCulet[count].text!= undefined)
				            {
					            strCulet=(pstrCulet[count].textContent || pstrCulet[count].innerText || pstrCulet[count].text);
					        }
					        else
					        {
					            strCulet=(pstrCulet[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strCulet="";
			            }
			            try
				        {	
				            if(pstrFluorescence[count].innerText!= undefined || pstrFluorescence[count].text!= undefined)
				            {
					            strFluorescence=(pstrFluorescence[count].textContent || pstrFluorescence[count].innerText || pstrFluorescence[count].text);
					        }
					        else
					        {
					            strFluorescence=(pstrFluorescence[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strFluorescence="";
			            }
			            try
				        {	
				            if(pstrMeas[count].innerText!= undefined || pstrMeas[count].text!= undefined)
				            {
					            strMeas=(pstrMeas[count].textContent || pstrMeas[count].innerText || pstrMeas[count].text);
					        }
					        else
					        {
					            strMeas=(pstrMeas[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strMeas="";
			            }
			            try
				        {	
				            if(pstrLengthWidth[count].innerText!= undefined || pstrLengthWidth[count].text!= undefined)
				            {
					            strLengthWidth=(pstrLengthWidth[count].textContent || pstrLengthWidth[count].innerText || pstrLengthWidth[count].text);
					        }
					        else
					        {
					            strLengthWidth=(pstrLengthWidth[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        strLengthWidth="";
			            }
			            try
				        {	
				            if(pshipinf[count].innerText!= undefined || pshipinf[count].text!= undefined)
				            {
					            shipinf=(pshipinf[count].textContent || pshipinf[count].innerText || pshipinf[count].text);
					        }
					        else
					        {
					            shipinf=(pshipinf[count].textContent);
					        }   
				        }
			            catch(e)
			            {
			    	        shipinf="0";
			            }
                        strTable=strTable + " <tr><td height='1'>";
	                    strTable=strTable + " <div id='div" + idProdVal + "' style='visibility:hidden; position:absolute; background-color:#e9e9e9'>";
                        strTable=strTable + "<table width='220' cellpadding='0' cellspacing='1'>";
                        strTable=strTable + "<tr><td style='border:solid 2px #CF963C'>";
                        strTable=strTable + "<table width='200' cellpadding='0' cellspacing='1' align='center'>";
                        strTable=strTable + "<tr><td colspan='2'><b>Diamond Information</b></td></tr>";
                        strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>";
                        strTable=strTable + "<td style='width:45%;'>Product Number</td>";
                        strTable=strTable + "<td>" + strSku + "</td>";
                        strTable=strTable + "</tr>";
                        if(strDepth != '')
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>";
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>";
                            strTable=strTable + "<td style='width:45%;'>Depth %</td>";
                            strTable=strTable + "<td>" + strDepth + "</td>";
                            strTable=strTable + "</tr>";
                        }
                        if( strTable1 != '')
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>"
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>"
                            strTable=strTable + "<td style='width:45%;'>Table %</td>"
                            strTable=strTable + "<td>" + strTable1 + "</td>"
                            strTable=strTable + "</tr>"
                        }
                        if (strSymmetry != '' )
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>"
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>"
                            strTable=strTable + "<td style='width:45%;'>Symmetry</td>"
                            strTable=strTable + "<td>" + strSymmetry+ "</td>"
                            strTable=strTable + "</tr>"
                        }
                        if( strPolish != '')
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>";
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>";
                            strTable=strTable + "<td style='width:45%;'>Polish</td>";
                            strTable=strTable + "<td>" + strPolish+ "</td>";
                            strTable=strTable + "</tr>";
                        }
                        if( strCulet != '')
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>";
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>";
                            strTable=strTable + "<td style='width:45%;'>Culet</td>";
                            strTable=strTable + "<td>" + strCulet+ "</td>";
                            strTable=strTable + "</tr>";
                        }
                        if( strFluorescence != '')
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>";
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>";
                            strTable=strTable + "<td style='width:45%;'>Fluorescence</td>";
                            strTable=strTable + "<td>" + strFluorescence+ "</td>";
                            strTable=strTable + "</tr>";
                        }
                        if(strMeas != '')
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>";
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>";
                            strTable=strTable + "<td style='width:45%;'>Measurements</td>";
                            strTable=strTable + "<td>" + strMeas+ "</td>";
                            strTable=strTable + "</tr>";
                        }
                        if( strLengthWidth != '')
                        {
                            strTable=strTable + "<tr><td colspan='2' style='height:2px;'></td></tr>";
                            strTable=strTable + "<tr style='background-color:#f9f9f9; height:20px;'>";
                            strTable=strTable + "<td style='width:45%;'>Length/width ratio</td>";
                            strTable=strTable + "<td>" + strLengthWidth+ "</td>";
                            strTable=strTable + "</tr>";
                        }
                        strTable=strTable + "<tr><td colspan='2'><b>Shipping Information</b></td></tr>";
			            strTable=strTable + "<tr><td height='20' bgcolor='#f9f9f9' colspan='2'>"
			            if(shipinf == 1 )
			            {
		                    strTable=strTable + "<p>";
	                        strTable=strTable + "Order by: 3 PM EST today<br />";
	                        strTable=strTable + "Receive on: " //+ FormatDateTime(DateAdd(DateInterval.Day, 1, Date.Today), DateFormat.ShortDate)+ ";
		                    strTable=strTable + "</p>"
			            }
			            else
			            {
		                    strTable=strTable + "<p>";
	                        strTable=strTable + "Order by: 3 PM EST today<br />";
	                        strTable=strTable + "Receive between: " //+ FormatDateTime(DateAdd(DateInterval.Day, 21, Date.Today), DateFormat.ShortDate)+ " and " + FormatDateTime(DateAdd(DateInterval.Day, 28, Date.Today), DateFormat.ShortDate)+ " 
		                    strTable=strTable + "</p>";
			            }
			            strTable=strTable + "</td></tr>"
			            strTable=strTable + "<tr><td colspan='2' height='5'></td></tr>"
                        strTable=strTable + "</table>";
                        strTable=strTable + "</td></tr>";
                        strTable=strTable + "</table>";
                        strTable=strTable + "</div>";
                        strTable=strTable + "</td></tr>";
	                    //<!--ends Showing diamond details on side of listing as div pop up -->
    	                
                        if( count%2 == 0 )
                            bg = "item-bg";
                        else
                            bg = "item-bg1"
			    }	
			}
			else
			{
			    idProdVal = "";
			}
			strTable=strTable + " <input type=hidden id=lastid value="+ idProdVal +" />" ;
			      strTable=strTable + "<tr ><td colspan=8 style='height:8px; background-color:#ccc' ></td></tr>";
                    
                    strTable=strTable + " <tr><td colspan=8 align=right>"
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','first');\" class=visiblelinkselected>&lt;&lt; First</a>&nbsp;&nbsp;"
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','prev');\" class=visiblelinkselected>&lt; Prev</a>&nbsp;&nbsp;"
                    strTable=strTable + " <input type=text readonly id=curpage1 class=pagetext value=1 />&nbsp;&nbsp;of"
                    
                    strTable=strTable + " <input type=text readonly id=pagecnts1 class=pagetext value="+pagecnts+" />&nbsp;&nbsp;"
                   
                   
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','next');\" class=visiblelink>Next &gt;</a>&nbsp;&nbsp;"
                    strTable=strTable + " <a href=# onclick=\"nextpage('"+strfrompage+"','last');\" class=visiblelink>Last &gt;&gt;</a>&nbsp;&nbsp;"
                    strTable=strTable + " </td></tr>"
                    
                  strTable=strTable + "</table>";
                  window.document.getElementById("rowno").value = count;
                  window.document.getElementById("pageitemcount").value = count;

			if(rowCount>0)
			{
			var strprice = ""
			var nprice = window.document.getElementById("npricefrom").value;
			var npriceto = window.document.getElementById("npriceto").value;
			if(nprice=="")nprice=0
			if(npriceto=="")npriceto=0
			
			if(nprice != 0 && npriceto != 0 )
			    strprice = "<b>Price:</b> From $" + nprice + " To $" + npriceto
			else if(npriceto==0)
			    strprice = "<b>Price:</b> > $" + nprice
			else if(nprice==0)
			    strprice = "<b>Price:</b> < $" + npriceto
			else
			    strprice = "";
			var ncarat = window.document.getElementById("ncaratfrom").value
			var ncaratto = window.document.getElementById("ncaratto").value
			if(ncarat=="")ncarat=0;
			if(ncaratto=="")ncaratto=0;
			if(ncarat != 0 && ncaratto != 0 )
			    strcarat = "<b>Carat weight:</b> From $" + ncarat + " To $" + ncaratto
			else if(ncaratto==0 && ncarat!=0)
			    strcarat = "<b>Carat weight:</b> > $" + ncarat
			else if(ncarat==0 && ncaratto != 0)
			    strcarat = "<b>Carat weight:</b> < $" + ncaratto
			else
			    strcarat = "";
			//window.document.getElementById("divResult").innerHTML='';
			window.document.getElementById("pricefrom").value = window.document.getElementById("npricefrom").value
			window.document.getElementById("priceto").value = window.document.getElementById("npriceto").value
			window.document.getElementById("caratfrom").value = window.document.getElementById("ncaratfrom").value
			window.document.getElementById("caratto").value = window.document.getElementById("ncaratto").value
			//window.document.getElementById("strsearchdiv").innerHTML = "Your search results: "+ rowCount +"&nbsp; Diamonds"
			window.document.getElementById("strpricediv").innerHTML = strprice;
			window.document.getElementById("strcaratdiv").innerHTML = strcarat;
	    	window.document.getElementById("divResult").innerHTML=strTable;
            }
            else
            {
            
            var strTable1='';
           // window.document.getElementById("divResult").innerHTML='';
            strTable1="<table width=200px cellpadding=0 cellspacing=0 border=1 align=center style=border-collapse:collapse; border:solid 1px #CF963C >";
            strTable1=strTable1 + " <tr><td></td></tr><tr><td height=100 align=center>";
            strTable1=strTable1 + " Sorry! No Diamonds available for your search criteria..";
            strTable1=strTable1 + " </td></tr></table>";
             
            window.document.getElementById("divResult").innerHTML=strTable1;
            
            
           
            }
            if(window.document.getElementById("tpricefrom"))
            {                
                window.document.Form2.tpricefrom.focus();
            }

		}
		
	}
}

