


//
// GESTIONE POSIZIONAMENTO DEL MOUSE
//

var posX = 0;
var posY = 0;

function setPos () {
 posX = 0;
 posY = 0;

 if (!e)
  var e = window.event

 if (e.pageX || e.pageY) {
  posX = e.pageX
  posY = e.pageY
 }

 else if (e.clientX || e.clientY) {
  posX = e.clientX + document.body.scrollLeft
  posY = e.clientY + document.body.scrollTop
 }

 return
}

document.onmousemove = setPos;





//
// VISUALIZZAZIONE DI MENU' VOLANTI
//

var popShow = new Array (false, false, false);

function popup (who) {
 popText0.style.visibility = "hidden";
 popText1.style.visibility = "hidden";
 popText2.style.visibility = "hidden";
 
 topbutton0.style.visibility = "visible";
 topbutton1.style.visibility = "visible";
 topbutton2.style.visibility = "visible";
 

 if (!popShow[who]) {
  if (( who == 0 ) || ( who == 1 ))
  {
    eval("popText"+who+".style.left = posX + 10");
    eval("popText"+who+".style.top = -38");
  }
  else
  {
    eval("popText"+who+".style.left = posX + 10");
    eval("popText"+who+".style.top = -38");
  }
  eval("popText"+who+".style.visibility = \"visible\"");

  for(var count in popShow)
   popShow[count] = false;

  popShow[who] = true;
  eval("topbutton"+who+".style.visibility='hidden'");
 }
 else
  popShow[who] = false;

 return;
}


//
// VARIE FUNZIONI
//

function changeNick ()
{
  newnick = prompt ("Inserisci il tuo nuovo nick:","");
  document.JAVirc.send( '/nick ' + newnick );
  return;
}

function joinChan ()
{
  newchan = prompt ("Inserisci il nome del canale:","");
  document.JAVirc.send( '/join ' + newchan );
  return;
}

function joinChan ()
{
  newchan = prompt ("Inserisci il nome del canale:","");
  document.JAVirc.send( '/join ' + newchan );
  return;
}

function idNick ()
{
  nickp = prompt ("Inserisci la password per il nick in uso:","");
  document.JAVirc.send( '/msg nickserv identify ' + nickp );
  return;
}

function fontSansSerif() {
  document.JAVirc.send("/FontFamily SansSerif");
  return;
}

function fontSerif() {
  document.JAVirc.send("/FontFamily Serif");
  return;
}

function fontCursive() {
  document.JAVirc.send("/FontFamily Cursive");
  return;
}

function fontMonospaced() {
  document.JAVirc.send("/FontFamily Monospaced");
  return;
}

function fontPlus() {
  document.JAVirc.send("/font +");
  return;
}

function fontLess() {
  document.JAVirc.send("/font -");
  return;
}

function switchAudio( lever ) {
  if ( lever == 0 )
  {
    document.JAVirc.send("/sound off");
  }
  else
  {
    document.JAVirc.send("/sound on");
  }
  return;
}
