//--------------------------------------------------------------------------------------------
function getHTTPObject() {
  	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
	try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	xmlhttp = false;
	}
	}
	@else
	xmlhttp = false;
	@end @*/
	if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
		try{
		  xmlhttp = new XMLHttpRequest();
		}catch(e){
		  xmlhttp = false;
		}
	}
	return xmlhttp;
}
//--------------------------------------------------------------------------------------------
function executeURL(jsUrl){  
	var httpObj = getHTTPObject(); 
	httpObj.open("GET", jsUrl, true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
			eval(httpObj.responseText);
		}
	}	
	httpObj.send(null);	
}
//--------------------------------------------------------------------------------------------
function ajaxSubmitForm(objForm){
	var jsUrl = objForm.action;
	var contentStr = "AJAX_FLAG=1&";
	for(i=0; i<objForm.length; i++){
		var currentElement = objForm.elements[i];
		var fldName = currentElement.name;
		// reset the label color
		labelId = "label_" + fldName;
		if(document.getElementById(labelId)){
			document.getElementById(labelId).style.color = "#000000";
		}
		// end : reset the label color
		if(currentElement.type=="select-multiple"){
			for(j=0; j<currentElement.options.length; j++){
				if(currentElement.options[j].selected){
					fldValue = currentElement.options[j].value;
					contentStr += (fldName + "=" + escape(fldValue) + "&");				  
				}			  
			}
		}else if(currentElement.type == "checkbox"){
			if(currentElement.checked){
				fldValue = currentElement.value;
				contentStr += (fldName + "=" + escape(fldValue) + "&");
			}
		}else{
			fldValue = currentElement.value;
			contentStr += (fldName + "=" + escape(fldValue) + "&");			
		}
		if(currentElement.type == "select" || currentElement.type == "select-one" || currentElement.type == "select-multiple") {
			if(currentElement.disabled!=true){
				currentElement.disabled = true;
				currentElement.loadingFlag = true;
			}
		}
	}	
	var httpObj = getHTTPObject(); 	
	httpObj.open("POST", jsUrl, true);
	httpObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	httpObj.send(contentStr);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){			
			eval(httpObj.responseText);		
		}
	}
}
//--------------------------------------------------------------------------------------------
function restoreDisabledElements(objForm){
	for(i=0; i<objForm.length; i++){
		var currentElement = objForm.elements[i];
		var fldName = currentElement.name;
		if(currentElement.type=="select" || currentElement.type=="select-one" || currentElement.type=="select-multiple"){
			if(currentElement.loadingFlag==true)
				currentElement.disabled = false;
		}
	}
}
//--------------------------------------------------------------------------------------------
function gotoURL(strURL){
	window.location.href = strURL;
}

//--------------------------------------------------------------------------------------------
function displayInfoMessage(msg){
	document.getElementById('infoPanel').innerHTML = "<div style=\"margin-bottom:5px;\">" + msg + "</div>";
	document.getElementById('infoPanel').style.display = "";
}
//--------------------------------------------------------------------------------------------