// ------------------------------------------------------------------------------------------
// Copyright AspDotNetStorefront.com, 1995-2007.  All Rights Reserved.
// http://www.aspdotnetstorefront.com
// For details on this license please visit  the product homepage at the URL above.
// THE ABOVE NOTICE MUST REMAIN INTACT. 
// ------------------------------------------------------------------------------------------

function makeHttpRequest(url, element, calltype) {
  var http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
      http_request.overrideMimeType('text/xml');
    }
  } else if (window.ActiveXObject) { // IE
    try {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  if (!http_request) {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
  http_request.onreadystatechange = function() {
    if (http_request.readyState == 4) {
      if (http_request.status == 200) {
        loadXML(http_request.responseXML,calltype);
      } else {
        alert('There was a problem with the request. (Code: ' + http_request.status + ')');
      }
    }
  }
  http_request.open('GET', url, true);
  http_request.send(null);
}

//******************************************************************************************
//***** NEW FUNCTION MADE TO GET PRICES ACCORDING TO COLOR******
//******************************************************************************************

function getPricingForColor(ProductID, VariantID, bGetSlideData)
{	    
    document.getElementById('dvProcess').style.visibility="visible";
    document.getElementById('spPdata').style.visibility="visible";
    document.getElementById('spPdatatext').style.visibility="visible";    
    //document.getElementById('trCartTotal').style.visibility="visible";
    document.getElementById('SizeMatrix').style.visibility="hidden";
    document.getElementById('btnAddToCart').style.visibility="hidden";
    //document.getElementById('btnAddToWishList').style.visibility="hidden";

    if(ProductID == undefined || VariantID == undefined)
	{
		return;
	}
    var url = "ajaxSizeMatrix.aspx?ProductID=" + ProductID + "&VariantID=" + VariantID + "&bGetSlideData=" + bGetSlideData;
    
    setTimeout("ProgressImage()", 500);
    makeHttpRequestForSizeMatrixReform(url,undefined); 
}

//*****************************************************************************************************************
//***** NEW FUNCTIONS MADE BY IMRAN ON 25TH OCT, 2007 TO GET SHIPPING CHARGES ACCORDING TO SELECTED STATE & ZIPCODE
//*****************************************************************************************************************

function getShippingCharges()
{
    var StateAbbre = '';
    var ZipCode = '';
    
    if(document.selection)
    {
        StateAbbre = document.getElementById("ddlState").options(document.getElementById("ddlState").selectedIndex).value;
        ZipCode = document.getElementById("txtZipCode").value;
    }
    else if (window.getSelection)
    {
        StateAbbre = document.getElementById("ddlState").options[document.getElementById("ddlState").selectedIndex].value;
        ZipCode = document.getElementById("txtZipCode").value;
    }
    
    if (isInteger(ZipCode) && isAlphabetic(StateAbbre))
    {
        if (StateAbbre != 'INTL')
        {
            document.getElementById('shoppingcartaspx13').innerHTML = '<img src="images/shippingloader.gif">';
            EnableDisableControls(true);

            var url = "ajaxShippingCharges.aspx?StateAbbre=" + StateAbbre + "&ZipCode=" + ZipCode;
            makeHttpRequestForShippingCharges(url);
        }
    }
    else
    {
        alert('Invalid Zip Code!');
    }
}

function makeHttpRequestForShippingCharges(url)
{
  var http_request = false;
  
  if (window.XMLHttpRequest)
  { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType)
    {
      http_request.overrideMimeType('text/xml');
    }
  } 
  
  else if (window.ActiveXObject) 
  { // IE
    try 
    {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) 
    {
      try 
      {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  
  if (!http_request) 
  {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
  
  http_request.onreadystatechange = function()
  {
    if (http_request.readyState == 4) 
    {
      if (http_request.status == 200) 
      {                                 
        LoadShippingCharges(http_request.responseText);       
      } 
      else 
      {
        document.getElementById('shoppingcartaspx13').innerHTML = '------';
        alert('Sorry! we are unable process your request.\nMay be this is happened due to incorrect combination of state and zip code.');
        EnableDisableControls(false);
      }              
    }
  }
  
  http_request.open('GET', url, true);
  http_request.send(null);
}

function LoadShippingCharges(html)
{	
    var element = 'shoppingcartaspx13';
    var elementcaption= 'shoppingcartaspx12';
    
	document.getElementById(element).innerHTML = html;
	document.getElementById(elementcaption).innerHTML = 'Shipping: (UPS Ground)';
	EnableDisableControls(false);
}

function EnableDisableControls(action)
{
    document.getElementById('btnCalculateShipping').disabled=action;
	document.getElementById('txtZipCode').disabled = action;
	document.getElementById('ddlState').disabled = action;
}

//*****************************************************************************************************************
//***** NEW FUNCTIONS MADE BY IMRAN ON 13TH NOV, 2007 TO DISPLAY, ADD & DELETE COUPON ENTERED IN SHOPPING CART
//*****************************************************************************************************************

function DisplayCartCoupons(CouponCode, CouponCodeDelete)
{	
    if (CouponCode == undefined)
        CouponCode = '';
        
    if (CouponCodeDelete == undefined)
        CouponCodeDelete = '';
    
    if ((CouponCode.length > 0) && (isAlphanumeric(CouponCode) == false))
    {
        alert('Please enter a valid Coupon Code!');
    }
    else
    {
        var url = "ajaxCartCoupons.aspx?CouponCode=" + CouponCode + "&CouponCodeDelete=" + CouponCodeDelete;
        MakeHttpRequestForCartCoupons(url);
        document.getElementById('CouponCode').value = '';
    }
}

function MakeHttpRequestForCartCoupons(url)
{
  var http_request = false;
  
  if (window.XMLHttpRequest) 
  { 
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) 
    {
      http_request.overrideMimeType('text/xml');
    }
  } 
  
  else if (window.ActiveXObject) 
  { // IE
    try 
    {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) 
    {
      try 
      {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  
  if (!http_request) 
  {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
  
  http_request.onreadystatechange = function() 
  {
    if (http_request.readyState == 4) 
    {
      if (http_request.status == 200) 
      {                                 
        LoadCartCoupons(http_request.responseText);
      } 
      else 
      {
        alert('Sorry! we are unable process your request.\nMay be this is happened due to internet connection failure.');
      }              
    }
  }
  
  http_request.open('GET', url, true);
  http_request.send(null);
}

function LoadCartCoupons(html)
{	
    var element = 'dvCartCoupons';
    document.getElementById(element).innerHTML = html;
}


//*****************************************************************************************************************
//***** NEW FUNCTIONS MADE BY IMRAN ON 25TH OCT, 2007 TO GET SIZES DROP DOWN ACCORDING TO SELECTED COLOR
//*****************************************************************************************************************

function getSizesForColor(CartID, objControl, CtrlToUpdate)
{
    var VariantID = objControl.options[objControl.selectedIndex].value;

    if(VariantID == undefined)
	{
		return;
	}
	
    var url = "ajaxColorSize.aspx?CartID=" + CartID + "&VariantID=" + VariantID;
    makeHttpRequestForColorSizeReform(url,undefined, CartID, CtrlToUpdate);
}

function makeHttpRequestForColorSizeReform(url, element, CartID, CtrlToUpdate) 
{
  var http_request = false;
  
  if (window.XMLHttpRequest) 
  { 
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) 
    {
      http_request.overrideMimeType('text/xml');
    }
  } 
  
  else if (window.ActiveXObject) 
  { // IE
    try 
    {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) 
    {
      try 
      {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  
  if (!http_request) 
  {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
  
  http_request.onreadystatechange = function() 
  {
    if (http_request.readyState == 4) 
    {
      if (http_request.status == 200) 
      {                                 
        LoadColorSizes(http_request.responseText, CartID, CtrlToUpdate);
      }
      else
      {
        alert('Sorry! we are unable process your request.\nMay be this is happened due to internet connection failure.');
      }
    }
  }
  
  http_request.open('GET', url, true);
  http_request.send(null);
}

function LoadColorSizes(html, CartID, CtrlToUpdate)
{
    var element = CtrlToUpdate + CartID;
    document.getElementById(element).innerHTML = html;
}

//*************************************************************************************************************************
//                                                      END
//*************************************************************************************************************************


function makeHttpRequestForSizeMatrixReform(url, element) 
{
  var http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
      http_request.overrideMimeType('text/xml');
    }
  } else if (window.ActiveXObject) { // IE
    try {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  if (!http_request) 
  {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
  http_request.onreadystatechange = function() {
    if (http_request.readyState == 4) 
    {
      if (http_request.status == 200) 
      {
        if (getPageName() != 'HS_ShowProduct.aspx')
        {
            LoadSlideDownContents(http_request.responseText);  
        }

        loadHTML(getTable(http_request.responseText));
        loadImage(getDiv(http_request.responseText));
      }
      else 
      {
        alert('Sorry! we are unable process your request.\nMay be this is happend due to internet connection failure.');
      }
    }
  }
  http_request.open('GET', url, true);
  http_request.send(null);
}

function ProgressImage()
{
    document.getElementById('dvProcess').style.visibility="hidden";	
    document.getElementById('spPdata').style.visibility="hidden";
    document.getElementById('spPdatatext').style.visibility="hidden";       
    document.getElementById('SizeMatrix').style.visibility="visible";
    document.getElementById('btnAddToCart').style.visibility="visible";
    //document.getElementById('btnAddToWishList').style.visibility="visible";
}

function getTable(content) 
{ 
   var x = content.indexOf("<!-- SIZE MATRIX --");
   x = content.indexOf(">", x);    
   var y = content.lastIndexOf("<!-- END SIZE MATRIX -->"); 
   return content.slice(x + 1, y);
} 

function getDiv(content) 
{ 
   var x = content.indexOf("<!-- IMAGE CONTAINER --");
   x = content.indexOf(">", x);    
   var y = content.lastIndexOf("<!-- END IMAGE CONTAINER -->"); 
   return content.slice(x + 1, y);
} 

function getPrice(content)
{
   var x = content.indexOf("<!-- PRICE CONTAINER --");
   x = content.indexOf(">", x);
   var y = content.lastIndexOf("<!-- END PRICE CONTAINER -->");
   return content.slice(x + 1, y);
}

function loadHTML(html)
{	
	document.getElementById('SizeMatrix').innerHTML = html;			
}

function loadImage(html)
{	
	document.getElementById('VariantImageContainer').innerHTML = html;	
	
}

function LoadSlideDownContents(contents)
{
    var strcontents = '';
    if (contents.indexOf("<!-- SLIDEDOWN CONTAINER --") != -1)
    {
        var x = contents.indexOf("<!-- SLIDEDOWN CONTAINER -->") - 1;
        var y = contents.lastIndexOf("<!-- END SLIDEDOWN CONTAINER -->");
        strcontents = contents.slice(x + 1, y);
        document.getElementById("dvSlideContents").innerHTML = strcontents;
    }
    
    if (contents.indexOf("<!-- SHOPPING CART --") != -1)
    {
        var x = contents.indexOf("<!-- SHOPPING CART -->") - 1;
        var y = contents.lastIndexOf("<!-- END SHOPPING CART -->");
        strcontents = contents.slice(x + 1, y);
        document.getElementById("achTotalCartItems").innerHTML = strcontents;
    }
    
    if (contents.indexOf("<!-- SHOPPING CART SUB TOTAL-->") != -1)
    {
        var x = contents.indexOf("<!-- SHOPPING CART SUB TOTAL-->") - 1;
        var y = contents.lastIndexOf("<!-- END SHOPPING CART SUB TOTAL -->");
        
        strcontents = contents.slice(x + 1, y);
        document.getElementById("dvShoppingCartSubTotal").innerHTML = strcontents;
    }
}

//*************************************************************************************************************
//*************************************************************************************************************

function loadXML(xml,calltype)
{
	if(calltype == 'shipping')
	{
		var string = '';
		var root = xml.getElementsByTagName('Shipping')[0];
		for (i = 0; i < root.childNodes.length; i++)
		{
    		var node = root.childNodes[i].tagName;
		    string += root.getElementsByTagName(node)[0].childNodes[0].nodeValue + "<br />";
		}
		if (document.getElementById('ShipQuote'))
		{
			document.getElementById('ShipQuote').innerHTML = string;
		}
	}
	if(calltype == 'pricing')
	{
		var prnode = xml.getElementsByTagName('PriceHTML')[0];
		var variantnode = xml.getElementsByTagName('VariantID')[0];
		var NewPrice = "Not Found";
		var VariantID = "0";
		if(prnode != undefined)
		{
			NewPrice = xml.getElementsByTagName('PriceHTML')[0].firstChild.data
		}
		if(variantnode != undefined)
		{
			VariantID = xml.getElementsByTagName('VariantID')[0].firstChild.data
		}
		
		if (document.getElementById('VariantPrice_' + VariantID))
		{
			document.getElementById('VariantPrice_' + VariantID).innerHTML = NewPrice;
		}
	}
}

function getShipping()
{
	if(document.getElementById('Quantity') == undefined || document.getElementById('VariantID') == undefined)
	{
		return;
	}
	var VariantID = document.getElementById('VariantID');
	var Quantity = document.getElementById('Quantity');
  if(Quantity == '')
  {
   Quantity = '1';
  }
  var Country = '';
  if(document.getElementById('Country').length > 0)
  {
	  Country = document.getElementById('Country').options[document.getElementById('Country').selectedIndex].value;
  }
  else
  {
	  Country = document.getElementById('Country').value;
  }
  var State = '';
  if(document.getElementById('State').length > 0)
  {
	  State = document.getElementById('State').options[document.getElementById('State').selectedIndex].value;
  }
  else
  {
	  State = document.getElementById('State').value;
  }
  var PostalCode = document.getElementById('PostalCode');
  
  if (Country.length > 0) {
    if (State.length > 0) {
      if (PostalCode.value.length > 4) {
        if (Quantity.value > 0) {
          Cookies.create('countrycookie',Country,99);
          Cookies.create('statecookie',State,99);
          Cookies.create('postalcookie',PostalCode.value,99);
          var url = "ajaxShipping.aspx?VariantID="+VariantID.value+"&Quantity="+Quantity.value+"&Country="+Country+"&State="+State+"&PostalCode="+PostalCode.value;
          //alert(url);
          makeHttpRequest(url,undefined,'shipping');
        } else {
          Cookies.erase('countrycookie');
          Cookies.erase('statecookie');
          Cookies.erase('postalcookie');
          Error('qty');
        }
      } else {
        Cookies.erase('countrycookie');
        Cookies.erase('statecookie');
        Cookies.erase('postalcookie');
        Error('postal');
      }
    } else {
      Cookies.erase('countrycookie');
      Cookies.erase('statecookie');
      Cookies.erase('postalcookie');
      Error('state');
    }
  } else {
    Cookies.erase('countrycookie');
    Cookies.erase('statecookie');
    Cookies.erase('postalcookie');
    Error('country');
  }
}


function getPricing(ProductID,VariantID)
{
	//alert('VariantID=' + VariantID);
	if(ProductID == undefined || VariantID == undefined)
	{
		return;
	}

	var ChosenSize = "";
	var ChosenSizeList = document.getElementById('Size');
	if(ChosenSizeList != undefined)
	{
		ChosenSize = ChosenSizeList.options[ChosenSizeList.selectedIndex].text;
	}

	var ChosenColor = "";
	var ChosenColorList = document.getElementById('Color');
	if(ChosenColorList != undefined)
	{
		ChosenColor = ChosenColorList.options[ChosenColorList.selectedIndex].text;
	}

    var url = "ajaxPricing.aspx?ProductID=" + ProductID + "&VariantID=" + VariantID + "&size=" + escape(ChosenSize) + "&color=" + escape(ChosenColor);
    makeHttpRequest(url,undefined,'pricing');
}



function Error(type) {
  if (type == 'country') {
    document.getElementById('ShipQuote').innerHTML = "Select A Country";
  }
  if (type == 'state') {
    document.getElementById('ShipQuote').innerHTML = "Select A State";
  }
  if (type == 'postal') {
    document.getElementById('ShipQuote').innerHTML = "Enter Postal Code";
  }
  if (type == 'qty') {
    document.getElementById('ShipQuote').innerHTML = "Enter A Quantity";
  }
}

var Cookies = {
  init: function () {
    var allCookies = document.cookie.split('; ');
    for (var i=0;i<allCookies.length;i++) {
      var cookiePair = allCookies[i].split('=');
      this[cookiePair[0]] = cookiePair[1];
    }
  },
  create: function (name,value,days) {
    if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
    this[name] = value;
  },
  erase: function (name) {
    this.create(name,'',-1);
    this[name] = undefined;
  }
};
Cookies.init();

window.onload=function readCookies() {
  if (!document.getElementById) return false;
  var countrycookie = Cookies['countrycookie'];
  var statecookie = Cookies['statecookie'];
  var postalcookie = Cookies['postalcookie'];
  if (countrycookie) {
    if (statecookie) {
      if (postalcookie) {
        if (document.getElementById('Country') != null) {
          document.getElementById('Country').value = Cookies['countrycookie'];
          if (document.getElementById('State') != null) {
            document.getElementById('State').value = Cookies['statecookie'];
            if (document.getElementById('PostalCode') != null) {
              document.getElementById('PostalCode').value = Cookies['postalcookie'];
              if (document.getElementById('VariantID') != null) {
                if (document.getElementById('Quantity') != null) {
                  getShipping();
                }
              }
            }
          }
        }
      }
    }
  }
}
//===================================================================================================================================
//==========================START POST ORDER USING AJAX====================================================================
//===================================================================================================================================

function GetQueryString(fobj)
{ 
   var str = "";
   var valueArr = null;
   var val = "";
   var cmd = ""; 

   for(var i = 0;i < fobj.elements.length;i++) 
   { 

       switch(fobj.elements[i].type) 
       { 
            case "text":
            
                str += fobj.elements[i].name + 
                "=" + escape(fobj.elements[i].value) + "&"; 
                break; 
                
           case "hidden":
           
                str += fobj.elements[i].name +
                 "=" + escape(fobj.elements[i].value) + "&";
                 break;
            
           case "select-one":

                str += fobj.elements[i].name +
                "=" + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&";
                break;
       } 

   } 

   str = str.substr(0,(str.length - 1)); 
   return str; 
} 

function PostOrder(url, objform, element) 
{
  
  var http_request = false;
  
  if (window.XMLHttpRequest) 
  { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) 
    {
      http_request.overrideMimeType('text/xml');
    }
  }
  
  else if (window.ActiveXObject)
  { // IE
    try {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  if (!http_request) 
  {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
    http_request.onreadystatechange = function() 
    {
        if (http_request.readyState == 4) 
        {
            if (http_request.status == 200) 
            {
                
            } 
            else 
            {
                alert('Sorry! we are unable process your request.\nMay be this is happend due to internet connection failure.');
            }
        }
    }
    
    document.getElementById('SizeMatrix').style.visibility="hidden";
    document.getElementById('btnAddToCart').style.visibility="hidden";
    //document.getElementById('btnAddToWishList').style.visibility="hidden";
    document.getElementById('spPdatatext').style.visibility="visible";
    document.getElementById('spPdata').style.visibility="visible";
    
    var queryString = GetQueryString(objform);
    http_request.open('POST', url, true);
    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http_request.setRequestHeader("Content-length", queryString.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(queryString);
}

function getSlideDownContents()
{	
    var url = "ajaxShippingCharges.aspx?SlideDownContents=1";
    makeHttpRequestForSlideDownContents(url);    
}


function makeHttpRequestForSlideDownContents(url)
{
  var http_request = false;
  
  if (window.XMLHttpRequest) 
  { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) 
    {
      http_request.overrideMimeType('text/xml');
    }
  } 
  
  else if (window.ActiveXObject) 
  { // IE
    try 
    {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) 
    {
      try 
      {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  
  if (!http_request) 
  {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
  
  http_request.onreadystatechange = function() 
  {
    if (http_request.readyState == 4) 
    {
      if (http_request.status == 200) 
      {                                 
        document.getElementById("dvSlideContents").innerHTML = http_request.responseText;
      } 
      else 
      {
        alert('Sorry! we are unable process your request.\nMay be this is happened due to incorrect combination of state and zip code.');
      }
    }
  }
  
  http_request.open('GET', url, true);
  http_request.send(null);
}

//=====================================================================================================================
//==========================END POST ORDER USING AJAX==================================================================
//=====================================================================================================================


var xmlReq = null;; 

function sub(f) 
{ 
   
   alert('jio') ;
   var file = 'Test.aspx';

   var str = getFormValues(f, "validate");
   
   alert(str) ;

   xmlReq = getXML(file,str); 

} 


function getFormValues(fobj,valFunc) 
{ 
   var str = "";
   var valueArr = null;
   var val = "";
   var cmd = ""; 

   for(var i = 0;i < fobj.elements.length;i++) 
   { 

       switch(fobj.elements[i].type) 
       { 
           case "text": 

                str += fobj.elements[i].name + 

                 "=" + escape(fobj.elements[i].value) + "&"; 

                 break; 

           case "select-one": 

                str += fobj.elements[i].name + 

                "=" + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&"; 

                break; 

       } 

   } 

   str = str.substr(0,(str.length - 1)); 

   return str; 

}

function getXML(file,str) 
{ 

   var doc = null 

   if (typeof window.ActiveXObject != 'undefined' ) 
   { 
        doc = new ActiveXObject("Microsoft.XMLHTTP");

        doc.onreadystatechange = function() 
        {
            if (doc.readyState == 4) 
            {
                if (doc.status == 200) 
                {
                    
                } 
                else 
                {
                    alert('Sorry! we are unable process your request.\nMay be this is happend due to internet connection failure.');
                }
            }
        }
   } 

   else 

   { 

       doc = new XMLHttpRequest(); 
       doc.onload = function() 
        {
            if (doc.readyState == 4) 
            {
                if (doc.status == 200) 
                {
                    
                } 
                else
                {
                    alert('Sorry! we are unable process your request.\nMay be this is happend due to internet connection failure.');
                }
            }
        }

   } 

   doc.open( "POST", file, true );

   doc.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 

   doc.send(str); 

   return doc; 

}

//===================================================================================================================================
//                  ****************************** START EMAIL SIGNUP SECTION ******************************
//===================================================================================================================================

function EmailSignUpRequest(sEmailAddress)
{
    if (sEmailAddress == undefined)
	{
		return;
	}
    var url = "ajaxMisc.aspx?EmailAddress=" + sEmailAddress;
    makeHttpRequestForEmailSignUp(url);
}

function makeHttpRequestForEmailSignUp(url)
{
  var http_request = false;
  
  if (window.XMLHttpRequest) 
  { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) 
    {
      http_request.overrideMimeType('text/xml');
    }
  } 
  
  else if (window.ActiveXObject) 
  { // IE
    try 
    {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) 
    {
      try 
      {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  
  if (!http_request) 
  {
    alert('Browser doesn\'t support Ajax. Site will NOT FULLY function properly.');
    return false;
  }
  
  http_request.onreadystatechange = function() 
  {
    if (http_request.readyState == 4) 
    {
      if (http_request.status == 200) 
      {                                 
        document.getElementById('dvEmailSignupInner').innerHTML = "<table width='142px;' height='20px'><tr><td class='NormalBlueBold' align='center'>Thanks for Signing up!</td></tr></table>";
      } 
      else
      {
        alert('Sorry! we are unable process your request.\nMay be this is happened due to incorrect combination of state and zip code.');
      }
    }
  }
  
  http_request.open('GET', url, true);
  http_request.send(null);
}


//===================================================================================================================================
//                  ****************************** END EMAIL SIGNUP SECTION ******************************
//===================================================================================================================================