﻿// JScript File

    function submit_data(prdId)
			{
               
				 // alert(document.getElementById("txtQty"+prdId).value);
				  var qty =document.getElementById("txtQty"+prdId).value;
				 
				 // alert(qty);
				    var url="RequestHandler.aspx?Id="+prdId+"&qty="+qty;
			        xmlHttp = GetobjXmlHttpect(stateChangeHandler);
					xmlHttp_Get(xmlHttp, url); 
			}
			
			function GetobjXmlHttpect(handler)
			{
				try{
				
					xmlHTTPobj = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e2){
					try{
						xmlHTTPobj = new ActiveXObject("Microsoft.XMLHTTP");
					}	
					catch(e1){
						xmlHTTPobj = false;
					}
				}
				
				if(!xmlHTTPobj && typeof XMLHttpRequest !='undefined'){
					xmlHTTPobj = new XMLHttpRequest();
					//alert('testing Object')
				}
				//alert(xmlHTTPobj);
				return xmlHTTPobj
				//alert("ok");
				alert(xmlHTTPobj);
			}
			 
			 
			function xmlHttp_Get(xmlhttp, url)
			{ 
    			xmlhttp.open('GET', url, true); 
    			xmlhttp.onreadystatechange = stateChangeHandler;
    			xmlhttp.send(null); 
 			} 
 			function stateChangeHandler() 
			{
			
				if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
 				{
 				//alert("q")
 					
 						//Gather the results from the callback
 						//var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  						var XMLdoc = xmlHttp.responseText; 
  						//alert(xmlHttp.responseText);
  						//var ctrl=document.getElementById("nameList");
  						var str;
  						str='';
  						
  						//alert(XMLdoc);
  						var strtrue = XMLdoc.substring(0,4);
  						//alert(strtrue);
  						if(strtrue=="True")
  						{
                            window.open ("Notice.aspx", "Shopping","location=0,directories=0,status=0,scrollbars=0,resizable=0,dialog=1,toolbar=0,fullscreen=0,menubar=0,width=350,height=150,top=220,left=400");
                            var str = xmlHttp.responseText;
                           // alert(str);
                            var substr = str.substring(4,5);
                            //alert(substr)
                            document.getElementById("lblProductCount").innerHTML = substr +" "+ "Products";
                            var totPrice = str.substring(5);
                            //alert(totPrice);
                            document.getElementById("lblTotPrice").innerHTML = "Total Price" +" "+ "$" +" "+ totPrice;
                           // alert(document.getElementById("lblTotPrice").innerHTML);
                            //document.getElementById("ctl00_lblProductCount").innerHTML = substr +" "+ "Products";
                           // alert( document.getElementById("ctl00_lblProductCount").innerHTML);
                           
  						}
  						else
  						{
  						    alert("Please Add Quantiry More Then Zero");
  						}
  						
						//Populate the innerHTML of the div with the results
 						//var ctrl=document.getElementById('nameList') ;
 					/*	var root=XMLdoc.getElementsByTagName('Customer');
 						
 						
 						if(root[0].childNodes.length>0)
 						{
 						var addParity = 0
 						var addPlus = 0
 						addParity = (is_ie)? 1:2;
 						addPlus = (is_ie)? 0:1;
 						//for(var i=1;i<root[0].childNodes.length;i++){
 							//alert(root[0].childNodes[(i*addParity)-1].nodeName + ' ,'  + ((i*addParity)-1) + ' ,' + root[0].childNodes[(i*addParity)-1].firstChild.nodeValue) 							
 						//}
 						
 						
 									document.getElementById("TxtShippingName").value= root[0].childNodes[(addParity*0)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtShippingEmail").value= root[0].childNodes[(addParity*1)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtShippingPhone").value= root[0].childNodes[(addParity*2)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtShippingFax").value= root[0].childNodes[(addParity*3)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtShippingAddress").value =root[0].childNodes[(addParity*6)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtShippingCity").value =root[0].childNodes[(addParity*7)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtShippingZip").value =root[0].childNodes[(addParity*9)+addPlus].firstChild.nodeValue; 	
 									checkCountry(document.getElementById("LstShippingCountry"),root[0].childNodes[(addParity*7)+addPlus].firstChild.nodeValue)
 									if (root[0].childNodes[(addParity*10)+addPlus].firstChild.nodeValue=="United States")
 									{
 										checkCountry(document.getElementById("LstShippingState"),root[0].childNodes[(addParity*8)+addPlus].firstChild.nodeValue)
 										document.getElementById("RowDisplayShippingStateText").style.display='none';
										document.getElementById("RowDisplayShippingStateList").style.display='';									
 									}
 									else
 									{
 										document.getElementById("TxtShippingState").value=root[0].childNodes[(addParity*8)+addPlus].firstChild.nodeValue
 										document.getElementById("RowDisplayShippingStateText").style.display='';
										document.getElementById("RowDisplayShippingStateList").style.display='none';
									}
 									document.getElementById("TxtShippingInstitution").value=root[0].childNodes[(addParity*4)+addPlus].firstChild.nodeValue;
 									
 									document.getElementById("TxtShippingDepartment").value=root[0].childNodes[(addParity*5)+addPlus].firstChild.nodeValue;
 									
 				
 									document.getElementById("TxtBillingName").value =  root[0].childNodes[(addParity*11)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtBillingEmail").value= root[0].childNodes[(addParity*12)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtBillingPhone").value= root[0].childNodes[(addParity*13)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtBillingFax").value= root[0].childNodes[(addParity*14)+addPlus].firstChild.nodeValue;
 									
 									document.getElementById("TxtBillingInst").value= root[0].childNodes[(addParity*15)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtBillingDept").value= root[0].childNodes[(addParity*16)+addPlus].firstChild.nodeValue;
 									
 									document.getElementById("TxtBillingAddress").value= root[0].childNodes[(addParity*17)+addPlus].firstChild.nodeValue;
 									document.getElementById("TxtBillingCity").value= root[0].childNodes[(addParity*18)+addPlus].firstChild.nodeValue;
 									
 									document.getElementById("TxtBillingZip").value =root[0].childNodes[(addParity*20)+addPlus].firstChild.nodeValue; 	
 									checkCountry(document.getElementById("LstBillingCountry"),root[0].childNodes[(addParity*21)+addPlus].firstChild.nodeValue)
 									
 									
 									if (root[0].childNodes[(addParity*21)+addPlus].firstChild.nodeValue=="United States")
 									{
 										checkCountry(document.getElementById("LstBillingState"),root[0].childNodes[(addParity*19)+addPlus].firstChild.nodeValue)
 										document.getElementById("RowDisplayBillingStateText").style.display='none';
										document.getElementById("RowDisplayBillingStateList").style.display='';									
 									}
 									else
 									{
 										document.getElementById("TxtBillingState").value=root[0].childNodes[(addParity*19)+addPlus].firstChild.nodeValue
 										document.getElementById("RowDisplayBillingStateText").style.display='';
										document.getElementById("RowDisplayBillingStateList").style.display='none';
									}
 									
 								document.frmPage.hdnAccountStatus.value=1;
 									document.getElementById("txtAcountNo").value=root[0].childNodes[(addParity*22)+addPlus].firstChild.nodeValue
 							
 						}	
 						else
 						{
 						//	alert("Please enter a valid customer account number!")
 								document.frmPage.txtAcountNo.value="";
 								
 							
 						}
 						*/
 						
 				} 
			}
			
			
