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 DisplayMessage(message, container, clear, type) {
	if((trimSpaces(message).length <=0)) {
		message = '&nbsp;';	
	}
	
	switch(type) {
		case 0: container.className = 'ResultContainer Loading';
				message = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loading! Please wait...';	
				break;
		case 1: container.className = 'ResultContainer Warning';
				message = '<strong style="color:#CC9901">Warning</strong> ' + message;
				break;
		case 2: container.className = 'ResultContainer Info';
				message = '<strong style="color:#009933">Info</strong> ' + message;
				break;
		case 3: container.className = 'ResultContainer Error';
				message = '<strong style="color:#CC0000">Error</strong> ' + message;
				break;
		case 4: container.className = '';
				message = '';
				break;
	}
	
	
	if(clear == true) {
		container.innerHTML = message;
	}	else {
		container.innerHTML = container.innerHTML + '<br />' + message;	
	}	
}
function trimSpaces(stringValue) {
	// Checks the first occurance of spaces and removes them
	for(i = 0; i < stringValue.length; i++) {
		if(stringValue.charAt(i) != " ") {
			break;
		}
	}
	if(i > 0) {
		stringValue = stringValue.substring(i);
	}
	
	// Checks the last occurance of spaces and removes them
	strLength = stringValue.length - 1;
	for(i = strLength; i >= 0; i--) {
		if(stringValue.charAt(i) != " ") {
			break;
		}
	}
	if(i < strLength) {
		stringValue = stringValue.substring(0, i + 1);
	}
	
	// Returns the string after removing leading and trailing spaces.
	return stringValue;
}
