	/************************************************************************************************************
	Ajax client lookup
	Copyright (C) 2006  DTHMLGoodies.com, Alf Magne Kalleland
	
	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.
	
	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
	
	Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
	written by Alf Magne Kalleland.
	
	Alf Magne Kalleland, 2006
	Owner of DHTMLgoodies.com
	
	
	************************************************************************************************************/	
	var ajaxObjects = new Array();
	var currentClientID=false;
	function getClientData()
	{
		var indexThis = ajaxObjects.length;
		ajaxObjects[indexThis] = new sack();

		var clientId = document.getElementById('clientID').value.replace(/[^a-zA-Z0-9 ]/g,'');
		if(clientId!=currentClientID){
			currentClientID = clientId
			ajaxObjects[indexThis].requestFile = 'getRest.php?getClientId='+clientId;	// Specifying which file to get
			ajaxObjects[indexThis].onCompletion = function(){ showClientData(indexThis); } ;	// Specify function that will be executed after file has been found
			ajaxObjects[indexThis].runAJAX();		// Execute AJAX function			
		}
		
	}
	
	function showClientData(indexThis)
	{
		var formObj = document.forms['SubmitClosed'];	
		eval(ajaxObjects[indexThis].response);
	}
	
	
	function initFormEvents()
	{
		//document.getElementById('clientID').onblur = getClientData;
		document.getElementById('clientID').onkeyup = getClientData; // If you wish to have a lookup "as you type"
		//document.getElementById('clientID').focus();
	}
	
	
	window.onload = initFormEvents;