function xmlhttpPost(strURL, strSubmit, strResultFunc, comboName, comboDefault, displayTest, selectedCombo,selectedValue) {
   var xmlHttpReq = false;
        
        // Mozilla/Safari
        if (window.XMLHttpRequest) {
            xmlHttpReq = new XMLHttpRequest();
			if(xmlHttpReq.overrideMimeType){               
				xmlHttpReq.overrideMimeType('text/xml');
			}
        }
        // IE
        else if (window.ActiveXObject) {
			xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
	
	xmlHttpReq.open('POST', strURL, true);
	xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlHttpReq.onreadystatechange = function() {
	if (xmlHttpReq.readyState == 4) {
           strResponse = xmlHttpReq.responseText;
           switch (xmlHttpReq.status) {
                   // Page-not-found error
                   case 404:
                           alert('Error: Not Found. The requested URL ' + 
                                   strURL + ' could not be found.');
                           break;
                   // Display results in a full window for server-side errors
                   case 500:
                           handleErrFullPage(strResponse);
                           break;
                   default:
                           // Call JS alert for custom error or debug messages
                           if (strResponse.indexOf('Error:') > -1 || 
                                   strResponse.indexOf('Debug:') > -1) {
                                   alert(strResponse);
                           }
                           // Call the desired result function
                           else {
                                   eval(strResultFunc + '(strResponse,comboName,comboDefault,displayTest,selectedCombo,selectedValue);');
                           }
                           break;
           }
   }
 }	
  xmlHttpReq.send(strSubmit);
}

function handleErrFullPage(strIn) {

        var errorWin;

        // Create new window and display error
        try {
                errorWin = window.open('', 'errorWin');
                errorWin.document.body.innerHTML = strIn;
        }
        // If pop-up gets blocked, inform user
        catch(e) {
                alert('An error occurred, but the error message cannot be' +
                        ' displayed because of your browser\'s pop-up blocker.\n' +
                        'Please allow pop-ups from this Web site.');
        }
}


function displayResult(strIn,comboName,comboDefault,displayTest,selectedCombo,selectedValue) {

//alert(strIn);

var strResponseArray;
var strarray;
var name1;
var name2;

strResponseArray = strIn.split('#');
var temp= eval(comboName);
if (temp.options.length) {
	//temp.options = null;
	for (i=0; i < temp.options.length; i++)
		temp.options[i] = null 
}
temp.options[0]=new Option(comboDefault,"");

if (strResponseArray.length-1 > 0) {
	for (var i = 0; i <= strResponseArray.length-1; i++) {
		strarray = strResponseArray[i].split('|');
		name1 = strarray[0];
/*		for (var count = 0; count < name1.length; count++) {
			if(name1.charAt(count) == " ") {
				name2 = name1.charAt(0).toUpperCase() + name1.substr(1,count-1).toLowerCase() + " " + name1.charAt(count+1).toUpperCase() + name1.substr(count+2,name1.length).toLowerCase();
			}
		}*/
		//name2 = name1.charAt(0).toUpperCase() + name1.substr(1,name1.length-1).toLowerCase();
		temp.options[i+1]=new Option(name1,strarray[1]);
	}
}
else {
	strarray = strIn.split('|');
	name1 = strarray[0];
	//name2 = name1.charAt(0).toUpperCase() + name1.substr(1,name1.length-1).toLowerCase();

	temp.options[1]=new Option(name1,strarray[1]);
}
temp.options[0].selected = true;
document.getElementById(displayTest).style.display = 'none';
//alert(selectedValue);
if (selectedValue)
{
	selectValue(selectedCombo,selectedValue);
}


}


function selectValue(comboName,selectedValue) {
//	alert(selectedValue);
	var temp = eval(comboName);
	for (i=0; i < temp.options.length ; i++)
	{
		//alert(temp.options[i].value);
		if (temp.options[i].value == selectedValue)
		{
			temp.options[i].selected = true;
		}
		
	}
}