var request = false;
   try {
     request = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         request = false;
       }  
     }
   }

   if (!request)
     alert("Error initializing XMLHttpRequest!");
     


 function buildProvinceDropdown(countrycode, type){      
   
  var ajaxRequest;  // The variable that makes Ajax possible!
  
      
      try{
            // Opera 8.0+, Firefox, Safari
            ajaxRequest = new XMLHttpRequest();
            
      } catch (e){
            // Internet Explorer Browsers
            try{
                  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                  
            } catch (e) {
                  try{
                        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                       
                  } catch (e){
                        // Something went wrong
                        alert("Your browser broke!");
                        return false;
                  }
            }
      }
	 	  
      // Create a function that will receive data sent from the server
      ajaxRequest.onreadystatechange = function (){
            if(ajaxRequest.readyState == 4){
                  var ajaxDisplay = document.getElementById('province_dropdown');
                  ajaxDisplay.innerHTML = ajaxRequest.responseText;   
            }
      }
                    
  	  var queryString = "?countrycode=" + countrycode + "&type=" + type;
  	  //alert (queryString);
      ajaxRequest.open("GET", "update_province_dropdown.php" + queryString, true);
      ajaxRequest.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
  	  ajaxRequest.setRequestHeader("Cache-Control", "no-cache");  
      ajaxRequest.send(null);     
}
   
  //////////////////////////////////////////////////////////////////////////////////////////////////

   

   function buildShippingProvinceDropdown(countrycode, type){      
   
    var ajaxRequest;  // The variable that makes Ajax possible!
  
      
      try{
            // Opera 8.0+, Firefox, Safari
            ajaxRequest = new XMLHttpRequest();
            
      } catch (e){
            // Internet Explorer Browsers
            try{
                  ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                  
            } catch (e) {
                  try{
                        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                       
                  } catch (e){
                        // Something went wrong
                        alert("Your browser broke!");
                        return false;
                  }
            }
      }
	 	  
      // Create a function that will receive data sent from the server
      ajaxRequest.onreadystatechange = function (){
            if(ajaxRequest.readyState == 4){
                  var ajaxDisplay = document.getElementById('shipping_province_dropdown');
                  ajaxDisplay.innerHTML = ajaxRequest.responseText;   
            }
      }
                    
  	  var queryString = "?countrycode=" + countrycode + "&type=" + type;
  	  //alert (queryString);
      ajaxRequest.open("GET", "update_province_dropdown.php" + queryString, true);
      ajaxRequest.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
  	  ajaxRequest.setRequestHeader("Cache-Control", "no-cache");  
      ajaxRequest.send(null);     
}
   
  //////////////////////////////////////////////////////////////////////////////////////////////////
   
      
     
  function isDifferentShipping(state){
	
  var ajaxRequest;  // The variable that makes Ajax possible!  
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
		
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			      
          var obj15 = document.getElementById("isSameShipping");
          var isChecked= obj15.checked;
                    
          if (isChecked == true)
          {
              document.getElementById("shipping_information").style.display = "none";              
              document.getElementById("vchCustShippingFirstName").value = ""; 
              document.getElementById("vchCustShippingLastName").value = "";  
              document.getElementById("vchCustShippingAddress").value = "";               
              document.getElementById("vchCustShippingCity").value = "";              
              document.getElementById("vchCustShippingState").value = "";
              document.getElementById("vchCustShippingZip").value = "";
              document.getElementById("vchCustShippingCountry").value = "";
              document.getElementById("vchCustShippingEmail").value = "";
                    
          }
          else
          {
              document.getElementById("shipping_information").style.display = "block";              
          }
        
		}
	}
	
  	
  var queryString = "";
	ajaxRequest.open("GET", "display_different_shipping.php" + queryString, true);
	ajaxRequest.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
  ajaxRequest.setRequestHeader("Cache-Control", "no-cache");  
	ajaxRequest.send(null);
	
	}
	
  //////////////////////////////////////////////////////////////////////////////////////////////////

