/**
 * Copyright 2003, IMTEAM www.imteam.it
 * QUESTO PROGRAMMA E' COPERTO DA COPYRIGHT E NON PUO' ESSERE COPIATO O
 * MODIFICATO (NEMMENO PARZIALMENTE) SENZA ESPLICITO CONSENSO DEL PROPRIETARIO.
 * NON PUO' ESSERE UTILIZZATO AL DI FUORI DEL PRODOTTO CON CUI E' STATO FORNITO.
 */

//  DATA ULTIMA MODIFICA: 2003-10-17;
//  VERSIONE: 0.1-2003;
//  MODIFICATO: C.Lanza clanza@imteam.it;

/* Versione: $Revision: 1.3 $ */


var mouseX = 0;
var mouseY = 0;

// determina area disponibile in larghezza dell'utente
function winGetWidth() {
  if ( typeof(is)=="undefined" || is == null) {
    return true;
  }
  if (is.ns4 || is.ns6) {
    width = window.innerWidth;
  }
  if (is.ie4 || is.ie5) {
    width = document.body.clientWidth;
    //width = document.body.clientWidth + document.body.scrollLeft;
  }
  return (width);
}

// determina area disponibile in altezza dell'utente
function winGetHeight() {
  if ( typeof(is)=="undefined" || is == null) {
    return true;
  }
  if (is.ns4 || is.ns6) {
    height = window.innerHeight;
  }
  if (is.ie4 || is.ie5) {
    height = document.body.clientHeight;
    //height = document.body.clientHeight + document.body.scrollTop;
  }
  return (height);
}

// get cursor location
function winCursorPosition(e) {
  if ( typeof(is)=="undefined" || is == null) {
    return true;
  }
  if (is.ns4 || is.ns6) {
    mouseX = e.pageX;
    mouseY = e.pageY;
  } else {
    mouseX = event.clientX + document.body.scrollLeft;
    mouseY = event.clientY + document.body.scrollTop;
  }
}

// verifica se mouse su scrollbar
function winMouseOnScrollbars(mouseX,mouseY) {
  var barWidth = 20;
  if (mouseX > (winGetWidth() + document.body.scrollLeft)) {
    return true;
  }
  if (mouseY > (winGetHeight() + document.body.scrollTop)) {
    return true;
  }
  return false;
}

function winChangeImage(imgName,imgObj) {
  if ( typeof(is)=="undefined" || is == null) {
    return true;
  }
  if (toolIsLoading()) {
    return;
  }
  if (is.ns4) {
		if (this.document.imgName!=null)
    	eval('this.document.' + imgName + '.src = "' + imgObj + '"');
  }
  if (is.ie4 || is.ie5 || is.ns6) {
		if (document.images[imgName]!=null)
    	document.images[imgName].src = imgObj;
  }
  return true;
}
