// JavaScript Document
function refreshCaptcha()
  {
   var xmlHttp;
   var str="";
  
  try
    {
   xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
     
	  if(xmlHttp.readyState==4)
        {		
		str = xmlHttp.responseText;	
		document.getElementById('captcha_image').innerHTML=str;
		}
      }  	
    xmlHttp.open("GET","captcha/reload_captchaimage.php",true);
	xmlHttp.send(null);
  }

function getXMLHTTP() 
{
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
					print("there is problem in ur browser");
				}
			}
		}		 	
		return xmlhttp;
}

function check_user_availability(strURL)
{  document.getElementById('usercheck').innerHTML="<img src='images/ajax-loader.gif' />";
	var req = getXMLHTTP();
	   if (req) 
		{
		  req.onreadystatechange = function() {
			if (req.readyState == 4) 
			{
			// only if "OK"
			 if (req.status == 200) 
				{	
				  document.getElementById('usercheck').innerHTML=req.responseText;
				  document.getElementById('errorsDiv_username').innderHTML="";
				} 
			else 
				{ alert("There was a problem while using XMLHTTP:\n" + req.statusText);	}
			}
		   }			
			req.open("GET",strURL, true);
			//req.open("POST",strURl,true);
			req.send(null);	
		}
	
}
