//  DATA CREAZIONE: 02-08-2006;
//  DATA MODIFICA: 07-09-2006;
//  VERSIONE: 2006.1.0;
//  AUTORE: Dott. Cristian Lanza;
//          rezalan@tiscali.it
//  LICENSE: full or partial use of this code is prohibited.
//           If interested contact the author asking for permit use of code.

var xPos = 0;
var yPos = 0;
var xScroll = 0;
var yScroll = 0;

function apriMusicista(pagina) {
  window.open(pagina,'musicista','width=300px,height=400px,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no');
}

function apriImmagine(nome,l,a) {
  window.open(nome,'foto','width=' + l + 'px,height=' + a + 'px,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no');
}

function cambiaImmagine(nomeImg,src) {
  if (document.layers) {
    eval('this.document.' + nomeImg + '.src = "' + src + '"');
  }
  if (document.all && !document.getElementById) {
    document.images[nomeImg].src = src;
  }
  if ((document.all && document.getElementById) || (!document.all && document.getElementById)) {
    document.images[nomeImg].src = src;
  }
  return true;
}

function mouseMano(obj) {
  if (document.layers) {
    this.layer = window.document[obj];
    this.layer.cursor = "pointer";
  }
  if (document.all && !document.getElementById) {
    this.element = window.document.all[obj];
    this.style = this.element.style;
    this.style.cursor = "hand";
  }
  if (document.all && document.getElementById) {
    this.element = document.getElementById(obj);
    this.style = this.element.style;
    this.style.cursor = "hand";
  }
  if (!document.all && document.getElementById) {
    this.element = document.getElementById(obj);
    this.style = this.element.style;
    this.style.cursor = "pointer";
  }
  return true;
}

function mouseDef(obj) {
  if (document.layers) {
    this.layer = window.document[obj];
    this.layer.cursor = "default";
  }
  if (document.all && !document.getElementById) {
    this.element = window.document.all[obj];
    this.style = this.element.style;
    this.style.cursor = "default";
  }
  if (document.all && document.getElementById) {
    this.element = document.getElementById(obj);
    this.style = this.element.style;
    this.style.cursor = "default";
  }
  if (!document.all && document.getElementById) {
    this.element = document.getElementById(obj);
    this.style = this.element.style;
    this.style.cursor = "default";
  }
  return true;
}

function ridimensionami(l,a) {
  if (!document.all && document.getElementById) {
    window.resizeTo(l+6,a+32);
  }
  if (document.all && document.getElementById) {
    window.resizeTo(l+10,a+36);
  }
}

function inPrimoPiano() {
  window.focus();
}

function getMouseXY(e) {
  if (document.all && document.getElementById) {
    xPos = event.clientX + document.body.scrollLeft;
    yPos = event.clientY + document.body.scrollTop;
  } else {
    xPos = e.pageX;
    yPos = e.pageY;
  }
  if (xPos < 0) {
   xPos = 0;
  }
  if (yPos < 0) {
    yPos = 0;
  }
  return true;
}

function catturaPosizioneMouse() {
  if (!(document.all && document.getElementById)) {
    document.captureEvents(Event.MOUSEMOVE);
  }
  document.onmousemove = getMouseXY;
}

function showMP3Player(did,id,y) {
//  alert("xPos = " + xPos + "\nyPos = " + yPos);
  var obj = document.getElementById(did);
  obj.style.border = "solid 1px black";
  obj.style.display = "block";
  if (document.all && document.getElementById) {
    obj.style.top = y + "px";
  } else {
    obj.style.top = yPos + "px";
  }
//  alert(xPos);
//  alert(obj.style.top);
  obj.style.left = (xPos+5) + "px";
  obj.style.width = "44px";
  obj.style.height = "33px";
  obj.innerHTML = "    <div style=\"background-color:#036CFE;font-size:2px;width:100%;height:11px;text-align:right;\">\n" +
                  "      &nbsp;<img src=\"../img/chiudi.gif\" name=\"chiudi\" alt=\"chiudi\" title=\"chiudi\" id=\"chiudi\" onclick=\"hideMP3Player('player');\" onmouseover=\"mouseMano('chiudi');cambiaImmagine('chiudi','../img/chiudi_on.gif');\" onmouseout=\"mouseDef('chiudi');cambiaImmagine('chiudi','../img/chiudi.gif');\" style=\"vertical-align:middle;\"/>\n" +
                  "    </div>\n" +
                  "    <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=\"44px\" height=\"22px\" id=\"playerMP3\" ALIGN=\"left\">\n" +
                  "      <param name=\"movie\" value=\"./pubblicazioni/playerMP3.swf\"/>\n" +
                  "      <param name=\"quality\" value=\"high\"/>\n" +
                  "      <param name=\"bgcolor\" value=\"#FFFFFF\"/>\n" +
                  "      <param name=\"flashVars\" value=\"idBrano=" + id + "\"/>\n" +
                  "      <embed src=\"./pubblicazioni/playerMP3.swf\" quality=\"high\" bgcolor=\"#FFFFFF\" width=\"44px\" height=\"22px\" name=\"playerMP3\" align=\"left\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" flashVars=\"idBrano=" + id + "\">\n" +
                  "      </embed>\n" +
                  "    </object>\n";
//  alert(obj.innerHTML);
}

function hideMP3Player(did) {
  var obj = document.getElementById(did);
  obj.style.border = "none";
  obj.style.display = "none";
  obj.style.top = "0px";
  obj.style.left = "0px";
  obj.style.width = "0px";
  obj.style.height = "0px";
  obj.innerHTML = "    &nbsp;";
}

