//Javascript for send state mls accounts to the pages
  var a = [ 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.5.0' ];
  var loadObj = new Object();
  var realtor_page_test = false; //default value
  
  if( !window.XMLHttpRequest && window.ActiveXObject ) {
//If IE, define XMLHttpRequest for consistency
  window.XMLHttpRequest = function() {
  var i = a.length;
  while (i--) {
   try {
     return new ActiveXObject( a[i] );
    } catch (e) {}
   }
   return null;
  };
 } 
  
  function checkBrowser() {
//See if the browser supports XMLHttpRequest
  if(window.XMLHttpRequest){
    //Mozilla
    return true;
  }
  else if(window.ActiveXObject) {
    //IE
    var testObj;
    var i = a.length;
    while (i--) {
     try {
       testObj = new ActiveXObject( a[i] );
	   return true;
	 } catch (e) {}
    }
  }
  return false;
} 
 
 function SendState(state_name_mc){
 	var state_name = state_name_mc.substr(0,2);
	var theURL;
  
  	//check browsers
	if(!checkBrowser()){
  		return true;
	}
  
    //define fucntion to call after save
  	loadObj.xmlHttp = new XMLHttpRequest();
  	loadObj.xmlHttp.onreadystatechange = function() 
	{
		if (loadObj.xmlHttp.readyState==4) {
    	  if(loadObj.xmlHttp.status == 200) { //The server responded with OK
			document.getElementById('usamls_account_overflow').innerHTML = loadObj.xmlHttp.responseText;
			document.getElementById('usamls_account_heading').innerHTML = state_name + " Accounts";
		  }
		}
	};
    
  	//send info to asp page
  	theURL = 'usa_map/load_usamls_statelinks.asp?state_code=' + state_name + '&realtor_page=' + realtor_page_test;
	loadObj.xmlHttp.open("GET", theURL, true);
  	loadObj.xmlHttp.send(null);
 }
