var visible=0;
var fixe=0;
var xcoord=0;
var ycoord=0;

function recupCoordonnees(eventDepSouris) {
	if(navigator.appName!="Microsoft Internet Explorer")
		chaine="blocInfos1";
	else
		chaine="blocInfos2";

    if(navigator.appName!="Microsoft Internet Explorer") {
        xcoord=eventDepSouris.pageX + 10;
        ycoord=eventDepSouris.pageY + 10;
    }
    else{
        if(document.documentElement.clientWidth>0) {
            xcoord=event.x + 10;
            ycoord=event.y + 10;
        }
        else{
            xcoord=event.x + 10;
            ycoord=event.y + 10;
        }
    }

    if(!fixe){
        if(typeof(document.getElementById(chaine).style.left)=='string') {
            document.getElementById(chaine).style.left = xcoord + 'px';
            document.getElementById(chaine).style.top = ycoord + 'px';
        } else {
            document.getElementById(chaine).style.left = xcoord;
            document.getElementById(chaine).style.top = ycoord;
        }
    }
}

function afficherInfos(texte) {
	if(navigator.appName!="Microsoft Internet Explorer")
		chaine="blocInfos1";
	else
		chaine="blocInfos2";

    if(!visible){
        visible=1;
        document.getElementById(chaine).style.visibility="visible";
        document.getElementById(chaine).innerHTML=texte;
    }
}

function cacher() {
	if(navigator.appName!="Microsoft Internet Explorer")
		chaine="blocInfos1";
	else
		chaine="blocInfos2";

    if(visible && !fixe){
        document.getElementById(chaine).style.visibility="hidden";
        document.getElementById(chaine).style.width=0;
        document.getElementById(chaine).style.heigth=0;
        document.getElementById(chaine).innerHTML="";
        visible=0;
    }
}

function figer() {
    if(visible && fixe) {
        fixe=0;
        cacher();
    }
    else if(visible) {
        fixe=1;
    }
}

function config() {
	if(navigator.appName!="Microsoft Internet Explorer")
		chaine="blocInfos1";
	else
		chaine="blocInfos2";

    document.getElementById(chaine).style.visibility="hidden";
    document.getElementById(chaine).style.width=0;
    document.getElementById(chaine).style.heigth=0;
    document.getElementById(chaine).innerHTML="";
    visible=0;
}

function showEntity(type,name,position,distance,race,level) {
	var chaine = "";
	chaine = "<table id='infosplayer' class='listing' width='100%'>" +
		"<tr><th colspan='2'>" + type + "</th></tr>" +
		"<tr><td colspan='2'><center>" + name + "<center></td></tr>" +
		"<tr><th width='20px'>Position</th><td>" + position +
		"</td></tr><tr><th>Distance</th><td>" + distance +
		"</td></tr><tr><th>Race</th><td>" + race +
		"</td></tr><tr><th>Niveau</th><td>" + level +
		"</td></tr></table>";
	afficherInfos(chaine);
}

function showItem(name,position,distance,vigor) {
	var chaine = "";
	chaine = "<table id='infosplayer' class='listing' width='100%'>" +
		"<tr><th colspan='2'>objet</th></tr>" +
		"<tr><td colspan='2'><center>" + name + "<center></td></tr>" +
		"<tr><th width='20px'>Position</th><td>" + position +
		"</td></tr><tr><th>Distance</th><td>" + distance +
		"</td></tr><tr><th>Vigueur</th><td>" + vigor +
		"</td></tr></table>";
	afficherInfos(chaine);
}

function showLocation(type,name,position,distance) {
	var chaine = "";
	chaine = "<table id='infosplayer' class='listing' width='100%'>" +
		"<tr><th colspan='2'>" + type + "</th></tr>" +
		"<tr><td colspan='2'><center>" + name + "<center></td></tr>" +
		"<tr><th width='20px'>Position</th><td>" + position +
		"</td></tr><tr><th>Distance</th><td>" + distance +
		"</td></tr></table>";
	afficherInfos(chaine);
}

