function ClientScriptManager()
{
	//Properties
	this.MethodQueue = new Array();
	this.ReadyToProcess = false;
	this.Exceptions = new Array();
	this.ProcessQueue = processQueue;
	this.QueueMethod = queueMethod;
	this.DisplayExceptions = displayExceptions;
	
	//Adds a method & parameters to the queue awaiting processing.
	function queueMethod(MethodName, ParameterArray)
	{
		var toAdd = new Array(2);	
		toAdd[0] = MethodName;
		toAdd[1] = ParameterArray;
		this.MethodQueue.unshift(toAdd);
	}

	function processQueue()
	{
		//Set Up Variables
		var bReturn = false;
		var toProcess;
		var methodCall;
		var params;
		var queLength=this.MethodQueue.length;
		
		for(i=0;i<queLength;i++)
		{
			toProcess = this.MethodQueue.pop();
			methodCall = toProcess[0] + "(";
			params = toProcess[1];
			if(params!=null)
			{
				for(p=0;p<params.length;p++)
				{
					if(methodCall.lastIndexOf("(")!=methodCall.length-1)
					{
						methodCall += ", ";
					}
					methodCall += params[p];
				}
			}
			methodCall += ")";
			//try and execute the method call
			try
			{
				window.execScript(methodCall,"javascript");
				//eval(methodCall);
			}
			catch(err)
			{
				bReturn = true;
				this.Exceptions.unshift(err);	
			}
		}
		//Check the Queue length, if greater than 0 then try again.
		if(this.MethodQueue.length>0)
		{
			this.ProcessQueue();
		}
		return bReturn;			
	}
	
	function displayExceptions()
	{
		var retVal = new Array();
		var message = "";
		var err;
		for(i=0;i<this.Exceptions.length;i++)
		{
			err = this.Exceptions.pop();
			message="No:" + err.number +"\n";
			message+="Name:" + err.name +"\n";
			message+="Message:" + err.message +"\n";
			message+="Description:" + err.description +"\n";
			retVal.push(message);
		}
	}
}

function SetFormOnLoad()
{
	document.getElementById("lang").style.display = "none" 
	document.getElementById("alt_submit").style.display = "none" 
}
function doSearch(language) 
{
	document.getElementById("lang").value = language;
	document.getElementById("Form1").submit();
}