var ie4 = (document.all);
var NS4 = (document.layers);
var ns6 = (!document.all && document.getElementById);
var update_session_check = 0;

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImageWithoutRestore() {
  var i,j=0,x,a=MM_swapImageWithoutRestore.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=null; x.src=a[i+2];x.width = 1;x.height = 1;}
}


function MM_swapImagePrint() { //v3.0
  var i,j=0,x,a=MM_swapImagePrint.arguments; if(!document.MM_print)document.MM_print=new Array;else j = document.MM_print.length; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_print[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestorePrint() { //v3.0
  var i,x,a=document.MM_print; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function addItemToPrint(ownid)
{
  var s1 = new String();
  var s2 = new String();

  s1=document.search.print_items.value;
  s2=s1.match(ownid);
  if (s2 != null)
  {
    eval("MM_swapImagePrint('Image_print_"+ownid+"','','../images/content/body/c_note_print.gif',1)");
    s1 = s1.replace(s2,"");
  }
  else
  {
    eval("MM_swapImagePrint('Image_print_"+ownid+"','','../images/content/body/c_note_print_.gif',1)");
    s1 += '!';
    s1 += ownid;
  }
  document.search.print_items.value = s1;

}



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

//zsolesz
// az editorban a tablazat hatterkepet cserelo script
function ChangeBgImg(imgs,idd) {
bdy = document.getElementsByTagName("td");
var j =  bdy.length;
for(var i=0; i < j; i++)
{
  if (bdy[i].id == idd)
    bdy[i].style.backgroundImage = 'url('+imgs+')';
}
}


// zsolesz
// trim a string. remove from the string the begining and the lasting spaces
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " " || ch == "\n") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " " || ch == "\n") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function


// simulation popup
function popup_simulation(file_name,x,y,p1,p2,fs){
// mekkora lesz a flash az ablakban
var xx = 0;
var yy = 0;
// mekkora ablakot nyit ha fs <> 1
var xxx = 0;
var yyy = 0;

if (fs == 1)
{
  popupwin = window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=0,left=0,width=0,height=0,fullscreen=yes');
  popupwin.resizeBy(19,0);
  xx = (screen.width - 15 ) * p1 / 100;
  yy = xx * y / x * p2 / 100;
}
else
{
  if (p1 != 0 && p2 != 0)
  {
    xx = (screen.width - 24 ) * p1 / 100;
    yy = xx * y / x * p2 / 100;
  }
  else
  {
    xx = x;
    yy = y;
  }
  xxx = xx;
  yyy = yy;
  xxx += 24;
  yyy += 57;
  if (screen.width < xxx) xxx = screen.width;
  if (screen.height-28 < yyy) yyy = screen.height-28;
  popupwin = window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=0,left=0,width=0,height=0');
  popupwin.resizeTo(xxx,yyy);
}
popupwin.focus();
//popupwin.location="simulation.php4?xx="+xx+"&yy="+yy+"&filename="+file_name;
popupwin.document.write("<html>");
popupwin.document.write("<head><title>COEDU // SZIMULÁCIÓ</title></head>");
popupwin.document.write("<body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0' bgcolor='#D7E18E'>");
popupwin.document.write("<table border='0' cellspacing='0' cellpadding='0' width='100%'><tr bgcolor='#B3C148'><td align='right'><a href='javascript:self.close()'><img src='../images/content/body/p_quit.gif' width='49' height='14' align='absmiddle' hspace='2' vspace='1' border='0'/></a></td></tr></table>");
popupwin.document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr bgcolor='7C7596'><td><img src='../images/content/body/sp.gif' width='1' height='1'/></td></tr></table>");
popupwin.document.write("<table width='100%' border='0' cellspacing='0' cellpadding='6'><tr><td bgcolor='E8E7E8'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td bgcolor='#D7E18E' align='center'>");
popupwin.document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+x+"' height='"+y+"'>");
popupwin.document.write("<param name=movie value='");
popupwin.document.write(file_name);
popupwin.document.write("'>");
popupwin.document.write("<param name='quality' value=high>");
popupwin.document.write("<param name='salign' value=LB>");
popupwin.document.write("<param name='PLAY' value=true>");
popupwin.document.write("<param name='LOOP' value='false'>");
popupwin.document.write("<embed src='");
popupwin.document.write(file_name);
popupwin.document.write("' quality=high salign=LB bgcolor=#435FB8 type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'  width='"+x+"' height='"+y+"' loop='false' play='true'>");
popupwin.document.write("</embed>");
popupwin.document.write("</object>");
popupwin.document.write("</td></tr></table></td></tr></table>");
popupwin.document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr bgcolor='7C7596'><td><img src='../images/content/body/sp.gif' width='1' height='1'/></td></tr></table>");
popupwin.document.write("</BODY></HTML>");
}






// print

function print_lesson(uid)
{
  var p = document.search.print_items.value;
  eval("openPrint('print.php4?print_items="+p+"',"+uid+");");
  document.search.print_items.value = '';
}

// search
function search_course(uid)
{
  eval("openSearch('search.php4?command=course',"+uid+");");
}



//

// SEARCH
// Begin
var win = this;
var n   = 0;

function findInPage(str) {
  var txt, i, found;

  if (str == "")
    return false;

  if (NS4 || ns6) {
    alert(win.find(str, false, true));
    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;
    if (n == 0) alert(str + " "+"nem található az oldalon.");
  }

  if (ie4) {
    txt = win.document.body.createTextRange();
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart("character", 1);
      txt.moveEnd("textedit");
    }
    if (found) {
      txt.moveStart("character", -1);
      txt.findText(str);
//      alert(txt.scrollIntoView);
      txt.scrollIntoView(true);
      txt.select();
//      hideStatusbar();
      n++;
    }
    else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }
      else
        alert(str + " "+"nem található az oldalon.");
    }
  }
  return false;
}
//  End


// a nagyitos kep
function popupzoom_xy(picture_file,picture_name,x,y) {
x+=32;
y+=32;
if (screen.width < x) x = screen.width;
if (screen.height-25 < y) y = screen.height-25;

popupwin = window.open('','image','resizable=no,scrollbars=1,toolbar=no,location=no,directories=no,status=no,menubar=no,top=0,left=0,width=1,height=1');
popupwin.resizeTo(x,y);
popupwin.focus();
popupwin.document.open("text/html");
popupwin.document.clear();
popupwin.document.write("<HTML><HEAD>");
popupwin.document.write("<TITLE>COEDU // ");
popupwin.document.write(picture_name);
popupwin.document.write("</TITLE></HEAD><body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'>");
popupwin.document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center'>");
popupwin.document.write("<img src='");
popupwin.document.write(picture_file);
popupwin.document.write("'/>");
popupwin.document.write("</td></tr></table>");
popupwin.document.write("</BODY></HTML>");
popupwin.document.close();
}
//

// a sorbarendezos teszt gomjainak scriptjei
function option_move_up(sn)
{
  if (!sn.options.disabled)
  {
    if (sn.selectedIndex == -1) sn.selectedIndex = 0;
    var sz = sn.selectedIndex;
    if ( sz > 0)
    {
      var felso_text = sn.options[sz-1].text;
      var felso_value = sn.options[sz-1].value;
      sn.options[sz-1].text = sn.options[sz].text;
      sn.options[sz-1].value = sn.options[sz].value;
      sn.options[sz].text = felso_text;
      sn.options[sz].value = felso_value;
      sn.selectedIndex = sz-1;
    }
  }
}
function option_move_down(sn)
{
  if (!sn.options.disabled)
  {
    if (sn.selectedIndex == -1) sn.selectedIndex = sn.options.length-1;
    var sz = sn.selectedIndex;
    if ( sz < sn.options.length - 1)
    {
      var also_text = sn.options[sz+1].text;
      var also_value = sn.options[sz+1].value;
      sn.options[sz+1].text = sn.options[sz].text;
      sn.options[sz+1].value = sn.options[sz].value;
      sn.options[sz].text = also_text;
      sn.options[sz].value = also_value;
      sn.selectedIndex = sz+1;
    }
  }
}



// zoom
function changeZoom(zoomVal){
	var obj=MM_findObj('zoom');
	if(document.getElementById){obj.style.zoom = zoomVal+'%'}
}
//








function P7_hideDiv(evt) { //v1.3 by PVII
 var b,relT,mT=false;
 if(document.layers){b=evt.target;if(b.p7aHide){
  b.visibility="hidden";}else{routeEvent(evt);}
 }else if(document.all&&!window.opera){b=event.srcElement;
  while(b!=null){if(b.tagName=="DIV" && b.p7ahD){mT=true;break;}b=b.parentElement;}
  if(!b.contains(event.toElement)){b.style.visibility="hidden";}
 }else if(document.getElementById){b=evt.currentTarget;relT=evt.relatedTarget;
  while(relT!=null){if(b==relT){mT=true;break;}
  relT=relT.parentNode;}if(!mT){b.style.visibility="hidden";}}
}

function P7_Snap() { //v2.63 by PVII
 var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}

function P7_VScroller(el,dr,ty,oy,spd) { //v1.6 by PVII
 var g,gg,fr,sp,pa='',slw=true,m=false,h,ly;ty=parseInt(ty);
 if((g=MM_findObj(el))!=null){gg=(document.layers)?g:g.style;}else{return;}
 if(dr=="Stop"){if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}
 if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& !window.opera){pa="px";}
 if(navigator.userAgent.indexOf("NT")>-1 || navigator.userAgent.indexOf("Windows 2000")>-1){slw=false;}
 if(spd=="Slow"){sp=(slw)?2:1;fr=(slw)?40:30;}else if(spd=="Medium"){sp=(slw)?4:1;fr=(slw)?40:10;
 }else{sp=(slw)?8:4;fr=(slw)?40:10;}if(spd=="Warp"){sp=5000;}var yy=parseInt(gg.top);if(isNaN(yy)){
 if(g.currentStyle){yy=parseInt(g.currentStyle.top);}else if(document.defaultView){
 yy=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("top"));}else{yy=0;}}
 if(document.all || document.getElementById){h=parseInt(g.offsetHeight);
 if(!h){h=parseInt(g.style.pixelHeight);}
 }else if(document.layers){h=parseInt(g.clip.height);}ly=ty+parseInt(oy)-h;
 if(dr=="Down"){if(yy>ly){m=true;yy-=sp;if(yy<ly){yy=ly;}}}
 if(dr=="Up"){if(yy<ty){m=true;yy+=sp;if(yy>ty){yy=ty;}}}
 if(dr=="Reset"){gg.top=ty+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}
 if(m){gg.top=yy+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=true;
  eval("g.p7Magic=setTimeout(\"P7_VScroller('"+el+"','"+dr+"',"+ty+","+oy+",'"+spd+"')\","+fr+")");
 }else{g.toMove=false;}
}


function P7_autoHide() { //v1.3 by PVII
 var i,g,args=P7_autoHide.arguments;
 for(i=0;i<args.length;i++){if((g=MM_findObj(args[i]))!=null){
  g.p7aHide=true;if(document.layers){
  g.captureEvents(Event.MOUSEOUT);}g.onmouseout=P7_hideDiv;g.p7ahD=true;}}
}

function P7_autoLayers() { //v1.5 by refi
  var g,b,k,f,args=P7_autoLayers.arguments;a=parseInt(args[0]);if(isNaN(a))a=0;if(!document.p7setc){
  p7c=new Array();document.p7setc=true;for(var u=0;u<10;u++){
  p7c[u]=new Array();}}for(k=1;k<args.length;k++){
  if((g=MM_findObj(args[k]))!=null){
  b=(document.layers)?g:g.style;b.visibility="visible";f=false;for(var j=0;j<p7c[a].length;j++){
  if(args[k]==p7c[a][j]){f=true;}}if(!f){p7c[a][p7c[a].length++]=args[k];}}}
}

function P7_autoLayersR() { //v1.4 by PVII
 var g,b,k,f,args=P7_autoLayers.arguments;a=parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc){p7c=new Array();document.p7setc=true;for(var u=0;u<10;u++){
 p7c[u]=new Array();}}for(k=0;k<p7c[a].length;k++){if((g=MM_findObj(p7c[a][k]))!=null){
 b=(document.layers)?g:g.style;b.visibility="hidden";}}for(k=1;k<args.length;k++){
 if((g=MM_findObj(args[k]))!=null){b=(document.layers)?g:g.style;b.visibility="visible";f=false;
 for(var j=0;j<p7c[a].length;j++){if(args[k]==p7c[a][j]) {f=true;}}
 if(!f){p7c[a][p7c[a].length++]=args[k];}}}
}




function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function resetTextField()
{
  var args = resetTextField.arguments;
  for(var j=0;j<(args.length);j++)
  {
  	if((x = MM_findObj(args[j])) != null) x.value = "";
  }
	return;
}

function setOwnId(id){
	if((x = MM_findObj('ownid')) != null)
		x.value = id;
	return;
}

function addNoticeSubmit()
{
	if((x = MM_findObj('notice_desc')) != null)
  {
  	  x.value = x.value.replace('"','&quot;');
      x.value = x.value.replace('\\','\\\\');
  	  x.value = x.value.replace('\'','\\\'');
  }
	if((y = MM_findObj('addBNform')) != null ) {
    if(y.notice_desc.value != "")
    {
      y.command.value = "addnotice";
  		y.submit();
    }
	}
	return;
}

function addBookmarkSubmit()
{
	if((x = MM_findObj('bookmark_title')) != null && (x1 = MM_findObj('bookmark_desc')) != null)
  {
      if (x.value == "")
      {
        var s = x1.value;
        var pos = 0;
        pos = s.indexOf("\n");
        if (pos != -1)
          s = s.substr(0,pos);

        x.value = s;
      }

      var re1 = new RegExp('"', 'gi');
      var re2 = new RegExp('\'', 'gi');
  	  x.value = x.value.replace(re1,'&quot;');
  	  x.value = x.value.replace(re2,'\\\'');
  	  x1.value = x1.value.replace(re1,'&quot;');
  	  x1.value = x1.value.replace(re2,'\\\'');
  }
	if((y = MM_findObj('addBNform')) != null) {
    if(y.bookmark_title.value != "")
    {
      y.command.value = "addbookmark";
  		y.submit();
    }
	}


}


function addNoticeTextOwn(text)
{
	if((x = MM_findObj('shownoticetextown')) != null)
	{
		x.innerHTML = text;
  }

	return;
}

function addNoticeTextTut(text)
{
	if((x = MM_findObj('shownoticetexttut')) != null)
	{
		x.innerHTML = text;
  }

	return;
}

function truncText(c)
{
	var str = "";
	if (c < 1) return;

	x = MM_findObj('notice');

	str = x.value;
	if(str.length > c)
	{
		str = str.substr(0,c-1);
		x.value = str;
	}
	return;
}

function getStyleObject(objectId){
  if(document.getElementById && document.getElementById(objectId))
	  return document.getElementById(objectId).style;
  else if (document.all && document.all(objectId))
	  return document.all(objectId).style;
  else if (document.layers && document.layers[objectId])
	  return document.layers[objectId];
  else return false;
}

function changeVis(objectId, newVisibility){
  var styleObject = getStyleObject(objectId);
  if(styleObject) styleObject.visibility = newVisibility;
}


function hideStatusbar(){
  changeVis("statusbar", "hidden");changeVis("toolbar", "hidden");
  changeVis("menu1", "hidden");changeVis("menu2", "hidden");
  changeVis("menu3", "hidden");changeVis("menu4", "hidden");
}


function setStatusbarPos(){
  update_session_check = 1;
  changeVis("statusbar", "hidden");changeVis("toolbar", "hidden");
  changeVis("menu1", "hidden");changeVis("menu2", "hidden");
  changeVis("menu3", "hidden");changeVis("menu4", "hidden");

  if(ie4)
  {
    this.scrollTop	= document.body.scrollTop;
    statusbar.style.pixelTop = this.scrollTop;
    toolbar.style.pixelTop   = this.scrollTop + 22;
    menu1.style.pixelTop      = this.scrollTop + 22;
    menu2.style.pixelTop      = this.scrollTop + 22;
    menu3.style.pixelTop      = this.scrollTop + 22;
    menu4.style.pixelTop      = this.scrollTop + 22;
  }
  if(ns6)
  {
    this.scrollTop	= scrollY;
    document.getElementById('statusbar').style.top = this.scrollTop + "px"
    this.scrollTop	= scrollY + 22;
    document.getElementById('toolbar').style.top = this.scrollTop + "px"
    document.getElementById('menu1').style.top   = this.scrollTop + "px"
    document.getElementById('menu2').style.top   = this.scrollTop + "px"
    document.getElementById('menu3').style.top   = this.scrollTop + "px"
    document.getElementById('menu4').style.top   = this.scrollTop + "px"
  }
  this.fade = 22;
  setTimeout("fadeIn()",1000);
}

var fade = 0;

function fadeIn()
{
  if(fade != 0)
  {
    changeVis('statusbar', 'visible')
    fade--;
    setStatusbarFadePos(fade);
    setTimeout("fadeIn()",100);
  }
}

function setStatusbarFadePos(pos){

  if(ie4)
  {
    this.scrollTop	= document.body.scrollTop;
    statusbar.style.pixelTop = this.scrollTop - pos;
    toolbar.style.pixelTop   = this.scrollTop + 22 - pos;
    menu1.style.pixelTop      = this.scrollTop + 22 - pos;
    menu2.style.pixelTop      = this.scrollTop + 22 - pos;
    menu3.style.pixelTop      = this.scrollTop + 22 - pos;
    menu4.style.pixelTop      = this.scrollTop + 22 - pos;
  }
  if(ns6)
  {
    this.scrollTop	= scrollY - pos;
    document.getElementById('statusbar').style.top = this.scrollTop + "px"
    this.scrollTop	= scrollY + 22 - pos;
    document.getElementById('toolbar').style.top = this.scrollTop + "px"
    document.getElementById('menu1').style.top   = this.scrollTop + "px"
    document.getElementById('menu2').style.top   = this.scrollTop + "px"
    document.getElementById('menu3').style.top   = this.scrollTop + "px"
    document.getElementById('menu4').style.top   = this.scrollTop + "px"
  }

}


function hideAllMenu(){
  changeVis("menu1", "hidden");changeVis("menu2", "hidden");
  changeVis("menu3", "hidden");changeVis("menu4", "hidden");
}

function initScroll(uid){
  if(ns6) scrollDetect(setStatusbarPos,uid);
}



// update course session functions
function updateSession()
{
  if(update_session_check == 1)
  {
    runInBack('update_course_session.php4','update_session')  ;
    update_session_check = 0;
  }
}



function initUpdateSession(repeat_time)
{
  repeat_time = repeat_time*1000;

  clearInterval(_update_session);
  var _update_session = setInterval("updateSession()",repeat_time);
}



function on_load(u_id, update_time, fontsize){
  initScroll(u_id);
  initUpdateSession(update_time);
  initBodyFontSize(fontsize);
  P7_autoHide('menu1','menu2','menu3','menu4');
  MM_preloadImages('../images/content/body/p_note_1.gif','../images/content/body/p_note_2.gif','../images/content/body/p_note_2b.gif','../images/content/body/p_note_3.gif','../images/content/body/p_note_4.gif','../images/content/body/p_note_5.gif','../images/content/body/p_note_5b.gif','../images/content/body/p_note_5c.gif','../images/content/body/p_note_5d.gif');
  MM_preloadImages('../images/content/body/button1.gif','../images/content/body/button2.gif','../images/content/body/button3.gif','../images/content/body/c_note_print_.gif','../images/content/body/c_note_print.gif');
  MM_preloadImages('../images/content/body/p_note_1.gif','../images/content/body/p_note_2.gif','../images/content/body/p_note_3.gif','../images/content/body/p_note_4.gif','../images/content/body/p_note_5.gif');
  MM_preloadImages('../images/content/body/bubb_note_tutor2.gif','../images/content/body/bubb_note_own2.gif');
  MM_preloadImages('../images/content/menu/status_gomb1_on.gif','../images/content/menu/status_gomb2_on.gif','../images/content/menu/status_gomb3_on.gif','../images/content/menu/status_gomb4_on.gif');
  MM_preloadImages('../images/content/menu/status_elejere_on.gif','../images/content/menu/status_vegere_on.gif','../images/content/menu/status_vissza_on.gif','../images/content/menu/status_tovabb_on.gif');
  MM_preloadImages('../images/content/menu/status_logo.gif','../images/content/menu/status_gomb1_on.gif','../images/content/menu/status_gomb1.gif','../images/content/menu/status_gomb2_on.gif','../images/content/menu/status_gomb2.gif','../images/content/menu/status_gomb3_on.gif','../images/content/menu/status_gomb3.gif','../images/content/menu/status_gomb4_on.gif','../images/content/menu/status_gomb4.gif','../images/content/menu/status_back.gif','../images/content/menu/link_p.gif','../images/content/menu/link.gif','../images/content/menu/status_indi1.gif','../images/content/menu/status_indi2.gif','../images/content/menu/status_indi3.gif','../images/content/menu/status_indi4.gif','../images/content/menu/status_elejere_on.gif','../images/content/menu/status_elejere.gif','../images/content/menu/status_vegere_on.gif','../images/content/menu/status_vegere.gif','../images/content/menu/status_vissza_on.gif','../images/content/menu/status_vissza.gif','../images/content/menu/status_tovabb_on.gif','../images/content/menu/status_tovabb.gif','../images/content/menu/sp.gif','../images/content/menu/toolbar_back.gif','../images/content/menu/toolbar_back.gif','../images/content/menu/t_search_on.gif','../images/content/menu/t_help_on.gif','../images/content/menu/t_hi_on.gif','../images/content/menu/t_hi.gif','../images/content/menu/t_print_on.gif','../images/content/menu/t_print.gif','../images/content/menu/t_search.gif','../images/content/menu/t_help.gif','../images/content/menu/t_print_on.gif','../images/content/menu/t_print.gif','../images/content/menu/t_search.gif','../images/content/menu/t_help.gif','../images/content/menu/t_tx_nezet.gif','../images/content/menu/t_kivonat_on.gif','../images/content/menu/t_kivonat.gif','../images/content/menu/t_kivonat_.gif','../images/content/menu/t_normal_on.gif','../images/content/menu/t_normal.gif','../images/content/menu/t_normal_.gif','../images/content/menu/t_bovitett_on.gif','../images/content/menu/t_bovitett.gif','../images/content/menu/t_bovitett_.gif','../images/content/menu/t_tx_nagyitas.gif','../images/content/menu/t_zoom_75_.gif','../images/content/menu/t_zoom_75_on.gif','../images/content/menu/t_zoom_75.gif','../images/content/menu/t_zoom_100_on.gif','../images/content/menu/t_zoom_100_.gif','../images/content/menu/t_zoom_100.gif','../images/content/menu/t_zoom_125_.gif','../images/content/menu/t_zoom_125_on.gif','../images/content/menu/t_zoom_125.gif','../images/content/menu/t_tx_jegyzet.gif','../images/content/menu/t_ki_.gif','../images/content/menu/t_ki_on.gif','../images/content/menu/t_ki.gif','../images/content/menu/t_be_.gif','../images/content/menu/t_be_on.gif','../images/content/menu/t_tx_kereses.gif','../images/content/menu/t_mehet_on.gif','../images/content/menu/t_mehet.gif','../images/content/menu/t_sep.gif','../images/content/menu/t_restart_on.gif','../images/content/menu/t_restart.gif','../images/content/menu/t_quit_on.gif','../images/content/menu/t_quit.gif','../images/content/menu/p_menu_1.gif','../images/content/menu/p_menu_2.gif','../images/content/menu/p_menu_3.gif','../images/content/menu/p_menu_4.gif','../images/content/menu/p_menu_5.gif','../images/content/menu/p_menu_6.gif','../images/content/menu/link.gif','../images/content/body/bubb_note_tutor1.gif','../images/content/body/bubb_note_tutor2.gif','../images/content/body/bubb_note_tutor3.gif','../images/content/body/bubb_note_own1.gif','../images/content/body/bubb_note_own2.gif','../images/content/body/bubb_note_own3.gif','../images/content/body/add_01.gif','../images/contenbody/add_bg.gif','../images/content/body/add_note_.gif','../images/content/body/add_bkmrk.gif','../images/content/body/add_note.gif','../images/content/body/add_bkmrk_.gif','../images/content/body/add_exit.gif','../images/content/body/add_bg.gif','../images/content/body/button1.gif','../images/content/body/button2.gif','../images/content/body/button3.gif','../images/content/body/down.gif','../images/content/body/button1.gif','../images/content/body/button2.gif');
}

var agt = navigator.userAgent.toLowerCase();

function scrollDetect(theFunction,uid)
{
  eval('var NameOfThisDetect = "wmainwindow_'+uid+'"');

  eval('window.' + NameOfThisDetect + ' = this;'); // window.RANDOMNAME = <this_Detect&gt;
  eval('this.name = "' + NameOfThisDetect + '";'); // <this_Detect>.name = "RANDOMNAME"

  this.changeFunction = theFunction;
  this.intervalTime = 1;   // milliseconds
  this.monitor = monitorScrolling;
  this.getWindowYOffset = getWindowYOffsetDetect;
  this.prevWindowYOffset = 0;
  var cmdstring = 'window.' + this.name + '.monitor()';
  this.interval = window.setInterval( cmdstring, this.intervalTime );
}

function getWindowYOffsetDetect()
{
  if ( window.pageYOffset || window.pageYOffset == 0 )    return window.pageYOffset;
  if ( document.body.scrollTop || document.body.scrollTop == 0 )
  {
    if ( document.documentElement.scrollTop || document.documentElement.scrollTop == 0 )
    {
      return document.body.scrollTop + document.documentElement.scrollTop;
    }
    else
      return document.body.scrollTop;
  }
}


function monitorScrolling()
{
  var newWinYOffset = getWindowYOffsetDetect();
  var Scrolled = (newWinYOffset != this.prevWindowYOffset);
  this.prevWindowYOffset = newWinYOffset;
  if (Scrolled)
    eval( 'this.changeFunction(' + newWinYOffset + ')' );
}

function showHideSelectBox(mode)
{
	if((x = MM_findObj('hideselect'))!= null)
	{
    if(mode == "show") x.style.display= 'inline';
    if(mode == "hide") x.style.display='none';
  }
}


// hatterben futtat a path-ban megadott php-t
// az alabbi kepet kell bezsurni az oldalra, es id parameterbe beadni a kep name attributumaba megadott nevet
//  <img name="nullgif" src="../images/admin/null.gif" width="0" height="0" border="0">
function runInBack(path,id)
{
  MM_swapImage(id,'',path,1);
}

//timer functions
function setTimeText(value)
{
  var b = "<b>";
  var e = "</b>";

  x = MM_findObj('timelayer');
  var t = value;
  var tm = (t-(t%60))/60;
  var ts = t%60;
  if(ts < 10) { ts = "0"+ts };

  x.innerHTML = b+tm+":"+ts+e;
}

function updateS()
{
  document.exf1.sec.value = (1+parseInt(document.exf1.sec.value));
  setTimeText(document.exf1.sec.value);
}

function startTimer(sec, savetime)
{
  savetime = savetime*1000;

  clearInterval(_myTimer_s);
  clearInterval(_mySaveTime);
  document.exf1.sec.value=sec;

  setTimeText(sec);

  var _mySaveTime = setInterval("runInBack('lesson_time_update.php4','nullgif')",savetime);
  var _myTimer_s  = setInterval("updateS()",1000);
}


function initBodyFontSize(s)
{
	document.body.style.fontSize = s;
}



function setBodyFontSizeLarger()
{
  var t = parseInt(document.body.style.fontSize);
  if(t == 25) return;
	document.body.style.fontSize = t+1+"px";
  runInBack('update_zoom.php4?command=plus','update_zoom');
}

function setBodyFontSizeSmaller()
{
  var t = parseInt(document.body.style.fontSize);
  if(t == 18) return;

	document.body.style.fontSize = t-1+"px";
  runInBack('update_zoom.php4?command=minus','update_zoom');
}

function initBodyFontSize(s)
{
  s += 20;
	document.body.style.fontSize = s+"px";
}

