
var yAjax = {

	getXmlHttp : function(){
		var xmlHttp = false;
	
		if (window.ActiveXObject){
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			if (xmlHttp ==  null){
				xmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");            
			}
		}else if (window.XMLHttpRequest){
			xmlHttp = new XMLHttpRequest();
		}			
		return xmlHttp;		
	}
	,
	open : function( sMmethod, sUrl, sAsync, sContent, sRequest, sFunction){
		var xmlHttp = this.getXmlHttp();
		var curUrl = location.href; 
		if( !xmlHttp ){
			alert("XMLHTTP Object »ý¼º ¿¡·¯ÀÔ´Ï´Ù.");
			return;
		}

		if (curUrl.indexOf("magazine.joins.com") < 0)
		{
			return;
		}
		xmlHttp.open(sMmethod, sUrl, sAsync);
		
		if( sMmethod=="POST" ){
			xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		}

		xmlHttp.onreadystatechange = function() {
	    	
		    if(xmlHttp.readyState == 4){ //COMPLETE(4)
		        	
					if( xmlHttp.status == 200 ){
		
						if( sRequest=="XML" ){
							eval(sFunction+'(xmlHttp.responseXML);');
						}else{
							eval(sFunction+'(xmlHttp.responseText);');
						}
					}else{
						alert("¿À·ù:"+xmlHttp.status);
					}       
				}
		}

		xmlHttp.send(sContent);		
	}
	,
	encode : function(paramValue){
		return encodeURIComponent(paramValue);
	}	
};

function funXMLHTTPReturn(methodOPT, responseType, actionURL){

	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.Open(methodOPT, actionURL, true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.Send(); 
	switch(responseType.toUpperCase()){		
		case 'TEXT' :
			return xmlhttp.responseText ;
			break;
		case 'XML' :
			return xmlhttp.responseXML ;
		break;
	}
	
	xmlhttp = null;	
}

