url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

function check_process(uname){
   if(uname==''){
      thetd='progress1';
      document.getElementById(thetd).innerHTML="<font color='red' size='2'><b>Enter The Username First</b></font>";
   }
   else{
      thetd1='progress1';
      document.getElementById(thetd1).innerHTML="&nbsp;";
      thetd='progress2';
      loading(thetd,'Please wait');
      url="check_username.php?uname="+uname;
      ajax_do(url);
   }
}

function loading(thediv,txt){
   document.getElementById(thediv).innerHTML="<img src=images/loading1.gif border=0>"+"<b>"+txt+"</b>";
}

function ajax_do (url) {
        // Does URL begin with http?
        if (url.substring(0, 4) != 'http') {
                url = base_url + url;
        }
        // Create new JS element
        var jsel = document.createElement('SCRIPT');
        jsel.type = 'text/javascript';
        jsel.src = url;

        // Append JS element (therefore executing the 'AJAX' call)
        document.body.appendChild (jsel);
        //return true;
}




