﻿
var Visibl=-1;
var ex=0, ey=0;
var jau=false;

window.onerror="null";

var SoundWin="false";
var SoundWinName="snd";
var SoundWinIsOpen="false";

var geras="false";
var browser = "oldAndInTheWay";
var bName = navigator.appName;
var bVersion = parseInt(navigator.appVersion);

if ( bName=="Netscape" ) 
{ 
  browser="ns";
  if ( bVersion>=3 ) geras="true";
} 
else 
{
  if ( bName=="Microsoft Internet Explorer" )
  {
    browser="ie";
    if ( bVersion>=4 ) geras="true";
  }
}

function brVersion() 
{
  if ( bName=="Netscape" ) 
  { 
    browser="ns";
    if ( bVersion>=3 ) geras="true";
  } 
  else 
  {
    if ( bName=="Microsoft Internet Explorer" )
    {
      browser="ie";
      if ( bVersion>=4 ) geras="true";
    }
  }
}


function setupDivs() 
{
  divStyle = new Array( 
    document.getElementById('d0').style,document.getElementById('d1').style,document.getElementById('d2').style,
    document.getElementById('d3').style,document.getElementById('d4').style,document.getElementById('d5').style,
    document.getElementById('d6').style,document.getElementById('d7').style,document.getElementById('d8').style,
    document.getElementById('d9').style,document.getElementById('d10').style);

  jau=true;  
}

function displayDivision(i,evt) 
{
  if( jau==false ) return;  

  if( evt==null ) return;  
  if ( i==Visibl ) return;

  if (evt.pageX) ex=evt.pageX;
  else 
   if (evt.clientX)
    ex = evt.clientX + (document.documentElement.scrollLeft ?
      document.documentElement.scrollLeft : document.body.scrollLeft);
   else return null;

  ex = ex - 40;
  if ( ex<0 ) ex = 0; 
  
  ae = divStyle[i];         
  ae.left = ex + 'px';

//  if (evt.pageY) ey=evt.pageY;
//  else 
//   if (evt.clientY)
//    ey=evt.clientY + (document.documentElement.scrollTop ?
//      document.documentElement.scrollTop : document.body.scrollTop);
//   else return null;
//  ae.top = ey + 'px'; 

  if ( Visibl!=-1 )
    divStyle[Visibl].visibility = "hidden";

  divStyle[i].visibility = "visible";
  Visibl=i;
  
  //alert(ae.left + " " + ae.top + " " + ae.visibility);
}

function hideDivision() 
{
  if( jau==false ) return;  

  if ( Visibl!=-1 ) divStyle[Visibl].visibility = "hidden";
  Visibl=-1;
}


function Kalbek(WavFile,x,y,txt)
{ 
  CloseAllWindows();
  OpenSoundWin(WavFile,x,y,txt);
}

function OpenSoundWin(url,x,y,txt) 
{
    SoundWin=window.open("",SoundWinName,
      "resizable=no,scrollbars=no,menubar=no,width=232,height=44,left="+x+",top="+y); 

    SoundWin.document.open();

    SoundWin.document.write("<html><head><title>");
    SoundWin.document.write(txt);
    SoundWin.document.write("</title></head>");

    SoundWin.document.write("<body bgcolor='#dddddd'>");

    SoundWin.document.write("<center>");
    SoundWin.document.write("<embed src='"); 

    SoundWin.document.write(url);

    SoundWin.document.write("' autostart=");
    SoundWin.document.write("True ");

    SoundWin.document.write("WIDTH='230' HEIGHT='44' ");

    SoundWin.document.write("controls='console' ");
    SoundWin.document.write("hidden=");
    SoundWin.document.write("False>");
    SoundWin.document.write("</center>");

    SoundWin.document.write("</body></html>");
    SoundWin.document.close();

    if ( SoundWin!="false" )
    {    
      if ( SoundWin.closed ) {} else
      {
        SoundWinIsOpen="true";
        if ( SoundWin.focus ) SoundWin.focus();
      }
    }	
}

function CloseAllWindows() 
{
  if ( SoundWin!="false" ) CloseSoundWin(); 
}
function CloseSoundWin() 
{
  if ( SoundWin!=null && SoundWin.open ) SoundWin.close(); 
  SoundWin=null; 
}



function nocontextmenu() 
{
  if ( window.event ) 
    { event.cancelBubble = true, event.returnValue = false;  }

  return false;
} 

function norightclick(e) 
{
  var rightclick;

  if (!e) var e = window.event;

  if (e.which) rightclick = (e.which == 3);
	else if (e.button) rightclick = (e.button == 2);

  if ( rightclick )
  {
    if ( window.event ) 
      { event.cancelBubble = true, event.returnValue = false;  }

    return false;
  }
}

document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
document.onmouseup = norightclick;

window.onload = setupDivs;

