// JavaScript Document
var Client = {
	
	xmlHttp: false,
	qs: '',
	method: 'POST',
	headerType: 'Content-Type',
	headerValue: 'application/x-www-form-urlencoded',
	url: '',
	xmlHttpResult: null,
	
	XmlHttpInit: function(){
		var XHRO = false;
		
		try {
			// Firefox, Opera 8.0+, Safari
			XHRO=new XMLHttpRequest();
		} catch (e) {
			// Internet Explorer
			try {
				XHRO=new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				XHRO=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		
		return XHRO;
	},
	
	XmlHttpSetHeaderType: function(headerType){
		this.headerType = headerType;				
	},
	
	XmlHttpSetHeaderValue: function(headerValue){
		this.headerValue = headerValue;				
	},
	
	XmlHttpSetMethod: function(method){
		this.method = method;
	},
	
	XmlHttpSendRequest: function(){
		
		//xmlResult = '';
		
		if(this.xmlHttp != null){
			this.xmlHttp.open(this.method,this.url);
			this.xmlHttp.setRequestHeader(this.headerType, this.headerValue);
			
			this.xmlHttp.onreadystatechange = function(){
				
				if(Client.xmlHttp.readyState == 4 && Client.xmlHttp.status == 200){
					Client.xmlHttpResult = Client.xmlHttp.responseText;
					//xmlResult = Client.xmlHttp.responseText;
				}
			}
			//this.xmlHttp.onreadystatechange = this.XmlRequest();
		
			if(this.method == 'POST') this.xmlHttp.send(this.qs);
			
		} else {
			
			alert("Your browser does not support AJAX");
			return false;;
		}
		
		return Client.xmlHttpResult;
	},
	
	XmlRequest: function(){
		
		if(this.xmlHttp.readyState == 4 && this.xmlHttp.status == 200){
			this.xmlHttpResult = this.xmlHttp.responseText;
		}
		
	},
	
	Login: function(frm){
		/*
		this.xmlHttp = this.XmlHttpInit();
		this.qs = "pass="+frm.Client_Login.value;
		this.url = "clientLogin.php";
		this.xmlHttpResult = this.XmlHttpSendRequest();
		//alert(this.xmlHttpResult);
		if(this.xmlHttpResult == 1){
			document.getElementById("errorMsg").innerHTML = "Your password is correct.";	
			*/
			frm.method = "post";
			frm.action = "client_login.php";
			frm.submit();
		/*} else {
			//alert(this.xmlHttpResult);
			document.getElementById("errorMsg").innerHTML = "Your password may be invalid.";	
		}*/
	}
	
	
}