/**********************************************
 *Class CMA
 *
 *
 *
 *
 **********************************************/
function CMA(objDiv,authcode,jumpurl)
{

	CMA.window = objDiv;
	CMA.jumpurl = jumpurl;
	CMA.httpobj = null;
	CMA.target = "http://www.museum-kai.net/mattach.ajax.php";
	CMA.authcode = authcode;

	CMA.style = 0;	//0 = list 1=body
		
}

/**********************************************
 *XMLHttpRequest
 *
 *
 *
 *
 **********************************************/
CMA.prototype.createHttpRequest = function()
{
	if(window.ActiveXObject)
	{
		try 
		{
			return new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				return new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e2) 
			{
				return null;
			}
		}
	} 
	else if(window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	} 
	else 
	{
		return null
	}
}

/**********************************************
 *XMLHttpRequest
 *
 *
 *
 *
 **********************************************/
CMA.prototype.sendHttpRequest = function(data,method,uri,async)
{
	// =========
	CMA.httpobj = CMA.prototype.createHttpRequest();
	
	// ===== open method ====
	CMA.httpobj.open(method,uri,async);
	CMA.httpobj.onreadystatechange = CMA.prototype.getHttpRequest;

	var contentTypeUrlenc = 'application/x-www-form-urlencoded; charset=UTF-8';
	CMA.httpobj.setRequestHeader('Content-Type',contentTypeUrlenc);

	//send method
	CMA.httpobj.send(data);
}

/**********************************************
 * GetXMLHttpRequest
 *
 *
 *
 *
 **********************************************/
CMA.prototype.getHttpRequest = function()
{
	if(CMA.httpobj.readyState == 4)
	{
		CMA.window.innerHTML = CMA.httpobj.responseText;
	}
}


/**********************************************
 * 
 *
 *
 *
 *
 **********************************************/
CMA.prototype.getNews = function()
{
	var strOpt;
	
	strOpt  = "&authcode=" + CMA.authcode;
	strOpt += "&jumpurl=" + CMA.jumpurl;
	strOpt += "&action=news";
	
	CMA.prototype.sendHttpRequest(strOpt,'post',CMA.target,true);
}

/**********************************************
 * 
 *
 *
 *
 *
 **********************************************/
CMA.prototype.getData = function(action,options)
{
	var strOpt;
	
	strOpt  = "&authcode=" + CMA.authcode;
	strOpt += "&jumpurl=" + CMA.jumpurl;
	strOpt += "&action=" + action;
	strOpt += "&options=" + options;
	
	CMA.prototype.sendHttpRequest(strOpt,'post',CMA.target,true);
}



function getGetParam() 
{ 
	var pm = new Array();
	var query = window.location.search.substring(1); 
	var parms = query.split('&'); 
			
	for (var i=0; i<parms.length; i++) 
	{ 
		var pos = parms[i].indexOf('='); 
		if (pos > 0) 
		{ 
			var key = parms[i].substring(0,pos); 
			var val = parms[i].substring(pos+1); 
			pm[key] = val; 
		} 
	} 
	return pm;
} 




