<html>
<head>
<META http-equiv=Content-Language content=zh-cn>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<link rel="stylesheet" type="text/css" href="../CSS/Base.css">
<link rel="stylesheet" type="text/css" href="../CSS/Common.css">
<style> td { padding:2px 5px 2px 5px;} table { margin-bottom:4px;}</style>
<script language=javascript src="../JS/CheckQuestion.js.php"></script>
<script type="text/javascript" src="../JS/Browser.js.php"></script>
<link href="../CSS/SurveyList.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 type="text/javascript" src="../JS/Jquery.min.js.php"></script>
<script type="text/javascript" src="../JS/Jquery.notification.js.php"></script>
<link type="text/css" rel="stylesheet" href="../CSS/Notification.css" />
<script type="text/javascript" src="../Chart/Swfobject.js.php"></script>
<script language=javascript>
function Check_Form_Validator()
{
   if (!CheckNotNull(document.Check_Form.chartWidth, "选定展示的图形大小 - 宽")) {return false;}
   if (!CheckNumber(document.Check_Form.chartWidth, "选定展示的图形大小 - 宽",50,2000)) {return false;}
   if (!CheckNotNull(document.Check_Form.chartHeight, "选定展示的图形大小 - 高")) {return false;}
   if (!CheckNumber(document.Check_Form.chartHeight, "选定展示的图形大小 - 高",50,2000)) {return false;}
   var theRows = document.getElementById('theSGGDataTable').rows.length;		
   var dataRows = theRows-1;
   for(var i=1;i<=dataRows;i++)
   {
	   var questionID = eval("document.getElementById('questionID_"+i+"')");
	   var priceID = eval("document.getElementById('price_"+i+"')");
	   var optionID = eval("document.getElementById('cond_"+i+"')");

	   if (!CheckListNoSelect(questionID,"分析变量"+i)) {return false;}
	   if (!CheckNotNull(priceID, "分析变量"+i+"的对应价格")) {return false;}
	   if (!CheckNoFloat(priceID, "分析变量"+i+"的对应价格")) {return false;}
	   if ( i != dataRows )
	   {
		   var k = i+1;
		   var priceNextID = eval("document.getElementById('price_"+k+"')");
		   if ( parseFloat(priceID.value) > parseFloat(priceNextID.value) )
		   {
				priceID.focus();
				$.notification("分析变量"+i+"的对应价格大于其后续变量的对应价格");
				return false;
		   }
	   }
	   if (!CheckListNoSelect(optionID,"分析变量"+i+"的顾客决定购买的选项")) {return false;}
	   if (!CheckListMaxSelect(optionID,"分析变量"+i+"的顾客决定购买的选项",2)) {return false;}
   }
}
function CheckNoFloat(objField, strText) {
    var objValue = objField.value;
    if (objValue=="") return true;
	var strErr = "“" + strText + "”不是正确的价格数据格式！";
	var reg=/^-?\d+\.?\d*$/;
	if (!reg.test(objValue)) {
        objField.focus();
		$.notification(strErr);
		return false;
	}
	return true;
}
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("EGGMapTable").style.display = '';
				document.getElementById("EGGCopyAction").style.display = '';
				document.getElementById("EGGMap").innerHTML = theRtnText;
				exeRuturnScript(theRtnText);
				adjustMenuWarpSize();
				parent.document.getElementById("the_content_iframe").contentWindow.document.body.style.overflowX='auto';
			}
			else
			{
				$.notification('网络传输问题');
			}
		}	
	} 
}
function exeRuturnScript(html) 
{ 
	var reg = /<script[^>]*>([^\x00]+)$/i; 
	var htmlBlock = html.split("<\/script>"); 
	for (var i in htmlBlock) 
	{ 
		var blocks;
		if (blocks = htmlBlock[i].match(reg)) 
		{ 
			var code = blocks[1].replace(/[<]!--/, ''); 
			try 
			{ 
				eval(code);
			} 
			catch (e) { } 
		}
	} 
}
function EGGSubmit()
{
    if( Check_Form_Validator() != false )
	{
		var surveyID = document.getElementById('surveyID').value;
		var chartWidth = document.getElementById('chartWidth').value;
		var chartHeight = document.getElementById('chartHeight').value;
		var ParamString = "Action=SGGSubmit";
		ParamString += "&surveyID="+surveyID;
		ParamString += "&chartWidth="+chartWidth;
		ParamString += "&chartHeight="+chartHeight;
		ParamString += "&dataSource=" + getRadioCheckBoxValue(document.Check_Form.dataSource);

		var theRows = document.getElementById('theSGGDataTable').rows.length;		
		var dataRows = theRows-1;
		ParamString += "&dataRows="+dataRows;
		for(var i=1;i<=dataRows;i++)
		{
			var questionID = eval("document.getElementById('questionID_"+i+"')");
			var priceID = eval("document.getElementById('price_"+i+"')");
			var optionID = eval("document.getElementById('cond_"+i+"')");

			ParamString += "&questionID"+i+"="+getRadioCheckBoxValue(questionID);
			ParamString += "&priceValue"+i+"="+Trim(priceID.value);
			ParamString += "&optionID"+i+"="+getRadioCheckBoxValue(optionID);
		}
		
		document.getElementById("EGGMapTable").style.display = '';
		document.getElementById("EGGMap").innerHTML = "<div id=\"preloading\" style=\"background-color:#f0f0f0;width:160px;overflow:hidden;white-space:nowrap;color:black;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('SimpleGG.php',ParamString);
	}
}
function ResetInit()
{
	document.getElementById("EGGMapTable").style.display = 'none';
	document.getElementById("EGGCopyAction").style.display = 'none';
	document.getElementById("EGGMap").innerHTML = '' ;
}
function Init(){
	AjaxShowDataSource({surveyID},1);
	var chartWidth = document.body.clientWidth -160;
	gId('chartWidth').value = chartWidth.toString();;
}
function copycode(obj) {
        
    var theSwfObject = obj.getElementsByTagName("object");
    for (var i=theSwfObject.length; i>=0; i--)
    {
		if( theSwfObject[i] != null )
		{
			theSwfObject[i].removeNode(true);
		}
	}
	var rng = document.body.createTextRange();
    rng.moveToElementText(obj);
    rng.scrollIntoView();
    rng.select();
    rng.execCommand("Copy");
    rng.collapse(false);
	$.notification("复制分析结果到剪贴板成功");
}
function gId(_sId){
	return document.getElementById(_sId);
}
var condRequest = false;
function AjaxCondRequest(url,objId)
{
	condRequest = false;
	if(window.ActiveXObject)
	{
		try  // IE
		{
			condRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				condRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	}
	else if(window.XMLHttpRequest)
	{
		// Mozilla, Safari,...
		condRequest = new XMLHttpRequest();
		if (condRequest.overrideMimeType)
		{
			condRequest.overrideMimeType('text/xml');
		}
	}
	
	if (!condRequest)
	{
		alert("Cannot create an XMLHTTP instance");
		return false;
	}
	condRequest.onreadystatechange = function(){	
		if (condRequest.readyState == 4)
		{
			if(condRequest.status == 200)
			{
				var thisObj = eval("document.getElementById('QuestionCond_"+objId+"')");
				thisObj.innerHTML = condRequest.responseText;
				adjustMenuWarpSize();
			}
			else
			{
				alert('网络传输问题');
			}
		}
	};
	condRequest.open('GET', url, true);
	condRequest.send(null);
}
function ShowQuestionCond(obj,objId)
{
	var url = "../Analytics/AjaxShowSGGQut.php?surveyID={surveyID}&thisId="+getRadioCheckBoxValue(obj)+"&thisNo="+objId;
	AjaxCondRequest(url,objId);
}
</script>
<script src="../JS/AjaxShowSGGQut.js.php?type=1&surveyID={surveyID}"></script>
</head>
<body oncontextmenu="return false" style="background-color:#244d8f;" onload="javascript:Init();">
<div style="line-height:10px">&nbsp;</div>
<div id="menu">
  <span style="float:left;padding-left:26px;"><div class="navmenu">数据报告中心 &raquo; 简单的Gabor Grancer法</div></span>
  <span style="float:right">
  <ul><li><a href="../System/ShowMain.php">我的问卷</a></li>
      <li class="current"><a href="../Analytics/DataOverview.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">标准报告</a>
      <li><a href="../Analytics/DefineReport.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">自定义报告</a></li>
      <li><a href="../Analytics/DataList.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">回复数据</a></li>
      <li><a href="../Analytics/EventAward.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">调查奖励</a></li>
      <li><a href="../Analytics/PanelArea.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">样本来源</a></li>
      <li><a href="../Analytics/TaskResult.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">计划任务</a></li>
      <li><a href="../Analytics/SurveyIndexResult.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}">指标分析</a></li>
	  </ul></span>
</div>

<div class="wrap q_clear" id=wrap>
<div>
<div class=content>
<div class=q_clear id=mysurvey><h1>[<font color=red>{surveyTitle}</font>] 简单的Gabor Grancer法</h1><br/></div>
<div id=myname><span class=red>*</span> [ <a onmouseover="this.T_WIDTH=446;this.T_PADDING=0;this.T_BGCOLOR='#ffffff'; return escape('<img src=../Images/Example/example_sgg.png width=621 align=center>')" href="javascript:void(0);"><font color=red>调查问题图例</font></a> ] 使用简单的Gabor Grancer法的目的：(1) 测试企业现有产品价格变化对需求的影响；(2) 确定企业新产品的最优价格并分析价格对需求的影响。通常在调查中设置6-12个价格水平，价格水平间的间距通常大致为当前价格的4-5%。研究价格降低对需求的影响，当前价格在系列的最高端，样本主要自非使用者中抽取；反之，当前价格应放在系列的前面几个水平，样本应从使用者中抽取。</div>
<div class="datalist">

<table class=datatable width=100% cellspacing=0 cellpadding=0 style="border-left:0px;border-right:0px">
  <tr>
      <td width=1% noWrap style="border:0px">&nbsp;</td>
      <td width=107 nowrap style="border:0px"><b>选择数据分析方向</b></td>
      <td width=110 nowrap bgcolor="#eeeeee" align=center style="border-left:1px #b5cfd9 solid;border-right:1px #b5cfd9 solid;"><a href="../Analytics/DataOverview.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">回复数据概览</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
      <td width=110 nowrap bgcolor="#eeeeee" align=center style="border-right:1px #b5cfd9 solid;"><a href="../Analytics/Frequency.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">频数频率分析</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" align=center style="border-right:1px #b5cfd9 solid;"><a href="../Analytics/DataCross.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">交叉数据分析</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" align=center style="border-right:1px #b5cfd9 solid;"><a href="../Analytics/OptionsCoeff.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">问卷均值分析</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" align=center style="border-right:1px #b5cfd9 solid;"><a href="../Analytics/DataChart.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">数据图形展示</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" align=center style="border-right:1px #b5cfd9 solid;"><a href="../Analytics/ChiSquare.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">卡方分布校验</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
 	  <td width=* style="border:0px;border-right:0px;">&nbsp;</td>
 </tr>
  <tr><td colspan=2></td>
	  <td width=110 nowrap bgcolor="#eeeeee" align=center style="border-left:1px #b5cfd9 solid;border-right:1px #b5cfd9 solid;border-bottom:0px"><a href="../Analytics/LinearRegression.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">线性回归分析</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" style="border-right:1px #b5cfd9 solid;border-bottom:0px" align=center>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../Analytics/TURF.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">TURF分析</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#244d8f" style="border-right:1px #b5cfd9 solid;border-bottom:0px" align=center><a href="../Analytics/PSM.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:white">价格研究模型</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" style="border-right:1px #b5cfd9 solid;border-bottom:0px" align=center><a href="../Analytics/CombOptions.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">合并选项统计</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" style="border-right:1px #b5cfd9 solid;border-bottom:0px" align=center><a href="../Analytics/DataMatching.php?Type=1&surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">问卷数据对比</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" style="border-right:1px #b5cfd9 solid;border-bottom:0px" align=center>&nbsp;</td>
	  <td width=* style="border:0px;border-right:0px;" colspan=2>&nbsp;</td>
  </tr>
</table>

<table class=datatable width=100% cellspacing=0 cellpadding=0 style="border-left:0px;border-right:0px">
  <tr><td width=1% noWrap style="border:0px">&nbsp;</td>
      <td width=107 nowrap style="border:0px"><b>选择数据分析维度</b></td>
      <td width=110 nowrap bgcolor="#244d8f" style="border:0px;border-left:1px #b5cfd9 solid;border-right:1px #b5cfd9 solid" align=center>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../Analytics/SimpleGG.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:white">简单GG法</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" style="border:0px;border-right:1px #b5cfd9 solid" align=center>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../Analytics/ExtendedGG.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">推广GG法</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=110 nowrap bgcolor="#eeeeee" style="border:0px;border-right:1px #b5cfd9 solid" align=center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../Analytics/PSM.php?surveyID={surveyID}&surveyTitle={survey_URLTitle}" style="color:#444444">PSM法</a><IMG SRC="../Images/list_menu_arrow.gif"></td>
	  <td width=* style="border:0px">&nbsp;</td>
  </tr>
</table>

 <form name="Check_Form" method="post" action="" onsubmit="return Check_Form_Validator();">

 <script src="../JS/AjaxDataSource.js.php"></script>
 <script>
 function refreshDataSource(){
	AjaxShowDataSource({surveyID},1);
 }
 </script>
	<div id="dataSourceTable"><div id="dataloading" style="background-color:#f0f0f0;width:160px;overflow:hidden;white-space:nowrap;color:black;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></div>

</div>
<div>
  <table style="border-top: #b5cfd9 1px solid;border-bottom: #b5cfd9 1px solid;" width=100% id="datatable" cellspacing=0 cellpadding=0>
   <tr><td height=5></td></tr>
	<tr><td><b>选定分析结果的图形大小：</b>宽：<input type=text name="chartWidth" id="chartWidth" size=8 value=920>px&nbsp;&nbsp;&nbsp;高：<input type=text name="chartHeight" id="chartHeight" size=8 value=500>px</td></tr>
	<tr><td height=10></td></tr>
	<tr><td><b>定义分析变量及其相关信息：(价格自低到高)</b></td></tr>
	<tr><td>
		<table id="theSGGDataTable" style="LINE-HEIGHT: 150%;border-collapse:collapse;" cellSpacing=0 cellPadding=0 width="100%" borderColor=#cccccc border=1>
			 <tr bgcolor="#f5f5f5">
				 <td width=6% nowrap align=center>&nbsp;<a href="javascript:void(0)" onclick="insertSGGRow(document.getElementById('theSGGDataTable').rows.length)" title="增加分析变量"><img src="../Images/jia.gif" border=0></a>&nbsp;<a href="javascript:void(0)" onclick="deleteSGGRow()" title="减少分析变量"><img src="../Images/jian.gif" border=0></a></td>
				 <td width=*>&nbsp;<b>分析变量</b></td>
				 <td width=8% align=center>&nbsp;<b>对应价格</b></td>
			  </tr>
			 <!-- BEGIN OPTION -->
			 <tr><td align=center>&nbsp;{optionOrderID}：</td>
			     <td><select name="questionID_{optionOrderID}" id="questionID_{optionOrderID}" onchange="javascript:ShowQuestionCond(this,{optionOrderID})" style="width:735px;*width:745px">
				      <option value=''>请选择...</option>
					  {questionList}
					 </select><br/>
					 <span id="QuestionCond_{optionOrderID}"></span>
				 </td>
				 <td align=center><input name="price_{optionOrderID}" id="price_{optionOrderID}" size=10></td>
			 </tr>
			 <!-- END OPTION -->
			</table>
	</td></tr>

	<tr><td>
         <input class=inputsubmit name="submit" type="button" id="submit" value="开始分析" onclick="javascript:EGGSubmit();" > 
         <input class=inputsubmit name="reset" type="reset" id="reset" value="&nbsp;&nbsp;重置&nbsp;&nbsp;" onclick="javascript:ResetInit();" >
		 <input type=hidden name="surveyID" id="surveyID" value="{surveyID}">
      </td>
    </tr>
   <tr><td height=5></td></tr>
  </form>
 </table>
 <table id="EGGCopyAction" width=100% style="LINE-HEIGHT: 150%;border-collapse:collapse;display:none;margin-bottom:0px;margin-top:10px" cellSpacing=0 cellPadding=0 borderColor=#b5cfd9 border=0><tr><td align=right bgcolor="#eeeeee" style="border:1px #b5cfd9 solid;border-bottom:0px;height:30px;"><a href="javascript:void(0)" onclick="copycode(gId('copyContent'));"><font color="#444444">复制分析结果到剪贴板</font></a><img src="../Images/list_menu_arrow.gif" border=0>&nbsp;&nbsp;</td></tr></table>

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

 <br/>
 <span class=red>*</span> 功能“以图片格式导出”可能需要更改IE安全设置方能顺利下载<br/>
 <span class=red>*</span> IE菜单“工具”->“Internet选项“->“安全”->“自定义级别”->启用“文件下载的自动提示”
</div></div></div>
 <script language=javascript src="../JS/Example.js.php"></script>
</body></html>
