// JavaScript Document

function  change_act(addr)
{
	document.form1.action=addr;
}
	   
	   
function test()
{
	document.getElementById('next').click();
} 


function trim(str)
{
  return str.replace(/(^\s*)|(\s*$)/g,"");
}


function jscheck_corrent_answer(id,answer)
   {
        var get_id;
		var retCode;
		
		
		var url;
	    url=window.location.href;
        //alert(window.location.href);
        var point;
	    point=url.lastIndexOf('/')+1;
        var strstr= url.substring(0,point);
        //url 除过最后的文件------------------
	    //alert(str);
		
		
		get_id=id;
		infoBoard=document.getElementById("checkInfo"); 
        infoBoard.innerText='保存中...'; 
        myurl=strstr+"check_correct_answer_p.php?id="+get_id;
        //myurl="http://127.0.0.1:8080/check_correct_answer.asp?id="+get_id;
		myurl=myurl+"&answer="+answer;
		
		//alert(myurl);
        retCode=openUrl(myurl); 
        //alert("服务器返回值："+retCode);
		retCode=trim(retCode);
		
        switch(retCode){ 
		
        case "-2": 
                infoBoard.innerHTML='<font color=red>抱歉,查询失败 请重试</font>';
				break; 
        case "1": 
                //infoBoard.innerHTML='<font color=red>回答正确</font>';
				infoBoard.innerHTML='<font color=#ff0000><b>已保存</b></font>';
				//setTimeout(test,1000);//延时1秒
				//infoBoard.innerHTML=="延时1秒";
				break; 
        case "0": 
		        infoBoard.innerHTML='<font color=#ff0000><b>回答错误</b></font>';
                //infoBoard.innerHTML='<font color=#ff0000><b>已保存</b></font>'; 
				//setTimeout(test,1000);//延时1秒
				//infoBoard.innerHTML=="延时1秒";
       } 
       return; 
} 


function jscheck_corrent_answer_panduan(page,zong_sele_num,id,answer,mode)
{
        
		var get_id;
		var retCode;
		
		var infoBoard;
		var infoBoard1;
		var infoBoard2;
		
		var sele_obj1;
		var sele_value1;
		
		var sele_obj2;
		var sele_value2;
		
		get_id=id;
		
		var url;
	    url=window.location.href;
        //alert(window.location.href);
        var point;
	    point=url.lastIndexOf('/')+1;
        var strstr= url.substring(0,point);
        //url 除过最后的文件------------------
	    //alert(str);
		
		sele_obj1=document.getElementById("p_sele"+id+'y');
		sele_value1=document.getElementById("p_sele"+id+'y').innerText;
		sele_obj1.innerHTML="<font color=#000000>"+sele_value1+"</font>";
		
		
		sele_obj2=document.getElementById("p_sele"+id+"n");
		sele_value2=document.getElementById("p_sele"+id+"n").innerText;
		sele_obj2.innerHTML="<font color=#000000>"+sele_value2+"</font>";
		
		
		infoBoard1=document.getElementById("p_displayinfo"+id+'y'); 
        infoBoard1.innerHTML=''; 
		
		infoBoard2=document.getElementById("p_displayinfo"+id+'n'); 
        infoBoard2.innerHTML=''; 
		
		infoBoard=document.getElementById("result"+id);
		
		
		if (answer=='1') 
		{
		  
		   sele_obj1.innerHTML="<font color=#ff0000>"+sele_value1+"</font>";
		   infoBoard1.innerHTML='<font color=#ff0000><b>已保存</b></font>';
		   //answer----------
		   /**
		   infoBoard1=document.getElementById("p_displayinfo"+id+'y'); 
           infoBoard1.innerHTML='<font color=#ff0000><b>已保存</b></font>'; 
		   
		   **/
		   
		}
		
		if (answer=='0') 
		{
		   //answer----------
		   sele_obj2.innerHTML="<font color=#ff0000>"+sele_value2+"</font>";
		   infoBoard2.innerHTML='<font color=#ff0000><b>已保存</b></font>';
		   /**
		   infoBoard2=document.getElementById("p_displayinfo"+id+'n'); 
           infoBoard2.innerHTML='<font color=#ff0000><b>已保存</b></font>';
		   **/ 
		}
		
		
        myurl=strstr+"check_correct_answer_p.php?id="+get_id;
        //myurl="http://127.0.0.1:8080/check_correct_answer.asp?id="+get_id;
		myurl=myurl+"&page="+page;
		myurl=myurl+"&zong_sele_num="+zong_sele_num;
		myurl=myurl+"&answer="+answer;
		//alert(myurl);
		
        retCode=openUrl(myurl); 
		retCode=trim(retCode);
        //alert("服务器返回值："+retCode);
		
		if (mode=='0') 
		{		
        	switch(retCode)
	   		{ 
		
        		case "-2": 
                	infoBoard.innerHTML='<font color=#ff0000>抱歉,查询失败</font>';
					break; 
        		case "1": 
			    	//infoBoard.innerHTML='<font color=#009933><b>答案:正确</b></font>';
					//infoBoard1.innerHTML='<font color=#ff0000><b>已保存</b></font>';
					
					//var newpage=0;
					//setTimeout('fetch_p_next_ti('+newpage+','+zong_sele_num+')',1000);//延时1秒
                	break; 
					
				case "2": 
			    	//infoBoard.innerHTML='<font color=#009933><b>答案:正确</b></font>';
					//infoBoard1.innerHTML='<font color=#ff0000><b>已保存</b></font>';
					//var newpage=parseInt(page);
					//setTimeout('fetch_p_next_ti('+newpage+','+zong_sele_num+')',1000);//延时1秒
					break; 
				
        		case "3": 
                	//infoBoard.innerHTML='<font color=#ff0000><b>答案:错误</b></font>';
					//infoBoard.innerHTML='<font color=#ff0000><b>已保存</b></font>'; 
					//setTimeout('test()',1000);//延时1秒
					//infoBoard.innerHTML='<font color=red>延时1秒！</font>';
					break;
					
				case "4": //正式考试模式
					//var newpage=0;
					//setTimeout('fetch_p_next_ti('+newpage+','+zong_sele_num+')',1000);//延时1秒
                	break; 
				case "5": //正式考试模式
					//var newpage=parseInt(page);
					//setTimeout('fetch_p_next_ti('+newpage+','+zong_sele_num+')',300);//延时1秒
					break; 
				
             } 
	   
		}
		
		
		if (mode=='1') 
		{
			//--正式考试模式------------
			//infoBoard.innerHTML='<font color=#ff0000><b>已保存</b></font>';
		}
	   
       return; 
	   
} 






function openUrl(url)
 
 { 
    var objxml=new ActiveXObject("Microsoft.XMLHttp") 
    objxml.open("GET",url,false); 
    objxml.send(); 
    retInfo=objxml.responseText; 
    if (objxml.status=="200")
	{ 
      return retInfo; 
    } 
    else
	{ 
      return "-2"; 
     } 
} 



function fetch_p_next_ti(page,zong_sele_num)
{
        
		var get_id;
		var retCode;
		var newpage;
		
		if (page<zong_sele_num)
		{
			 newpage=parseInt(page)+1;
		}
		else
		{
			newpage=1;
		}
		
		var url;
	    url=window.location.href;
        //alert(window.location.href);
        var point;
	    point=url.lastIndexOf('/')+1;
        var strstr= url.substring(0,point);
        //url 除过最后的文件------------------
	    //alert(str);
		
		
		infoBoard=document.getElementById("p_all"); 
        infoBoard.innerText='查询中...'; 
        myurl=strstr+"a0middle_panduan.php?page="+newpage;
       
		//alert(page);
		//alert(myurl);
        retCode=openUrl(myurl); 
		retCode=trim(retCode);
        //alert("服务器返回值："+retCode);
		
		infoBoard.innerHTML=retCode;
	   
       return; 
	   
	   
} 




function fetch_p_prior_ti(page,zong_sele_num)
{
        
		var get_id;
		var retCode;
		var newpage;
		
		if (page>1)
		{
			 newpage=parseInt(page)-1;
		}
		else
		{
			newpage=zong_sele_num;
		}
		
		var url;
	    url=window.location.href;
        //alert(window.location.href);
        var point;
	    point=url.lastIndexOf('/')+1;
        var strstr= url.substring(0,point);
        //url 除过最后的文件------------------
	    //alert(str);
		
		
		infoBoard=document.getElementById("p_all"); 
        infoBoard.innerText='查询中...'; 
        myurl=strstr+"a0middle_panduan.php?page="+newpage;
       
		//alert(page);
		//alert(myurl);
        retCode=openUrl(myurl); 
		retCode=trim(retCode);
        //alert("服务器返回值："+retCode);
		
		infoBoard.innerHTML=retCode;
	   
       return; 
} 
