function LoadFile(sol,year)
{
	linkhead = new String('./index.php');
	objParam = new Object();
	objParam.option = "com_archbydate";
	objParam.task = "getArchHistoryList";
	objParam.class_id = document.adminForm.class_id.value;
	objParam.lang = get_current_language();
	objParam.sol = sol;
	objParam.year = year;
	
	
	sendRequest(LoadResult, 
	CombineParam(objParam),  
	'POST',
	linkhead,
	true,
	true
    );
}

function openURLspecial(strlink)
  { 
   //location.href = "./index.php?option=com_tsumelearn&id=" + strlink+"&imgmirror="+document.adminForm.imgmirror.value+"&lang="+get_current_language(); //2nd
   //var new_link = "./index.php?option=com_tsumelearn&id=" + strlink+"&imgmirror="+document.adminForm.imgmirror.value+"&lang="+get_current_language();
   var new_link = "./index.php?option=com_archbydate&task=loadArchHistoryList&sol=1&class_id=" + strlink+"&imgmirror="+document.adminForm.imgmirror.value+"&lang="+get_current_language();
   window.open(new_link,'GenerateGameRecord','width=800,height=600,toolbar=1,menubar=1,scrollbars=1,location=1,status=1,resizable=1');
  }  



function LoadResult(oj)
{
	//alert(oj.responseText)
	tmp  =  decodeURIComponent(oj.responseText);
  //eval('this.objResult='+tmp);

	objResult = eval ("(" + tmp + ")");		//orginal
	//alert(objResult.historyinfo[0].comment);
	objTsumegoHistoryList = new TsumegoHistoryList(objResult);
	objTsumegoHistoryList.ChangeData();
}



function TsumegoHistoryList(result)
{
	this.sOption = new String('com_archbydate');
	this.sTask = new String('getArchHistoryList');
	this.objResult = result;
	//dump(this.objResult);	
	
	this.ChangeData=function()
	{
		this.ChangeTitle();	
		this.ChangeContent();
	}
	
	this.ChangeTitle=function()
	{
		var objframe_title = document.getElementsByName("tsumegohistorylist_title");
		var newcontent = String('');
		newcontent = this.objResult.TsumegoClassInfo.tsumegoclass[0];
		objframe_title[0].innerHTML = newcontent;		
	}
	this.ChangeContent=function()
	{
		var objframe_content = document.getElementsByName("tsumegohistorylist_content");
		var newcontent = String('');
		
		for(i=0;i<this.objResult.historyinfo.length;i++)
		{
			newcontent += '<div class="block" style="margin:0em;">';
			
			//comments
			newcontent += '<div class="contents" style="float:left;width:100%; padding-top: 0px;text-align:left;">';			
			if(get_current_language()=='en')
				newcontent += '<span style=\"float:left; font-size : 13px;color : #0066FF; \">'+this.objResult.historyinfo[i].historyenglishtitle + '</span>' + ' : ' + this.objResult.historyinfo[i].englishcomment + ' ... ';
			else
				newcontent += '<span style=\"float:left; font-size : 13px;color : #0066FF; \">'+this.objResult.historyinfo[i].historytitle + '</span>' + ' : ' + this.objResult.historyinfo[i].comment + ' ... ';
			if(this.objResult.historyinfo[i].sol==0)
			{
			   if(this.objResult.gid>=1)
				    newcontent += '<a href="javascript:openURLspecial('+this.objResult.historyinfo[i].answerid+')"><font size=2>('+this.objResult.lang._keyword_solution+')	</font></a>';
				 else
				 {
				    newcontent += "<span style='font-size : 13px;color : RED;'>"
				    newcontent += '('+this.objResult.lang._keyword_solution+'. ';
            newcontent += this.objResult.lang._keyword_arch_sol;
            newcontent += "<a href='./index.php?option=com_registration&task=register'>"+this.objResult.lang._keyword_arch_register+'</a>)</span>';
				    //newcontent += '<span style=\"float:left; font-size : 13px;color : RED; \">'+this.objResult.lang._keyword_arch_sol+'</span>';
				 }
			}	
			else
				newcontent += '('+this.objResult.lang._keyword_solution+')';

			newcontent += '</div>';

			
			
			//picture	the question image
			if(this.objResult.historyinfo[i].sol==0)
			{
				if (get_current_language()=='en')
					newcontent += '<iframe width="550" height="555" align="left" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.connect6.org/board_en/display.php?format=simplesgf&mirror='+document.adminForm.imgmirror.value+'&input='+this.objResult.historyinfo[i].movelist+'"></iframe>';//3
				else
					newcontent += '<iframe width="550" height="555" align="left" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.connect6.org/board/display.php?format=simplesgf&mirror='+document.adminForm.imgmirror.value+'&input='+this.objResult.historyinfo[i].movelist+'"></iframe>';//4
			}
			else
			{			  
				if (get_current_language()=='en')
					newcontent += '<iframe width="550" height="555" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.connect6.org/board_en/display.php?format=simplesgf&mirror='+document.adminForm.imgmirror.value+'&input='+this.objResult.historyinfo[i].movelist_sol+'&filter='+this.objResult.historyinfo[i].filter+'"></iframe>';//5
				else
					newcontent += '<iframe width="550" height="555" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.connect6.org/board/display.php?format=simplesgf&mirror='+document.adminForm.imgmirror.value+'&input='+this.objResult.historyinfo[i].movelist_sol+'&filter='+this.objResult.historyinfo[i].filter+'"></iframe>';//6
			}
			//show solution
			newcontent += '</div>';		//end div class block		
			//if(i!=this.objResult.historyinfo.length-1)
			//	newcontent +=	'<span style="float:left;width: 100%;"><hr style="color: #9e9ed7;height:2px;"></hr></span>';
			//end block then draw line
		}
		
		//過去棋局連結
		if(this.objResult.historyinfo[0].sol==0)
		{
  		newcontent += '<div class="block" style="margin:0em;">';
	 	 newcontent += '<div class="contents" style="float:left;width:100%; padding-top: 0px;text-align:left;">';
	 	 if (get_current_language()=='en')
		  newcontent += '<span><a href="./index.php?option=com_archbydate&task=loadArchClassList&lang=en" >'+this.objResult.lang._keyword_more+'...</a></span>';
  		else
	 	 newcontent += '<span><a href="./index.php?option=com_archbydate&year='+this.objResult.year+'&task=loadArchClassList" >'+this.objResult.lang._keyword_more+'...</a></span>';
	 	 newcontent += '</div>';
		  newcontent += '</div>';
		}
		objframe_content[0].innerHTML = newcontent;	
	}

	
	
	
	
}//end function TsumegoClassList()


