function SetEval() {
document.SpHtmlForm.string.value=eval(document.SpHtmlForm.string.value);
}
function SpStartPage()
{
    document.onkeyup = checkKeysIE;       
  		// Блокировка PopUp меню
  		document.body.oncontextmenu=function(e){
  		e = window.event; 
		document.SpHtmlForm.SpData.value  = 'CONTEXTMENU{'+String(e.x)+','+String(e.y)+'}';
  		document.title = document.title;
  		return false};

}
function SetSpData(codeblock){
  		document.SpHtmlForm.SpData.value  = codeblock;
  		document.title = document.title;
}
function SetStatus(id, name)
{             
 SetSpData('FEVAL("DocHtmlEditField",,,{"'+name+'",'+id+'})');
}

function checkKeysIE()
{
   var KeyID = event.keyCode;
   var status = 0;
   if (event.shiftKey)
      {status = status + 1};
   if (event.altKey)
      {status = status + 2};
   if (event.ctrlKey)
      {status = status + 4};
       document.SpHtmlForm.SpData.value  = 'KEYBOARD{'+String(KeyID)+','+String(status)+'}';
       document.title = document.title;
   KeyID = 0;
   switch(KeyID)
   { case 0:
     break; }
 }
function isScrolledIntoView(id)
{
    var elem = $("#"+id)[0];
    var docViewTop = $(window).scrollTop();
    var docViewBottom = docViewTop + $(window).height();

    var elemTop = $(elem).offset().top;
    var elemBottom = elemTop + $(elem).height();

    return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
