// $Revision: 4908 $

// global functions...

function TestResultPage(obj)
{
  if(obj == undefined)  
  {
    alert('Can\'t test result page. Obj is undefined');
    return;
  }

  for(var i = 0; i < ResultPage.nPageUsers; i++)
  {
    obj.UsersTableSetUser(i, i+1, "User" + String(i+1), String((i+1)*100), String(i+2), String((i+1)*1000));
  } 
  
  obj.UsersTableSetActiveField(0);
  ResultPage.SetNumOfPages(30);
}

// handle functions
function ClickResultUserTableTyper()
{
  ResultPage.UsersTableSetActiveField(1);
  ResultPage.SetCrit(0);
  ResultPage.RequestUserTable();
}
function ClickResultUserTableSpeed()
{
  ResultPage.UsersTableSetActiveField(2);
  ResultPage.SetCrit(1);
  ResultPage.RequestUserTable();
}
function ClickResultUserNumOfErrors()
{
  ResultPage.UsersTableSetActiveField(3);
  ResultPage.SetCrit(2);
  ResultPage.RequestUserTable();
}
function ClickResultUserTableRating()
{
  ResultPage.UsersTableSetActiveField(4);
  ResultPage.SetCrit(3);
  ResultPage.RequestUserTable();
}


function UpdatePageNumber(pageNum, bUpdate)
{
  ResultPage.SetCurPage(pageNum);
  
  with(ResultPage)
  {  
	 if(RegRes == RegExRes)
	 {
	  if(commonInfo.TypeOfExercise == 1  ||  commonInfo.TypeOfExercise == 6)
		  RequestUserTable();
	  else
		  PostForm();
	 }
	 else
	 {
		 try
		  {
			  //ResultSpeedTestInfo.nPage = pageNum; //Это берется со страницы
			  //####
			  ResultSpeedTestInfo.nPage = pageNum;
			  RequestSpeedTestResult();
			  //if(bUpdate == undefined  ||  bUpdate == true) RequestSpeedTestResult();
		  }
		  catch(e){alert("UpdatePageNumber(): " + e.description);} 
	 }
  }
}

function UpdatePage()
{
  if(commonInfo.TypeOfExercise == 1  ||  commonInfo.TypeOfExercise == 6)
    RequestRatingTableUser(ExerciseInfo.ID, commonInfo.CourseID);
  else
    ResultPage.PostForm();
}

// TResultPage...
function TResultPage(blockName, exerciseBlockName)
{
  this.BlockName = blockName; 
  this.ExerciseBlockName = exerciseBlockName; 
  
  this.Set = Set;
  this.WindowTop = WindowTop;
  this.WindowLeft = WindowLeft;
  
  this.NumOfPages = 0;
  this.CurPage = 0;
  
  this.CritTyper = "Typer";
  this.CritSpeed = "Speed";
  this.CritNumOfMistakes = "NumOfMistakes";
  this.CritRating = "Rating";
  this.CurCrit = this.CritPosition;
  this.nPageUsers = 8; // num of users at the result table(s)
  
  this.ExerciseID = 1;
  this.bSet = false;
  
  this.UserProfilePath = "/profile/";
  
  this.ResultMessageEmptyField = new TEmptyField("default", "white");
  
  this.RegExRes = 0;
  this.RegSpdRes = 1;
  this.RegRes = this.RegExRes;
  
  this.SetGrammarResult = function(correctWords, typedWords)
  {
    var tableCorrectWords = "";
    var tableIncorrectWords = "";
    var bWasFirstCorrectWord = false;
    var bWasFirstIncorrectWord = false;
    var unnecSymbols = String(",.;:-");
    var correctWords_ = StrArrayDeleteSymbols(correctWords, unnecSymbols);
    var typedWords_ = StrArrayDeleteSymbols(typedWords, unnecSymbols);
    
    for(var i = 0; i < typedWords_.length; i++)
    {
      if(correctWords_[i] == typedWords_[i])
      {
        if(bWasFirstCorrectWord) tableCorrectWords += ", "; 
        tableCorrectWords += typedWords_[i];
        bWasFirstCorrectWord = true;
      }
      else
      {
        if(bWasFirstIncorrectWord)  tableIncorrectWords += ", "; 
        tableIncorrectWords += "<i>"+typedWords_[i] + "</i> &ndash; " + correctWords_[i];
        bWasFirstIncorrectWord = true;
      }
    }
    
    if(tableCorrectWords != "")  
    {
      document.getElementById('IDCorrectWords').innerHTML = tableCorrectWords + ".";
    }
    if(tableIncorrectWords != "") 
    {
      document.getElementById('IDIncorrectWords').innerHTML = tableIncorrectWords + ".";
    }
  };
  
  this.ShowGrammarResult = function()
  {
    var obj1 = document.getElementById('IDRatingTableSpan');
    var obj2 = document.getElementById('IDResultMiksanatik');
    var obj3 = document.getElementById('IDLiteracySpan');
    
    if(obj1 != undefined) obj1.style.display = "none";
    if(obj2 != undefined) obj2.style.display = "none";
    if(obj3 != undefined) obj3.style.display = "";
  };
  
  this.ratingTable = {
    show: function(bVal)
    {
       var obj = document.getElementById('IDRatingTableSpan');
       if(bVal)
         obj.style.display = "";
       else
        obj.style.display = "none";  
    }
  };
  
  this.ShowRatingTable = function()
  {
    var obj1 = document.getElementById('IDRatingTableSpan');
    var obj2 = document.getElementById('IDResultMiksanatik');
    var obj3 = document.getElementById('IDLiteracySpan');
    
    
    if(!Environment.IsOnline()) obj1.style.display = "none";
    else
      if(obj1 != undefined) obj1.style.display = "";
    if(obj2 != undefined) obj2.style.display = "none";
    if(obj3 != undefined) obj3.style.display = "none";      
  };
  
  this.ShowMiksanatik = function()
  {
    var obj1 = document.getElementById('IDRatingTableSpan');
    var obj2 = document.getElementById('IDResultMiksanatik');
    var obj3 = document.getElementById('IDLiteracySpan');
    
    if(obj1 != undefined) obj1.style.display = "none";
    if(obj2 != undefined) obj2.style.display = "";
    if(obj3 != undefined) obj3.style.display = "none";     
    
    this.ShowRating(false);
  };
  
  this.HideMain = function()
  {
    var obj1 = document.getElementById('IDRatingTableSpan');
    var obj2 = document.getElementById('IDResultMiksanatik');
    var obj3 = document.getElementById('IDLiteracySpan');
    
    if(obj1 != undefined) obj1.style.display = "none";
    if(obj2 != undefined) obj2.style.display = "none";
    if(obj3 != undefined) obj3.style.display = "none";      
  };
  
  this.IsSet = function()
  {
    return this.bSet;
  };
  
  this.SetExerciseID = function(exID)
  {
    this.ExerciseID = exID;
  };
  
  this.SetWindowTop = function(val)
  {
    this.WindowTop = val;
  };
  this.SetWindowLeft = function(val)
  {
    this.WindowLeft = val;
  };
  
  this.SetLessonExercise = function(lesson, exercise)
  {
    try
    {
      document.getElementById('IDTaskNumber').innerHTML = lesson + '.' + exercise;
    }
    catch(e){} 
  };
  
  this.SetPanelSpeed = function(speed)
  {
    document.getElementById('resultPanelSpeed').innerHTML = speed;
  };
  
  this.UpdatePanelFullTime = function()
  {
    var oFlTm = document.getElementById('IDResultTimeElapsed');
    oFlTm.innerHTML = /*GetFullExTime()*/GetActiveExTime();
  };
  
  this.SetPanelNumOfErrors = function(numOfErrors)
  {
    document.getElementById('resultPanelNumOfErrors').innerHTML = numOfErrors;
  };
  
  this.SetHeader = function(header)
  {
    document.getElementById('IDResultHeader').innerHTML = header;
  };
  
  this.SetPanelRating = function(rating)
  {
    document.getElementById('resultPanelRating').innerHTML = rating;
  };
  
  this.SetPanelAvarageSpeed = function(avarageSpeed)
  {
    try
    {
      document.getElementById('resultPanelAvarageSpeed').innerHTML = avarageSpeed;
    }
    catch(e){}
  };
  
  this.SetPanelTextTyped = function(textTyped)
  {
    try
    {
      document.getElementById('resultPanelTextTyped').innerHTML = textTyped;
    }
    catch(e){}
  };
  
  this.SetPanelTotalNumOfErrors = function(numOfErrors)
  {
    document.getElementById('resultPanelTotalNumOfErrors').innerHTML = numOfErrors;
  };
  
  this.SetNumOfTasks = function(val)
  {
    try
    {
      document.getElementById('resultPanelExercisesPassed').innerHTML = val;
    }
    catch(e){}  
  };
  this.SetAvarageSpeed = function(val)
  {
    try
    {
      document.getElementById('resultPanelAvarageSpeed').innerHTML = val;
    } 
    catch(e) {}
  };
  this.SetNumOfSymbolsTyped = function(val)
  {
    try
    {
      document.getElementById('resultPanelTextTyped').innerHTML = val;
    }
    catch(e){} 
  };
  this.SetNumOfErrors = function(val)
  {
    try
    {
      document.getElementById('resultTotalNumOfErrors').innerHTML = val;
    }
    catch(e){} 
  };
  
  this.UserTableHeadFieldsIds = new Array("resultUserTablePosition", "resultUserTableTyper", "resultUserTableSpeed", 
    "resultUserTableNumOfErrors", "resultUserTableRating");
  this.UserTableHeadFieldsNames = new Array("Позиция", "Солист", "Скорость", "Ошибок", "Рейтинг");
  this.PrevTableHeadIndex = 0;
  
  this.UsersTableSetActiveField = function(index)
  {
    if(this.PrevTableHeadIndex == index) return;
    if(this.PrevTableHeadIndex != 0) document.getElementById(this.UserTableHeadFieldsIds[this.PrevTableHeadIndex]).innerHTML = 
      "<font class='resultUserTableHeadDashed'>" + this.UserTableHeadFieldsNames[this.PrevTableHeadIndex] + "</font>";
    document.getElementById(this.UserTableHeadFieldsIds[index]).innerHTML = 
      "<font class='resultUserTableHeadWithoutDashed'>" + this.UserTableHeadFieldsNames[index] + "</font>"; 
    
    this.PrevTableHeadIndex = index;
  };
  
  this.PrevTableRowIndex = 0;
  
  this.UsersTableSetActiveRow = function(index)
  {
	var o = document.getElementById("resultUserTableRow" + String(index));
	var o2 = document.getElementById("resultUserTableRow" + String(this.PrevTableRowIndex));
    
	if(this.PrevTableRowIndex == index) return;
  
    if(index != -1) 
    {
    	o.style.background = "#D1EDBB";
    }
    if(this.PrevTableRowIndex != -1)
    {
    	if(this.PrevTableRowIndex % 2) o2.style.background = "rgb(238,238,238)";
    	else  o2.style.background = "rgb(255,255,255)";
    }
    
    this.PrevTableRowIndex = index;
  };
  
  this.UsersTableSetRowDisplay = function(index, BDisplay)
  {
    if(BDisplay)
    {
      document.getElementById("resultUserTableRow" + String(index)).style.visibility = "visible";
      if(window.navigator.appName == "Microsoft Internet Explorer")
      {
        document.getElementById("IDRatingTableSpeedBPre" + String(index)).style.visibility = "visible";
        document.getElementById("IDRatingTableSpeedBPost" + String(index)).style.visibility = "visible";
        document.getElementById("IDRatingTableErrorsBPre" + String(index)).style.visibility = "visible";
        document.getElementById("IDRatingTableErrorsBPost" + String(index)).style.visibility = "visible";
        document.getElementById("IDRatingTableRatingBPre" + String(index)).style.visibility = "visible";
        document.getElementById("IDRatingTableRatingBPost" + String(index)).style.visibility = "visible";
      }
    }
    else
    {
      document.getElementById("resultUserTableRow" + String(index)).style.visibility = "hidden";
      if(window.navigator.appName == "Microsoft Internet Explorer")
      {
        document.getElementById("IDRatingTableSpeedBPre" + String(index)).style.visibility = "hidden";
        document.getElementById("IDRatingTableSpeedBPost" + String(index)).style.visibility = "hidden";
        document.getElementById("IDRatingTableErrorsBPre" + String(index)).style.visibility = "hidden";
        document.getElementById("IDRatingTableErrorsBPost" + String(index)).style.visibility = "hidden";
        document.getElementById("IDRatingTableRatingBPre" + String(index)).style.visibility = "hidden";
        document.getElementById("IDRatingTableRatingBPost" + String(index)).style.visibility = "hidden";
      }
    } 
  };
  
  this.TrimUserName = function(name)
  {
    if(name.length > 30)
      return name.slice(0, 30) + "&hellip;";
    return name;
  };
  
  this.UsersTableSetUser = function(index, pos, user, speed, numOfErrors, rating)
  {
    document.getElementById("resultUserTablePosition" + index).innerHTML = pos;
    document.getElementById("resultUserTableUserName" + index).innerHTML = 
      "<span style=\"cursor: pointer\" onclick=\"OpenNewWindow('" + this.GetRatingTableRowUserRef(index) + "')\">" + 
            this.TrimUserName(user) + "</span>";
    document.getElementById("resultUserTableSpeed" + index).innerHTML = speed;
    document.getElementById("resultUserTableNumOfErrors" + index).innerHTML = numOfErrors;
    document.getElementById("resultUserTableRating" + index).innerHTML = rating;
  };
  
  this.SetResultMessage = function(message)
  {
    var message_ = message.replace(/\n/,Environment.getResultTextSlashNReplace());
    
    var photoText = "";
    if(PhotoInfo.IsHint(ExerciseInfo.LessonNumber, commonInfo.TypeOfExercise, exerciseUserStatus.getNumErrors()))
         photoText = "<span style='font-weight: bold; font-size: 10pt'>На фото: " + PhotoCaptions[parseInt(ExerciseInfo.LessonNumber) + 1] + "</span><hr>";
    
    document.getElementById("resultMessage").innerHTML = photoText + message_.replace(/\n/g,"<br><div class='resultAddSpace'> </div>");
  };
  
  this.SetNumOfPages = function(numOfPages)
  {
    this.NumOfPages = numOfPages;
  };
  
  this.SetCurPage = function(curPage)
  {
    this.CurPage = curPage;
  };
  
  this.GetCurPage = function()
  {
    return this.CurPage;
  };
  
  this.SetCrit = function(col)
  {
    switch(col)
    {
    case 0:
      this.CurCrit = this.CritTyper;
      break;
    case 1:
      this.CurCrit = this.CritSpeed;
      break;
    case 2:
      this.CurCrit = this.CritNumOfMistakes;
      break;
    case 3:
      this.CurCrit = this.CritRating;
      break;
    default:
      alert("Exception: SetCrit() : wrong criterion '" + col + "' was specified");  
    }
    
    this.UsersTableSetActiveField(col+1);
  };
  
  // private function : do not call directly
  this.UpdateUserTable = function()
  {
    this.UsersTableSetActiveRow(-1); // clear selection
    for(var i = 0; i < this.nPageUsers; i++)
    {
      //alert("i="+i);
      this.UsersTableSetUser(i, i+1 + this.nPageUsers*this.GetCurPage(), RatingInfo.User[i], RatingInfo.AvarageSpeed[i], 
              RatingInfo.Errors[i], RatingInfo.Rating[i]);
      if(RatingInfo.User[i] != "")  this.UsersTableSetRowDisplay(i, true);
      else  this.UsersTableSetRowDisplay(i, false);
      if(RatingInfo.Active[i] == "1")             
      {
        this.UsersTableSetActiveRow(i);
      }
    }    
    
    this.SetNumOfPages(RatingInfo.NumOfPages);
  };
  
  this.RequestUserTable = function() /*This function may require some time (use AJAX request)*/
  { /*this.Crit, this.CurPage*/
      
      if(this.CurCrit == this.CritTyper)
      {
        RequestRatingTablePage(this.ExerciseID, this.CurPage + 1, "name", commonInfo.CourseID);
      }
      else
      if(this.CurCrit == this.CritSpeed)
      {
        RequestRatingTablePage(this.ExerciseID, this.CurPage + 1, "avg_speed", commonInfo.CourseID);
      }
      else
      if(this.CurCrit == this.CritNumOfMistakes)
      { 
        RequestRatingTablePage(this.ExerciseID, this.CurPage + 1, "errors", commonInfo.CourseID);
      } 
      else
      if(this.CurCrit == this.CritRating)
      {
        RequestRatingTablePage(this.ExerciseID, this.CurPage + 1, "rating", commonInfo.CourseID);
      }
      else
      {
        alert("Exception: UpdateUserTable() : object has wrong .CurCrit");
        return;
      }
  };
  
  this.Selector = {
	black: function(arri)
	{
	  return "<FONT COLOR='black'>" + arri + "</FONT>&nbsp;";
	},
    blue: function(i, arri)
    {
		return "<FONT COLOR='#3B91D3'><span onclick='UpdatePageNumber(" + i + 
        ");' style='cursor: pointer'><U>" + arri + "</U></span></FONT>&nbsp;";
    }
  };
  
  this.ResultPageSelector = function()
  {
    var res = "";
    var i;
    
    if(this.NumOfPages < 2) return "";

    var arr = USelector.Get(this.CurPage, this.NumOfPages, 10);
    
    var s = "";
    for(var i in arr)
    {
    	s += arr[i] + " ";
    }
//    alert("s="+s);
    
    var j = USelector.Min;
    
    if(USelector.Min > 0)
    	res += this.Selector.blue(0, "1");
    
    for(var i in arr)
    {
    	if(j == this.CurPage)
    		res += this.Selector.black(arr[i]);
    	else
    		res += this.Selector.blue(j, arr[i]);
    	j++;
    }
    
    if(j < USelector.MaxPg)
    	res += this.Selector.blue(USelector.MaxPg, String(USelector.MaxPg + 1));
    
    return res;
  };
  
  this.SetErrorsCritical = function(bVal)
  {
    var obj = document.getElementById("IDResultHeader");
    var objScrollDiv = document.getElementById('resultMessage');
    var objCornerTopLeft = document.getElementById('IDTdResultMessageCornerTopLeft');
    var objBkTop = document.getElementById('IDTdResultMessageBkTop');
    var objCornerTopRight = document.getElementById('IDTdResultMessageCornerTopRight');
    var objBkLeft = document.getElementById('IDTdResultMessageBkLeft');
    var objBkRight = document.getElementById('IDTdResultMessageBkRight');
    var objCornerBottomLeft = document.getElementById('IDTdResultMessageCornerBottomLeft');
    var objBkBottom = document.getElementById('IDTdResultMessageBkBottom');
    var objCornerBottomRight = document.getElementById('IDTdResultMessageCornerBottomRight');
     
    if(bVal)
    {
      objScrollDiv.className = "ClassResultTextRed";
      obj.style.color = "#D00000";  
      objCornerTopLeft.className = "exResultMessageCornerTopLeftRed";
      objBkTop.className = "exResultMessageBkTopRed";
      objCornerTopRight.className = "exResultMessageCornerTopRightRed";
      objBkLeft.className = "exResultMessageBkLeftRed";
      objBkRight.className = "exResultMessageBkRightRed";
      objCornerBottomLeft.className = "exResultMessageCornerBottomLeftRed";
      objBkBottom.className = "exResultMessageBkBottomRed";
      objCornerBottomRight.className = "exResultMessageCornerBottomRightRed";  
    }
    else
    {
      objScrollDiv.className = "ClassResultText";
      obj.style.color = "#5FAC20";
      objCornerTopLeft.className = "exResultMessageCornerTopLeft";
      objBkTop.className = "exResultMessageBkTop";
      objCornerTopRight.className = "exResultMessageCornerTopRight";
      objBkLeft.className = "exResultMessageBkLeft";
      objBkRight.className = "exResultMessageBkRight";
      objCornerBottomLeft.className = "exResultMessageCornerBottomLeft";
      objBkBottom.className = "exResultMessageBkBottom";
      objCornerBottomRight.className = "exResultMessageCornerBottomRight";
    }
  }; 
  
  this.ShowGoToLessonList = function(bVal)
  {
    var obj = document.getElementById("IDResPGoToLessonList");
    
    if(bVal)  obj.style.display = "";
    else  obj.style.display = "none";  
  };
  
  this.oGotoLessonListReference = {
  
    id: "IDResPGoToLessonList",
  
    get: function()
    {
      return document.getElementById(this.id);
    },
  
    assignGoToLessonList: function()
    {
      this.get().innerHTML = "<a onclick=\"" + ResultPage.resultActions.getOverviewReference() + "\"><nobr>" + ResultPage.resultActions.getOverviewCaption() + "</nobr></a>";
    },
    assignRepeatExercise: function()
    {
      this.get().innerHTML = "<a onclick=\"RepeatExercise()\"><nobr>Повторить упражнение</nobr></a>";
    },
    assignNone: function()
    {
      this.get().innerHTML = "";      
    },
    show: function(bVal)
    {
      if(bVal)  this.get().style.display = "";
      else  this.get().style.display = "none";
    }
  };
  
  this.ShowContinue = function(bVal)
  {
    var obj = document.getElementById("IDResPContinue");
    if(bVal)  obj.style.display = "";
    else  obj.style.display = "none";    
  };
  
  function Set()
  {                          
//    CloseRedoObj.Show(false);
    ShowMainWindow(false);
  
    var obj = document.getElementById(this.BlockName); 
    
    var str = this.GetContent();

    str += '</TABLE>';

    obj.innerHTML = str;
    
    switch(GetExType())
    {
    case 0: case 4:
      this.SetRatingTableDisplay(false);
      this.SetPanelRatingDisplay(false, Environment.IsOnline());
      this.SetPanelErrorsDisplay(false);
      this.SetMiksanatikDisplay(true);
      this.SetLessonSelectorDisplay(false);
      this.ShowRating(false);
      this.ShowToday(true);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      break;
    case 5:
      this.SetRatingTableDisplay(false);
      this.SetPanelRatingDisplay(false, Environment.IsOnline());
      this.SetPanelErrorsDisplay(false);
      this.SetMiksanatikDisplay(false);
      this.SetLessonSelectorDisplay(false);
      this.ShowRating(false);
      this.SetLessonSelectorDisplay(false);
      this.ShowToday(true);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      break;
    case 32:
      this.SetRatingTableDisplay(false);
      this.SetPanelRatingDisplay(false, Environment.IsOnline());
      this.SetPanelErrorsDisplay(true);
      this.SetMiksanatikDisplay(true);
      this.SetLessonSelectorDisplay(false);
      this.ShowRating(false);
      this.ShowToday(false);
      this.FillResSpeedSpan();
      if(IsUserLogin())
    	  this.ShowResSpeedSpan(true, Environment.IsOnline());
      else
    	  this.ShowResSpeedSpan(false, Environment.IsOnline());
//      this.SetRepeatSpan('<a onclick="UnsetResultPageClose();" style="cursor: pointer"><font color="#AB0000"><U><b><i>Закрыть</i></b></U></font></a>');
      break;      
    case 2:
      this.SetPanelSpeedDisplay(false);
      this.SetRatingTableDisplay(true);
      this.SetPanelRatingDisplay(true, Environment.IsOnline());
      this.SetPanelErrorsDisplay(false);
      this.SetMiksanatikDisplay(false);
      this.SetLessonSelectorDisplay(true);
      this.ShowRating(true);
      this.ShowToday(true);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      break;
    case 3:
      this.SetRatingTableDisplay(true);
      this.SetPanelRatingDisplay(true, Environment.IsOnline());
      this.SetPanelErrorsDisplay(false);
      this.SetMiksanatikDisplay(false);
      this.SetLessonSelectorDisplay(true);
      this.ShowRating(true);
      this.ShowToday(true);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      break;
    case 6:
      this.SetRatingTableDisplay(true);
      this.SetPanelRatingDisplay(true, Environment.IsOnline());
      this.SetPanelErrorsDisplay(false);
      this.SetMiksanatikDisplay(false);
      this.SetLessonSelectorDisplay(true);
      this.ShowRating(true);
      this.ShowToday(true);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      break;
    case 7:           
      this.SetRatingTableDisplay(true);
      this.SetPanelRatingDisplay(true, Environment.IsOnline());
      this.SetPanelErrorsDisplay(false);
      this.SetMiksanatikDisplay(false);
      this.SetLessonSelectorDisplay(false);
      this.ShowRating(true);
      this.ShowToday(true);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      break;
    case 8:
      this.SetRatingTableDisplay(true);
      this.SetPanelRatingDisplay(true, Environment.IsOnline());
      this.SetPanelErrorsDisplay(true);
      this.SetLessonSelectorDisplay(false);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      break;
    default:
      this.SetRatingTableDisplay(true);
      this.SetPanelRatingDisplay(true, Environment.IsOnline());
      this.SetPanelErrorsDisplay(true);
      this.ShowResSpeedSpan(false, Environment.IsOnline());
      
// means for usual exercise (type 1)      
      if(exerciseUserStatus.getNumErrors() > ExerciseInfo.MaxNumOfMistakes)
        this.SetErrorsCritical(true);
      else
        this.SetErrorsCritical(false);
      
      this.SetMiksanatikDisplay(false);
      this.SetLessonSelectorDisplay(true);
      this.ShowRating(true);
      this.ShowToday(true);
    }
    
    this.HideResultPanelIfEmpty();
//    this.HideTodayIfEmpty();
    obj.style.top = this.WindowTop;
    obj.style.left = this.WindowLeft;
    obj.style.display = "";
    
    if(BScreenResolutionLowRegime) document.getElementById('IDResultToday').style.display = "none";
    
    document.getElementById(this.ExerciseBlockName).style.display = "none";
    
    ResultImg.Update(ExerciseInfo.LessonNumber, commonInfo.TypeOfExercise, exerciseUserStatus.getNumErrors());
 
    this.oGotoLessonListReference.show(IsUserLogin());
    if(Environment.IsOnline())
      this.oGotoLessonListReference.assignGoToLessonList();
    else
    if(ExerciseInfo.isExam)
      this.oGotoLessonListReference.assignNone();
    else
      this.oGotoLessonListReference.assignRepeatExercise(); 
 
    this.ShowContinue(IsUserLogin()); 
    
    this.bSet = true;
  }

this.ShowRefToLast = function(bVal)
{
   var o = document.getElementById("IDRefToLast");
   if(bVal) o.style.visibility = "visible";
   else
      o.style.visibility = "hidden";
};

this.SetRefToLast = function(ref)
{
  var o = document.getElementById("IDRefToLast");  
  o.innerHTML = "<a onclick='UnsetResultPageClose(\""+ref+"\")'><nobr>К последнему доступному</nobr></a>";  
};

this.IsResultPanelSpeedDisplay = function()
{
  if(document.getElementById('IDResultPanelSpeed').style.display == "none") return false;
  return true;
};
this.IsResultPanelErrorsDisplay = function()
{
  if(document.getElementById('IDResultPanelErrors').style.display == "none") return false;
  return true;
};
this.IsResultPanelRatingDisplay = function()
{
  if(document.getElementById('IDResultPanelRating').style.display == "none") return false;
  return true;
};

this.ShowResultPanel = function(bVal)
{
  var obj = document.getElementById("IDResultPanel");
  if(bVal)  obj.style.display = "";
  else    obj.style.display = "none";
};

this.HideResultPanelIfEmpty = function()
{
  if(
    this.IsResultPanelSpeedDisplay() == false  &&
    this.IsResultPanelErrorsDisplay() == false  /*&&
    this.IsResultPanelRatingDisplay() == false*/
  )
  {
    this.ShowResultPanel(false);
  }
};
/*this.HideTodayIfEmpty = function()
{

}*/

  
this.Unset = function()
{
  this.ShowResBottomCaptions(false);
  document.getElementById(this.BlockName).style.display = "none";
  document.getElementById(this.ExerciseBlockName).style.display = "";
  
  this.bSet = false;
//  FlashInput.SetFlashLoaded(false);
  if(!isIe6()) 
  {
//    FlashInput.Reset();
  }
  
/*  if(window.navigator.appName == "Opera")
  {
    ResetKeyboard();
  }*/                                                                  
  
  CloseRedoObjRes.Show(false);
//  CloseRedoObj.Show(true);
  
  ResetBegTime();
};
  
this.BSetRefToNext = false;  
  
this.SetRefToNextExercise = function(ref)
{
  ResultInfo.RefToNext = ref;
  var obj = document.getElementById('IDToNextExercise'); 
  
    if(this.BSetRefToNext == false)
    {
      obj.innerHTML =
        '<a style="cursor: pointer" onclick="CloseOrGoToPage();"><font color="#5FAC20"><U><b><i>Продолжить</i></b></U></font></a>';
      this.BSetRefToNext = true;
    }
};  

this.RefToNextHasSet = function(bVal)
{
  this.BSetRefToNext = bVal;
};

this.IsSetRefToNext = function()
{
  return this.BSetRefToNext;
};

this.ShowRating = function(bVal)
{
  try{
    if(bVal)
    {
      document.getElementById("IDRatingTable").style.display="";
      document.getElementById("IDStrTaskRating").style.display="inline";
      document.getElementById("IDTaskNumber").style.display="inline";
    }
    else
    {
      document.getElementById("IDRatingTable").style.display="none";
      document.getElementById("IDStrTaskRating").style.display="none";
      document.getElementById("IDTaskNumber").style.display="none";
    }
  }
  catch(e){}
};

this.SetLessonSelectorDisplay = function(bVal)
{
  try
  {
    if(bVal) document.getElementById("IDResLsnSel").style.display="inline";
    else document.getElementById("IDResLsnSel").style.display="none";
  }
  catch(e){}
};

this.SetMiksanatikDisplay = function(bVal)
{

};
  
this.SetPanelErrorsDisplay = function(bVal)
{
  if(bVal)  document.getElementById('IDResultPanelErrors').style.display = "";
  else  document.getElementById('IDResultPanelErrors').style.display = "none";  
}; 

this.SetResultPanelDisplay = function(bVal)
{
  if(bVal)  document.getElementById('IDResultPanel').style.display = "";
  else  document.getElementById('IDResultPanel').style.display = "none";  
};

this.SetPanelSpeedDisplay = function(bVal)
{
  if(bVal)  document.getElementById('IDResultPanelSpeed').style.display = "";
  else  document.getElementById('IDResultPanelSpeed').style.display = "none";    
};

this.SetPanelRatingDisplay = function(bVal, bCanShow)
{

  var obj = document.getElementById('IDResultPanelRating');

  if(!bCanShow)
  {
     obj.style.display = "none";
     return;
  }

  if(bVal)  obj.style.display = "";
  else  obj.style.display = "none"; 
};
  
this.SetRatingTableDisplay = function(bVal)
{
  if(bVal)  
  {
    document.getElementById('IDRatingTable').style.display = "inline";
  }
  else  document.getElementById('IDRatingTable').style.display = "none";   
};

this.SetSpeedTestRegisterEnterTrDisplay = function(bVal)
{
  if(bVal)  
  {
    document.getElementById('IDSpeedTestRegisterEnterTr').style.display = "";
  }
  else  document.getElementById('IDSpeedTestRegisterEnterTr').style.display = "none";
};

this.PostForm = function()
{
  ShowMainWindow(true);
  CloseRedoObjRes.Show(true); // show result key for opera
};

this.GetUserProfilePath = function()
{
  return this.UserProfilePath; 
};

this.GetRatingTableRowUserRef = function(userNum)
{
  return this.GetUserProfilePath() + RatingInfo.UserId[userNum] + "/";
};

this.GetRatingTableRow = function(index)
{
  var scls = "";	
  if((index % 2) == 1) scls = "class='bkGray'";
	
  return  '				<TR VALIGN=CENTER ' + scls + ' id="resultUserTableRow' + index + '">' +
'					<TD WIDTH=20% align="center">' +
'						<FONT Size=2><B><span id="resultUserTablePosition' + index + '">11</span></B></FONT></TD>' +
'					<TD WIDTH=20% align="CENTER">' +
'						<FONT Size=2><U><nobr><span id="resultUserTableUserName' + index + '">Луноход 1</span></nobr></U></FONT></TD>' +
'					<TD WIDTH=20% align="CENTER">' +
'					' +
'						<table><tr><td><b class="classGreenB" id="IDRatingTableSpeedBPre' + index + '"></b>' +
'            <div display="inline" class="classGreenDiv"><FONT Size=2><span id="resultUserTableSpeed' + index + '">000</span></FONT></div>' +
'            <b class="classGreenB" id="IDRatingTableSpeedBPost' + index + '"></b></td></tr></table></TD>' +
'					<TD WIDTH=20% align="center">' +
'						<table><tr><td><b class="classRedB" id="IDRatingTableErrorsBPre' + index + '"></b>' +
'            <div display="inline" class="classRedDiv"><FONT Size=2><span id="resultUserTableNumOfErrors' + index + '">121</span></FONT></div>' +
'            <b class="classRedB" id="IDRatingTableErrorsBPost' + index + '"></b></td></tr></table></TD>' +
'					<TD WIDTH=20% align="center">' +
'						<table><tr><td><b class="classBlueB" id="IDRatingTableRatingBPre' + index + '"></b>' +
'            <div display="inline" class="classBlueDiv"><FONT Size=2><span id="resultUserTableRating' + index + '">80</span></FONT></div>' +
'            <b class="classBlueB" id="IDRatingTableRatingBPost' + index + '"></b></td></tr></table></TD>' +
'				</TR>';
};

//

this.TabSpeedTable = function()
{
  return '<table width="100%" height="100%" border="0" cellpadding="1" cellspacing="0" id="IDTableSpeedRes" class="noWrap">';
};

this.TabSpeedUntable = function()
{
  return '</table>';
};

this.TabSpeedHead = function()
{
  return '<tr style="text-align: left;" valign="bottom"><td>&nbsp;</td><td class="GreenGeorgia" colspan="4"><div style="margin-top: 0px">Статистика</div></td></tr><tr><td colspan="5" id="IDResSpeedSel">... 1 2 ...</td></tr>';
};

this.TabSpeedHead2 = function()
{
  return '<tr valign="middle" style="font-size: 14pt; text-align: center"><td rowspan="'+String(this.nPageUsers+1)+'" valign="bottom"><div class="margRight10">' + this.Tables.Today() + '</div></td><td width="15%"></td><td width="35%"><div class="marginTopBottom5"><span id="IDResHeadDate" onclick="ResultPage.ResSpdTabClck(this.id)" class="resultUserTableHeadWithoutDashed">Дата и время</span></div></td><td width="25%"><div class="marginTopBottom5"><span id="IDResHeadSpeed" class="resultUserTableHeadDashed" onclick="ResultPage.ResSpdTabClck(this.id)">Скорость</span></div></td><td width="25%"><div class="marginTopBottom5"><span id="IDResHeadErrors" class="resultUserTableHeadDashed" onclick="ResultPage.ResSpdTabClck(this.id)">Ошибок</span></div></td></tr>';
};


this.ResSpdIds = new Array("IDResHeadDate", "IDResHeadSpeed", "IDResHeadErrors");
this.ResSpdTabClck = function(id)
{	
	var j = 0;
	for(i in this.ResSpdIds)
	{
		var o = document.getElementById(this.ResSpdIds[i]);
		if(id == this.ResSpdIds[i])
		{
			o.className = 'resultUserTableHeadWithoutDashed';
			ResultSpeedTestInfo.nCrit = j;
		}
		else
			o.className = 'resultUserTableHeadDashed';
		
		j++;
	}
	UpdatePageNumber(ResultSpeedTestInfo.nPage);
};

this.GetIDResSpeedPos = function(i) { return "IDResSpeedPos" + String(i); };
this.GetIDResSpeedDate = function(i) { return "IDResSpeedDate" + String(i); };
this.GetIDResSpeedSpeed = function(i) { return "IDResSpeedSpeed" + String(i); };
this.GetIDResSpeedErrors = function(i) { return "IDResSpeedErrors" + String(i); };
this.GetIDTabSpeedRow = function(i) { return "IDResTabSpeedRow" + String(i); };
this.ResSpeedPos = function(i) { return document.getElementById(this.GetIDResSpeedPos(i)); };
this.ResSpeedDate = function(i) { return document.getElementById(this.GetIDResSpeedDate(i)); };
this.ResSpeedSpeed = function(i) { return document.getElementById(this.GetIDResSpeedSpeed(i)); };
this.ResSpeedErrors = function(i) { return document.getElementById(this.GetIDResSpeedErrors(i)); };
this.SetResSpeedPos = function(i, t) { this.ResSpeedPos(i).innerHTML = t; };

this.TabSpeedVisArr = new Array(true, true, true, true, true, true, true, true);
this.SetTabSpeedRowVis = function(i, v) 
{

  try
  {

	 if(v == this.TabSpeedVisArr[i]) return;

	 if(v)
	 {
  		document.getElementById(this.GetIDTabSpeedRow(i)).style.visibility = "visible";
	   	this.TabSpeedVisArr[i] = true;
	 }
	 else
	 {
  		document.getElementById(this.GetIDTabSpeedRow(i)).style.visibility = "hidden";
  		this.TabSpeedVisArr[i] = false;
   }
	
	}
	catch(e) {}
};

this.SetResSpeedDate = function(i, t) {
	try
	{
		this.ResSpeedDate(i).innerHTML = t;
	}
	catch(e)
	{
		alert("this.ResSpeedDate="+this.ResSpeedDate);
	}
};
this.SetResSpeedSpeed = function(i, t) { this.ResSpeedSpeed(i).innerHTML = t; };
this.SetResSpeedErrors = function(i, t) { this.ResSpeedErrors(i).innerHTML = t; };

this.TabSpeedBody = function()
{
  var s = "";
  
  var cls = "class='bkGray'";
  
  for(var i = 0; i < this.nPageUsers; i++)
  {
	if((i % 2) == 1) scls = cls;
	else scls = "";
		
    s += '<tr ' + scls + ' id="' + this.GetIDTabSpeedRow(i) + '"><td align="left">' + this.TabSpeedColPos(i) + '</td>' +
          '<td align="center">' + this.TabSpeedCol(this.GetIDResSpeedDate(i)) + '</td>' +
          '<td align="center">' + this.TabSpeedCol(this.GetIDResSpeedSpeed(i), "green") + '</td>' +
          '<td align="center">' + this.TabSpeedCol(this.GetIDResSpeedErrors(i), "red") + '</td>' + '</tr>';
  }  
  
  return s; //###                                                                
};

this.TabSpeedColPos = function(i)
{
  return '<b><div class="leftLitMarg" id="' + this.GetIDResSpeedPos(i) + '"></div></b>'; 
};

this.TabSpeedCol = function(id, cls_)
{
  if(cls_ == undefined)
  {
	  var sRes = '<b><span id="' + id + '"></span></b>';
	  return sRes;
  }
	  
  var cls = "classGreen"; 
  if(cls_ == "blue")  cls = "classBlue";
  else
  if(cls_ == "red")  cls = "classRed";

  var clsB = cls + "B"; 
  var clsDiv = cls + "Div";
  
  var sRes = '<table><tr><td><b class="' + clsB + '"></b><div id="' + id + '" class="' + clsDiv + '"></div><b class="' + clsB + '"></b></td></tr></table>';
  
  return sRes; 
};

this.TabSpeed = function()
{
  return this.TabSpeedTable() + this.TabSpeedHead() + this.TabSpeedHead2() + this.TabSpeedBody() + this.TabSpeedUntable();
};

this.FillResSpeedSpan = function() { document.getElementById('IDResSpeedTable').innerHTML = this.TabSpeed(); };

this.ShowResSpeedSpan = function(b, bCanShow) 
{ 
  var obj = document.getElementById('IDResSpeedTable');
  
  if(bCanShow == false)
  {
     obj.style.display = "none";
     return;
  } 

  if(b)  
    obj.style.display = "";
	else
	  obj.style.display = "none"; 
};
//

this.FormRatingTableRows = function()
{
  var retS = "";
  for(var i = 0; i < this.nPageUsers; i++)
    retS += this.GetRatingTableRow(i);
    
  return retS;
};

this.ShowToday = function(bShow)
{
  if(bShow)
    document.getElementById('IDResultToday').style.display = "";
  else
    document.getElementById('IDResultToday').style.display = "none";
};

this.ShowRepeat = function(bShow)
{
  if(bShow)
    document.getElementById('IDResultRepeat').style.display = "";
  else
    document.getElementById('IDResultRepeat').style.display = "none";  
};

this.SetRepeatSpan = function(html_)
{
  document.getElementById('IDResultRepeat').innerHTML = html_;
};

this.ScreenResFragment2 = function()
{
  if(window.navigator.appName == "Microsoft Internet Explorer"  ||  BScreenResolutionLowRegime == false)
  {
    return  '<TR>' +
'		<TD COLSPAN=4 valign="middle">' +
'<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td VALIGN="middle" ALIGN="center">' +
'			<FONT FACE="Georgia"><I><span style="font-size: 20pt; color: #5FAC20" id="IDResultHeader">Поздравляю!</span></I></FONT></td>' +
'<td align="right" width="91px">' + CloseRedoObjRes.Generate() + '</td></tr></table></TD>' +
'	</TR>';
  }
  else
  {
    return '<TR>' +
'		<TD COLSPAN=4 valign="middle">' +
'<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td VALIGN="middle" ALIGN="center">' +
'			<FONT FACE="Georgia"><FONT SIZE=6><I><span style="font-size: 20pt; color: #5FAC20" id="IDResultHeader">Поздравляю!</span></I></FONT></td>' +
'<td align="right" width="91px">' + CloseRedoObjRes.Generate() + '</td></tr></table></TD>' +
'	</TR>'; 
  }
};
this.SetResultMessageHeight = function(val)
{
  var obj = document.getElementById('resultMessage');
  if(obj != null)
    obj.style.height = val;
  this.ResultMessageHeight = val;
};
this.GetResultMessageHeight = function()
{
  return this.ResultMessageHeight;
};

this.SetResultPageContinueRef = function(caption)
{
  document.getElementById('IDResultPageContinueRef').innerHTML = caption;
};

this.ShowResBottomCaptions = function(bVal)
{
  var o = document.getElementById('IDResBottomCaptions');
  
  if(bVal)
    o.style.visibility = "visible";
  else
    o.style.visibility = "hidden";
    
  if(ResultInfo.RefToLast != "" && Environment.IsOnline())
  {
    ResultPage.ShowRefToLast(true);     
  }
  else
    ResultPage.ShowRefToLast(false);
};

this.ExTable = {
	Show: function()
	{
		document.getElementById('IDResExTable').style.display = "";
	},
	Hide: function()
	{
		document.getElementById('IDResExTable').style.display = "none";
	}
};

this.Tables = {
		Today: function()
		{
	return '		<span id="IDResultToday"><table style="width: 231px; table-layout: fixed; margin-top: 5px;" border="0" cellpadding="0" cellspacing="0">' +
	'		<tr height="18">' +
	'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_0.png)" width="4"/>' +
	'			<td width="64" style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_1.png) no-repeat"/>' +
	'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_2.png) repeat-x"/>' +
	'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_4.png)" width="4"/>' +
	'		</tr><tr>' +
	'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_5.png)"/>' +
	'			<td colspan="2">' +
	'				<table border="0" width="100%">' +
	'        <tr><td width="64" align="left">' +
	'				<span class="classSmallGrayPanelFont"><nobr>Пройдено заданий</nobr></span>' +
	'				</td><td  align="right">' +
	'				<div id="resultSpeed"><table><tr><td><b class="classBlueB"></b>' +
	'            <div display="inline" class="classBlueDiv"><FONT Size=2><span id="resultPanelExercisesPassed">121</span></FONT></div>' +
	'            <b class="classBlueB"></b></td></tr></table></div>' +
	'			</td></tr>' +
	'			  <tr><td width="64" align="left">' +
	'				<span class="classSmallGrayPanelFont"><nobr>Средняя скорость</nobr></span>' +
	'				</td><td  align="right">' +
	'				<div id="resultSpeed"><table><tr><td><b class="classGreenB"></b>' +
	'            <div display="inline" class="classGreenDiv"><FONT Size=2><span id="resultPanelAvarageSpeed">121</span></FONT></div>' +
	'            <b class="classGreenB"></b></td></tr></table></div>' +
	'			</td></tr>' + 
	'			<tr><td width="64" align="left">' +
	'				<span class="classSmallGrayPanelFont"><nobr>Всего набрано</nobr></span>' +
	'				</td><td  align="right">' +
	'				<div id="resultSpeed"><table><tr><td><b class="classBlueB"></b>' +
	'            <div display="inline" class="classBlueDiv"><FONT Size=2><span id="resultPanelTextTyped">121</span></FONT></div>' +
	'            <b class="classBlueB"></b></td></tr></table></div>' +
	'			</td></tr>' +
	'			<tr><td width="64" align="left">' +
	'				<span class="classSmallGrayPanelFont"><nobr>Всего ошибок</nobr></span>' +
	'				</td><td align="right">' +
	'				<div id="resultSpeed"><table><tr><td><b class="classRedB"></b>' +
	'            <div display="inline" class="classRedDiv"><FONT Size=2><span id="resultTotalNumOfErrors">121</span></FONT></div>' +
	'            <b class="classRedB"></b></td></tr></table></div>' +
	'			</td></tr>' +
	'      </table>' +
	'	  	</td>' +
	'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_9.png)"/>' +
	'		</tr><tr height="4">' +
	'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_15.png)"/>' +
	'			<td colspan="2" style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_17.png)"/>' +
	'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/TodayField/today_19.png)"/>' +
	'		</tr></table></span> ';	
		}
};

this.elements = {
  showRowResSpeedTable: function(bShow)
  {
    var show = "";
    if(bShow == false)
      show = "none";
      
    document.getElementById("IDTrResSpeedTable").style.display = show;
  }
};

this.resultActions = {
  getOverviewCaption: function()
  {
    if(GetExType() == 32)
      return "К&nbsp;обучению";
    else
      return "К&nbsp;списку&nbsp;уроков"
  },
  getOverviewReference: function()
  {
    if(GetExType() == 32)
      return "document.location.href = '/study/';";
    else
      return "document.location.href = '/study/" + commonInfo.CourseID + "/#" + ExerciseInfo.LessonNumber + "';";
  }
  
};

this.GetContent = function()
{ 

  

  return '<TABLE WIDTH=900 BORDER="0" CELLPADDING=4 CELLSPACING=0  style="cursor: default;" id="IDMainResultTable">' +
'	<COL WIDTH=73*>' +
'	<COL WIDTH=73*>' +
'	<COL WIDTH=37*>' +
'	<COL WIDTH=73*>' +
this.ScreenResFragment2() +
'	<TR>' +
'<td colspan="4">'+
'<table border="0"><tr><td style="width:330px; height: 222px; vertical-align: top; background: url(' +  Environment.getResourceDirectory() + 'img/Result/frame.PNG) top left no-repeat"><img id="IDResultImg" style="position: relative; left: 9px; top: 9px; width: 297px; height: 202px" src="' + Environment.getResourceDirectory() + 'img/Result/201.jpg"></td><td style="vertical-align: top">' +
'<FONT COLOR="#333333">' + 
this.ResultMessageEmptyField.HTMLPreResultMessageField() +
'<div id="resultMessage" class="ClassResultText"></div></FONT>' +
this.ResultMessageEmptyField.HTMLPostResultMessageField() +
'</td></tr></table></td>' +
'	</TR>' +
'	<TR id="IDTrResSpeedTable" height="30px">' +
'  <td colspan="4"><span id="IDResSpeedTable"></span>' +
'<span id="IDResExTable"><table style="margin-top: 10px" width="100%" height="100%" cellpadding="0px" cellspacing="0px" border="0px"> <tr valign="bottom"> <td width="29%"></td><TD WIDTH=29% align="left" valign="bottom">' +
'			<FONT COLOR="#5FAC20"><FONT FACE="Georgia"><FONT SIZE="5"><I><nobr><span id="IDStrTaskRating">Рейтинг по заданию</span>&nbsp;<span id="IDTaskNumber"></span></nobr></I></FONT></FONT></FONT></TD>' +
'		<TD COLSPAN=2 WIDTH=43% align="right" valign="middle">' +
'			<span id="IDResLsnSel" class="FntSlctor"></span></TD> </tr> </table> </span> </td>' +
'	</TR>' +
'	<TR>' +
'		<TD WIDTH=29% valign="top">' +
'		<table id="IDResultPanel" style="width: 231px; table-layout: fixed; margin-top: 5px;" border="0" cellpadding="0" cellspacing="0">' +
'		<tr height="18">' +
'			<td background="' + Environment.getResourceDirectory() + 'img/ResultField/result_0.png" width="4"/>' +
'			<td width="64" style="background: url(' + Environment.getResourceDirectory() + 'img/ResultField/result_1.png) no-repeat"/>' +
'			<td style="background: url(' + Environment.getResourceDirectory() + 'img/ResultField/result_2.png) repeat-x"/>' +
'			<td background="' + Environment.getResourceDirectory() + 'img/ResultField/result_4.png" width="4"/>' +
'		</tr><tr id="IDResultPanelSpeed">' +
'			<td background="' + Environment.getResourceDirectory() + 'img/ResultField/result_5.png"/>' +
'			<td colspan="2">' +
'				<table width="100%">' +
        '<tr><td width="64">' +
'				<span class="classSmallGrayPanelFont">Скорость</span>' +
'				</td><td align="right">' +
'				<div id="resultSpeed"><table><tr><td><b class="classGreenB"></b>' +
'            <div display="inline" class="classGreenDiv"><FONT Size=2><span id="resultPanelSpeed">000</span></FONT></div>' +
'            <b class="classGreenB"></b></td></tr></table></div>' +
'			</td></tr>' +
        '<tr><td width="64">' +
'				<span class="classSmallGrayPanelFont">Затрачено&nbsp;времени</span>' +
'				</td><td align="right">' +
'				<div id="resultTimeElapsed"><table><tr><td><b class="classBlueB"></b>' +
'            <div display="inline" class="classBlueDiv"><FONT Size=2><span id="IDResultTimeElapsed">&nbsp;</span></FONT></div>' +
'            <b class="classBlueB"></b></td></tr></table></div>' +
'			</td></tr>' +
'      <tr id="IDResultPanelErrors"><td width="64">' +
'				<span class="classSmallGrayPanelFont">Ошибок</span>' +
'				</td><td align="right">' +
'				<div id="resultNumOfMistakes"><table><tr><td><b class="classRedB"></b>' +
'            <div display="inline" class="classRedDiv"><FONT Size=2><span id="resultPanelNumOfErrors">121</span></FONT></div>' +
'            <b class="classRedB"></b></td></tr></table></div>' +
'			</td></tr>' +
'			<tr id="IDResultPanelRating"><td width="64" align="left">' +
'				<span class="classSmallGrayPanelFont">Рейтинг</span>' +
'				</td><td  align="right">' +
'				<div id="resultRating"><table><tr><td><b class="classBlueB"></b>' +
'            <div display="inline" class="classBlueDiv"><FONT Size=2><span id="resultPanelRating">121</span></FONT></div>' +
'            <b class="classBlueB"></b></td></tr></table></div>' +
'			</td></tr>' +
'      </table>' +
'	  	</td>' +
'			<td background="' + Environment.getResourceDirectory() + 'img/ResultField/result_9.png"/>' +
'		</tr><tr height="4">' +
'			<td background="' + Environment.getResourceDirectory() + 'img/ResultField/result_15.png"/>' +
'			<td colspan="2" background="' + Environment.getResourceDirectory() + 'img/ResultField/result_17.png"/>' +
'			<td background="' + Environment.getResourceDirectory() + 'img/ResultField/result_19.png"/>' +
'		</tr></table> ' +
'    ' +
'		</TD>' +
'		<TD id="IDUserTableTd" ROWSPAN=2 COLSPAN=3 WIDTH=71% align="center" style="vertical-align: bottom">' +
'<span id="IDRatingTableSpan">' +
'			<TABLE WIDTH="100%" HEIGTH="100%" BORDER=0 CELLPADDING=1 CELLSPACING=0 id="IDRatingTable">' +
'				<TR VALIGN=TOP height="25px">' +
'<TD WIDTH=22% align="center">' +
'						<FONT SIZE=4><span id="resultUserTablePosition" style="cursor: pointer">Позиция</span></FONT></p>' + 
'</TD>' +
'<TD WIDTH=42% align="center">' +
'<FONT SIZE=4><span id="resultUserTableTyper">Солист</span></FONT></p>' +
'</TD>' +
'<TD WIDTH=12% align="center">' +
'						<FONT SIZE=4><span id="resultUserTableSpeed" onclick="ClickResultUserTableSpeed();" style="cursor: pointer"><FONT class="resultUserTableHeadDashed">Скорость</FONT></span></FONT></p>' +
'</TD>' +
'<TD WIDTH=12% align="center">' +
'						<FONT SIZE=4><span id="resultUserTableNumOfErrors" onclick="ClickResultUserNumOfErrors();" style="cursor: pointer"><FONT class="resultUserTableHeadDashed">Ошибок</FONT></span></FONT></p>'+
'</TD>' +
'<TD WIDTH=12% align="center">' +
'						<FONT SIZE=4><span id="resultUserTableRating" onclick="ClickResultUserTableRating();" style="cursor: pointer"><FONT class="resultUserTableHeadDashed">Рейтинг</FONT></span></FONT></p>' +
'</TD>' +
'				</TR>' + this.FormRatingTableRows() +
'</TABLE></span>' +
'<img style="margin: 50px" id="IDResultMiksanatik" src="' + Environment.getResourceDirectory() + 'img/Miksanatik/bigMainMiksanatik.PNG">' +
'<span id="IDResBottomCaptions" style="visibility: hidden"><table width="100%" height="30px" cellpadding="0" cellspacing="0" border="0"><tr>'+
'<td align="left" valign="bottom"><span style="visibility: hidden" id="IDRefToLast" class="ResultPageBotCaptRed"></span></td>'+
'<td align="right" valign="bottom" width="33%"><span id="IDResPGoToLessonList" class="ResultPageBotCaptBlue"><a onclick="' + this.resultActions.getOverviewReference() + '"><nobr>' + this.resultActions.getOverviewCaption() + '</nobr></a></span></td>'+
'<td align="right" valign="bottom" width="33%"><span id="IDResPContinue" class="ResultPageBotCaptGreen"><a id="IDResultPageContinueRef" onclick="CloseOrGoToPage()"></a></span>'+
'</tr></table></span>' +
'		</TD>' +
'	</TR>' +
'	<TR VALIGN=top>' +
'		<TD WIDTH=29%>' + this.Tables.Today() +
'		</TD>' +
'	</TR>' +
'	<TR id="IDSpeedTestRegisterEnterTr" VALIGN="bottom">' +
'		<TD colspan="4" align="left">' +
'<span id="IDSpeedTestRegisterLabel"><p><span class="SpeedTestRegisterLabel"><a href="/profile/">Зарегистрируйтесь</a> в виртуальной школе &laquo;Соло на клавиатуре&raquo;.</span></p>'+
'<p><span class="SpeedTestEnterLabel">Если Вы уже зарегистрированы, <a href="/">войдите.</a></span></p></span></TD></TR>';
};
  
}
