var MainPageURL = "../pages/AjaxServerpage.aspx";
var isIE=false;
if(!window.XMLHttpRequest)
{
	isIE=true;
}
if((window.navigator.appName).toLowerCase()=='microsoft internet explorer') //checking for Ie7
{
   var version = window.navigator.appVersion;
   var version1 ;
   if(version.indexOf("MSIE")!=-1)
   {
	version1 = version.substring((version.indexOf("MSIE")+4),version.length);
	version1 = version1.substring(0,2);
	if ( parseInt(version1) == 7)
	{
		isIE=true;
		
	}
   }     
}  

		/******* For Cufflinks ****/
		var Xmlhttp; 
		var xmlDoc;
		var CurrentpageIndex = 0;
		var PageSize = 5;
		var PreviousPage;
		var NextPage;
		var SelectedCollection;
		var IsPaging;   //for  Checking results in pages or not.
		var PageCount = 0;
		var btncontrol;
		var TotalCufflinkCount = 0;
		
		/****** For Silk Knots *****/
		
		var Xmlhttp2;
		var CurrentpageIndex2 = 0;
		var PreviousPage2;
		var NextPage2;
		var SelectedCollection2;
		var IsPaging2;   //for  Checking results in pages or not.
		var PageCount2 = 0;
		var btncontrol2;
		var TotalSilkKnotCount = 0;

		function SetNextPreviousLinks()
		{
			var tempCufflinkCurrentPage = CurrentpageIndex + 1;
			var tempSilkKnotCurrentPage = CurrentpageIndex2 + 1;
			
			var TotalCufflinkPages = 0;			
			var TotalSilkKnotPages = 0;
			
			if( (TotalCufflinkCount/PageSize) > parseInt((TotalCufflinkCount/PageSize)) )
			{
				TotalCufflinkPages =  parseInt((TotalCufflinkCount/PageSize)) + 1;
			}
			else
			{
				TotalCufflinkPages =  (TotalCufflinkCount/PageSize);
			}
			
			if( (TotalSilkKnotCount/PageSize) > parseInt((TotalSilkKnotCount/PageSize)) )
			{
				TotalSilkKnotPages =  parseInt((TotalSilkKnotCount/PageSize)) + 1;
			}
			else
			{
				TotalSilkKnotPages =  (TotalSilkKnotCount/PageSize);
			}
			
			if( (tempCufflinkCurrentPage == 1) && (tempSilkKnotCurrentPage == 1) )
			{
				document.getElementById("lnkprev").className = "graylinks12";
				document.getElementById("lnkprev").onclick = function()
				{
					return false;
				}
			}
			else
			{
				document.getElementById("lnkprev").className = "graylinksbrown";
				document.getElementById("lnkprev").onclick = function()
				{
					getPreviousPage();
					return false;
				}
			}
			
			var MaxCurrentPage = 0;
			if(tempCufflinkCurrentPage > tempSilkKnotCurrentPage)
			{
				MaxCurrentPage = tempCufflinkCurrentPage;
			}
			else
			{
				MaxCurrentPage = tempSilkKnotCurrentPage;
			}
			
			if( (TotalSilkKnotPages > TotalCufflinkPages) || (TotalSilkKnotPages < TotalCufflinkPages) )
			{
				if(TotalSilkKnotPages > TotalCufflinkPages)
				{
					if(MaxCurrentPage == TotalSilkKnotPages )
					{
						document.getElementById("lnknext").className = "graylinks12";
						document.getElementById("lnknext").onclick = function()
						{
							return false;
						}
					}
					else
					{
						document.getElementById("lnknext").className = "graylinksbrown";
						document.getElementById("lnknext").onclick = function()
						{
							getNextPage();
							return false;
						}
					}
				}
				else
				{
					if(MaxCurrentPage == TotalCufflinkPages )
					{
						document.getElementById("lnknext").className = "graylinks12";
						document.getElementById("lnknext").onclick = function()
						{
							return false;
						}
					}
					else
					{
						document.getElementById("lnknext").className = "graylinksbrown";
						document.getElementById("lnknext").onclick = function()
						{
							getNextPage();
							return false;
						}
					}
				}
			}
			else if(TotalSilkKnotPages == TotalCufflinkPages)
			{
				if(MaxCurrentPage == TotalSilkKnotPages)
				{
					document.getElementById("lnknext").className = "graylinks12";
					document.getElementById("lnknext").onclick = function()
					{
						return false;
					}
				}
				else
				{
					document.getElementById("lnknext").className = "graylinksbrown";
					document.getElementById("lnknext").onclick = function()
					{
						getNextPage();
						return false;
					}
				}
			}		
		}
		
		
		function createXmlHttp(value)
		{
         var moz = (typeof document.implementation != 'undefined') && (typeof 
         document.implementation.createDocument != 'undefined');
         if (moz)
          {
			if(value == 1)
			{
				Xmlhttp = new XMLHttpRequest();	
			}
			else
			{
				Xmlhttp2 = new XMLHttpRequest();
			}
          
          }
	    else // for Ie
	    {
	   try
		{
			if(value == 1)
			{
				Xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			else
			{
				Xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
			}
			
	     }
	  catch(e)
	    {
		try
		{
			if(value ==1)
			{
				Xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			else
			{
				Xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
			}			
		} 
		catch(oc)
		{
			Xmlhttp = null;
			Xmlhttp2 = null;
		}
	    }
	   }  //end else;	
		}// end createXmlhttp;
	
	function getAccessoriesAll(Selectedlink)
		{
			btncontrol=Selectedlink;            // "0" for cufflinks all and 1 and 2 for next and prev links for Cufflinks
												// "3" for silkknots all and 4 and 5 for next and prev links for Silkknots			
			var url= "";
		
			
			
		
		   if(Selectedlink <= 2)
		   {
				btncontrol=Selectedlink;   
				url= MainPageURL + "?Accessories="+"Cufflinks";	
				document.getElementById('divAccessories').innerHTML='';
				createXmlHttp(1);
				if(Xmlhttp)
				{
					Xmlhttp.onreadystatechange = handleresponse;
					Xmlhttp.open("GET", url, true);
					Xmlhttp.send(null);	
				}
		   }
		   else
		   {
				btncontrol2=Selectedlink;   
				url= MainPageURL + "?Accessories="+"Silkknots";	
				document.getElementById('divSilkKnots').innerHTML='';
				createXmlHttp(2);
				if(Xmlhttp2)
				{
					
					Xmlhttp2.onreadystatechange = handleresponse2;
					Xmlhttp2.open("GET", url, true);
					Xmlhttp2.send(null);	
				}
		   }
			
			    
		//url="AjaxServerpage.aspx?Accessories="+"Ties";
			
		 // return false;
		 }//end getText;
				
		function handleresponse()
		{
			if(Xmlhttp.readyState == 4)
			{ 
				if (Xmlhttp.status == 200)
				{
					if(Xmlhttp.responseXML.documentElement)
					{				
						display(Xmlhttp.responseXML.documentElement);	
						/*if(Xmlhttp.responseXML.documentElement.childNodes.length == 0)
						{
							document.getElementById("lnknext").className = "graylinks12";
							document.getElementById("lnknext").onclick = function()
							{
								return false;
							}

							document.getElementById("lnkprev").className = "graylinks12";
							document.getElementById("lnkprev").onclick = function()
							{
								return false;
							}
						}*/					
					}
				}
			}
		} //end handle response
		
		function handleresponse2()
		{
			if(Xmlhttp2.readyState == 4)
			{ 
				if (Xmlhttp2.status == 200)
				{
					if(Xmlhttp2.responseXML.documentElement)
					{
						displaySilkKnots(Xmlhttp2.responseXML.documentElement);							
						/*if(Xmlhttp2.responseXML.documentElement.childNodes.length == 0)
						{
							document.getElementById("lnknext").className = "graylinks12";
							document.getElementById("lnknext").onclick = function()
							{
								return false;
							}

							document.getElementById("lnkprev").className = "graylinks12";
							document.getElementById("lnkprev").onclick = function()
							{
								return false;
							}
						}*/
					}
				}
			}
		} //end handle response
		
		function formatCurrency(obj)
		{       
			var num,cents;
		 	num=obj;
			num = num.toString().replace(/\$|\,/g,'');
			if(isNaN(num))
					num = "0";							
					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( num + '.' + cents);
		}			
	    
	    
	    function displaySilkKnots(obj)
				{ 
				var loopcnt1;
				var loopcnt2
				var firstchild = obj.firstChild;
				var loopcheck;
				var imgsrc;
				var strDescription;
				var price;
				var OldPrice;
				var strFabrcImg;
				var strPrice;
				var baseIndex;
				var lastIndex;
			// code for paging //
				
			  if(btncontrol2==3 || btncontrol2==0 )
				{
					CurrentpageIndex2 =0;
					baseIndex = 0;
					if(isIE==true)
					{
						lastIndex = obj.childNodes.length
						TotalSilkKnotCount = obj.childNodes.length
						if((obj.childNodes.length)>=PageSize)
						{
							lastIndex = PageSize; //obj.childNodes.length;
						} 
					}
					else
					{
						lastIndex = parseInt((obj.childNodes.length-1)/2);
						TotalSilkKnotCount =  parseInt((obj.childNodes.length-1)/2);
						if((lastIndex)>=PageSize)
						{
							lastIndex = PageSize; //obj.childNodes.length;
						} 
					
					}
					
				}
				// code for paging//
				 		   
					var table1=document.createElement('table')
				    table1.setAttribute('cellPadding',0);
					table1.setAttribute('cellSpacing',13);
					//table1.className = "borderdots";
					table1.id = "tblList";	
					table1.align='left';				
					//table1.style.border="1px solid red";
					table1.style.width="100%";
					table1.style.height="100%";
					var tbody=document.createElement('tbody');					
					var tr =document.createElement('tr');
				
			// code for paging //
				
				if(btncontrol2==3 ||  btncontrol2==0 )
				{
					if(isIE==true)
					{
						if(((obj.childNodes.length)%PageSize)!=0)
							PageCount2 = parseInt((obj.childNodes.length)/PageSize) + 1;
						else
							PageCount2 = parseInt((obj.childNodes.length)/PageSize);
					}
					else
					{
						if((((obj.childNodes.length-1)/2)%PageSize)!=0)
							PageCount2 = parseInt(((obj.childNodes.length-1)/2)/PageSize) + 1;
						else
							PageCount2 = parseInt(((obj.childNodes.length-1)/2)/PageSize);
					}
					
				} 
				
				if(btncontrol2==4 || btncontrol2==1 )  //for next button in paging
				{
				  baseIndex = CurrentpageIndex2 * PageSize;
				  lastIndex = baseIndex + PageSize;
				  if(isIE==true)
				  {
					if((obj.childNodes.length)< lastIndex)
					{
						lastIndex=obj.childNodes.length;
					}
				  }
				  else
				  {
					if(parseInt((obj.childNodes.length-1)/2)< lastIndex)
					{
						lastIndex=parseInt((obj.childNodes.length-1)/2);
					}
				  
				  }
				  
				}
				 
				if(btncontrol2==5 || btncontrol2==2)               //code for previous page          
				{
				  baseIndex = CurrentpageIndex2 * PageSize;
				  lastIndex = baseIndex + PageSize; 
				}
				// code for paging//
				
			   		/* Check for page Links  */
		if((obj.childNodes.length)<= PageSize)
		{
			//document.getElementById('tdprev2').style.display="none";
			//document.getElementById('tdnext2').style.display="none";
			document.getElementById('lnkprev2').onclick = function()
			{
				return false;
			}
			document.getElementById('lnknext2').onclick = function()
			{
				return false;
			}
			
			document.getElementById('lnkprev2').className = "graylinks12";
			document.getElementById('lnknext2').className = "graylinks12";
			
		}
			
		if(obj.childNodes.length>PageSize)
		{
			if (baseIndex ==0)
			{
				//document.getElementById('tdprev2').style.display="none";
				document.getElementById('lnkprev2').onclick = function()
				{
					return false;
				}
				document.getElementById('lnkprev2').className = "graylinks12";
			}
			else
			{
				//document.getElementById('tdprev2').style.display='';
				document.getElementById('lnkprev2').onclick = function()
				{
					getPreviousPage2();
					return false;
				}
				document.getElementById('lnkprev2').className = "graylinksbrown";
			}
			if(isIE==true)
			{
				if(lastIndex >= obj.childNodes.length)
				{//lnknext2
					//document.getElementById('tdnext2').style.display="none";
					document.getElementById("lnknext2").onclick = function()
					{
						return false;
					}
					document.getElementById('lnknext2').className = "graylinks12";
				}
				else
				{
					document.getElementById("lnknext2").onclick = function()
					{
						getNextPage2();
						return false;
					}
					document.getElementById('lnknext2').className = "graylinksbrown";
					//document.getElementById('tdnext2').style.display='';
				}
				
			}
			else   //For Mozilla
			{
				
				if( (2*lastIndex+1) >= obj.childNodes.length)
				{
					//document.getElementById('tdnext2').style.display="none";
					document.getElementById("lnknext2").onclick = function()
					{
						return false;
					}
					document.getElementById('lnknext2').className = "graylinks12";
				}
				else
				{
					//document.getElementById('tdnext2').style.display='';
					document.getElementById("lnknext2").onclick = function()
					{
						getNextPage2();
						return false;
					}
					document.getElementById('lnknext2').className = "graylinksbrown";
				}
			}  
		
		}
		
		/* End check for page Links */	
				
				for(loopcnt1=baseIndex; loopcnt1 < lastIndex;loopcnt1++)  //obj.childNodes.length
				{
					if((loopcnt1)%5==0)
					{
						var tr = document.createElement('tr');
						tr.align="left";
						
						/*var tdimg=document.createElement('td');
						tdimg.id ="tdimg";
						tdimg.align="left";
						tdimg.style.width = "14px";
						//tdimg.innerHTML = "&nbsp;"; 
						tr.appendChild(tdimg);*/
					}

					var tdimg=document.createElement('td');
					tdimg.id ="tdimg";
					tdimg.align="left";
					
					var innertable=document.createElement('table')
				    innertable.setAttribute('cellPadding',0);
					innertable.setAttribute('cellSpacing',0);
					innertable.style.border="1px solid #cccccc";
					//innertable.style.border="1px solid red";
					innertable.style.width="84px";
					//innertable.style.height="67px";
					innertable.style.height="94px";
					innertable.align='left';
					//innertable.style.border="1";
					
					var innertbody=document.createElement('tbody');
					var innertr =document.createElement('tr');
					var innertd=document.createElement('td');
					innertd.align='center';
					var Giftcardimg = document.createElement('img');
					Giftcardimg.id="imgGiftCard";
					var lblId=document.createElement('LABEL');
					var lblDescription=document.createElement('LABEL');
					lblDescription.className="tddescription";
					
					lblId.style.display='none';
					price=document.createElement('LABEL');
					price.className="tddescription";
					
					OldPrice=document.createElement('LABEL');
					OldPrice.className="Strikedline";
					
					if(isIE==true)
					{            
					    imgsrc = document.createTextNode(obj.childNodes[loopcnt1].childNodes[2].text).nodeValue;
					    if(document.createTextNode(obj.childNodes[loopcnt1].childNodes[1].text).nodeValue.length > 13)
					    {
							lblDescription.innerHTML = document.createTextNode("&nbsp;" + obj.childNodes[loopcnt1].childNodes[1].text).nodeValue;
							lblDescription.innerHTML = lblDescription.innerHTML.substring(0,12) + "...";
					    }
					    else
					    {
							lblDescription.innerHTML = document.createTextNode("&nbsp;" + obj.childNodes[loopcnt1].childNodes[1].text).nodeValue;
					    }
					    
					    lblDescription.title = document.createTextNode(obj.childNodes[loopcnt1].childNodes[1].text).nodeValue;
					    
						price.innerHTML ="&nbsp;$" +parseInt(document.createTextNode(obj.childNodes[loopcnt1].childNodes[4].text).nodeValue);
						try
						{
							
							if(parseFloat(obj.childNodes[loopcnt1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue) > 0)
							{
								OldPrice.innerHTML = "$" +parseInt(document.createTextNode(obj.childNodes[loopcnt1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue).nodeValue);
							}
							else
							{
								OldPrice.innerHTML = "";
							}
						}
						catch(ers)
						{
							OldPrice.innerHTML = "";
						}
						
						lblId.innerHTML=document.createTextNode(obj.childNodes[loopcnt1].childNodes[0].text).nodeValue;
					}
					else
					{
					    if(obj.childNodes[2*loopcnt1+1].childNodes[5].firstChild)
							imgsrc =  obj.childNodes[2*loopcnt1+1].childNodes[5].firstChild.nodeValue;
					    if(document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue.length > 13)
					    {
							lblDescription.innerHTML=document.createTextNode("&nbsp;" + obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue;
							lblDescription.innerHTML = lblDescription.innerHTML.substring(0,12) + "...";
					    }
					    else
					    {
							lblDescription.innerHTML=document.createTextNode("&nbsp;" + obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue;
					    }
					   	
					   	lblDescription.title=document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue;
					   	
					   	price.innerHTML ="&nbsp;$" +parseInt(document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[9].firstChild.nodeValue).nodeValue);
					   	lblId.innerHTML=document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[1].firstChild.nodeValue).nodeValue;
					    Giftcardimg.style.display='';
					    try
						{
							if(obj.childNodes[2*loopcnt1+1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue + "" != "0")
							{
								OldPrice.innerHTML = "$" +parseInt(document.createTextNode(obj.childNodes[2*loopcnt1+1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue).nodeValue);
							}
							else
							{
								OldPrice.innerHTML = "";
							}
						}
						catch(ers)
						{
							OldPrice.innerHTML = "";
						}
					}  
					
					Giftcardimg.src = imgsrc;
					Giftcardimg.style.width = "84px";
					Giftcardimg.style.height = "94px";
					innertable.background = imgsrc;	                                 
					
					Giftcardimg.onclick =function()
					{
						RedirecttoAccessoryDetails(this.parentNode.getElementsByTagName("LABEL")[0].childNodes[0].nodeValue,this.parentNode.parentNode.parentNode.getElementsByTagName("TR")[2].getElementsByTagName("LABEL")[0].childNodes[0].nodeValue,"silkknot");
				  	}
				  	
				  	
				  	innertd=document.createElement('td');
				    innertd.style.width='50%';
				    innertd.valign='top';
				    innertd.align='left';
					//innertd.appendChild(price);
					
					var decDiv = document.createElement("DIV");
					decDiv.appendChild(price);
					decDiv.className = "backgroundopacity";
					decDiv.style.position = "absolute";
					decDiv.style.zIndex = 10;
					//decDiv.style.marginTop = "10px";
				    
					innertd.appendChild(decDiv);
					
					if(OldPrice.innerHTML != "")
					{
						/*innertd.appendChild(document.createTextNode(" ["));
						innertd.appendChild(OldPrice);
						innertd.appendChild(document.createTextNode("]"));*/
						
					}
					
					//innertd.appendChild(imgFabric);
					innertr.appendChild(innertd);
				 	innertbody.appendChild(innertr);
					innertr =document.createElement('tr');
					innertd=document.createElement('td');
					//innertd.style.width='30px';
					//innertd.style.height='60px';						
				  	innertd.appendChild(Giftcardimg);
				  	Giftcardimg.style.cursor='pointer';
				  	innertd.appendChild(lblId);
				  	innertr.appendChild(innertd);
				  	innertbody.appendChild(innertr);
					innertr =document.createElement('tr');
					innertd=document.createElement('td');
					innertd.align='left';
					var decDiv = document.createElement("DIV");
					
					decDiv.style.display = "none";
					
					//lblDescription.style.width = "1050%";
					decDiv.appendChild(lblDescription);
					decDiv.className = "backgroundopacity";
					decDiv.style.position = "absolute";
					decDiv.style.zIndex = 10;
					decDiv.style.marginTop = "-10px";
					//innertr.style.border = "1px soild red"; 
					//decDiv.style.width = "80px";
					innertd.colSpan = "2";
					innertd.appendChild(decDiv);
					innertr.appendChild(innertd);
					
					//innertd.appendChild(imgFabric);
				
					innertbody.appendChild(innertr);
					innertable.appendChild(innertbody);
					tdimg.appendChild(innertable);
					tr.appendChild(tdimg);
															
				   } 
				 
				   if(!isIE)
				   {
						var intCounter = 1;
						intCounter = tr.getElementsByTagName("TD").length;
						intCounter = (intCounter % 5);
						if(intCounter != 0)
						{
							var intLoopIndex = 1;
							if(intCounter == 3)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "143px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 2)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "56px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 1)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "13px";
									tr.appendChild(tempTDD);
								}
							}
						}
				   }
				   else
				   {
						var intCounter = 1;
						intCounter = tr.getElementsByTagName("TD").length;
						intCounter = (intCounter % 5);
						if(intCounter != 0)
						{
							var intLoopIndex = 1;
							if(intCounter == 3)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "143px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 2)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "56px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 1)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "13px";
									tr.appendChild(tempTDD);
								}
							}
						}
				   }
				
				//alert(GetChildCount(tbody));
				tbody.appendChild(tr);
				table1.appendChild(tbody);
			/* if(baseIndex!=lastIndex)
				{
				fnCheckPageSize(baseIndex,lastIndex,table1); // For Creating empty tables to fill the grid.
				}*/
			document.getElementById('divSilkKnots').style.display='';
			document.getElementById('divSilkKnots').appendChild(table1);
				
			SetNextPreviousLinks();				
		}//end display
			
		function GetChildCount(object,tagName)
		{
			var intIndex = 0;
			var intCounter = 0;
			while(object.childNodes[intCounter])
			{
				if(object.childNodes[intCounter].tagName.toLowerCase() == tagName.toLowerCase())
				{
					intIndex++;
				}
				intCounter++;
			}
			return intIndex;
		}	
				
		function display(obj)
				{ 
			
				var loopcnt1;
				var loopcnt2
				var firstchild = obj.firstChild;
				var loopcheck;
				var imgsrc;
				var strDescription;
				var price;
				var OldPrice;
				var strFabrcImg;
				var strPrice;
				var baseIndex;
				var lastIndex;
			// code for paging //
				
			  if(btncontrol==0 || btncontrol==3)
				{
					CurrentpageIndex =0;
					baseIndex = 0;
					if(isIE==true)
					{
						lastIndex = obj.childNodes.length;
						TotalCufflinkCount = obj.childNodes.length;
						if((obj.childNodes.length)>=PageSize)
						{
							lastIndex = PageSize; //obj.childNodes.length;
						} 
					}
					else
					{
						lastIndex = parseInt((obj.childNodes.length-1)/2);
						TotalCufflinkCount = parseInt((obj.childNodes.length-1)/2);
						if((lastIndex)>=PageSize)
						{
							lastIndex = PageSize; //obj.childNodes.length;
						} 
					
					}
					
				}
				// code for paging//
				 		   
					var table1=document.createElement('table')
				    table1.setAttribute('cellPadding',0);
					table1.setAttribute('cellSpacing',13);
					//table1.className = "borderdots";
					table1.id = "tblList";	
					table1.align='left';				
					//table1.style.border="1px solid red";
					table1.style.width="100%";
					table1.style.height="100%";
					var tbody=document.createElement('tbody');					
					var tr =document.createElement('tr');
				
			// code for paging //
				
				if(btncontrol==0 || btncontrol==3)
				{
					if(isIE==true)
					{
						if(((obj.childNodes.length)%PageSize)!=0)
							PageCount = parseInt((obj.childNodes.length)/PageSize) + 1;
						else
							PageCount = parseInt((obj.childNodes.length)/PageSize);
					}
					else
					{
						if((((obj.childNodes.length-1)/2)%PageSize)!=0)
							PageCount = parseInt(((obj.childNodes.length-1)/2)/PageSize) + 1;
						else
							PageCount = parseInt(((obj.childNodes.length-1)/2)/PageSize);
					}
					
				} 
				
				if(btncontrol==1 || btncontrol==4)  //for next button in paging
				{
				  baseIndex = CurrentpageIndex * PageSize;
				  lastIndex = baseIndex + PageSize;
				  if(isIE==true)
				  {
					if((obj.childNodes.length)< lastIndex)
					{
						lastIndex=obj.childNodes.length;
					}
				  }
				  else
				  {
					if(parseInt((obj.childNodes.length-1)/2)< lastIndex)
					{
						lastIndex=parseInt((obj.childNodes.length-1)/2);
					}
				  
				  }
				  
				}
				 
				if(btncontrol==2 || btncontrol==5)               //code for previous page          
				{
				  baseIndex = CurrentpageIndex * PageSize;
				  lastIndex = baseIndex + PageSize; 
				}
				// code for paging//
				
			   		/* Check for page Links  */
		if((obj.childNodes.length)<=PageSize)
		{
			//document.getElementById('tdprev').style.display="none";
			//document.getElementById('tdnext').style.display="none";
			
			document.getElementById("lnknext").onclick = function()
			{
				return false;
			}
			
			document.getElementById("lnkprev").onclick = function()
			{
				return false;
			}
			
			document.getElementById("lnknext").className = "graylinks12";
			document.getElementById("lnkprev").className = "graylinks12";
		}
			
		if(obj.childNodes.length>PageSize)
		{
			if (baseIndex ==0)
			{
				//document.getElementById('tdprev').style.display="none";
				document.getElementById("lnkprev").onclick = function()
				{
					return false;
				}
				document.getElementById("lnkprev").className = "graylinks12";
			}
			else
			{
				//document.getElementById('tdprev').style.display='';
				document.getElementById("lnkprev").onclick = function()
				{
					getPreviousPage();
					return false;
				}
				document.getElementById("lnkprev").className = "graylinksbrown";
			}
			if(isIE==true)
			{
				if(lastIndex >= obj.childNodes.length)
				{
					//document.getElementById('tdnext').style.display="none";
					document.getElementById("lnknext").onclick = function()
					{
						return false;
					}
					document.getElementById("lnknext").className = "graylinks12";
				}
				else
				{
					//document.getElementById('tdnext').style.display='';
					document.getElementById("lnknext").onclick = function()
					{
						getNextPage();
						return false;
					}
					document.getElementById("lnknext").className = "graylinksbrown";
				}
			}
			else   //For Mozilla
			{
				
				if( (2*lastIndex+1) >= obj.childNodes.length)
				{
					//document.getElementById('tdnext').style.display="none";
					document.getElementById("lnknext").onclick = function()
					{
						return false;
					}
					document.getElementById("lnknext").className = "graylinks12";
				}
				else
				{
					//document.getElementById('tdnext').style.display='';
					document.getElementById("lnknext").onclick = function()
					{
						getNextPage();
						return false;
					}
					document.getElementById("lnknext").className = "graylinksbrown";
				}
			}  
		
		}
		
		/* End check for page Links */	
				
				for(loopcnt1=baseIndex; loopcnt1 < lastIndex;loopcnt1++)  //obj.childNodes.length
				{
					if((loopcnt1)%5==0)
					{
						var tr = document.createElement('tr');
						tr.align="left";
					}

					var tdimg=document.createElement('td');
					tdimg.id ="tdimg";
					tdimg.align="left";
					
					var innertable=document.createElement('table')
				    innertable.setAttribute('cellPadding',0);
					innertable.setAttribute('cellSpacing',0);
					innertable.style.border="1px solid #cccccc";
					innertable.style.width="84px";
					innertable.style.height="94px";
					innertable.align='left';
					//innertable.style.border="1";
					
					var innertbody=document.createElement('tbody');
					var innertr =document.createElement('tr');
					var innertd=document.createElement('td');
					innertd.align='center';
					var Giftcardimg = document.createElement('img');
					Giftcardimg.id="imgGiftCard";
					var lblId=document.createElement('LABEL');
					var lblDescription=document.createElement('LABEL');
					lblDescription.className="tddescription";
					
					lblId.style.display='none';
					price=document.createElement('LABEL');
					price.className="fontgreen";
					
					OldPrice=document.createElement('LABEL');
					OldPrice.className="Strikedline";
					
					if(isIE==true)
					{            
					    imgsrc = document.createTextNode(obj.childNodes[loopcnt1].childNodes[2].text).nodeValue;
					    if(document.createTextNode(obj.childNodes[loopcnt1].childNodes[1].text).nodeValue.length > 13)
					    {
							lblDescription.innerHTML = document.createTextNode("&nbsp;" + obj.childNodes[loopcnt1].childNodes[1].text).nodeValue;
							lblDescription.innerHTML = lblDescription.innerHTML.substring(0,12) + "...";
					    }
					    else
					    {
							lblDescription.innerHTML = document.createTextNode("&nbsp;" + obj.childNodes[loopcnt1].childNodes[1].text).nodeValue;
					    }
					    
					    lblDescription.title = document.createTextNode(obj.childNodes[loopcnt1].childNodes[1].text).nodeValue;
					    
						price.innerHTML ="&nbsp;$" +parseInt(document.createTextNode(obj.childNodes[loopcnt1].childNodes[4].text).nodeValue);
						try
						{
							
							if(parseFloat(obj.childNodes[loopcnt1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue) > 0)
							{
								OldPrice.innerHTML = "$" +parseInt(document.createTextNode(obj.childNodes[loopcnt1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue).nodeValue);
							}
							else
							{
								OldPrice.innerHTML = "";
							}
						}
						catch(ers)
						{
							OldPrice.innerHTML = "";
						}
						
						lblId.innerHTML=document.createTextNode(obj.childNodes[loopcnt1].childNodes[0].text).nodeValue;
					}
					else
					{
					    if(obj.childNodes[2*loopcnt1+1].childNodes[5].firstChild)
							imgsrc =  obj.childNodes[2*loopcnt1+1].childNodes[5].firstChild.nodeValue;
					    if(document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue.length > 13)
					    {
							lblDescription.innerHTML= document.createTextNode("&nbsp;" + obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue;
							lblDescription.innerHTML = lblDescription.innerHTML.substring(0,12) + "...";
					    }
					    else
					    {
							lblDescription.innerHTML=document.createTextNode("&nbsp;" + obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue;
					    }
					   	
					   	lblDescription.title= document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[3].firstChild.nodeValue).nodeValue;
					   	
					   	price.innerHTML ="&nbsp;$" +parseInt(document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[9].firstChild.nodeValue).nodeValue);
					   	lblId.innerHTML=document.createTextNode(obj.childNodes[2*loopcnt1+1].childNodes[1].firstChild.nodeValue).nodeValue;
					    Giftcardimg.style.display='';
					    try
						{
							if(obj.childNodes[2*loopcnt1+1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue + "" != "0")
							{
								OldPrice.innerHTML = "$" +parseInt(document.createTextNode(obj.childNodes[2*loopcnt1+1].getElementsByTagName("OldPrice")[0].childNodes[0].nodeValue).nodeValue);
							}
							else
							{
								OldPrice.innerHTML = "";
							}
						}
						catch(ers)
						{
							OldPrice.innerHTML = "";
						}
					}  
					
					Giftcardimg.src = imgsrc;
					Giftcardimg.style.width = "84px";
					Giftcardimg.style.height = "94px";
					innertable.background=imgsrc;	                                 
					
					Giftcardimg.onclick =function()
					{
						RedirecttoAccessoryDetails(this.parentNode.getElementsByTagName("LABEL")[0].childNodes[0].nodeValue,this.parentNode.parentNode.parentNode.getElementsByTagName("TR")[2].getElementsByTagName("LABEL")[0].childNodes[0].nodeValue,"cufflink");
				  	}
									  	
				  	innertd=document.createElement('td');
				    innertd.style.width='50%';
				    innertd.valign='top';
				    innertd.align='left';
				    var decDiv = document.createElement("DIV");
					decDiv.appendChild(price);
					decDiv.className = "backgroundopacity";
					decDiv.style.position = "absolute";
					decDiv.style.zIndex = 10;
					//decDiv.style.marginTop = "10px";
				    
					innertd.appendChild(decDiv);
					if(OldPrice.innerHTML != "")
					{
						/*innertd.appendChild(document.createTextNode(" ["));
						innertd.appendChild(OldPrice);
						innertd.appendChild(document.createTextNode("]"));*/
					}
										
					//innertd.appendChild(imgFabric);
					innertr.appendChild(innertd);
				 	innertbody.appendChild(innertr);
					innertr =document.createElement('tr');
					innertd=document.createElement('td');
					//innertd.style.width='30px';
					//innertd.style.height='60px';						
				  	innertd.appendChild(Giftcardimg);
				  	Giftcardimg.style.cursor='pointer';
				  	innertd.appendChild(lblId);
				  	innertr.appendChild(innertd);
				  	innertbody.appendChild(innertr);
					innertr =document.createElement('tr');
					innertd=document.createElement('td');
					innertd.align='left';
					var decDiv = document.createElement("DIV");
					decDiv.style.display = "none";
					//lblDescription.style.width = "1050%";
					decDiv.appendChild(lblDescription);
					decDiv.className = "backgroundopacity";
					decDiv.style.position = "absolute";
					decDiv.style.zIndex = 10;
					decDiv.style.marginTop = "-10px";
					//innertr.style.border = "1px soild red"; 
					//decDiv.style.width = "80px";
					innertd.colSpan = "2";
					innertd.appendChild(decDiv);
					innertr.appendChild(innertd);
					
					//innertd.appendChild(imgFabric);
				
					innertbody.appendChild(innertr);
					innertable.appendChild(innertbody);
					tdimg.appendChild(innertable);
					tr.appendChild(tdimg);
					tbody.appendChild(tr);
				   } 
				   
				   if(!isIE)
				   {
						var intCounter = 1;
						intCounter = tr.getElementsByTagName("TD").length;
						intCounter = (intCounter % 5);
						if(intCounter != 0)
						{
							var intLoopIndex = 1;
							if(intCounter == 3)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "143px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 2)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "56px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 1)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "13px";
									tr.appendChild(tempTDD);
								}
							}
						}
				   }
				   else
				   {
						var intCounter = 1;
						intCounter = tr.getElementsByTagName("TD").length;
						intCounter = (intCounter % 5);
						if(intCounter != 0)
						{
							var intLoopIndex = 1;
							if(intCounter == 3)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "143px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 2)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "56px";
									tr.appendChild(tempTDD);
								}
							}
							else if(intCounter == 1)
							{
								for(intLoopIndex = intCounter; intLoopIndex <= 4; intLoopIndex++)
								{
									var tempTDD = document.createElement("TD");
									//tempTDD.appendChild(document.createTextNode(" "));
									tempTDD.innerHTML = "&nbsp;";
									tempTDD.style.width = "13px";
									tr.appendChild(tempTDD);
								}
							}
						}
				   }
				   
				 table1.appendChild(tbody);
				/* if(baseIndex!=lastIndex)
				  {
					fnCheckPageSize(baseIndex,lastIndex,table1); // For Creating empty tables to fill the grid.
				   }*/
				document.getElementById('divAccessories').style.display='';
				document.getElementById('divAccessories').appendChild(table1);
				
				SetNextPreviousLinks();		
							
			}//end display
				
				
				
		function fnCheckPageSize(baseIndex,lastIndex,table1)
		{
			var intlooop;
			var intRowcnt,intinnerloop;
			var cnt=(PageSize)-(lastIndex-baseIndex);
			if((lastIndex-baseIndex)<(PageSize))
			{
				for(intloop=0;intloop< cnt;intloop++)
				{
					var tr;
					intRowcnt=table1.childNodes[0].childNodes.length;
					if(table1.childNodes[0].childNodes[intRowcnt-1].childNodes.length==4)
					{
						 tr= document.createElement('tr');
					}
					else
					{
						tr= table1.childNodes[0].childNodes[intRowcnt-1];
					}
					
					var tdimg=document.createElement('td');
					tdimg.id ="tdimg";
					
					var innertable=document.createElement('table')
				    innertable.setAttribute('cellPadding',2);
					innertable.setAttribute('cellSpacing',0);
					innertable.style.border="1px solid #cccccc";
					innertable.style.width="140";
					innertable.style.height="100";
					innertable.align="left";
					var innertbody=document.createElement('tbody');
					var innertr =document.createElement('tr');
					var innertd=document.createElement('td');
					innertd.align='center';
					innertd.style.width='100';						
				  	innertr.appendChild(innertd);
				  	innertbody.appendChild(innertr);
				  	innertable.appendChild(innertbody);
					tdimg.appendChild(innertable);
					tr.appendChild(tdimg);
					table1.childNodes[0].appendChild(tr);
				}
		
			}
		
		}		
		
		function getNextPage()
		{
		
			if (CurrentpageIndex < PageCount-1)        
			{
				CurrentpageIndex++;
				getAccessoriesAll(1);    // '1' is for next link
			}
			/*else
			{
				getAccessoriesAll(0);
			}*/
			
			if (CurrentpageIndex2 < PageCount2-1)        
			{
				CurrentpageIndex2++;
				getAccessoriesAll(4);    // '4' is for next link
			}
			/*else
			{
				getAccessoriesAll(3);
			}*/
			
	   		return false;
	   			
		 } //End getNextpage() function 
		
		
		function getPreviousPage()
		{
			
			if(CurrentpageIndex > CurrentpageIndex2)
			{
				if(CurrentpageIndex > 0)  
				{
					CurrentpageIndex--;
					getAccessoriesAll(2);  //'2' is for prev link
				}
			}
			else if(CurrentpageIndex < CurrentpageIndex2)
			{
				if(CurrentpageIndex2 > 0)              
				{
					CurrentpageIndex2--;
					getAccessoriesAll(5);  //'5' is for prev link
				}
			}
			else
			{
				if(CurrentpageIndex > 0)  
				{
					CurrentpageIndex--;
					getAccessoriesAll(2);  //'2' is for prev link
				}
				
				if(CurrentpageIndex2 > 0)              
				{
					CurrentpageIndex2--;
					getAccessoriesAll(5);  //'5' is for prev link
				}
			}
			
		  
		   return false;
		}  // End function getPreviousPage
       	
       	function getNextPage2()
		{
	
			if (CurrentpageIndex2 < PageCount2 - 1)        
			{
				CurrentpageIndex2++;
				getAccessoriesAll(4);    // '4' is for next link
			}
	   			return false;
		 } //End getNextpage() function 
		
		
		function getPreviousPage2()
		{         
		  if(CurrentpageIndex2 > 0)              
		  {
		    CurrentpageIndex2--;
		    getAccessoriesAll(5);  //'5' is for prev link
		  }
		  
		   return false;
		}  // End function getPreviousPage
       	
       	
       function	RedirecttoAccessoryDetails(Id,Name,acctype)  
       {
		
		if((intSalesRepId + "").length > 0)
		{
			 if(parseInt(intSalesRepId + "") > 0 )
			 {
				window.location.href="SalesRepAccessories_Detail.aspx?ID=" + Id + '&Name=' + Name + "&Type=" + acctype;
			 }
			 else
			 {
				window.location.href="AccessoriesView.aspx?ID=" + Id + '&Name=' + Name + "&Type=" + acctype;
			 }			 
		}
		else
		{
			 window.location.href="AccessoriesView.aspx?ID=" + Id + '&Name=' + Name + "&Type=" + acctype;
		}          
       }  //End  RedirecttoUserSelect
       
       function GetNextItem(objlink,obj)
       {
		  if(!IsPopupDisplay())
		  {
			var Id;
			var url;
			var objSrc;
	          
			Id =  document.getElementById('hdnAccessoryIdNextEl').previousSibling.value;   // obj.parentNode.getElementsByTagName("INPUT")[0].value;
	          
			url= MainPageURL + "?Function=GetNextcufflink&Id="+ Id +"&link=" + objlink + "&Type=" + AccType ;
			createXmlHttp(1);
			if(Xmlhttp)
				{		
						Xmlhttp.onreadystatechange = function()
													{
														if(Xmlhttp.readyState==4)
															{
																if(Xmlhttp.status==200)
																{
																
																if(Xmlhttp.responseXML)
																	if(Xmlhttp.responseXML.documentElement)
																	{
																		objSrc = Xmlhttp.responseXML.documentElement.getElementsByTagName("tblAccessories")[0]
																		if (objSrc)
																		{
																			if (objSrc.getElementsByTagName("AccessoriesId")[0].firstChild)
																		 		{
																				document.getElementById('hdnAccessoryId').previousSibling.value = objSrc.getElementsByTagName("AccessoriesId")[0].firstChild.nodeValue;
																				}  
																				if (objSrc.getElementsByTagName("AccessoryName")[0].firstChild)
																				{
																					document.getElementById('lblCufflinkName').innerHTML = objSrc.getElementsByTagName("AccessoryName")[0].firstChild.nodeValue;	
																					//document.getElementById('lblTitle').innerHTML = objSrc.getElementsByTagName("AccessoryName")[0].firstChild.nodeValue;   														    
																				}
																				else
																				document.getElementById('lblCufflinkName').innerHTML = "N/A";	
																				
																				if (objSrc.getElementsByTagName("ImagePath")[0].firstChild)
																				{
																					document.getElementById('imgquickview').src = objSrc.getElementsByTagName("ImagePath")[0].firstChild.nodeValue.replace("_1_1","_2_2");															    
																				}
																				
																				try
																				{
																					if (objSrc.getElementsByTagName("Price")[0].firstChild)
																					{
																						document.getElementById('lblPrice').innerHTML = '$'+ formatCurrency(objSrc.getElementsByTagName("Price")[0].firstChild.nodeValue);	
																						document.getElementById('hdnPrice').value = formatCurrency(objSrc.getElementsByTagName("Price")[0].firstChild.nodeValue);													    
																					}
																					else
																					document.getElementById('lblPrice').innerHTML = "N/A";	
																				}
																				catch(ers){};	
																				 
																				try
																				{
																						if (objSrc.getElementsByTagName("Color")[0].firstChild)
																						{
																							document.getElementById('lblColor').innerHTML = objSrc.getElementsByTagName("Color")[0].firstChild.nodeValue;															    
																						}
																						else
																						document.getElementById('lblColor').innerHTML = "N/A";	
																						 
																				} 
																				catch(ers){};
																				
																				try
																				{
																																					
																					if (objSrc.getElementsByTagName("Details")[0].firstChild)
																					{
																						document.getElementById('lblDetails').innerHTML = objSrc.getElementsByTagName("Details")[0].firstChild.nodeValue;															    
																					}
																					else
																					document.getElementById('lblDetails').innerHTML = "N/A";
																				}		
																				catch(ers){};	
																				
																				try
																				{																			 
																						if (objSrc.getElementsByTagName("ExternalProductId")[0].firstChild)
																						{
																						document.getElementById('lblcode').innerHTML = "02BV" + objSrc.getElementsByTagName("ExternalProductId")[0].firstChild.nodeValue;															    
																						}
																						else
																						document.getElementById('lblcode').innerHTML = "N/A";
																				}
																				catch(ers){};		
																					
																				try
																				{																			 
																						if (objSrc.getElementsByTagName("IntName")[0].firstChild)
																						{
																							document.getElementById('lblCufflinkType').innerHTML = objSrc.getElementsByTagName("IntName")[0].firstChild.nodeValue;															    
																						}
																						else
																						document.getElementById('lblCufflinkType').innerHTML = "N/A";
																				}
																				catch(ers){};
																				
																				try
																				{																			 
																						if (objSrc.getElementsByTagName("AccessoryCategoryId")[0].firstChild)
																						{
																							if(objSrc.getElementsByTagName("AccessoryCategoryId")[0].firstChild.nodeValue.toLowerCase().indexOf("2") > -1)
																							{
																								AccType = "cufflink";
																							}
																							else
																							{
																								AccType = "silkknot";
																							}
																							
																						}
																						
																				}
																				catch(ers){};	
																		 	
																		}  
																	   
																	}	
																}
																
															}
						                             
						                             
													}	
						
						if( (!window.XMLHttpRequest)||(isIE) )   //(document.all)
						{   
							Xmlhttp.open("POST", url, true);
							Xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
						}
						else
						{
							Xmlhttp.open("GET", url, true);
						} 
						Xmlhttp.send(null);
					}
      			return false;
		  }
		  else
		  {
			return false;
		  }
    
       }
       
       var imageprt;    
       function ShowLageView(obj)
       {
			if(!IsPopupDisplay())
			{
				document.getElementById('divQuickFabric').style.display = '';
				document.getElementById("lblCName").innerHTML = document.getElementById("lblCufflinkName").innerHTML;
				document.getElementById('LargeImage').src =  obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("IMG")[0].src.replace("_2_2","_3_3");
				//document.getElementById('LargeImage').setAttribute("tempsrc",obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("IMG")[0].src.replace("_2_2","_3_3"));
				imageprt = setInterval("AssignImage()",10);  
			}
			else
			{
				return false;
			}     
       }
       
       function AssignImage()
       {
			document.getElementById('LargeImage').src = document.getElementById('LargeImage').src;
			
			clearInterval(imageprt);
       }
      
	function IsPopupDisplay()
	{
		var intDisplayCount = 0;
		if(document.getElementById("divAlert").style.display == "")
		{
			intDisplayCount++;
		}
		if(document.getElementById("divconfirmation").style.display == "")
		{
			intDisplayCount++;
		}
		if(document.getElementById("divQuickFabric").style.display == "")
		{
			intDisplayCount++;
		}
		if(intDisplayCount > 0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
