function createRequestObject() {
    var tmpXmlHttpObject;
    
    //depending on what the browser supports, use the right way to create the XMLHttpRequest object
    if (window.XMLHttpRequest) { 
        // Mozilla, Safari would use this method ...
        tmpXmlHttpObject = new XMLHttpRequest();
	
    } else if (window.ActiveXObject) { 
        // IE would use this method ...
        tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    return tmpXmlHttpObject;
}

function Contact ()
{	
	//perform login	
	var httpDo = createRequestObject();
	var userName=document.getElementById ('name').value;
	var email=document.getElementById ('email').value;
	var message=document.getElementById('message').value;
	params = 'username='+userName+'&email='+email+'&message='+message;
	httpDo.open('GET','Contact.php?'+params);

	httpDo.onreadystatechange = function()
	{
            if(httpDo.readyState == 4)
            {	   		
                document.getElementById('ajax').innerHTML = httpDo.responseText;	
                document.getElementById('ajax').style.display = '';	
            }   	
	}
	httpDo.send(null);	
}

function RecoverPassword ()
{	
	//perform login	
        document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random();
	var httpDo = createRequestObject();
	var email=document.getElementById ('email').value;
	params = 'email='+email;
	httpDo.open('GET','doRecover.php?'+params);

	httpDo.onreadystatechange = function()
	{
            if(httpDo.readyState == 4)
            {	   		
                document.getElementById('ajax').innerHTML = httpDo.responseText;	
                document.getElementById('ajax').style.display = '';	
            }   	
	}
	httpDo.send(null);	
}

function DoLogin (path)
{	
    //perform login	
    var httpDo = createRequestObject();
    var userName=document.getElementById ('name').value;
    var password=document.getElementById ('password').value;
    params = 'username='+userName+'&password='+password;
    httpDo.open('GET',path+'/doLogin.php?'+params);
    httpDo.onreadystatechange = function()
    {
        if(httpDo.readyState == 4)
        {	   		
            document.getElementById('ajaxlogin').innerHTML = httpDo.responseText;	
            document.getElementById('ajaxlogin').style.display = '';	
        }   	
    }
    httpDo.send(null);	
}

function Register ()
{	
	//perform login	
        document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random();
	var httpDo = createRequestObject();
	var userName=document.getElementById ('username').value;
        var password=document.getElementById('password').value;
        var password1=document.getElementById('password1').value;
	var email=document.getElementById ('email').value;
	var captcha=document.getElementById('captcha').value
	params = 'username='+userName+'&password='+password+'&password1='+password1+'&email='+email+'&captcha='+captcha;
	httpDo.open('GET','doRegister.php?'+params);

	httpDo.onreadystatechange = function()
	{
            if(httpDo.readyState == 4)
            {	   		
                document.getElementById('ajax').innerHTML = httpDo.responseText;	
                document.getElementById('ajax').style.display = '';	
            }   	
	}
	httpDo.send(null);	
}
