var ouinterval = 14;

var _ouInterval;
var iesux = 1;
var ticker = 0;

function DOMwrap(name) {
    if (document.getElementById)
        return document.getElementById(name);
     else if (document.all)
        return document.all[name];
    else if (document.layers)
        return document.layers[name];
}

function CheckSignup(thetype, thevalue) {
var ouhttp;
   try {
      ouhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
      try {
         ouhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
         ouhttp = false;
      }
   }

   if (!ouhttp && typeof XMLHttpRequest!='undefined') {
      ouhttp = new XMLHttpRequest();
      iesux = 0;
   }

   if(! ouhttp) {
      return false;
   }

   ouhttp.onreadystatechange=function() {
      if (ouhttp.readyState==4) {
         if(ouhttp.responseText) {
            if(DOMwrap('checkemail')){
            	var emailreturn = ouhttp.responseText;
		if(emailreturn != 0){
			if(thetype == "username"){
				DOMwrap('check'+thetype).innerHTML = "<font color='green'><b>Your name will be : " + emailreturn + "</b></font>";
			} else {
				DOMwrap('check'+thetype).innerHTML = "<font color='green'><b>Good</b></font>";
			}
		} else {
			DOMwrap('check'+thetype).innerHTML = "<font color='red'><b>Bad</b></font>";
		}
	    }
         }
      }
   }
   ouhttp.open("POST", "/checksignup.php?check="+thetype+"&value="+thevalue,true);
   try {
      ouhttp.setRequestHeader('X-Referer', document.location);
   } catch (e) {
      //alert(e);
   }


   if(iesux) {
      ouhttp.send()
   } else {
      ouhttp.send(null)
   }

   return true;
}
