

/*
-- ------ Cms ------ --
*/
function Cms(){}
//-- ------ #Parameters ------ --

Cms.prototype.sAjax_0=new netsSingleAjax();
Cms.prototype.sPage="";


//-- ------ #Methods ------ --
//#Vote
Cms.prototype.OnVote_GetOptions=function(pParid,pID){
	tmpURL=this.sPage+"?ActionType=DReport_Options&DReport_Options="+pParid+tmpCommon.sysSPLIT1+pID;
	this.sAjax_0.sFlag="reportPanel";
	this.sAjax_0.sPanel="reportPanel";
	this.sAjax_0.sURL=tmpURL;
	this.sAjax_0.sendRequestSp(tmpURL,"main_Vote_GetOptions_Callback();");
	//window.open(tmpURL,"_blank");
	
	return 0;
}
function main_Vote_GetOptions_Callback(){
	var tmpFlag=tmpCms.sAjax_0.sFlag;
	var tmpPanel=document.getElementById(tmpCms.sAjax_0.sPanel);
	var tmpURL=tmpCms.sAjax_0.sURL;
	var tmpHttpRequests=tmpCms.sAjax_0.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;
			tmpCms.OnVote_ControlsShow();
	    }else{
	    	tmpPanel.innerHTML=tmpCommon.sysError_Ajax.replace(/\{Nets.Response}/g,tmpURL);
	    }
	}else{
		tmpPanel.innerHTML=tmpCommon.sysLoading_Ajax;
	}
}
Cms.prototype.OnVote_ControlsShow=function(){
	if(document.getElementById("cvctSet_PageTxt_RowBox").className==tmpCommon.sysHidden){
		document.getElementById("cvctSet_PageTxt_RowBox").className="";
		document.getElementById("cvctSet_ResultTxt_RowBox").className="";
		document.getElementById("cvctTime_EndTxt_RowBox").className="";
		document.getElementById("cvctControl_LenTxt_RowBox").className="";
		document.getElementById("cvctControl_DefaultTxt_RowBox").className="";
		document.getElementById("cvctControl_NeedTxt_RowBox").className="";
		document.getElementById("cvctControl_InputTxt_RowBox").className="";
		document.getElementById("reportPanel_ShowButton").innerHTML="隐藏部分资料";
	}else{
		document.getElementById("cvctSet_PageTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("cvctSet_ResultTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("cvctTime_EndTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("cvctControl_LenTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("cvctControl_DefaultTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("cvctControl_NeedTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("cvctControl_InputTxt_RowBox").className=tmpCommon.sysHidden;
		document.getElementById("reportPanel_ShowButton").innerHTML="查看所有资料";
	}

	return 0;
}
Cms.prototype.OnVote_ControlSelected=function(){
	//-- ------ #Get type ------ --
	var Coun0=0;
	var tmpTYPE="Text";
	while(document.getElementById("cvctControl_TypeTxt"+Coun0)!=undefined){
		if(document.getElementById("cvctControl_TypeTxt"+Coun0).checked){
			tmpTYPE=document.getElementById("cvctControl_TypeTxt"+Coun0).value;
		}
		Coun0++;
	}
	//-- ------ #Methods ------ --
	if(tmpTYPE=="CheckboxAR" || tmpTYPE=="RadioAR"){
		document.getElementById("reportPanel_OptionsBox").className="Report_Flat_Options";
		document.getElementById("reportPanel_OptionsBox_Flag").value=1;
	}else{
		document.getElementById("reportPanel_OptionsBox").className=tmpCommon.sysHidden;
		document.getElementById("reportPanel_OptionsBox_Flag").value=0;
		
	}
	
	return 0;
}

/*
<span>0</span><input id="cvotIDTxt_{Nets.Index}" name="cvotIDTxt_{Nets.Index}" type="hidden" value="0" />

<input id="cvotNameTxt_{Nets.Index}" name="cvotNameTxt_{Nets.Index}" type="text" 
	class="SControl1 Report_Flat_OptionsTableInputbox"
	onclick="tmpControl.onControlLight(this,'Report_Flat_OptionsTableInputbox');"
	onblur="tmpControl.onControlBlur(this,'Report_Flat_OptionsTableInputbox');"
	value="" />

<a href="#Here" onclick="tmpCms.OnVote_OptionsDelete(this);" class="Link1 FBlue1">删除本选项</a>

*/
Cms.prototype.sOptionsTemplate_0='<span>0</span><input type="hidden" value="0" />';
Cms.prototype.sOptionsTemplate_1='<input type="text" class="SControl1 Report_Flat_OptionsTableInputbox" onclick="tmpControl.onControlLight(this,\'Report_Flat_OptionsTableInputbox\');" onblur="tmpControl.onControlBlur(this,\'Report_Flat_OptionsTableInputbox\');" value="" />';
Cms.prototype.sOptionsTemplate_2='<a href="#Here" onclick="tmpCms.OnVote_OptionsDelete(this);" class="Link1 FBlue1">删除本选项</a>';

Cms.prototype.OnVote_OptionsNew=function(){
	var Coun0=0;
	var tmpElement=document.getElementById("reportPanel_OptionsTable");
	tmpElement.insertRow(0);

	Coun0=0;
	tmpSTR=this.sOptionsTemplate_0;
	tmpSTR=tmpSTR.replace(/\{Nets.Index}/g,0);
	tmpElement.rows[0].insertCell();
	tmpElement.rows[0].cells[Coun0].className="Report_Flat_OptionsTableIndex";
	tmpElement.rows[0].cells[Coun0].innerHTML=tmpSTR;
	
	Coun0++;
	tmpSTR=this.sOptionsTemplate_1;
	tmpSTR=tmpSTR.replace(/\{Nets.Index}/g,0);
	tmpElement.rows[0].insertCell();
	tmpElement.rows[0].cells[Coun0].className="Report_Flat_OptionsTableInput";
	tmpElement.rows[0].cells[Coun0].innerHTML=tmpSTR;
	
	Coun0++;
	tmpSTR=this.sOptionsTemplate_2;
	tmpSTR=tmpSTR.replace(/\{Nets.Index}/g,0);
	tmpElement.rows[0].insertCell();
	tmpElement.rows[0].cells[Coun0].className="Report_Flat_OptionsTableButton";
	tmpElement.rows[0].cells[Coun0].innerHTML=tmpSTR;
	
	
	this.OnVote_OptionsReset();
	return 0;
}
Cms.prototype.OnVote_OptionsDelete=function(pElement){
	pElement.parentNode.parentNode.removeNode(true);
	
	
	this.OnVote_OptionsReset();
	return 0;
}
Cms.prototype.OnVote_OptionsReset=function(){
	var tmpElement=document.getElementById("reportPanel_OptionsTable");
	var Coun0=0;
	while(tmpElement.rows.length>Coun0){
		tmpINT=Coun0+1;
		tmpElement.rows[Coun0].cells[0].childNodes[0].innerHTML=tmpINT;
		
		Coun0++;
	}
	
	return 0;
}
Cms.prototype.OnVote_OptionsSubmit=function(){
	var tmpElement=document.getElementById("reportPanel_OptionsTable");
	var tmpCONTENT="";
	var Coun0=0;
	while(tmpElement.rows.length>Coun0){
		tmpCONTENT+=tmpElement.rows[Coun0].cells[0].childNodes[1].value+tmpCommon.sysSPLIT2;
		tmpCONTENT+=tmpElement.rows[Coun0].cells[1].childNodes[0].value+tmpCommon.sysSPLIT3;
		
		Coun0++;
	}
	
	document.getElementById("reportPanel_OptionsValueTxt").value=tmpCONTENT;
	return 0;
}

//-- ------ #Instanct ------ --
var tmpCms=new Cms();



