

/*
-- ------ Main ------ --
*/
function Main(){}
//-- ------ #Parameters ------ --
Main.prototype.sPage="../../../QPlatform/m_nets/user/main.php";
Main.prototype.sAjax_Notes=new netsSingleAjax();
Main.prototype.sAjax_News=new netsSingleAjax();
Main.prototype.sAjax_Power=new netsSingleAjax();

//-- ------ #Methods ------ --
//#Notes
Main.prototype.sNotes_BoxName="mainNotes_Box";
Main.prototype.sNotes_TxtName="mainNotes_Txt";
Main.prototype.sNotes_MessageName="mainNotes_Message";
Main.prototype.sNotes_DefaultSTR="请在这里输入您要记事的内容，按“保存”按钮保存...";

Main.prototype.OnLoad_Notes=function(){
	tmpURL=this.sPage+"?ActionType=DGetNotes";
	this.sAjax_Notes.sFlag="Data";
	this.sAjax_Notes.sPanel=this.sNotes_BoxName;
	this.sAjax_Notes.sURL=tmpURL;
	this.sAjax_Notes.sendRequestSp(tmpURL,"main_LoadNotes_Callback();");
	//window.open(tmpURL,"_blank");
	
	return 0;
}
function main_LoadNotes_Callback(){
	var tmpFlag=tmpMain.sAjax_Notes.sFlag;
	var tmpPanel=document.getElementById(tmpMain.sAjax_Notes.sPanel);
	var tmpURL=tmpMain.sAjax_Notes.sURL;
	var tmpHttpRequests=tmpMain.sAjax_Notes.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			tmpPanel.innerHTML=tmpData;
	    }else{
	    	tmpPanel.innerHTML=tmpCommon.sysError_Ajax.replace(/\{Nets.Response}/g,tmpURL);
	    }
	}else{
		tmpPanel.innerHTML=tmpCommon.sysLoading_Ajax;
	}
}
Main.prototype.OnSubmit_News=function(){
	tmpURL=this.sPage+"?ActionType=DAdd_Get&DAdd_Get="+
		tmpCommon.encodeURL(document.getElementById(this.sNotes_TxtName).value,0);
	this.sAjax_Notes.sFlag="Message";
	this.sAjax_Notes.sPanel=this.sNotes_MessageName;
	this.sAjax_Notes.sURL=tmpURL;
	this.sAjax_Notes.sendRequestSp(tmpURL,"main_SubmitNotes_Callback();");
	//window.open(tmpURL,"_blank");
	document.getElementById(this.sNotes_TxtName).value=this.sNotes_DefaultSTR;

	return 0;
}
function main_SubmitNotes_Callback(){
	var tmpFlag=tmpMain.sAjax_Notes.sFlag;
	var tmpPanel=document.getElementById(tmpMain.sAjax_Notes.sPanel);
	var tmpURL=tmpMain.sAjax_Notes.sURL;
	var tmpHttpRequests=tmpMain.sAjax_Notes.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			tmpPanel.innerHTML=tmpData;
			tmpMain.OnLoad_Notes();
	    }else{
	    	tmpPanel.innerHTML=tmpCommon.sysError_Ajax.replace(/\{Nets.Response}/g,tmpURL);
	    }
	}else{
		tmpPanel.innerHTML=tmpCommon.sysLoading_Ajax;
	}
}

Main.prototype.OnNotesTxt_Focus=function(){
	var tmpElement=document.getElementById(this.sNotes_TxtName);
	if(tmpElement.value==this.sNotes_DefaultSTR){
		tmpElement.value="";
	}
	tmpElement.className="SControlLight1";
	
	return 0;
}
Main.prototype.OnNotesTxt_Blur=function(){
	var tmpElement=document.getElementById(this.sNotes_TxtName);
	if(tmpElement.value==""){
		tmpElement.value=this.sNotes_DefaultSTR;
	}
	tmpElement.className="SControl1";
	
	return 0;
}


//#News
Main.prototype.sNews_BoxName="mainNews_Box";

Main.prototype.OnLoad_News=function(){
	tmpURL=this.sPage+"?ActionType=DGetNews";
	this.sAjax_News.sFlag="Data";
	this.sAjax_News.sPanel=this.sNews_BoxName;
	this.sAjax_News.sURL=tmpURL;
	this.sAjax_News.sendRequestSp(tmpURL,"main_LoadNews_Callback();");
	//window.open(tmpURL,"_blank");

	return 0;
}
function main_LoadNews_Callback(){
	var tmpFlag=tmpMain.sAjax_News.sFlag;
	var tmpPanel=document.getElementById(tmpMain.sAjax_News.sPanel);
	var tmpURL=tmpMain.sAjax_News.sURL;
	var tmpHttpRequests=tmpMain.sAjax_News.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			tmpPanel.innerHTML=tmpData;
	    }else{
	    	tmpPanel.innerHTML=tmpCommon.sysError_Ajax.replace(/\{Nets.Response}/g,tmpURL);
	    }
	}else{
		tmpPanel.innerHTML=tmpCommon.sysLoading_Ajax;
	}
}

//#Power
Main.prototype.sPower_BoxName="mainPower_Box";

Main.prototype.OnLoad_Power=function(pPage){
	tmpURL=this.sPage+"?ActionType=DPowerCheck";
	this.sAjax_Power.sFlag="Message";
	this.sAjax_Power.sPanel=this.sPower_BoxName;
	this.sAjax_Power.sURL=tmpURL;
	this.sAjax_Power.sendRequestSp(tmpURL,"main_LoadPower_Callback();");
	//window.open(tmpURL,"_blank");

	return 0;
}
function main_LoadPower_Callback(){
	var tmpFlag=tmpMain.sAjax_Power.sFlag;
	var tmpPanel=document.getElementById(tmpMain.sAjax_Power.sPanel);
	var tmpURL=tmpMain.sAjax_Power.sURL;
	var tmpHttpRequests=tmpMain.sAjax_Power.sHttpRequests;
	//alert(tmpHttpRequests.responseText);
	if(tmpHttpRequests.readyState==4){
		//alert(tmpHttpRequests.responseText);
		var tmpData=getDataByFlag(tmpHttpRequests.responseText,tmpFlag);
		//alert(tmpData);
		if(tmpData.indexOf("sendRequest")>=0 && tmpData!="<!--sendRequest-->"){
			tmpPanel.innerHTML=tmpData;
	    }else{
	    	tmpPanel.innerHTML=tmpCommon.sysError_Ajax.replace(/\{Nets.Response}/g,tmpURL);
	    }
	}else{
		tmpPanel.innerHTML=tmpCommon.sysLoading_Ajax;
	}
}






