<!--

// Ajax º£ÀÌ½º °´Ã¼
// Return a new XMLHttpRequest object, or false if this browser doesn't support it.
// The responseHandler argument is a response callback function with only one argument. function(data);
// The responseDataType argument is a response data processing type. ['text' | 'xml']
function newXMLHttpRequest(responseHandler, responseDataType) {
	var xmlreq = false;
	
	if (window.XMLHttpRequest) {
		// Create XMLHttpRequest object in non-Microsoft browsers.
		xmlreq = new XMLHttpRequest();
		
	} else if (window.ActiveXObject) {
		try {
			// Try to create XMLHttpRequest in later versions of Internet Explorer.
			xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
			
		} catch (e1) {
			try {
				// Try version supported by older versions of Internet Explorer.
				xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
				
			} catch (e2) { xmlreq = false; }
		}
	}

	if (xmlreq)	{		
		if (responseDataType.toLowerCase() == "text") responseDataType = "text";
		else responseDataType = "xml";

		xmlreq.onreadystatechange = function() {

			// HTTP »óÅÂ ÄÚµå
			// XMLHttpRequestÀÇ »óÅÂ ¼Ó¼º(status property)Àº 
			// ¿äÃ»ÀÌ ¼º°øÀûÀ¸·Î ¿Ï·áµÇ¾ú´ÂÁö¸¦ º¸±â À§ÇØ Å×½ºÆ®µÈ´Ù.
			// status¿¡´Â ¼­¹ö ÀÀ´ä¿¡ ´ëÇÑ HTTP »óÅÂ ÄÚµå°¡ Æ÷ÇÔµÇ¾î ÀÖ´Ù. 
			// GET°ú POST ¿äÃ»À» ¼öÇàÇÒ ¶§ 200(OK)ÀÌ ¾Æ´Ñ ¾î¶² ÄÚµåµµ ¿¡·¯ÀÌ´Ù. 
			// ¼­¹ö°¡ ¸®´ÙÀÌ·ºÆ® ÀÀ´ä(¿¹¸¦ µé¾î, 301 ¶Ç´Â 302)À» º¸³»¸é ºê¶ó¿ìÀú´Â 
			// ¸®´ÙÀÌ·ºÆ®¸¦ µû¶ó »õ·Î¿î À§Ä¡¿¡¼­ ¸®¼Ò½º¸¦ °¡Á®¿Â´Ù. 
			// XMLHttpRequest´Â ¸®´ÙÀÌ·ºÆ® »óÅÂ ÄÚµå¸¦ º¼ ¼ö ¾ø´Ù. 
			// ¶ÇÇÑ ºê¶ó¿ìÀú(Cache-Control: no-cache)´Â Çì´õ¸¦ ¸ðµç XMLHttpRequest¿¡ Ãß°¡ÇÏ¿© 
			// Å¬¶óÀÌ¾ðÆ® ÄÚµå°¡ (º¯°æµÇÁö ¾ÊÀº) 304 ¼­¹ö ÀÀ´äÀ» ´Ù·çÁö ¾Êµµ·Ï ÇÑ´Ù. 

			// If the rqeuest's status is "complete"
			if (xmlreq.readyState == 4) {
				// Check that a successful server response was received
				if (xmlreq.status == 200) {
					// ÄÝ¹é ÇÔ¼ö°¡ Á¸ÀçÇÏ´ÂÁö È®ÀÎÇØ¾ß ÇÑ´Ù.
					if (typeof(responseHandler) == "function") {
						// Pass the XML payload of the response to the handler function
						// reponseXMLÀ» »ç¿ëÇÏ¸é XML Çü½ÄÀÇ °´Ã¼·Î ³Ñ°Ü ¹Þ´Â´Ù.			
						// responseText¸¦ »ç¿ëÇÏ¸é XML ¹®ÀÚ¿­À» ³Ñ°Ü ¹Þ´Â´Ù.
						if (responseDataType == "text") responseHandler(xmlreq.responseText);
						else responseHandler(xmlreq.responseXML);
					}					
				} else {
					// An HTTP problem has occured
					alert("HTTP error: " + xmlreq.status);
				}
			}
		}
	}
	
	return xmlreq;
}
-->
