	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, April 2006
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/	

	var ajax_list_externalFile = 'ajax-list-name.php';	// Path to external file

	var ajax_list_objects = new Array();	
	var ajax_list_activeInput = false;
	var ajax_list_activeItem;

	var ajax_list_MSIE = false;
	if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)
		ajax_list_MSIE=true;
	
	var currentListIndex = 0;
	
	function ajax_list_cancelEvent()
	{
		return false;
	}		
		
	function ajax_option_list_showContent(ajaxIndex,outputObj,paramToExternalFile,whichIndex,divs)
	{
		if(whichIndex!=currentListIndex)return;	
		for (m=outputObj.options.length-1;m>0;m--)
			outputObj.options[m]=null;
		var content = ajax_list_objects[ajaxIndex].response;
		var elements = content.split('|');
		outputObj.options[0]=new Option('Select','Select');
		for(i=0;i<elements.length-1;i++){
			var option = elements[i].split('###');
			outputObj.options[i+1]=new Option(option[0],option[1])
		}
		divs.className ='hiddendiv';
	}

	function ajax_showOptions(inputArray,paramToExternalFile,outputObj,otherParam,Param2,div)
	{
		div.className ='showDiv';
		var tmpIndex=currentListIndex/1;
		var ajaxIndex = ajax_list_objects.length;
		ajax_list_objects[ajaxIndex] = new sack();
		var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1';
		
		if(inputArray.length>0){
			url+='&Data='+encodeURIComponent(inputArray.join('~'));
		}
		if(otherParam){
			url +='&Type='+otherParam;
		}
		if(Param2){
			url+='&Param='+Param2;
		}
		ajax_list_objects[ajaxIndex].requestFile = url;	// Specifying which file to get
		ajax_list_objects[ajaxIndex].onCompletion = function(){ ajax_option_list_showContent(ajaxIndex,outputObj,paramToExternalFile,tmpIndex,div); };	// Specify function that will be executed after file has been found
		ajax_list_objects[ajaxIndex].runAJAX();		// Execute AJAX function		
	}
