﻿// JScript File
var obj,obj1,obj2,obj3,obj4,obj5;


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 + '.' + cents);
}
//Ajax function for calulating the Shipping cost from inc-Shippingmenthod.asp


function GetShipCostViaAJAX(idbCart)
{
	var shipment;

	shipment=document.getElementById("ordshipment").value;
	//alert(txtamt);
			
	try
	{
		//	obj = new ActiveXObject("Msxml2.XMLHTTP");
		obj=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj = null;
		}
	}
	if(obj!=null)
	{
		obj.onreadystatechange = ProcessResponse;

		//alert("getShipCost.asp?shipment="+ shipment +"&idbcart="+ idbCart  );
		
		obj.open("GET","getShipCost.asp?shipment="+ shipment +"&idbcart="+ idbCart,true);
		obj.send(null);         
	}
	return false;
}


function ProcessResponse()
{
	if(obj.readyState == 4)
	{
	//alert(obj.responseText);
		if(obj.status == 200)
		{
			var dsRoot=obj.responseXML.documentElement;  
			var shipcost = dsRoot.getElementsByTagName('ShipAmount');
			var shipdays = dsRoot.getElementsByTagName('ShipDays');
			var prdTitle = dsRoot.getElementsByTagName('ProductTitle');  
			var shipType  = dsRoot.getElementsByTagName('ShipType');       
			var strPrdsTitle,strShipType;	
							
			//alert(dsRoot.getElementsByTagName('ShipAmount'));
			//alert(shipcost[0].text);
			try
			{
				if(shipcost[0].innerText != undefined || shipcost[0].text != undefined )
				{
				text=(shipcost[0].innerText || shipcost[0].text);
				}
				else
				{
				text=(shipcost[0].textContent );
				}
				window.document.getElementById("divShipCharge").innerHTML=formatCurrency(text);
			}
			catch(e)
			{
				// alert(e)
				window.document.getElementById("divShipCharge").innerHTML="0.00";
			}
			try
			{
				if(prdTitle[0].innerText != undefined || prdTitle[0].text != undefined )
				{
				strPrdsTitle=(prdTitle[0].innerText || prdTitle[0].text);
				}
				else
				{
				strPrdsTitle=(prdTitle[0].textContent );
				}
			}
			catch(e)
			{
				   // alert(e)
			}
			try
			{
				if(shipType[0].innerText != undefined || shipType[0].text != undefined )
				{
				strShipType=(shipType[0].innerText || shipType[0].text);
				}
				else
				{
				strShipType=(shipType[0].textContent );
				}
			}
			catch(e)
			{
				   // alert(e)
			}
			var txtamt;
			txtamt=document.getElementById("divShipTax").innerHTML;
			txtamt=txtamt.replace("$","")
			txtamt=txtamt.replace(",","")
			
			var txtSubTotal;
			txtSubTotal=document.getElementById("divShipSubtotal").innerHTML;
			txtSubTotal=txtSubTotal.replace("$","")
			txtSubTotal=txtSubTotal.replace(",","")
			
			var text,newGTotal; 
			
			newGTotal=parseFloat(text)+	parseFloat(txtSubTotal)	+ parseFloat(txtamt);
			
		    // alert("text"+text);
		    // alert("txtSubTotal"+txtSubTotal);
		    // alert("txtamt"+document.getElementById("divShipTax").innerHTML);
			
			newGTotal=formatCurrency(newGTotal)
			document.getElementById("divShipGDTotal").innerHTML=newGTotal;
			//document.getElementById("divShipGDTotal").value=newGTotal;
			
			document.getElementById("txtOrdSubTotal").value=txtSubTotal;
			document.getElementById("txtOrdTax").value=txtamt;
			document.getElementById("txtOrdShipCost").value=text;
			document.getElementById("txtOrdGdTotal").value=newGTotal;
			
		    //Changing the shipping details table based on the selected shippment
			
			var strShipTab;
			strShipTab="";
			strShipTab="<table border=0 width=98% >";
			strShipTab=strShipTab+"<tr><td width=200><b>Item</b></td><td><b>Shipping</b></td><td><b>Cost</b></td></tr>";
			strShipTab=strShipTab+"<tr><td>"+strPrdsTitle+"</td><td>"+strShipType+"</td><td>"+formatCurrency(text)+"</td></tr>";
			strShipTab=strShipTab+"</table>";
			document.getElementById("txtShippingTable").value=strShipTab;
			//document.getElementById("divOrdShipDetails").innerHTML=strShipTab;
			
		    //End of that
			
			
		    //Changing the order details in the Order section(last portion)
			 document.getElementById("divOrdShipCost").innerHTML=formatCurrency(text);
			 document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newGTotal);
		     //End of that
		}
	}
}
			
	
			
function GetTaxViaAJAX()
{
	
	
		        
	 var billState;
	 billState=document.getElementById("billstateCode").value;
	
	
	  
	 var txtSubTot;
	 txtSubTot=document.getElementById("txtOrdSubTotal").value;
	 txtSubTot=txtSubTot.replace("$","")
	 txtSubTot=txtSubTot.replace(",","")
				
	 var newDTTotal,strTaxAmt,strShipAmt;

	 newDTTotal=document.getElementById("divShipGDTotal").innerHTML
	 newDTTotal=newDTTotal.replace("$","")
	 newDTTotal=newDTTotal.replace(",","")
	  
	 strTaxAmt=document.getElementById("divShipTax").innerHTML;
	 strTaxAmt=strTaxAmt.replace("$","")
	 strTaxAmt=strTaxAmt.replace(",","")
	  
	 //strShipAmt=document.getElementById("divShipCharge").innerHTML;
	 //strShipAmt=strShipAmt.replace("$","")
	 //strShipAmt=strShipAmt.replace(",","")
		  
	 if (strTaxAmt=="") 
		 strTaxAmt=0
	  
	 //if (strShipAmt=="") 
		 //strShipAmt=0
	  
	 if (newDTTotal=="") 
		 newDTTotal=0
				  
	// alert("txtSubTot" +txtSubTot);  
	 //alert("newDTTotal" +newDTTotal);
	 //alert("strTaxAmt" +strTaxAmt);
	 
	 
	  
	 // newDTTotal=parseFloat(newDTTotal)-(parseFloat(strTaxAmt)+parseFloat(strShipAmt));
	 newDTTotal=parseFloat(newDTTotal)-parseFloat(strTaxAmt);
	 
	 

	 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
	 document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);		  
				  
	 document.getElementById("txtOrdTax").value="0.00";
	 document.getElementById("txtOrdGdTotal").value=parseFloat(newDTTotal);
	  
	 document.getElementById("divShipTax").innerHTML="$0.00";
	 document.getElementById("divOrdTax").innerHTML="$0.00";			
						
				 
	try
	{
		//	obj = new ActiveXObject("Msxml2.XMLHTTP");
		obj1=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj1 = null;
		}
	}
	if(obj1!=null)
	{
		obj1.onreadystatechange = ProcessResponseTax; 
		//alert("getTaxs.asp?pbillState="+ billState+"&pSubTotal="+txtSubTot);
		obj1.open("GET","getTaxs.asp?pbillState="+ billState+"&pSubTotal="+txtSubTot ,true);
		obj1.send(null);         
	}
	return false;
}

function ProcessResponseTax()
{
	if(obj1.readyState == 4)
	{
		//alert(obj1.responseText);
		if(obj1.status == 200)
		{
			var dsRoot=obj1.responseXML.documentElement;  
			var taxcost         = dsRoot.getElementsByTagName('Tax');
			//var unitshipcost    = dsRoot.getElementsByTagName('unitshipcost');
			//var shipcost        = dsRoot.getElementsByTagName('shipcost');
			//var minimum_shipcost= dsRoot.getElementsByTagName('minimum_shipcost');						
			
			var strPrdsTitle,strShipType,text;	
			var pShipCost=0,pMinimum_shipcost=0,pUnitShipCost = 0;			
			
			try
			{

				if(taxcost[0].innerText != undefined || taxcost[0].text != undefined )
				{
				text=(taxcost[0].innerText || taxcost[0].text);
				}
				else
				{
				text=(taxcost[0].textContent );
				}
				window.document.getElementById("divShipTax").innerHTML=formatCurrency(text);
			}
			catch(e)
			{
				window.document.getElementById("divShipTax").innerHTML="$0.00";
			}
			//Unit ShipCost (per sql ft)=========
			/*try
			{
				if(unitshipcost[0].innerText != undefined || unitshipcost[0].text != undefined )
				{
					pUnitShipCost=(unitshipcost[0].innerText || unitshipcost[0].text);
				}
				else
				{
					pUnitShipCost=(unitshipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pUnitShipCost = 0
			}*/
			//Unit ShipCost (per sql ft)=========
			
			//ship cost==================
			/*try
			{
				if(shipcost[0].innerText != undefined || shipcost[0].text != undefined )
				{
					pShipCost=(shipcost[0].innerText || shipcost[0].text);
				}
				else
				{
					pShipCost=(shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pShipCost = 0
			}*/
			//ship cost==================
			//minimum ship cost==========
			/*try
			{
				if(minimum_shipcost[0].innerText != undefined || minimum_shipcost[0].text != undefined )
				{
					pMinimum_shipcost=(minimum_shipcost[0].innerText || minimum_shipcost[0].text);
				}
				else
				{
					pMinimum_shipcost=(minimum_shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pMinimum_shipcost = 0
			}*/
			//minimum ship cost==================
			
			var txtamt;
			txtamt=document.getElementById("divShipTax").innerHTML;
			txtamt=txtamt.replace("$","")
			txtamt=txtamt.replace(",","")
			
			var txtSubTotal;
			txtSubTotal=document.getElementById("divShipSubtotal").innerHTML;
			txtSubTotal=txtSubTotal.replace("$","")
			txtSubTotal=txtSubTotal.replace(",","")
			
			var newGTotals; 
			newGTotals=document.getElementById("divShipGDTotal").innerHTML;
			newGTotals=newGTotals.replace("$","")
			newGTotals=newGTotals.replace(",","")
			
			//code added by kavitha to change shipping calc on 21-07-07
			//==============================
			//window.document.getElementById("divShipCharge").innerHTML=formatCurrency(pShipCost);
			//document.getElementById("txtOrdShipCost").value=pShipCost;
			//window.document.getElementById("divOrdShipCost").innerHTML=formatCurrency(pShipCost);
			
			
			/*var strShipTab;
			strShipTab="";
			var strPrdsTitle = window.document.getElementById("PrdsTitle").value
			var strFreeTitle = window.document.getElementById("FreeTitle").value
			strShipType = "Standard Shipping"
			strShipTab="<table border=0 width=98% >";
			strShipTab=strShipTab+"<tr><td width=200 valign='top'><b>Item</b></td><td valign='top'><b>Shipping</b></td><td><b>Cost</b></td></tr>";
			strShipTab=strShipTab+"<tr><td valign='top'>"+strPrdsTitle+"</td><td valign='top'>"+strShipType+"</td><td valign='top'>"+formatCurrency(pShipCost)+"</td></tr>";
			if (strFreeTitle != "")
			{
				strShipTab=strShipTab+"<tr><td>"+strFreeTitle+"</td><td>Free Shipping</td><td>"+formatCurrency(0)+"</td></tr>";
			}
			strShipTab=strShipTab+"</table>";
			document.getElementById("txtShippingTable").value=strShipTab;
			document.getElementById("divOrdShipDetails").innerHTML=strShipTab;*/
			
			//==============================
			//newGTotals=parseFloat(text)+ parseFloat(pShipCost) + parseFloat(newGTotals);
			
			//alert(text);
			newGTotals=parseFloat(text) + parseFloat(newGTotals);
			  
			
			newGTotal=formatCurrency(newGTotals)
			//document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newGTotals);
			
			document.getElementById("txtOrdSubTotal").value=txtSubTotal;
			document.getElementById("txtOrdTax").value=text;
			document.getElementById("txtOrdGdTotal").value=newGTotals;
			
			
		 	//Changing the order details in the Order section(last portion)
			 document.getElementById("divOrdTax").innerHTML=formatCurrency(text);
			 document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newGTotals);
			 
			 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newGTotals);
			 //End of that
		}
	}
}
			
function GetTaxViaAJAXCart()
{
		        
	 var billState;
	 billState=document.getElementById("billstateCode").value;
	
	
	 
	 var txtSubTot;
	 txtSubTot=document.getElementById("txtOrdSubTotal").value;
	 txtSubTot=txtSubTot.replace("$","")
	 txtSubTot=txtSubTot.replace(",","")
				
	 var newDTTotal,strTaxAmt,strShipAmt;

	 newDTTotal=document.getElementById("divShipGDTotal").innerHTML
	 newDTTotal=newDTTotal.replace("$","")
	 newDTTotal=newDTTotal.replace(",","")
	  
	 strTaxAmt=document.getElementById("divShipTax").innerHTML;
	 strTaxAmt=strTaxAmt.replace("$","")
	 strTaxAmt=strTaxAmt.replace(",","")
	  
			  
	 if (strTaxAmt=="") 
		 strTaxAmt=0
	  
	 if (newDTTotal=="") 
		 newDTTotal=0
				  
	 newDTTotal=parseFloat(newDTTotal)-parseFloat(strTaxAmt);
	 
	

	

	 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
	 document.getElementById("txtOrdTax").value="0.00";
	 document.getElementById("txtOrdGdTotal").value=parseFloat(newDTTotal);
	 document.getElementById("divShipTax").innerHTML="$0.00";
	 
		//alert(document.getElementById("txtOrdSubTotal").value);					
				 
	try
	{
		//	obj = new ActiveXObject("Msxml2.XMLHTTP");
		obj1=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj1 = null;
		}
	}
	if(obj1!=null)
	{
		obj1.onreadystatechange = ProcessResponseTaxCart; 
		 
		obj1.open("GET","getTaxs.asp?pbillState="+ billState+"&pSubTotal="+txtSubTot ,true);
		obj1.send(null);         
	}
	return false;
}

function ProcessResponseTaxCart()
{
	if(obj1.readyState == 4)
	{
		//alert(obj1.responseText);
				
		if(obj1.status == 200)
		{
			var dsRoot=obj1.responseXML.documentElement;  
			var taxcost         = dsRoot.getElementsByTagName('Tax');
			
			var strPrdsTitle,strShipType,text;	
			var pShipCost=0,pMinimum_shipcost=0,pUnitShipCost = 0;			
			
			try
			{

				if(taxcost[0].innerText != undefined || taxcost[0].text != undefined )
				{
				text=(taxcost[0].innerText || taxcost[0].text);
				}
				else
				{
				text=(taxcost[0].textContent );
				}
				window.document.getElementById("divShipTax").innerHTML=formatCurrency(text);
			}
			catch(e)
			{
				window.document.getElementById("divShipTax").innerHTML="$0.00";
			}
			
			
			
			var txtamt;
			txtamt=document.getElementById("divShipTax").innerHTML;
			
			txtamt=txtamt.replace("$","")
			txtamt=txtamt.replace(",","")
			
			var txtSubTotal;
			 txtSubTotal=document.getElementById("txtOrdSubTotal").value;
			//alert(txtSubTotal);
			 txtSubTotal=txtSubTotal.replace("$","")
			 txtSubTotal=txtSubTotal.replace(",","")
			// alert(document.getElementById("txtOrdSubTotal").value);					

			
			var newGTotals,newGTotals1; 
			newGTotals=document.getElementById("divShipGDTotal").innerHTML;
			newGTotals=newGTotals.replace("$","")
			newGTotals=newGTotals.replace(",","")
			
			
			
			newGTotals1=parseFloat(text) + parseFloat(txtSubTotal);
		 
			//alert(newGTotals1);
			newGTotals1=formatCurrency(newGTotals1)
			
			
			
			
		 	//Changing the order details in the Order section(last portion)
			// document.getElementById("divOrdTax").innerHTML=formatCurrency(text);
			 //document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newGTotals);
			 
			
			 // document.getElementById("txtOrdSubTotal").innerHTML=formatCurrency(newGTotals1);
			 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newGTotals1);
			 
			 
			 //End of that
		}
	}
}

function ProcessResponseTaxCartold()
{
	if(obj1.readyState == 4)
	{
		//alert(obj1.responseText);
		if(obj1.status == 200)
		{
			var dsRoot=obj1.responseXML.documentElement;  
			var taxcost         = dsRoot.getElementsByTagName('Tax');
			
			var strPrdsTitle,strShipType,text;	
			var pShipCost=0,pMinimum_shipcost=0,pUnitShipCost = 0;			
			
			try
			{

				if(taxcost[0].innerText != undefined || taxcost[0].text != undefined )
				{
				text=(taxcost[0].innerText || taxcost[0].text);
				}
				else
				{
				text=(taxcost[0].textContent );
				}
				window.document.getElementById("divShipTax").innerHTML=formatCurrency(text);
			}
			catch(e)
			{
				window.document.getElementById("divShipTax").innerHTML="$0.00";
			}
			
			
			
			var txtamt;
			txtamt=document.getElementById("divShipTax").innerHTML;
			
			txtamt=txtamt.replace("$","")
			txtamt=txtamt.replace(",","")
			
			var txtSubTotal;
			txtSubTotal=document.getElementById("divShipSubtotal").innerHTML;
			
			txtSubTotal=txtSubTotal.replace("$","")
			txtSubTotal=txtSubTotal.replace(",","")
			
			var newGTotals,newGTotals1; 
			newGTotals=document.getElementById("divShipGDTotal").innerHTML;
			newGTotals=newGTotals.replace("$","")
			newGTotals=newGTotals.replace(",","")
			
			newGTotals=parseFloat(text) + parseFloat(newGTotals);
			
			newGTotals1=parseFloat(text) + parseFloat(txtSubTotal);
		 
			newGTotal=formatCurrency(newGTotals)
			newGTotals1==formatCurrency(newGTotals1)
			
			document.getElementById("txtOrdSubTotal").value=txtSubTotal;
			document.getElementById("txtOrdTax").value=text;
			document.getElementById("txtOrdGdTotal").value=newGTotals;
			
			
		 	//Changing the order details in the Order section(last portion)
			// document.getElementById("divOrdTax").innerHTML=formatCurrency(text);
			 //document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newGTotals);
			 
			 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newGTotals);
			  document.getElementById("divShipGDTotal1").innerHTML=formatCurrency(newGTotals1);
			 
			 //End of that
		}
	}
}
			

function GetShipViaAJAX()
{
		        
	 var shipState;
	 shipState=document.getElementById("shpStateCode").value;
	 
	 var pickuplocation;
	 pickuplocation=document.getElementById("pickuplocation").value;
	 
	 var commship;
	// if (document.getElementById("commship").checked)
	 	//commship=1;
	 //else
	commship=0;
	 
	 var txtSubTot;
	 txtSubTot=document.getElementById("txtOrdSubTotal").value;
	 txtSubTot=txtSubTot.replace("$","")
	 txtSubTot=txtSubTot.replace(",","")
				
	 var newDTTotal,strTaxAmt,strShipAmt;

	 newDTTotal=document.getElementById("divShipGDTotal").innerHTML
	 newDTTotal=newDTTotal.replace("$","")
	 newDTTotal=newDTTotal.replace(",","")
	  
	 strShipAmt=document.getElementById("divShipCharge").innerHTML;
	 strShipAmt=strShipAmt.replace("$","")
	 strShipAmt=strShipAmt.replace(",","")
	  
	 if (strShipAmt=="") 
		 strShipAmt=0
	  
	 if (newDTTotal=="") 
		 newDTTotal=0
				  
	 newDTTotal=parseFloat(newDTTotal)-parseFloat(strShipAmt);
	 
	 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
	 document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);		  
	 document.getElementById("txtOrdGdTotal").value=parseFloat(newDTTotal);
				 
	try
	{
		//	obj = new ActiveXObject("Msxml2.XMLHTTP");
		obj1=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj1 = null;
		}
	}
	if(obj1!=null)
	{
		obj1.onreadystatechange = ProcessResponseShpCost;
		
		//alert("getTaxs.asp?pshipState="+ shipState+"&pSubTotal="+txtSubTot);
		obj1.open("GET","getSupShipCost.asp?pshipState="+ shipState+"&pSubTotal="+txtSubTot+"&pcommship="+commship+"&pickuploc="+pickuplocation ,true);
		
		obj1.send(null);         
	}
	return false;
}




function ProcessResponseShpCost()
{
	if(obj1.readyState == 4)
	{
		//alert(obj1.responseText);
		if(obj1.status == 200)
		{
			var dsRoot=obj1.responseXML.documentElement;  
			//var taxcost         = dsRoot.getElementsByTagName('Tax');
			var unitshipcost    = dsRoot.getElementsByTagName('unitshipcost');
			var shipcost        = dsRoot.getElementsByTagName('shipcost');
			var minimum_shipcost= dsRoot.getElementsByTagName('minimum_shipcost');		
			var commship		= dsRoot.getElementsByTagName('commship');				
			var shipDiscount		= dsRoot.getElementsByTagName('shipDiscount');				
			
			var strPrdsTitle,strShipType,text;	
			var pShipCost=0,pMinimum_shipcost=0,pUnitShipCost = 0,pcommship=0,pShipDiscount=0;
			
			try
			{

				if(commship[0].innerText != undefined || commship[0].text != undefined )
				{
				pcommship=(commship[0].innerText || commship[0].text);
				}
				else
				{
				pcommship=(commship[0].textContent );
				}
				//window.document.getElementById("divShipTax").innerHTML=formatCurrency(text);
			}
			catch(e)
			{
				pcommship=0;
			}
			
			
			try
			{

				if(shipDiscount[0].innerText != undefined || shipDiscount[0].text != undefined )
				{
				pshipDiscount=(shipDiscount[0].innerText || shipDiscount[0].text);
				}
				else
				{
				pshipDiscount=(shipDiscount[0].textContent );
				}
				//window.document.getElementById("divShipTax").innerHTML=formatCurrency(text);
			}
			catch(e)
			{
				pshipDiscount=0;
			}
			
			//Unit ShipCost (per sql ft)=========
			try
			{
				if(unitshipcost[0].innerText != undefined || unitshipcost[0].text != undefined )
				{
					pUnitShipCost=(unitshipcost[0].innerText || unitshipcost[0].text);
				}
				else
				{
					pUnitShipCost=(unitshipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pUnitShipCost = 0
			}
			//Unit ShipCost (per sql ft)=========
			
			//ship cost==================
			try
			{
				if(shipcost[0].innerText != undefined || shipcost[0].text != undefined )
				{
					pShipCost=(shipcost[0].innerText || shipcost[0].text);
				}
				else
				{
					pShipCost=(shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pShipCost = 0
			}
			//ship cost==================
			//minimum ship cost==========
			try
			{
				if(minimum_shipcost[0].innerText != undefined || minimum_shipcost[0].text != undefined )
				{
					pMinimum_shipcost=(minimum_shipcost[0].innerText || minimum_shipcost[0].text);
				}
				else
				{
					pMinimum_shipcost=(minimum_shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pMinimum_shipcost = 0
			}

			//To discount the amount for commercial Shipping 
			if (pcommship==1)
			{
				
				if (parseFloat(pShipCost) > parseFloat(pShipDiscount))
				{
					pShipCost=(parseFloat(pShipCost) - parseFloat(pshipDiscount));
				}
				else
				{
					pShipCost=0;
				}
			}
			
			
			
			//minimum ship cost==================
					
			//var txtamt;
			//txtamt=document.getElementById("divShipTax").innerHTML;
			//txtamt=txtamt.replace("$","")
			//txtamt=txtamt.replace(",","")
			
			var txtSubTotal;
			txtSubTotal=document.getElementById("divShipSubtotal").innerHTML;
			txtSubTotal=txtSubTotal.replace("$","")
			txtSubTotal=txtSubTotal.replace(",","")
			
			var newGTotals; 
			newGTotals=document.getElementById("divShipGDTotal").innerHTML;
			newGTotals=newGTotals.replace("$","")
			newGTotals=newGTotals.replace(",","")
			
			//code added by kavitha to change shipping calc on 21-07-07
			//==============================
			window.document.getElementById("divShipCharge").innerHTML=formatCurrency(pShipCost);
			document.getElementById("txtOrdShipCost").value=pShipCost;
			window.document.getElementById("divOrdShipCost").innerHTML=formatCurrency(pShipCost);
			
			var strShipTab;
			strShipTab="";
			var strPrdsTitle = window.document.getElementById("PrdsTitle").value
			var strFreeTitle = window.document.getElementById("FreeTitle").value
			strShipType = "Standard Shipping"
			strShipTab="<table border=0 width=98% >";
			strShipTab=strShipTab+"<tr><td width=200><b>Item</b></td><td><b>Shipping</b></td><td><b>Cost</b></td></tr>";
			strShipTab=strShipTab+"<tr><td>"+strPrdsTitle+"</td><td>"+strShipType+"</td><td>"+formatCurrency(pShipCost)+"</td></tr>";
			if (strFreeTitle != "")
			{
				strShipTab=strShipTab+"<tr><td>"+strFreeTitle+"</td><td>Free Shipping</td><td>"+formatCurrency(0)+"</td></tr>";
			}
			strShipTab=strShipTab+"</table>";
			document.getElementById("txtShippingTable").value=strShipTab;
			document.getElementById("divOrdShipDetails").innerHTML=strShipTab;
			
			//==============================
			//alert("text"+text);
			//alert("pShipCost"+pShipCost);
		   //alert("newGTotals"+newGTotals);
		    //alert(document.getElementById("txtOrdTax").value);
		   
		   
			//newGTotals=parseFloat(text)+ parseFloat(pShipCost) + parseFloat(newGTotals);
			newGTotals= parseFloat(pShipCost) + parseFloat(newGTotals);
			
			newGTotal=formatCurrency(newGTotals)
			document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newGTotals);
			
			document.getElementById("txtOrdSubTotal").value=txtSubTotal;
			//document.getElementById("txtOrdTax").value=text;
			document.getElementById("txtOrdGdTotal").value=newGTotals;
			
		 	//Changing the order details in the Order section(last portion)
			// document.getElementById("divOrdTax").innerHTML=formatCurrency(text);
			document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newGTotals);
			//End of that
		}
	}
}

 

function GetTaxViaAJAXCart_old()


{
		   
	 var shipState;
	 shipState=document.getElementById("billstateCode").value;
	 
	 /*var pickuplocation;
	 pickuplocation=document.getElementById("pickuplocation").value;
*/	 
	 var txtSubTot;
	 txtSubTot=document.getElementById("txtOrdSubTotal").value;
	 txtSubTot=txtSubTot.replace("$","")
	 txtSubTot=txtSubTot.replace(",","")
				
	 var newDTTotal,strTaxAmt,strShipAmt;

	 newDTTotal=document.getElementById("divShipGDTotal").innerHTML
	 newDTTotal=newDTTotal.replace("$","")
	 newDTTotal=newDTTotal.replace(",","")

	 strShipAmt=document.getElementById("divShipCharge").innerHTML;
	 strShipAmt=strShipAmt.replace("$","")
	 strShipAmt=strShipAmt.replace(",","")
		
	 if (strShipAmt=="") 
		 strShipAmt=0
	  
	 if (newDTTotal=="") 
		 newDTTotal=0
				  
		  
	// alert("newDTTotal" +newDTTotal);
	  
	 newDTTotal=parseFloat(newDTTotal)-parseFloat(strShipAmt);
	 

	 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
	 //document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);		  
				  
	 
	 document.getElementById("txtOrdGdTotal").value=parseFloat(newDTTotal);
	  
	
						
				 
	try
	{
		//	obj = new ActiveXObject("Msxml2.XMLHTTP");
		obj1=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj1 = null;
		}
	}
	if(obj1!=null)
	{
		obj1.onreadystatechange = ProcessResponseShpCostCart;
		
		alert("getSupShipCost.asp?pshipState="+ shipState+"&pSubTotal="+txtSubTot);
		obj1.open("GET","getSupShipCost.asp?pshipState="+ shipState+"&pSubTotal="+txtSubTot ,true);
		obj1.send(null);         
	}
	return false;
}




function ProcessResponseShpCostCart()
{
	if(obj1.readyState == 4)
	{
		//alert(obj1.responseText);
		if(obj1.status == 200)
		{
			var dsRoot=obj1.responseXML.documentElement;  
			//var taxcost         = dsRoot.getElementsByTagName('Tax');
			var unitshipcost    = dsRoot.getElementsByTagName('unitshipcost');
			var shipcost        = dsRoot.getElementsByTagName('shipcost');
			var minimum_shipcost= dsRoot.getElementsByTagName('minimum_shipcost');						
			
			var strPrdsTitle,strShipType,text;	
			var pShipCost=0,pMinimum_shipcost=0,pUnitShipCost = 0;			
			
			
			try
			{
				if(unitshipcost[0].innerText != undefined || unitshipcost[0].text != undefined )
				{
					pUnitShipCost=(unitshipcost[0].innerText || unitshipcost[0].text);
				}
				else
				{
					pUnitShipCost=(unitshipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pUnitShipCost = 0
			}
			//Unit ShipCost (per sql ft)=========
			
			//ship cost==================
			try
			{
				if(shipcost[0].innerText != undefined || shipcost[0].text != undefined )
				{
					pShipCost=(shipcost[0].innerText || shipcost[0].text);
				}
				else
				{
					pShipCost=(shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pShipCost = 0
			}
			//ship cost==================
			//minimum ship cost==========
			try
			{
				if(minimum_shipcost[0].innerText != undefined || minimum_shipcost[0].text != undefined )
				{
					pMinimum_shipcost=(minimum_shipcost[0].innerText || minimum_shipcost[0].text);
				}
				else
				{
					pMinimum_shipcost=(minimum_shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pMinimum_shipcost = 0
			}
			
			
			var txtSubTotal;
			txtSubTotal=document.getElementById("divShipSubtotal").innerHTML;
			txtSubTotal=txtSubTotal.replace("$","")
			txtSubTotal=txtSubTotal.replace(",","")
			
			var newGTotals; 
			newGTotals=document.getElementById("divShipGDTotal").innerHTML;
			newGTotals=newGTotals.replace("$","")
			newGTotals=newGTotals.replace(",","")
			
			//code added by kavitha to change shipping calc on 21-07-07
			//==============================
			window.document.getElementById("divShipCharge").innerHTML=formatCurrency(pShipCost);
			document.getElementById("txtOrdShipCost").value=pShipCost;
			//window.document.getElementById("divOrdShipCost").innerHTML=formatCurrency(pShipCost);
			
			var strShipTab;
			strShipTab="";
			//var strPrdsTitle = window.document.getElementById("PrdsTitle").value
			//var strFreeTitle = window.document.getElementById("FreeTitle").value
			//strShipType = "Standard Shipping"
			//strShipTab="<table border=0 width=98% >";
			//strShipTab=strShipTab+"<tr><td width=200><b>Item</b></td><td><b>Shipping</b></td><td><b>Cost</b></td></tr>";
			//strShipTab=strShipTab+"<tr><td>"+strPrdsTitle+"</td><td>"+strShipType+"</td><td>"+formatCurrency(pShipCost)+"</td></tr>";
			//if (strFreeTitle != "")
			//{
				//strShipTab=strShipTab+"<tr><td>"+strFreeTitle+"</td><td>Free Shipping</td><td>"+formatCurrency(0)+"</td></tr>";
			//}
			//strShipTab=strShipTab+"</table>";
			//document.getElementById("txtShippingTable").value=strShipTab;
			//document.getElementById("divOrdShipDetails").innerHTML=strShipTab;
			
			//==============================
			//alert("text"+text);
			//alert("pShipCost"+pShipCost);
		   //alert("newGTotals"+newGTotals);
		    //alert(document.getElementById("txtOrdTax").value);
		   
		   
			//newGTotals=parseFloat(text)+ parseFloat(pShipCost) + parseFloat(newGTotals);
			newGTotals= parseFloat(pShipCost) + parseFloat(newGTotals);
			
			newGTotal=formatCurrency(newGTotals)
			document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newGTotals);
			
			document.getElementById("txtOrdSubTotal").value=txtSubTotal;
			//document.getElementById("txtOrdTax").value=text;
			document.getElementById("txtOrdGdTotal").value=newGTotals;
			
		 	//Changing the order details in the Order section(last portion)
			// document.getElementById("divOrdTax").innerHTML=formatCurrency(text);
			//document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newGTotals);
			//End of that
		}
	}
}




//Function for assining billing address to shipping address
function assign_values_not(frmCustOrder, pIdDbSessionCart)
{
  if(document.frmCustOrder.separateShipping.checked)
   {
	frmCustOrder.shipname.value=document.frmCustOrder.billname.value;
			frmCustOrder.shiplastname.value=document.frmCustOrder.billlastname.value;
			frmCustOrder.shpPhone.value=document.frmCustOrder.billphone.value;
			frmCustOrder.shpAddress1.value=document.frmCustOrder.billaddress1.value;
			frmCustOrder.shpAddress2.value=document.frmCustOrder.billaddress2.value;
			frmCustOrder.shpCity.value=document.frmCustOrder.billcity.value;
			frmCustOrder.shipProvince.value=document.frmCustOrder.billProvince.value;
			//frmCustOrder.shpState.value=document.frmCustOrder.billstate.value;
			frmCustOrder.shpZip.value=document.frmCustOrder.billzip.value;
			frmCustOrder.shpStateCode.value=document.frmCustOrder.billstateCode.value;
			frmCustOrder.shpCountryCode.value=document.frmCustOrder.billcountryCode.value;
	
  }
  else
  {
 frmCustOrder.shipname.value="";
		  frmCustOrder.shiplastname.value="";
		  frmCustOrder.shpPhone.value="";
		  frmCustOrder.shpAddress1.value="";
		  frmCustOrder.shpAddress2.value="";
		  frmCustOrder.shipProvince.value="";
		  frmCustOrder.shpCity.value="";
		  //frmCustOrder.shpState.value="";
		  frmCustOrder.shpZip.value="";
		  frmCustOrder.shpStateCode.value="";
		  frmCustOrder.shpCountryCode.value="US";
  }

  check_country(document.frmCustOrder, pIdDbSessionCart)

}

//88888888888888888888888888888888888888888888888888888888888

//Function for assining billing address to shipping address
			
function assign_values(frmCustOrder,idcust,subscriber)
      {
	  pguest=document.frmCustOrder.hidGuestFlag.value;
      if(document.frmCustOrder.separateShipping.checked)
	  {
			frmCustOrder.shipname.value=document.frmCustOrder.billname.value;
			frmCustOrder.shiplastname.value=document.frmCustOrder.billlastname.value;
			frmCustOrder.shpPhone.value=document.frmCustOrder.billphone.value;
			frmCustOrder.shpAddress1.value=document.frmCustOrder.billaddress1.value;
			frmCustOrder.shpAddress2.value=document.frmCustOrder.billaddress2.value;
			frmCustOrder.shpCity.value=document.frmCustOrder.billcity.value;
			//frmCustOrder.shpState.value=document.frmCustOrder.billstate.value;
			frmCustOrder.shpZip.value=document.frmCustOrder.billzip.value;
			frmCustOrder.shpStateCode.value=document.frmCustOrder.billstateCode.value;
			frmCustOrder.shpCountryCode.value=document.frmCustOrder.billcountryCode.value;
			if (pguest!=1)
			{
				if(document.getElementById("addresstype").checked)
				 document.getElementById("addresstype").checked=false;
			}
			
			if(idcust != 0)
			{
				frmCustOrder.addresslist.selectedIndex=0;
				frmCustOrder.addresstype.checked=false;
				document.getElementById("addressbook").style.visibility='hidden';
				document.getElementById("addressbook").style.position='absolute';
			}
			
			//Function for taking the tax
			//GetShipTaxViaAJAX();
			//GetTaxViaAJAX();
			
	  }
	  else
	  {
		  frmCustOrder.shipname.value="";
		  frmCustOrder.shiplastname.value="";
		  frmCustOrder.shpPhone.value="";
		  frmCustOrder.shpAddress1.value="";
		  frmCustOrder.shpAddress2.value="";
		  frmCustOrder.shpCity.value="";
		  //frmCustOrder.shpState.value="";
		  frmCustOrder.shpZip.value="";
		  frmCustOrder.shpStateCode.value="";
		  frmCustOrder.shpCountryCode.value="US";
		  
		  var newDTTotal,strTaxAmt,strShipAmt;
		  
		  newDTTotal=document.getElementById("divShipGDTotal").innerHTML
		  newDTTotal=newDTTotal.replace("$","")
		  newDTTotal=newDTTotal.replace(",","")
		  
		  strTaxAmt=document.getElementById("divShipTax").innerHTML;
		  strTaxAmt=strTaxAmt.replace("$","")
		  strTaxAmt=strTaxAmt.replace(",","")
		  
		  strShipAmt=document.getElementById("divShipCharge").innerHTML;
		  strShipAmt=strShipAmt.replace("$","")
		  strShipAmt=strShipAmt.replace(",","")
		  
		  //alert("newDTTotal" +newDTTotal);
		 // alert("strTaxAmt" +strTaxAmt);
		  
		  if (strTaxAmt=="") 
		  strTaxAmt=0
		  
		  if (strShipAmt=="") 
		  strShipAmt=0
		  
		  //newDTTotal=parseFloat(newDTTotal)-parseFloat(strTaxAmt);
		  //alert(newDTTotal);
		  //alert(strTaxAmt);
		  //alert(strShipAmt);
		  
		  newDTTotal=parseFloat(newDTTotal)-parseFloat(strShipAmt);
		  
		  //alert("strTaxAmt" +newDTTotal);
		    
		  //'document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
		  //'document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);		  
		  
		  //document.getElementById("txtOrdTax").value="0.00";
		  
		  //'document.getElementById("txtOrdGdTotal").value=newDTTotal;
		  
		  //document.getElementById("divShipTax").innerHTML="$0.00";
		  //document.getElementById("divOrdTax").innerHTML="$0.00";
		  
		  
		  //'document.getElementById("txtOrdShipCost").value="0.00";
		  
		  //'document.getElementById("divShipCharge").innerHTML="$0.00";
		 // 'document.getElementById("divOrdShipCost").innerHTML="$0.00";
		  
	  }
}
   
////////////////////////////////////Function Ends/////////////////////////////////////////////////////////////////  
    
////////////////////////Function for calculating the tax when address is selected from adddressbook//

function loadAddress()
{
  var addresslist;
  addresslist= document.getElementById("addresslist").value;
		
  var newDTTotal,strTaxAmt;
  
  newDTTotal=document.getElementById("divShipGDTotal").innerHTML
  newDTTotal=newDTTotal.replace("$","")
  newDTTotal=newDTTotal.replace(",","")
  
  strTaxAmt=document.getElementById("divShipTax").innerHTML;
  strTaxAmt=strTaxAmt.replace("$","")
  strTaxAmt=strTaxAmt.replace(",","")
  
  //alert("newDTTotal" +newDTTotal);
  //alert("strTaxAmt" +strTaxAmt);
  
  newDTTotal=parseFloat(newDTTotal)-parseFloat(strTaxAmt);
  
  //alert("strTaxAmt" +strTaxAmt);
	
  document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
  document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);		  
  
  document.getElementById("txtOrdTax").value="0.00";
  document.getElementById("txtOrdGdTotal").value=newDTTotal;
  
  document.getElementById("divShipTax").innerHTML="$0.00";
  document.getElementById("divOrdTax").innerHTML="$0.00";
		
  try
	{
		//	obj2 = new ActiveXObject("Msxml2.XMLHTTP");
		obj2=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj2 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj2 = null;
		}
	}
	if(obj2!=null)
	{
		obj2.onreadystatechange = ProcessResponseAddress;
		//alert("getShipCost.aspx?cmbno="+ cmbNo +"&ship="+ shipment +"&idbcart="+ idbCart +"&sesShip="+ sesShiprds );
		
		obj2.open("GET","getCustAddress.asp?addresslist="+ addresslist ,true);
		obj2.send(null);
		
		//GetShipTaxViaAJAX();

		
	}
	return false;

}
        
function ProcessResponseAddress()
{
	if(obj2.readyState == 4)
		{
		//alert(obj2.responseText);
			if(obj2.status == 200)
			{
				
				var dsRoot      = obj2.responseXML.documentElement;  
				var shFName     = dsRoot.getElementsByTagName('ShFName');
				var shLName     = dsRoot.getElementsByTagName('ShLName');
				var shAddress1  = dsRoot.getElementsByTagName('ShAddress1');
				var shAddress2  = dsRoot.getElementsByTagName('ShAddress2');
				var shiZip      = dsRoot.getElementsByTagName('ShZip'); 
				var shState     = dsRoot.getElementsByTagName('ShState');  
				var shStateCode = dsRoot.getElementsByTagName('ShStateCode');  
				var shCity      = dsRoot.getElementsByTagName('ShCity');
				var shCountry   = dsRoot.getElementsByTagName('ShCountry');   
				var shPhone	    = dsRoot.getElementsByTagName('shPhone'); 
					 
				var fName,lName,strAddress1,strAddress2,strZip,strState,strCity,strCountry,strphone;	
								
				try
				{
					if(shFName[0].innerText != undefined || shFName[0].text != undefined )
					{
						fName=(shFName[0].innerText || shFName[0].text);
					}
					else
					{
						fName=(shFName[0].textContent );
					}
					 document.getElementById("shipname").value=fName;
				}
				catch(e)
				{
					// alert(e)
					document.getElementById("shipname").value="";
				}
				try
				{
					if(shLName[0].innerText != undefined || shLName[0].text != undefined )
					{
						lName=(shLName[0].innerText || shLName[0].text);
					}
					else
					{
						lName=(shLName[0].textContent );
					}
					 document.getElementById("shiplastname").value=lName;
				}
				catch(e)
				{
					   // alert(e)
					document.getElementById("shiplastname").value="";
				}
			   
			   try
				{
					if(shPhone[0].innerText != undefined || shPhone[0].text != undefined )
					{
					strphone=(shPhone[0].innerText || shPhone[0].text);
					}
					else
					{
					strphone=(shPhone[0].textContent );
					}
					document.getElementById("shpPhone").value=strphone;
				}
				catch(e)
				{
					// alert(e)
					document.getElementById("shpPhone").value="";
				}
				try
				{
					if(shAddress1[0].innerText != undefined || shAddress1[0].text != undefined )
					{
						strAddress1=(shAddress1[0].innerText || shAddress1[0].text);
					}
					else
					{
						strAddress1=(shAddress1[0].textContent );
					}
					document.getElementById("shpAddress1").value=strAddress1;
				}
				catch(e)
				{
					   // alert(e)
					   document.getElementById("shpAddress1").value="";
				}
			 try
				{

					if(shAddress2[0].innerText != undefined || shAddress2[0].text != undefined )
					{
						strAddress2=(shAddress2[0].innerText || shAddress2[0].text);
					}
					else
					{
						strAddress2=(shAddress2[0].textContent );
					}
					
					document.getElementById("shpAddress2").value=strAddress2;
					
					
				}
				catch(e)
				{
					   // alert(e)
					   document.getElementById("shpAddress2").value="";
				}	    
			 try
				{
					if(shiZip[0].innerText != undefined || shiZip[0].text != undefined )
					{
					strZip=(shiZip[0].innerText || shiZip[0].text);
					}
					else
					{
					strZip=(shiZip[0].textContent );
					}
					document.getElementById("shpZip").value=strZip;
				}
				catch(e)
				{
					   // alert(e)
					   document.getElementById("shpZip").value="";
				}	    
			 try
				{
					if(shStateCode[0].innerText != undefined || shStateCode[0].text != undefined )
					{
					strState=(shStateCode[0].innerText || shStateCode[0].text);
					}
					else
					{
					strState=(shStateCode[0].textContent );
					}
					document.getElementById("shpStateCode").value=strState;
				}
				catch(e)
				{
					   // alert(e)
					   document.getElementById("shpStateCode").value="";
				}

			  try
				{
					if(shCity[0].innerText != undefined || shCity[0].text != undefined )
					{
					strCity=(shCity[0].innerText || shCity[0].text);
					}
					else
					{
					strCity=(shCity[0].textContent );
					}
					
					document.getElementById("shpCity").value=strCity;
				}
				catch(e)
				{
					   document.getElementById("shpCity").value="";
				}

			  try
				{
					if(shCountry[0].innerText != undefined || shCountry[0].text != undefined )
					{
					strCountry=(shCountry[0].innerText || shCountry[0].text);
					}
					else
					{
					strCountry=(shCountry[0].textContent );
					}
					
					document.getElementById("shpCountryCode").value=strCountry;
				}
				catch(e)
				{
					document.getElementById("shpCountryCode").value="";
				}
				//Function for taking the tax
				 GetTaxViaAJAX();
			}
		}
	}

    
    
    
////////////////////////////////////Function Ends/////////////////////////////////////////////////////////////////  

////////////////////////Function for Checking the Gift Certificate////////////////////////////////////////////////


function checkGiftCard()
{
    var strGiftCNumber;
    
    strGiftCNumber = document.getElementById("giftcardNumber").value;
    

    if (strGiftCNumber!="")
    {
        var intValidGC;
        
        document.getElementById("hidPayMode").value="";
        GetGCardAJAX(strGiftCNumber);
    }
    else
    {
        document.getElementById("divGCMessage").innerHTML="";
        document.getElementById("hidPayMode").value="";
        alert("Enter giftcard number");
        document.getElementById("giftcardNumber").focus();
        return false;
    }
    

}

////////////////////////////////Function Ends/////////////////////////////////////////////////////////////////  
////////////////////////Ajax Function for Checking the Gift Certificate////////////////////////////////////////////////

function GetGCardAJAX(strGCNumber)
			{
			
					
				try
				{
				//	obj3 = new ActiveXObject("Msxml2.XMLHTTP");
				obj3=new XMLHttpRequest();
				}
				catch(e)
				{
					try
					{
						obj3 = new ActiveXObject("Microsoft.XMLHTTP");
						
					}
					catch(e1)
					{
						obj3 = null;
					}
				}
				if(obj3!=null)
				{
					obj3.onreadystatechange = ProcessResponseGC;
		
					
					//alert("getGCdetails.asp?gcnumber="+ strGCNumber );
					
					obj3.open("GET","getGCdetails.asp?gcnumber="+ strGCNumber,true);
					obj3.send(null);         
				}
				return false;
			}


			function ProcessResponseGC()
			
			{
			
					
				if(obj3.readyState == 4)
				{
				//alert(obj3.responseText);
					if(obj3.status == 200)
					{
						
						var dsRoot    = obj3.responseXML.documentElement;  
						var tGCExists = dsRoot.getElementsByTagName('GCExists');
						var tGCId     = dsRoot.getElementsByTagName('GCId');
						var tGCAmt    = dsRoot.getElementsByTagName('GCAmt'); 
						var tGCbalance= dsRoot.getElementsByTagName('GCBalance'); 
						var tGCExpiry = dsRoot.getElementsByTagName('GCExpiry'); 
						var tGCExpFlg = dsRoot.getElementsByTagName('GCExpiryFlg');      
						
										
						
						try
						{

							if(tGCExists[0].innerText != undefined || tGCExists[0].text != undefined )
							{
							intGCExists=(tGCExists[0].innerText || tGCExists[0].text);
							}
							else
							{
							intGCExists=(tGCExists[0].textContent );
							}
    						
						}
						catch(e)
						{
						}
					    
					    try
						{

							if(tGCId[0].innerText != undefined || tGCId[0].text != undefined )
							{
							intGCId=(tGCId[0].innerText || tGCId[0].text);
							}
							else
							{
							intGCId=(tGCId[0].textContent );
							}
						}
						catch(e)
						{
						}
					    try
						{

							if(tGCAmt[0].innerText != undefined || tGCAmt[0].text != undefined )
							{
							    intGCAmt=(tGCAmt[0].innerText || tGCAmt[0].text);
							}
							else
							{
							    intGCAmt=(tGCAmt[0].textContent );
							}
						}
						catch(e)
						{
						}
						
						
						try
						{

							if(tGCbalance[0].innerText != undefined || tGCbalance[0].text != undefined )
							{
							    intGCbalance=(tGCbalance[0].innerText || tGCbalance[0].text);
							}
							else
							{
							    intGCbalance=(tGCbalance[0].textContent );
							}
						}
						catch(e)
						{
						}
					
						
					   try
						{

							if(tGCExpiry[0].innerText != undefined || tGCExpiry[0].text != undefined )
							{
							    intGCExpiry=(tGCExpiry[0].innerText || tGCExpiry[0].text);
							}
							else
							{
							    intGCExpiry=(tGCExpiry[0].textContent );
							}
						}
						catch(e)
						{
						}
						
						
					     try
						{

							if(tGCExpFlg[0].innerText != undefined || tGCExpFlg[0].text != undefined )
							{
							    intGCExpFlg=(tGCExpFlg[0].innerText || tGCExpFlg[0].text);
							}
							else
							{
							    intGCExpFlg=(tGCExpFlg[0].textContent );
							}
						}
						catch(e)
						{
						}
				
                     
                     document.getElementById("hidGCbalance").value=intGCbalance;
					
					 
					 
                     
                     var intOrdtotal=document.getElementById("divShipGDTotal").innerHTML;
                     intOrdtotal=intOrdtotal.replace("$","");
                     intOrdtotal=intOrdtotal.replace(",","");
                     
                     
                     if(intGCExists==0)
                     {
                       // alert("Sorry!! Couldn't locate Gift Certificate Number.Please Try Again.");
                       
                        document.getElementById("divGCMessage").innerHTML="Sorry!! Couldn't locate Gift Certificate Number.Please Try Again.";
                        document.getElementById("giftcardNumber").value="";
                        document.getElementById("giftcardNumber").focus();
                        return false;
                     }
					  
                     else if (intGCExists==1 && intGCbalance==0)
                     {
                        //alert("Sorry!! There is No Balance with your Gift Certificate.");
                        document.getElementById("divGCMessage").innerHTML="Sorry!! There is No Balance with your Gift Certificate.";
                        document.getElementById("giftcardNumber").value="";
                        document.getElementById("giftcardNumber").focus();
                        return false;
                     }
                     else if (intGCExists==1 && intGCExpFlg==1)
                     {
                        document.getElementById("divGCMessage").innerHTML="Sorry!! Your Gift Certificate is Expired.";
                        //alert("Sorry!! Your Gift Certificate is Expired.");
                        document.getElementById("giftcardNumber").value="";
                        document.getElementById("giftcardNumber").focus();
                        return false;
                     }
                      else if(intGCExists==1 && (parseFloat(intGCbalance)<parseFloat(intOrdtotal)))
                     {
						document.getElementById("divGCMessage").innerHTML="Sorry!! Your have only "+ formatCurrency(intGCbalance) +" balance in this Gift Certificate. Please enter CC Info also.";  
						
						document.getElementById("cardType").disabled=false;
						document.getElementById("cardNumber").disabled=false;
						document.getElementById("cardcode").disabled=false;
						document.getElementById("expMonth").disabled=false;
						document.getElementById("ExpYear").disabled=false;
						
						document.getElementById("hidPayMode").value="14";
						return false;
                     }
                     else
                     {
                        document.getElementById("hidPayMode").value="10";
						document.getElementById("divGCMessage").innerHTML="";
                     }
					}
				
				}
			}
			
////////////////////////////////Function Ends/////////////////////////////////////////////////////////////////  
			
			
			
function GetCouponNoAJAX(IdCustomer)
{
	document.getElementById("divCoupMessage").innerHTML="";
	document.getElementById("divCoupCalc").innerHTML="";
	var strCupNumber= document.getElementById("couponNo").value;

	if (strCupNumber!="")
	{
		try
		{
		//	obj4 = new ActiveXObject("Msxml2.XMLHTTP");
		obj4=new XMLHttpRequest();
		}
		catch(e)
		{
			try
			{
				obj4 = new ActiveXObject("Microsoft.XMLHTTP");
				
			}
			catch(e1)
			{
				obj4 = null;
			}
		}
		if(obj4!=null)
		{
			obj4.onreadystatechange = ProcessResponseCoupon;
			//alert("getShipCost.aspx?cmbno="+ cmbNo +"&ship="+ shipment +"&idbcart="+ idbCart +"&sesShip="+ sesShiprds );
			
			obj4.open("GET","getCoupondetails.asp?cupNumber="+ strCupNumber+"&IdCustomer="+IdCustomer,true);
			obj4.send(null);         
		}
		return false;
	}
	else
	{
		 document.getElementById("divCoupMessage").innerHTML="";
	}
}


			function ProcessResponseCoupon()
			
			{
			
					
				if(obj4.readyState == 4)
				{
				//alert(obj4.responseText);
					if(obj4.status == 200)
					{
						
						var dsRoot      = obj4.responseXML.documentElement;  
						var tCouExists  = dsRoot.getElementsByTagName('CoupExists');
						var tCouId      = dsRoot.getElementsByTagName('CoupId');
						var tCouHave    = dsRoot.getElementsByTagName('CoupHave'); 
						var tCouExpiry  = dsRoot.getElementsByTagName('CoupExpiry'); 
						var tCouExpFlg  = dsRoot.getElementsByTagName('CoupExpiryFlg');      
						var tCouUsedFlg = dsRoot.getElementsByTagName('CoupUsedFlg');  
						var tCouAmt     = dsRoot.getElementsByTagName('CoupAmt');  
						var tCouType    = dsRoot.getElementsByTagName('CoupType');  
						var tCoupNo     = dsRoot.getElementsByTagName('CoupNo');  
										
						
						try
						{

							if(tCouExists[0].innerText != undefined || tCouExists[0].text != undefined )
							{
							intCouExists=(tCouExists[0].innerText || tCouExists[0].text);
							}
							else
							{
							intCouExists=(tCouExists[0].textContent );
							}
    						
						}
						catch(e)
						{
						}
					    
					    try
						{

							if(tCouId[0].innerText != undefined || tCouId[0].text != undefined )
							{
							intCouId=(tCouId[0].innerText || tCouId[0].text);
							}
							else
							{
							intCouId=(tCouId[0].textContent );
							}
						}
						catch(e)
						{
						}
						
					    try
						{

							if(tCouAmt[0].innerText != undefined || tCouAmt[0].text != undefined )
							{
							    intCouAmt=(tCouAmt[0].innerText || tCouAmt[0].text);
							}
							else
							{
							    intCouAmt=(tCouAmt[0].textContent );
							}
						}
						catch(e)
						{
						}
						 try
						{

							if(tCouType[0].innerText != undefined || tCouType[0].text != undefined )
							{
							    intCouType=(tCouType[0].innerText || tCouType[0].text);
							}
							else
							{
							    intCouType=(tCouType[0].textContent );
							}
						}
						catch(e)
						{
						}
						
					    try
						{

							if(tCoupNo[0].innerText != undefined || tCoupNo[0].text != undefined )
							{
							    intCoupNo=(tCoupNo[0].innerText || tCoupNo[0].text);
							}
							else
							{
							    intCoupNo=(tCoupNo[0].textContent );
							}
						}
						catch(e)
						{
						}
						
					    try
						{

							if(tCouHave[0].innerText != undefined || tCouHave[0].text != undefined )
							{
							    intCouHave=(tCouHave[0].innerText || tCouHave[0].text);
							}
							else
							{
							    intCouHave=(tCouHave[0].textContent );
							}
						}
						catch(e)
						{
						}
						
						
						try
						{

							if(tCouExpiry[0].innerText != undefined || tCouExpiry[0].text != undefined )
							{
							    intCouExpiry=(tCouExpiry[0].innerText || tCouExpiry[0].text);
							}
							else
							{
							    intCouExpiry=(tCouExpiry[0].textContent );
							}
						}
						catch(e)
						{
						}
					   try
						{

							if(tCouExpFlg[0].innerText != undefined || tCouExpFlg[0].text != undefined )
							{
							    intCouExpFlg=(tCouExpFlg[0].innerText || tCouExpFlg[0].text);
							}
							else
							{
							    intCouExpFlg=(tCouExpFlg[0].textContent );
							}
						}
						catch(e)
						{
						}
						
					    try
						{

							if(tCouUsedFlg[0].innerText != undefined || tCouUsedFlg[0].text != undefined )
							{
							    intCouUsedFlg=(tCouUsedFlg[0].innerText || tCouUsedFlg[0].text);
							}
							else
							{
							    intCouUsedFlg=(tCouUsedFlg[0].textContent );
							}
						}
						catch(e)
						{
						}
                     
                                          
                           
                     if(intCouExists==0)
                     {
                       // alert("Sorry!! Couldn't locate Gift Certificate Number.Please Try Again.");
                       
                        document.getElementById("divCoupMessage").innerHTML="Sorry!! Your coupon is not valid";
                        document.getElementById("couponNo").select();
                        document.getElementById("couponNo").focus();
                        return false;
                     }
                                        
                     else if(intCouExists==1 && intCouExpiry==1)
                     {
                        document.getElementById("divCoupMessage").innerHTML="Sorry!! Your coupon is expired.";
                        //alert("Sorry!! Your Gift Certificate is Expired.");
                        document.getElementById("couponNo").select();
                        document.getElementById("couponNo").focus();
                        return false;
                     
                     }
                     
                      else if(intCouExists==1 && intCouUsedFlg==1)
                     {
                            document.getElementById("divCoupMessage").innerHTML="Sorry!! You have already used your coupon.";  
                            document.getElementById("couponNo").select();
                            document.getElementById("couponNo").focus();
                            return false;
                     }
                     
                     else if(intCouExists==1 && intCouUsedFlg!=1 && intCouUsedFlg!=1)
                     {
                     
                        document.getElementById("hidCoupAmt").value=intCouAmt;
                        document.getElementById("hidCoupType").value=intCouType;
                        
                        
                        if(intCouAmt!=0)
                        {
                            
                            var intOrdTot=document.getElementById("divShipGDTotal").innerHTML;
                            intOrdTot=intOrdTot.replace("$","");
                            intOrdTot=intOrdTot.replace(",","");
                            
                            if (intCouType=="$")
                            {   
                                intDiscAmt=intCouAmt;
                                intOrdTot=parseFloat(intOrdTot)-parseFloat(intDiscAmt);
                                
                            
                            }
                            else if (intCouType=="%")
                            {
                               intDiscAmt=(parseFloat(intOrdTot)*parseFloat(intCouAmt))/100;
                               intOrdTot=parseFloat(intOrdTot)-parseFloat(intDiscAmt);
                               
                            }
                            else if (intCouType=="fs")
                            {
                            
                                 var intShipAmt=document.getElementById("divShipCharge").innerHTML;
                                 intShipAmt=intShipAmt.replace("$","");
                                 intShipAmt=intShipAmt.replace(",","");
                            
                                 intDiscAmt= intShipAmt;
                                 intOrdTot=parseFloat(intOrdTot)-parseFloat(intDiscAmt);
                                
                            }
                            
                            document.getElementById("txtOrdGdTotal").value=intOrdTot;
                            document.getElementById("hidCoupDisAmt").value=intDiscAmt;
                            
                            var divCopStr;
                            
                            divCopStr="<table width=100% border=0>"
                           //divCopStr=divCopStr+ "<TR><TD COLSPAN=4>&nbsp;</TD>";
                            //divCopStr=divCopStr+"<td valign=top  align=right COLSPAN=2><b>Total:</b></td>";
                           // divCopStr=divCopStr+"<TD valign=top  align=right>"+ formatCurrency(intOrdTot+intDiscAmt)+"</TD></TR>";
			                divCopStr=divCopStr+"<TR><TD COLSPAN=5 align=right width=96%>&nbsp;<b>Discount From Coupon "+ intCoupNo +" "
			                 if (intCouType!="fs")
			                {
			                divCopStr=divCopStr+" "+ intCouAmt +" "+ intCouType +":";
			                }
			                if (intCouType=="fs")
			                {
			                    divCopStr=divCopStr+"(Free Shipping)";
			                }
			               
			                divCopStr=divCopStr+"</b></td>";
			                divCopStr=divCopStr+"<TD valign=top class=red align=right> "+ formatCurrency(intDiscAmt) +"</TD></TR></table>";
			              //divCopStr=divCopStr+"<TR> <TD COLSPAN=4>&nbsp;</TD><td valign=top  align=right COLSPAN=2>"
			              //divCopStr=divCopStr+"<b>Net Total:</b></td><TD valign=top class=red align=right>"+ FormatCurrency(pTotal1)+"</b></TD></TR>"
                            
                            document.getElementById("divCoupCalc").style.visibility='visible';
                            document.getElementById("divCoupCalc").style.position='static';
                            document.getElementById("divCoupCalc").innerHTML=divCopStr;
                            
                            document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(intOrdTot);
                        
                        }
                     }
                     
                     else
                     {
                             document.getElementById("divCoupMessage").innerHTML="";
                             document.getElementById("divCoupCalc").innerHTML="";
                     
                     }
                     
                     
                     
                     
                     
                     
							
					}
				
				}
			}
			
////////////////////////////////Function Ends/////////////////////////////////////////////////////////////////  


////////////////////////////////Function For Taking the saved Credit Card details/////////////////////////////  


function GetCCInfoAJAX()
			{
			     
			   
		    	var strCTitle= document.getElementById("cardTitle").value;
				//alert(strCTitle);
			
			if (strCTitle!="")
			{
				try
				{
				//	obj5 = new ActiveXObject("Msxml2.XMLHTTP");
				obj5=new XMLHttpRequest();
				}
				catch(e)
				{
					try
					{
						obj5 = new ActiveXObject("Microsoft.XMLHTTP");
						
					}
					catch(e1)
					{
						obj5 = null;
					}
				}
				if(obj5!=null)
				{
					obj5.onreadystatechange = ProcessResponseCC;					
					obj5.open("GET","getCCdetails.asp?ccID="+ strCTitle,true);
					obj5.send(null);         
				}
				return false;
				
			}
			else
			{
			   document.getElementById("cardType").value="";
			   document.getElementById("cardNumber").value="";
			   document.getElementById("cardcode").value="";
			   document.getElementById("expMonth").value="";
			   document.getElementById("ExpYear").value="";
                                          
			}
	
			}


			function ProcessResponseCC()
			
			{
			
					
				if(obj5.readyState == 4)
				{
		//	alert(obj5.responseText);
					if(obj5.status == 200)
					{
						
						var dsRoot      = obj5.responseXML.documentElement;  
						var tCCTYpe     = dsRoot.getElementsByTagName('CCType');
						var tCCNumber   = dsRoot.getElementsByTagName('CCNumber');
						var tCCCode     = dsRoot.getElementsByTagName('CCCode'); 
						var tCCExMon    = dsRoot.getElementsByTagName('CCExMon'); 
						var tCCExYer    = dsRoot.getElementsByTagName('CCExYear');      
										
						
						try
						{

							if(tCCTYpe[0].innerText != undefined || tCCTYpe[0].text != undefined )
							{
							intCCType=(tCCTYpe[0].innerText || tCCTYpe[0].text);
							}
							else
							{
							intCCType=(tCCTYpe[0].textContent );
							}
    						
						}
						catch(e)
						{
						}
					    
					    try
						{

							if(tCCNumber[0].innerText != undefined || tCCNumber[0].text != undefined )
							{
							intCCNumber=(tCCNumber[0].innerText || tCCNumber[0].text);
							}
							else
							{
							intCCNumber=(tCCNumber[0].textContent );
							}
						}
						catch(e)
						{
						}
						
					    try
						{

							if(tCCCode[0].innerText != undefined || tCCCode[0].text != undefined )
							{
							    intCCCode=(tCCCode[0].innerText || tCCCode[0].text);
							}
							else
							{
							    intCCCode=(tCCCode[0].textContent );
							}
						}
						catch(e)
						{
						}
						 try
						{

							if(tCCExMon[0].innerText != undefined || tCCExMon[0].text != undefined )
							{
							    intCCExMon=(tCCExMon[0].innerText || tCCExMon[0].text);
							}
							else
							{
							    intCCExMon=(tCCExMon[0].textContent );
							}
						}
						catch(e)
						{
						}
						
					    try
						{

							if(tCCExYer[0].innerText != undefined || tCCExYer[0].text != undefined )
							{
							    intCCExYr=(tCCExYer[0].innerText || tCCExYer[0].text);
							}
							else
							{
							    intCCExYr=(tCCExYer[0].textContent );
							}
						}
						catch(e)
						{
						}
						
					  
					   document.getElementById("cardType").value=intCCType;
					   document.getElementById("cardNumber").value=intCCNumber;
					   document.getElementById("cardcode").value=intCCCode;
					   document.getElementById("expMonth").value=intCCExMon;
                       document.getElementById("ExpYear").value=intCCExYr;
                                          
                     
							
					}
				
				}
			}


////////////////////////////////Function Ends///////////////////////////////////////////////////////////////// 

function GetShipTaxViaAJAX()
{
		        
	 var shipState;
	 shipState=document.getElementById("shpStateCode").value;
	 var billState;
	 billState=document.getElementById("billstateCode").value;
	 var pickuplocation;
	 pickuplocation=document.getElementById("pickuplocation").value;
	
	 var txtSubTot;
	 txtSubTot=document.getElementById("txtOrdSubTotal").value;
	  txtSubTot=txtSubTot.replace("$","")
	 txtSubTot=txtSubTot.replace(",","")
				
	 var newDTTotal,strTaxAmt,strShipAmt;

	 newDTTotal=document.getElementById("divShipGDTotal").innerHTML
	 newDTTotal=newDTTotal.replace("$","")
	 newDTTotal=newDTTotal.replace(",","")
	  
	 strTaxAmt=document.getElementById("divShipTax").innerHTML;
	 strTaxAmt=strTaxAmt.replace("$","")
	 strTaxAmt=strTaxAmt.replace(",","")
	  
	 strShipAmt=document.getElementById("divShipCharge").innerHTML;
	 strShipAmt=strShipAmt.replace("$","")
	 strShipAmt=strShipAmt.replace(",","")
		  
	 if (strTaxAmt=="") 
		 strTaxAmt=0
	  
	 if (strShipAmt=="") 
		 strShipAmt=0
	  
	 if (newDTTotal=="") 
		 newDTTotal=0
				  
		  
	 //alert("newDTTotal" +newDTTotal);
	 //alert("strTaxAmt" +strTaxAmt);
	  
	 newDTTotal=parseFloat(newDTTotal)-(parseFloat(strTaxAmt)+parseFloat(strShipAmt));
	  
	 //alert("strShipAmt" +strShipAmt);
	 //alert("newDTTotal" +newDTTotal);

	 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
	 document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newDTTotal);		  
				  
	 document.getElementById("txtOrdTax").value="0.00";
	 document.getElementById("txtOrdGdTotal").value=parseFloat(newDTTotal);
	  
	 document.getElementById("divShipTax").innerHTML="$0.00";
	 document.getElementById("divOrdTax").innerHTML="$0.00";			
						
				 
	try
	{
		//	obj = new ActiveXObject("Msxml2.XMLHTTP");
		obj1=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj1 = null;
		}
	}
	if(obj1!=null)
	{
		obj1.onreadystatechange = ProcessResponseShipTax;
		//alert("getShipTaxs.asp?pshipState="+ shipState+"&pbillState="+billState+"&pSubTotal="+txtSubTot);
		obj1.open("GET","getShipTaxs.asp?pshipState="+ shipState+"&pbillState="+ billState+"&pSubTotal="+txtSubTot+"&pickuploc="+pickuplocation ,true);
		obj1.send(null);         
	}
	return false;
}

function ProcessResponseShipTax()
{
	if(obj1.readyState == 4)
	{
		//alert(obj1.responseText);
		if(obj1.status == 200)
		{
			var dsRoot=obj1.responseXML.documentElement;  
			var taxcost         = dsRoot.getElementsByTagName('Tax');
			var unitshipcost    = dsRoot.getElementsByTagName('unitshipcost');
			var shipcost        = dsRoot.getElementsByTagName('shipcost');
			var minimum_shipcost= dsRoot.getElementsByTagName('minimum_shipcost');						
			
			var strPrdsTitle,strShipType,text;	
			var pShipCost=0,pMinimum_shipcost=0,pUnitShipCost = 0;			
			
			try
			{

				if(taxcost[0].innerText != undefined || taxcost[0].text != undefined )
				{
				text=(taxcost[0].innerText || taxcost[0].text);
				}
				else
				{
				text=(taxcost[0].textContent );
				}
				window.document.getElementById("divShipTax").innerHTML=formatCurrency(text);
			}
			catch(e)
			{
				window.document.getElementById("divShipTax").innerHTML="$0.00";
			}
			//Unit ShipCost (per sql ft)=========
			try
			{
				if(unitshipcost[0].innerText != undefined || unitshipcost[0].text != undefined )
				{
					pUnitShipCost=(unitshipcost[0].innerText || unitshipcost[0].text);
				}
				else
				{
					pUnitShipCost=(unitshipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pUnitShipCost = 0
			}
			//Unit ShipCost (per sql ft)=========
			
			//ship cost==================
			try
			{
				if(shipcost[0].innerText != undefined || shipcost[0].text != undefined )
				{
					pShipCost=(shipcost[0].innerText || shipcost[0].text);
				}
				else
				{
					pShipCost=(shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pShipCost = 0
			}
			//ship cost==================
			//minimum ship cost==========
			try
			{
				if(minimum_shipcost[0].innerText != undefined || minimum_shipcost[0].text != undefined )
				{
					pMinimum_shipcost=(minimum_shipcost[0].innerText || minimum_shipcost[0].text);
				}
				else
				{
					pMinimum_shipcost=(minimum_shipcost[0].textContent );
				}    						
			}
			catch(e)
			{
				pMinimum_shipcost = 0
			}
			//minimum ship cost==================
			
			var txtamt;
			txtamt=document.getElementById("divShipTax").innerHTML;
			txtamt=txtamt.replace("$","")
			txtamt=txtamt.replace(",","")
			
			var txtSubTotal;
			txtSubTotal=document.getElementById("divShipSubtotal").innerHTML;
			txtSubTotal=txtSubTotal.replace("$","")
			txtSubTotal=txtSubTotal.replace(",","")
			
			var newGTotals; 
			newGTotals=document.getElementById("divShipGDTotal").innerHTML;
			newGTotals=newGTotals.replace("$","")
			newGTotals=newGTotals.replace(",","")
			
			//code added by kavitha to change shipping calc on 21-07-07
			//==============================
			window.document.getElementById("divShipCharge").innerHTML=formatCurrency(pShipCost);
			document.getElementById("txtOrdShipCost").value=pShipCost;
			window.document.getElementById("divOrdShipCost").innerHTML=formatCurrency(pShipCost);
			
			var strShipTab;
			strShipTab="";
			var strPrdsTitle = window.document.getElementById("PrdsTitle").value
			var strFreeTitle = window.document.getElementById("FreeTitle").value
			strShipType = "Standard Shipping"
			strShipTab="<table border=0 width=98% >";
			strShipTab=strShipTab+"<tr><td width=200><b>Item</b></td><td><b>Shipping</b></td><td><b>Cost</b></td></tr>";
			strShipTab=strShipTab+"<tr><td>"+strPrdsTitle+"</td><td>"+strShipType+"</td><td>"+formatCurrency(pShipCost)+"</td></tr>";
			if (strFreeTitle != "")
			{
				strShipTab=strShipTab+"<tr><td>"+strFreeTitle+"</td><td>Free Shipping</td><td>"+formatCurrency(0)+"</td></tr>";
			}
			strShipTab=strShipTab+"</table>";
			document.getElementById("txtShippingTable").value=strShipTab;
			document.getElementById("divOrdShipDetails").innerHTML=strShipTab;
			
			//==============================
			//alert("text"+text);
			//alert("pShipCost"+pShipCost);
		   // alert("newGTotals"+newGTotals);
			newGTotals=parseFloat(text)+ parseFloat(pShipCost) + parseFloat(newGTotals);
			
			newGTotal=formatCurrency(newGTotals)
			document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newGTotals);
			
			document.getElementById("txtOrdSubTotal").value=txtSubTotal;
			document.getElementById("txtOrdTax").value=text;
			document.getElementById("txtOrdGdTotal").value=newGTotals;
			
		 	//Changing the order details in the Order section(last portion)
			 document.getElementById("divOrdTax").innerHTML=formatCurrency(text);
			 document.getElementById("divOrdGrdTot").innerHTML=formatCurrency(newGTotals);
			 //End of that
		}
	}
}



function GetTaxViaAJAXshopping_Cart()
{
		        alert("hii")
	 var billState;
	 billState=document.getElementById("billstateCode").value;
	
	
	 
	 var txtSubTot;
	 txtSubTot=document.getElementById("txtOrdSubTotal").value;
	 txtSubTot=txtSubTot.replace("$","")
	 txtSubTot=txtSubTot.replace(",","")
				
	 var newDTTotal,strTaxAmt,strShipAmt;

	 newDTTotal=document.getElementById("divShipGDTotal").innerHTML
	 newDTTotal=newDTTotal.replace("$","")
	 newDTTotal=newDTTotal.replace(",","")
	  
	 strTaxAmt=document.getElementById("divShipTax").innerHTML;
	 strTaxAmt=strTaxAmt.replace("$","")
	 strTaxAmt=strTaxAmt.replace(",","")
	  
			  
	 if (strTaxAmt=="") 
		 strTaxAmt=0
	  
	 if (newDTTotal=="") 
		 newDTTotal=0
				  


	 document.getElementById("divShipGDTotal").innerHTML=formatCurrency(newDTTotal);
	 document.getElementById("txtOrdTax").value="0.00";
	 document.getElementById("txtOrdGdTotal").value=parseFloat(newDTTotal);
	 document.getElementById("divShipTax").innerHTML="$0.00";
						
				 
	try
	{
		//	obj = new ActiveXObject("Msxml2.XMLHTTP");
		obj1=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			obj1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			obj1 = null;
		}
	}
	if(obj1!=null)
	{
		obj1.onreadystatechange = ProcessResponseTaxCart; 
		 
		obj1.open("GET","getTaxs.asp?pbillState="+ billState+"&pSubTotal="+txtSubTot ,true);
		obj1.send(null);         
	}
	return false;
}


			