
var g_demand = null; /* / 全局对象*/
function on_demand_load() {
	g_demand = new GMDemand();
}
function onClicks(_type, _id, _page){
	switch(_type){
		case 'GetDateVoid'    : g_demand.doGetDateVoid(_type,_id);            break;
		default             : /*no message*/                                 break;
	}
}
function styleChange(styleid){
	switch(styleid){
		case 'ri':  ri.className="body_middle1_down_right_top_right";
					zhou.className="body_middle1_down_right_top_right1";
					yue.className="body_middle1_down_right_top_right2";
					break;
		case 'zhou': ri.className="body_middle1_down_right_top_right1";
					 zhou.className="body_middle1_down_right_top_right";
					 yue.className="body_middle1_down_right_top_right2";
					 break;
		case 'yue' : ri.className="body_middle1_down_right_top_right1";
					 zhou.className="body_middle1_down_right_top_right4";
					 yue.className="body_middle1_down_right_top_right5";
					break;
	}
}
var GMDemand = Class.create();
GMDemand.prototype = {
	initialize: function() {
		this.m_AjaxType = "";
		this.m_AjaxObject = null;
		this.m_UrlBase = "index.php?controller=demand";
	},
	AbortAjax: function() {
		if( this.m_AjaxObject != null ) {
			var theTrans = this.m_AjaxObject.transport;
			theTrans.abort(); theTrans = null;
		}
	},
	SendAjaxRequest: function(_url) {
		var theComplete = this.DoAjaxResponse.bindAsEventListener(this);
		var theCmd = ((arguments[1] != null) ? arguments[1] : 'GET');
		var theBody = ((arguments[2] != null) ? arguments[2] : null);
		var theOptions = {
      		method:     theCmd,
      		postBody:	theBody,
			onComplete: theComplete
		};
		delete this.m_AjaxObject;
		this.m_AjaxObject = new Ajax.Request(_url,theOptions);
	},
	DoAjaxResponse: function(_response) {
		if( _response.responseText.length <= 0 || _response.readyState != 4 ) {
			// alert('-- Ajax none response-text --');
			return;
		}
		switch(this.m_AjaxType) {
			case 'GetDateVoid':     this.doAjaxGetDateVoid(_response);     break;
			default:  				alert('-- unknown error --');          break;
		}
	},
	/*AJAX : 发送请求*/
	doGetDateVoid: function(_type, _data){
		var theUrl = this.m_UrlBase + '&action=GetDateMovie&date=' + _data;
		this.m_AjaxType = _type;
		this.SendAjaxRequest(theUrl);
	},	
	/*AJAX : 返回信息*/
	doAjaxGetDateVoid: function(_response){
		var data = _response.responseText.evalJSON(true);
		$('void_list').innerHTML = data.entity;
	}
	
}
