function LoadFile()
{
	linkhead = new String('./index.php');
	objParam = new Object();
	objParam.option = "com_tsumego";
	objParam.task = "getTsumegoHistoryList";
	objParam.class_id = document.adminForm.class_id.value;
	objParam.lang = get_current_language();
	
	
	sendRequest(LoadResult, 
	CombineParam(objParam),  
	'POST',
	linkhead,
	true,
	true
    );
}

function openURLspecial(strlink)
  { 
   location.href = "./index.php?option=com_tsumego&id=" + strlink+"&imgmirror="+document.adminForm.imgmirror.value+"&lang="+get_current_language();
  }  



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_tsumego');
	this.sTask = new String('getTsumegoHistoryList');
	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;">';
			/*
			newcontent += this.objResult.lang._keyword_title + ' : ' + this.objResult.historyinfo[i].historytitle + '<br>' ;
			newcontent += this.objResult.lang._keyword_englishtitle + ' : ' + this.objResult.historyinfo[i].historyenglishtitle + '<br>' ;
			newcontent += this.objResult.lang._keyword_create_time + ' : ' + this.objResult.historyinfo[i].create_time + '<br>' ;
			newcontent += this.objResult.lang._keyword_status + ' : ' + this.objResult.historyinfo[i].status + '<br>' ;
			newcontent += this.objResult.lang._keyword_verified + ' : ' + this.objResult.historyinfo[i].verified + '<br>' ;
			*/
			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].answerid)
				newcontent += '<a href="javascript:openURLspecial('+this.objResult.historyinfo[i].answerid+')"><font size=2>('+this.objResult.lang._keyword_solution+')	</font></a>';
			else
				newcontent += '('+this.objResult.lang._keyword_solution+')';

			newcontent += '</div>';

			
			
			//picture	the question image
			if(this.objResult.historyinfo[i].answerid)
			{
				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>';
				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>';
			}
			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+'"></iframe>';
				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+'"></iframe>';
			}
			//show solution
			newcontent += '</div>';		//end div class block
			/*
			if(this.objResult.historyinfo[i].answerid)
			{
				newcontent += '<div class="anscontents" style="float:left;text-align:left;">';
				newcontent += '<a href="javascript:openURLspecial('+this.objResult.historyinfo[i].answerid+')"><font size=4>('+this.objResult.lang._keyword_solution+')<BR><BR><BR><BR></font></a>'
				newcontent += '</div>';
			}
			else
			{
				newcontent += '<div class="anscontents" style="float:left;padding-top:250px;text-align:left;">';
				newcontent += '('+this.objResult.lang._keyword_solution+')';
				newcontent += '</div>';
			}*/
			
			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
		}
		
		objframe_content[0].innerHTML = newcontent;	
	}

	
	
	
	
}//end function TsumegoClassList()


