function popUp(URL,w,h,scrollB) {
day = new Date();
id = day.getTime();
if(scrollB==null)b = 0;

eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=" + scrollB + ",location=0,statusbar=0,menubar=0,resizable=0,width=" + w + ",height=" + h + ",left = 602,top = 296');");
}

var site;

var XMousePos, YMousePos;

var isNS;

var isDHTML;

var evt = null;

var hidden;

var v_item;



function CaptureMousePosition(e) 
{

	if (v_item == 'InfoSupplementaire')
	{	
		newXPosition = -200;
		newYPosition = -200;
	} 
	else
	{
		newXPosition = 10;
		newYPosition = 15;	
	}

	if(document.all) //For IE
	{
		XMousePos = window.event.x + newXPosition + document.body.scrollLeft + 'px';
		YMousePos = window.event.y + newYPosition + document.body.scrollTop + 'px';
	}
	else //For Netscape 
	{
		XMousePos = e.clientX + newXPosition + self.pageXOffset + 'px';
		YMousePos = e.clientY + newYPosition + self.pageYOffset + 'px';
	}
}

function GetItem(strItem)
{

	if(document.all) //For IE
		return document.all[strItem];
	else //For Netscape
		return document.getElementById(strItem);
}

function HideToolTip()
{
	var Frame = GetItem(v_item);
	Frame.style.left = "-300px";
	Frame.style.top = "-300px";
	hidden = true;
}

function PlaceToolTip(mouseEvent,Frame)
{
	CaptureMousePosition(mouseEvent);
	Frame.style.left = XMousePos;
	Frame.style.top  = YMousePos;
	return;	
}

function ShowToolTip(site,mouseEvent,newItem)
{

	hidden = false;
	v_item = newItem;
	
	var Frame = GetItem(v_item);
	
	PlaceToolTip(mouseEvent, Frame);
	Frame.src = site;
	if(v_item == 'MenuToolTip' || v_item == 'Legende')
	{
		document.onmousemove = followMe;
	} 
	else 
	{
		document.onmousemove = null;
	}	
	return;	
}

function followMe(evt)
{	
	if (isNS) event = evt;
    var frame = GetItem(v_item);
	if (!hidden) {
	//alert(v_item+2);	
		PlaceToolTip(evt,frame);
		return;
	}	
}

function newImage(arg) {

	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}



function changeImages() {

	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;

function preloadImages() {

	if (document.images) {
		btn_teams_over = newImage("../images/menu/up/btn_teams_over.gif");
		btn_standings_over = newImage("../images/menu/up/btn_standings_over.gif");
		btn_statistics_over = newImage("../images/menu/up/btn_statistics_over.gif");
		btn_power_rankings_over = newImage("../images/menu/up/btn_power_rankings_over.gif");
		btn_rosters_over = newImage("../images/menu/up/btn_rosters_over.gif");
		btn_awards_over = newImage("../images/menu/up/btn_awards_over.gif");
		preloadFlag = true;
	}
}

// Pointeur sur la fenêtre

var windowPopup;

function popupWindow(url, width, height, scrollbars, left, top)
{
/*
height 			numeric 	Specifies the height of the window in pixels 
width 			numeric 	Specifies the width of the window in pixels
menubar 		boolean 	Controls the menu at the top of the window 
toolbar 		boolean 	Controls the standard browser toolbar 
directories 	boolean 	Controls the standard browser directory buttons 
location 		boolean 	Controls the Location entry field 
scrollbars 		boolean 	Controls the horizontal and vertical scrollbars 
resizable 		boolean 	Controls the ability to resize the window 
status 			boolean 	Controls the status bar at the bottom of the window 
*/
	// Param de la fenêtre
	var param = "height="+height+", width="+width+", menubar='no', "+
				"toolbar='no', directories='no', location='no', "+
				"scrollbars="+scrollbars+", resizable=yes, status='no', left="+left+", top="+top+"";

	var titre = "EAONLINE";
	windowPopup = window.open(url, titre, param);
	// Mettre la fenêtre en premier plan
	windowPopup.focus();
}

var win = null;

function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+''
	win = window.open(mypage,myname,settings)
}
