// JavaScript Document
var xmlHttp

function reset_domain_div(){
	document.getElementById('domain_results').style.display='none';
	document.getElementById("domain_results").innerHTML='<div id="loading_container" style=""><img src="images/ecomm/loading.gif" alt=""><br />&nbsp;&nbsp;en chargement...</div>';
}


function view_domain(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("domain_results").style.display = 'block';
		document.getElementById("domain_results").innerHTML=xmlHttp.responseText;
	} 
}

function get_domain(sld, tld){ 
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	if(sld==""){
		alert("Svp. Entrez un nom de domaine à trouver.");
		return;
	}
	document.getElementById("domain_results_container").style.display = 'block';
	document.getElementById("domain_results").style.display = 'block';
	var url="include/checkDomain.php";	
	url=url+"?sld="+sld+"&tld="+tld;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=view_domain;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e){
		//Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
		catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}