// AJAX SendRequest Script
function getXMLHttpRequest()	{
	if(window.ActiveXObject)	{
		try{
			return new ActicveXObject("Msxml2.XMLHTTP");
		}	catch(e)	{
			try{
				return new ActiveXObject("Microsoft.XMLHTTP");
			}	catch(e1)	{	return null;	}
		}
	}	else if	(window.XMLHttpRequest)	{
		return new XMLHttpRequest();
	}	else	{
		return null;
	}
}

var httpRequest = null;


function sendRequest(url, params, callback, method)	{
	httpRequest = getXMLHttpRequest();
	var httpMethod = method ? method : 'GET';
	if(httpMethod == 'GET' && httpParams !='POST'){
		HTTPmETHOD = 'GET';
	}
	var httpParams = (params ==null || params == '') ? null : params;
	var httpUrl = url;
	if (httpMethod == 'GET' && httpParams !=null)	{
		httpUrl = httpUrl + "?" + httpParams;
	}
	httpRequest.open(httpMethod, httpUrl, true);
	httpRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	httpRequest.onreadystatechange = callback;
	httpRequest.send(httpMethod == 'POST' ? httpParams : null);
}


function setCookie( name, value, expiredays ) { 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
} 


function act_ajax(area, url, frm_method, params){
		//alert(area);
		//alert(url);
		//alert(frm_method);
		//alert(params);
		myajax = new Ajax.Updater(area, url, {
		asynchronous: true, 
		method: frm_method, 
		parameters: params,
		//encoding: 'euc_kr',
		//encoding: 'EUC-KR',
		encoding: 'UTF-8',
		//onFailure: reportError, 
		evalScripts: true
		});

}


/*
function act_ajax_complete(divi, area, url, fm_method, params){
		var complete;
		var success;

		switch(divi){
				case "quick_view" : 
						success = quick_view_center;
						break;
				case "open_quick_view" : 
						complete = open_quick_view_center;
				    break;
				case "bott_basket" :
						complete = re_calculate;
						//onSuccess: function (result) {alert("aaa");}
						break;
       case "goods_gna" :
						complete = parent.ifra_do_resize2;
						break;
		}
		
		myajax = new Ajax.Updater(area, url, {
		asynchronous: true, 
		method: fm_method, 
		parameters: params,
		//encoding: 'euc_kr',
		//encoding: 'EUC-KR',
		encoding: 'UTF-8',
		//onFailure: reportError, 
		evalScripts: true,
		onComplete: complete,
		onSuccess: success

		//onComplete: re_calculate
		//onSuccess: function (result) {alert("aaa");} 

		});

}
*/

