var xmlHttp; 
	
var requestURL = 'http://cjb.y-lynx.com/getboats.aspx'; 
//var requestURL = 'http://localhost/map/getboats.aspx'; 

function init()
{ 
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);


// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {  // if we've detected an acceptable version
	request_data();
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Vous devez mettre à jour votre player Flash !!! '
  	+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
}

function request_data()
{ 
	//Create the xmlHttp object to use in the request 
	//stateChangeHandler will fire when the state has changed, i.e. data is received back 
	// This is non-blocking (asynchronous) 
	xmlHttp = GetXmlHttpObject(stateChangeHandler); 
		
	//Send the xmlHttp get to the specified url 
	xmlHttp_Get(xmlHttp, requestURL); 
} 

//stateChangeHandler will fire when the state has changed, i.e. data is received back 
// This is non-blocking (asynchronous) 
function stateChangeHandler() 
{ 
	//readyState of 4 or 'complete' represents that data has been returned 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete'){ 
		//Gather the results from the callback 
		var xmlstr = xmlHttp.responseText; 
		var xdoc;
		try
		{
			xdoc = new ActiveXObject("Microsoft.XMLDOM")
			xdoc.async="false"
			xdoc.loadXML(xmlstr)
		}
		catch(e)
		{
			var xparser = new DOMParser();
			xdoc = xparser.parseFromString(xmlstr,"text/xml");
		}
		
		window.document["myFlash"].SetVariable("datastr", xmlstr);
		t=setTimeout('request_data()',5000)
	} 
} 

// XMLHttp send GET request 
function xmlHttp_Get(xmlhttp, url) 
{ 
	xmlhttp.open('GET', url, true); 
	xmlhttp.send(null); 
} 

function GetXmlHttpObject(handler) 
{ 
	var objXmlHttp = null;    //Holds the local xmlHTTP object instance 

	//Attempt to create the object 
	try{ 
   		objXmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); 
		objXmlHttp.onreadystatechange = handler; 
	} 
	catch(e){ 
		try{ 
			objXmlHttp = new XMLHttpRequest();
			objXmlHttp.onreadystatechange = handler; 
		} 
		catch(e){ 
		//Object creation errored 
			alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
			return; 
		} 
	} 

	//Return the instantiated object 
	return objXmlHttp; 
} 

