// Extended Tooltip Javascript

// copyright 9th August 2002, by Stephen Chapman, Felgall Pty Ltd

// copyright 3th September 2003, by Chahid Benamar, cgi



var DH = 0;

var an = 0;

var al = 0;

var ai = 0;

if (document.getElementById) {

  ai = 1;

  DH = 1;

} else {

 if (document.all) {

  al = 1;

  DH = 1;

  } else {

    browserVersion = parseInt(navigator.appVersion);

    if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {

      an = 1;

      DH = 1;

    }

  }

}



function fd(oi,ws) {

  if (ws == 1) {

    if (ai) {

      return (document.getElementById(oi).style);

    } else {

      if (al) {

        return (document.all[oi].style);

      } else {

        if (an) {

          return (document.layers[oi]);

        }

      }

    }

  } else {

    if (ai) {

      return (document.getElementById(oi));

    } else {

      if (al) {

        return (document.all[oi]);

      } else {

        if (an) {

          return (document.layers[oi]);

        }

      }

    }

  }

}



function pw() {

  if (window.innerWidth != null)

    return window.innerWidth;

  if (document.body.clientWidth != null)

    return document.body.clientWidth;



  return (null);

}



/*

This function displays a pop up window.

evt : event mouse

pathImage: mage path in the server

x : x coordinate

y : y coordinate

w : width of the window

h : height of the window

*/

var myWindow = null;

function popUpWindow(evt,pathImage,x,y,w,h) {

	  // The path in prod: /shop/en/jsp/content/mybell/oci/popUpWindow.htm

		var pathFile = "popUpWindow.htm?pathImage=";

		if (myWindow != null){

        myWindow.close();

        myWindow = null;

        return;

    } else

	     myWindow = window.open(pathFile+pathImage,"","left="+x+",top="+y+",width="+w+",height="+h);

}



/*

This function displays a pop up relative to the origin screen (0,0)

evt : event mouse

oi: name of the layer

x : x coordinate

y : y coordinate

*/

function popUp(evt,oi, x, y) {



    var wp = pw();

    ds = fd(oi,1);

    dm = fd(oi,0);

    st = ds.visibility;



    if (dm.offsetWidth)

      ew = dm.offsetWidth;

    else

      if (dm.clip.width)

    		ew = dm.clip.width;



    if (st == "visible" || st == "show") {

      ds.visibility = "hidden";

    } else {

      if (evt.y || evt.pageY) {

        	ds.left = x;

        	ds.top = y;

      }

      ds.visibility = "visible";

    }

 }



/*

This function displays a pop up relative to the coordinates of the mouse.

evt : event mouse

oi: name of the layer

x : x coordinate

y : y coordinate

*/

 function popUpEvent(evt,oi, x, y) {

 	  var wp = pw();

    ds = fd(oi,1);

    dm = fd(oi,0);

    st = ds.visibility;



    if (st == "visible" || st == "show") {

      ds.visibility = "hidden";

    } else {

      if (evt.y || evt.pageY) {

        if (evt.pageY) {

          lv = evt.pageX;

          tv = evt.pageY;

        }

        else {

          lv = evt.x;

          tv = evt.y  + document.body.scrollTop;

        }

        ds.left = lv + x;

        ds.top = tv + y;

      }

      ds.visibility = "visible";

    }

}





/*

This function displays a pop up relative to the coordinate of the mouse and a fixed X value.

evt : event mouse

oi: name of the layer

x : x coordinate

y : y coordinate

*/

 function popUpEventY(evt,oi, x, y) {

 	  var wp = pw();

    ds = fd(oi,1);

    dm = fd(oi,0);

    st = ds.visibility;



    if (st == "visible" || st == "show") {

      ds.visibility = "hidden";

    } else {

      if (evt.y || evt.pageY) {

        if (evt.pageY) {

          tv = evt.pageY;

        }

        else {

          tv = evt.y  + document.body.scrollTop;

        }

        ds.left = x;

        ds.top = tv + y;

      }

      ds.visibility = "visible";

    }

}

