var http = "";
var fs   = "";

str = document.cookie;

if(str.search(/FundoradoSession/) != "-1")
{
   result = str.search(/FundoradoSession/);
   
   if(str.substr(result, str.substr(result, str.length).indexOf(";")))
   {
      tmp = str.substr(result, str.substr(result, str.length).indexOf(";")).split("=");
      fs  = tmp[1];
   }
   else
   {
      tmp = str.substr(result, str.length).split("=");
      fs  = tmp[1];
   }   
}

if(str.search(/SadoradoSession/) != "-1")
{
   result = str.search(/SadoradoSession/);
   
   if(str.substr(result, str.substr(result, str.length).indexOf(";")))
   {
      tmp = str.substr(result, str.substr(result, str.length).indexOf(";")).split("=");
      fs  = tmp[1];
   }
   else
   {
      tmp = str.substr(result, str.length).split("=");
      fs  = tmp[1];
   }   
}

function getHTTPObject() 
{
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try 
		{
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
		xmlhttp = false;
		}
	}
	return xmlhttp;
}

function transmitSessionID()
{
   http.open("post", "/PHP/updateAjaxSession.php", true);
   http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   http.send("session_id=" + fs);
   window.setTimeout("transmitSessionID()", 20000);
}

if(fs != ""){
   http = getHTTPObject();
   if(http)
      transmitSessionID();
}
