<html>
<head>
<META http-equiv=Content-Language content=zh-cn>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="../CSS/Base.css" rel="stylesheet" type="text/css"/>
<link href="../CSS/Tab.css" rel="stylesheet" type="text/css"/>
<link href="../CSS/Common.css" rel="stylesheet" type="text/css"/>
<LINK href="../CSS/Window.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="../JS/Common.js.php"></script>
<script type="text/javascript" src="../JS/Window.js.php"></script>
<script>
function refreshParent() {
   //self.location.replace(self.location.href);
   self.location.href = '{defineURL}';
}
function checkall(form) 
{
	if( form.all.checked)
	{
		for(var i = 0;i < form.elements.length-1; i++) 
		{
			var e = form.elements[i];
			e.checked = true;
		}
	}
	else
	{
		for(var i = 0;i < form.elements.length-1; i++) 
		{
			var e = form.elements[i];
			e.checked = false;
		}
    }
}
function copycode(obj) {
        
	var rng = document.body.createTextRange();
    rng.moveToElementText(obj);
    rng.scrollIntoView();
    rng.select();
    rng.execCommand("Copy");
    rng.collapse(false);
	alert("复制分析结果到剪贴板成功");
}
function $(_sId){
	return document.getElementById(_sId);
}
function ajax_Submit(url,postStr) {
	var ajax=false; 
	try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
	if (!ajax && typeof XMLHttpRequest!='undefined') ajax = new XMLHttpRequest(); 

	ajax.open("POST", url, true); 
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	ajax.send(postStr);
	ajax.onreadystatechange = function(){
		if (ajax.readyState == 4)
		{
			if(ajax.status == 200)
			{
				var theRtnText = ajax.responseText;
				document.getElementById("dataAnalysisMapTable").style.display = '';
				document.getElementById("dataAnalysisCopyAction").style.display = '';
				document.getElementById("dataAnalysisMap").innerHTML = theRtnText ;
				parent.document.getElementById("theIframe").scrolling='auto';
			}
			else
			{
				alert('网络传输问题');
			}
		}	
	} 
}

function DataAnalysisSubmit()
{
	//得到defineID的值
	var objField = document.form.defineID;
	var theDefineIDValue = '';
	if( objField.length == null )
	{
		if (objField.checked)  theDefineIDValue += objField.value + ',';
	}
	else
	{		
		for( k=0;k<objField.length;k++){
			if (objField[k].checked)  theDefineIDValue += objField[k].value + ',';
		}
	}
	theDefineIDValue = theDefineIDValue.substr(0,theDefineIDValue.length-1);
	var surveyID = document.getElementById('surveyID').value;
	var ParamString = "Action=DataAnalysisSubmit";
	ParamString += "&defineID="+theDefineIDValue;
	ParamString += "&surveyID="+surveyID;
	document.getElementById("dataAnalysisMapTable").style.display = '';
	document.getElementById("dataAnalysisMap").innerHTML = "<div id=\"preloading\" style=\"position:absolute;top:0;left:0;z-index:1;background-color:#f0f0f0;left:0;top:0;width:160px;overflow:hidden;white-space:nowrap;color:black;position:fixed;top:0;left:0;font-weight:bold;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;-khtml-border-bottom-right-radius:5px;border-bottom-right-radius:5px;\">&nbsp;<img src=\"..\/Images\/wait.gif\" width=\"16px\" height=\"16px\">&nbsp;正在加载数据分析&nbsp;<\/div>";
	ajax_Submit('DefineReport.php',ParamString);
}
</script>

<body oncontextmenu="return false" style="margin-top:0px">

<div id="tabs1"> 
    <ul> 
        <li><a href="ShowMain.php"><span>我的问卷</span></a></li> 
        <li><a href="{countURL}"><span>频数频率分析</span></a></li> 
        <li><a href="{listURL}"><span>问卷回复详细</span></a></li>
        <li><a href="{dataChartURL}"><span>数据图形展示</span></a></li>
        <li><a href="{crossURL}"><span>交叉数据分析</span></a></li>
        <li id="current"><a href="{defineURL}"><span>组装分析报告</span></a></li>
    </ul> 
</div> 

<div style="line-height:10px">&nbsp;</div>
<div class="wrap q_clear" id=wrap>
<div>
<div>
<div class=q_clear id=myheadertext><h1>自由组装<span class=red>[{surveyTitle}]</span>数据分析报告</h1><p class=recnumclass>[ <span class=red>{recNum}</span> 组定义 ]</p>&nbsp;
<input class=inputsubmit name="createNew" type="button" id="createNew" value="新增定义" onclick="javascript:showPopWin('{newDefineURL}', 700, 430, refreshParent, null,'新增数据分析报告组装定义')"><br/></div>
<div id=myname>以频数频率分析与交叉数据分析为原件，可自由组装所需要的数据分析报告</div>
<form name="form" method="post" action="">
<a name="top" href="javascript:void(0);"></a>
<div class="datalist" style="position: relative">
 <table class=datatable id="datatable" cellspacing=0 cellpadding=0>
   <tr class=coltitle>
	  <td width=3% noWrap>&nbsp;</td>
	  <td width=3% noWrap><b>序号</b></td>
      <td width=89%>&nbsp;<B>报告类型</B></td>
      <td width=8% noWrap align=center><b>操 作</b> </td>
   </tr>
   <!-- BEGIN LIST -->
   <tr height=25 onmouseover="this.style.backgroundColor='#deefff'" onmouseout="this.style.backgroundColor='#ffffff'">
      <td align=center valign=center><input name="defineID[]" type="checkbox" id="defineID" value="{defineID}"></td>
	  <td noWrap><b>{orderNum}</b></td>
      <td valign=top>{reportName}</td>
      <td noWrap align=center valign=center>
		   <A href="{deleteURL}" onclick="return window.confirm('您真的想删除该条数据分析报告组装定义吗？本操作不可恢复！')">删除</A>
	  </td>
   </tr>
   <tr>
     <td bgcolor="#f5fafe" colspan=2>&nbsp;</td>
     <td colspan=2 align=left bgcolor="#f5fafe" height=25>{defineList}</td>
   </tr>
   <!-- END LIST -->
</table>
<table width=100% style="border:0px;margin:0px;padding:0px;">
    <tr>
	  <td width=3% style="border:0px;margin:0px;padding:0px;" align=center><input name="all" type="checkbox" id="all" value="all" onclick="checkall(this.form)" style="background-color:#ffffff"></td>
	  <td style="border:0px;margin:0px;padding:0px;">
	  <span style="float:left"><input name="DeleteDefineSubmit" class=inputsubmit type="submit" id="DeleteDefineSubmit" value="删除定义" onclick="return window.confirm('您真的想删除当前选中的数据分析报告组装定义吗？本操作不可恢复！')"> <input class=inputsubmit name="submit" type="button" id="submit" value="开始分析" onclick="javascript:DataAnalysisSubmit();"></span>
	  <span style="float:right">&nbsp;<a name="footer" href="#top"><img src="../Images/top.gif" align="middle" alt="TOP"></a></span>	
	</td></tr>
</table>

</div>

<table id="dataAnalysisCopyAction" width=100% style="LINE-HEIGHT: 150%;border-collapse:collapse;display:none;" cellSpacing=0 cellPadding=0 borderColor=#b5cfd9 border=0>
  <tr><td align=right><a href="javascript:void(0)" onclick="copycode($('dataAnalysisMap'));"><b>复制分析结果到剪贴板</b></a><img src="../Images/list_menu_arrow.gif" border=0>&nbsp;&nbsp;</td></tr></table>

<table id="dataAnalysisMapTable" style="LINE-HEIGHT: 150%;border-collapse:collapse;display:none;" cellSpacing=0 cellPadding=0 width="100%" borderColor=#b5cfd9 border=1>
   <tr><td id="dataAnalysisMapInner" align=center style="padding-top:5px;padding-bottom:5px"><div id="dataAnalysisMap"></div></td></tr>
 </table>

</div></div></div>
<input name="surveyID" type="hidden" id="surveyID" value="{surveyID}"> 
</form>
</body></html>