
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();
		if( !xmlHttp ){
			alert("XMLHTTP Object »ý¼º ¿¡·¯ÀÔ´Ï´Ù.");
			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, false);
	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;
	
}

// ¼ýÀÚ Ã¼Å©
function NumberChk(cValue){

	var str = cValue;

	if(str.length == 0)
		return false;

	digits = "-0123456789" ;

	for(i=0; i<str.length; i++)
	{
		if (digits.indexOf(str.charAt(i))<0)
		{
			return false;
		}
	}

	return true;

}

// ÆÄÀÏ È®ÀåÀÚ ¸®ÅÏ
function GetExtention(strFileName)
{
	return strFileName.substring(strFileName.lastIndexOf('.')+1, strFileName.length) ;
}

function OpenPopUp(IntWidth, IntHeight, Url)
{
	var IntW = (screen.width-IntWidth)/2;
	var IntH = (screen.height-IntHeight)/2;

	var StrUrl = Url;
	var oWin = window.open(StrUrl,"PopUp","toolbar=no,menubar=no,resizable=no,width="+IntWidth+",height="+IntHeight+",left="+IntW+",top="+IntH+",scrollbars=no");
	oWin.focus(true);
}

function OpenPopUp2(IntWidth, IntHeight, Url)
{
	var IntW = (screen.width-IntWidth)/2;
	var IntH = (screen.height-IntHeight)/2;

	var StrUrl = Url;
	var oWin = window.open(StrUrl,"PopUp","toolbar=no,menubar=no,resizable=no,width="+IntWidth+",height="+IntHeight+",left="+IntW+",top="+IntH+",scrollbars=yes");
	oWin.focus(true);
}

/*
function setCookie(name, value, expire)
{
	var eDate = new Date();
	eDate.setDate(eDate.getDate() + expire);
	document.cookie = name + "=" + value + "; expires=" +  eDate.toGMTString()+ "; path=/";
}
*/
