function writediv(texte) 
     { 
     document.getElementById('val_username').innerHTML = texte; 
     } 

function verifLogin(login) 
     { 
	 if(!login)
		writediv('<img src="Resources/cross.jpg" border=0 width=20 height=20 >');
	else if(texte = file('veriflogin.php?login='+login)) 
     	{ 
          if(texte == 11 || texte == 12 || texte == 21) {
               writediv('<img src="Resources/cross.jpg" border=0 width=20 height=20 id="val_username_img"><span style="color:#cc0000;"> Sorry, that username is taken</span>');
			   document.getElementById('username').className = 'register_txtbox_fail';
		  }
          else if(texte == 22) {
               writediv('<img src="Resources/tick.jpg" border=0 width=20 height=20 id="val_username_img">');
			   document.getElementById('username').className = 'register_txtbox_ok';
		  }
		  else 
               writediv(texte); 
         } 
	 
     } 



function file(fichier) 

     { 

     if(window.XMLHttpRequest) // FIREFOX 

          xhr_object = new XMLHttpRequest(); 

     else if(window.ActiveXObject) // IE 

          xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 

     else 

          return(false); 

     xhr_object.open("GET", fichier, false); 

     xhr_object.send(null); 

     if(xhr_object.readyState == 4) return(xhr_object.responseText); 

     else return(false); 

     } 
