var linkDialogDiv = null;
var linkDialogTitle = null;
var linkDialogBet = null;
var linkDialogWin = null;
var linkDialogType = null;
var linkDialogDesc = null;

var typeDiv, typeValueDiv;
var winDiv, winValueDiv;
var betDiv, betValueDiv;

var divTypeHRRight, divTypeHR;
var divWinHRRight, divWinHR;
var divBetHRRight, divBetHR;

var descDiv;

function linkDialogPlay( linkDiv, type, title, bet, win, desc )
{
	linkDialogTitle.nodeValue = title;
	
	var taille = 114 + parseInt((desc.length / 25) * 14);
	var txtTop = 102;
	
	if( type == "" )
	{
		divTypeHRRight.style.visibility = "hidden";
		divTypeHR.style.visibility = "hidden";
		typeDiv.style.display = "none";
		typeValueDiv.style.display = "none";
		taille -= 20;
		txtTop -= 20;
	}
	else
	{
		divTypeHRRight.style.visibility = "visible";
		divTypeHR.style.visibility = "visible";
		typeDiv.style.display = "block";
		typeValueDiv.style.display = "block";
		linkDialogType.nodeValue = type;
	}
	
	if( bet == "" && win == "" )
	{
		winDiv.style.display = "none";
		winValueDiv.style.display = "none";
		betDiv.style.display = "none";
		betValueDiv.style.display = "none";
		divWinHRRight.style.visibility = "hidden";
		divWinHR.style.visibility = "hidden";
		divBetHRRight.style.visibility = "hidden";
		divBetHR.style.visibility = "hidden";
		taille -= 40;
		txtTop -= 52;
	}
	else
	{
		winDiv.style.display = "block";
		winValueDiv.style.display = "block";
		betDiv.style.display = "block";
		betValueDiv.style.display = "block";
		divWinHRRight.style.visibility = "visible";
		divWinHR.style.visibility = "visible";
		divBetHRRight.style.visibility = "visible";
		divBetHR.style.visibility = "visible";
		linkDialogBet.nodeValue = bet;
		linkDialogWin.nodeValue = win;
	}
	
	linkDialogDiv.style.height = taille + "px";
	descDiv.style.top = txtTop + "px";
	
	linkDialogDesc.nodeValue = desc;
	
	var coord = getCorrectPopCoord(linkDiv, 280, taille);
	
	linkDialogDiv.style.display = "block";
	
	linkDialogDiv.style.left = coord[0] + "px";
	linkDialogDiv.style.top = coord[1] + "px";
}

function linkDialogStop()
{
	linkDialogDiv.style.display = "none";
}

function initLinkDialog()
{
	linkDialogDiv = document.createElement("div");
	
	linkDialogDiv.style.top = "0px";
	linkDialogDiv.style.left = "0px";
	linkDialogDiv.style.width = "280px";
	linkDialogDiv.style.height = "200px";
	linkDialogDiv.style.position = "absolute";
	linkDialogDiv.style.borderColor = "#08289F";
	linkDialogDiv.style.background = "#84B8E5";
	linkDialogDiv.style.borderStyle = "double";
	linkDialogDiv.style.display = "none";
	
	setOpacity( linkDialogDiv, 85 );
	
	// Table
	var divTitleHR = document.createElement("hr");
	divTitleHR.style.borderColor = "#08289F";
	divTitleHR.style.borderStyle = "double";
	divTitleHR.style.margin = "0px";
	divTitleHR.style.height = "3px";
	divTitleHR.style.top = "20px";
	divTitleHR.style.width = "100%";
	divTitleHR.style.position = "absolute";
	linkDialogDiv.appendChild( divTitleHR );
	
	divTypeHRRight = document.createElement("hr");
	divTypeHRRight.style.borderColor = "#08289F";
	divTypeHRRight.style.borderStyle = "double";
	divTypeHRRight.style.margin = "0px";
	divTypeHRRight.style.height = "24px";
	divTypeHRRight.style.top = "22px";
	divTypeHRRight.style.width = "3px";
	divTypeHRRight.style.left = "30%";
	divTypeHRRight.style.position = "absolute";
	linkDialogDiv.appendChild( divTypeHRRight );
	
	divTypeHR = document.createElement("hr");
	divTypeHR.style.borderColor = "#08289F";
	divTypeHR.style.borderStyle = "double";
	divTypeHR.style.margin = "0px";
	divTypeHR.style.height = "3px";
	divTypeHR.style.top = "46px";
	divTypeHR.style.width = "100%";
	divTypeHR.style.position = "absolute";
	linkDialogDiv.appendChild( divTypeHR );
	
	divWinHRRight = document.createElement("hr");
	divWinHRRight.style.borderColor = "#08289F";
	divWinHRRight.style.borderStyle = "double";
	divWinHRRight.style.margin = "0px";
	divWinHRRight.style.height = "24px";
	divWinHRRight.style.top = "48px";
	divWinHRRight.style.width = "3px";
	divWinHRRight.style.left = "30%";
	divWinHRRight.style.position = "absolute";
	linkDialogDiv.appendChild( divWinHRRight );
	
	divWinHR = document.createElement("hr");
	divWinHR.style.borderColor = "#08289F";
	divWinHR.style.borderStyle = "double";
	divWinHR.style.margin = "0px";
	divWinHR.style.height = "3px";
	divWinHR.style.top = "72px";
	divWinHR.style.width = "100%";
	divWinHR.style.position = "absolute";
	linkDialogDiv.appendChild( divWinHR );
	
	divBetHRRight = document.createElement("hr");
	divBetHRRight.style.borderColor = "#08289F";
	divBetHRRight.style.borderStyle = "double";
	divBetHRRight.style.margin = "0px";
	divBetHRRight.style.height = "24px";
	divBetHRRight.style.top = "72px";
	divBetHRRight.style.width = "3px";
	divBetHRRight.style.left = "30%";
	divBetHRRight.style.position = "absolute";
	linkDialogDiv.appendChild( divBetHRRight );
	
	divBetHR = document.createElement("hr");
	divBetHR.style.borderColor = "#08289F";
	divBetHR.style.borderStyle = "double";
	divBetHR.style.margin = "0px";
	divBetHR.style.height = "3px";
	divBetHR.style.top = "96px";
	divBetHR.style.width = "100%";
	divBetHR.style.position = "absolute";
	linkDialogDiv.appendChild( divBetHR );
	
	// Title
	var titleDiv = document.createElement("div");
	titleDiv.style.position = "absolute";
	titleDiv.style.width = "100%";
	titleDiv.style.height = "20px";
	titleDiv.style.textAlign = "center";
	titleDiv.style.fontFamily = "times";
	titleDiv.style.fontWeight = "bold";
	titleDiv.style.fontSize = "16px";
	titleDiv.style.color = "#02229A";
	linkDialogTitle = document.createTextNode("Title");
	titleDiv.appendChild( linkDialogTitle );
	
	// Type
	typeDiv = document.createElement("div");
	typeDiv.style.position = "absolute";
	typeDiv.style.width = "30%";
	typeDiv.style.height = "24px";
	typeDiv.style.top = "24px";
	typeDiv.style.textAlign = "center";
	typeDiv.style.fontFamily = "times";
	typeDiv.style.fontWeight = "bold";
	typeDiv.style.fontSize = "14px";
	typeDiv.style.color = "#222222";
	var typeText = document.createTextNode("Type : ");
	typeDiv.appendChild( typeText );
	
	typeValueDiv = document.createElement("div");
	typeValueDiv.style.position = "absolute";
	typeValueDiv.style.width = "70%";
	typeValueDiv.style.left = "35%";
	typeValueDiv.style.height = "10px";
	typeValueDiv.style.top = "24px";
	typeValueDiv.style.textAlign = "left";
	typeValueDiv.style.fontFamily = "times";
	typeValueDiv.style.fontStyle = "italic";
	typeValueDiv.style.fontWeight = "bold";
	typeValueDiv.style.fontSize = "14px";
	typeValueDiv.style.color = "#333333";
	linkDialogType = document.createTextNode("KDor");
	typeValueDiv.appendChild( linkDialogType );
	
	// Win
	winDiv = document.createElement("div");
	winDiv.style.position = "absolute";
	winDiv.style.width = "30%";
	winDiv.style.height = "10px";
	winDiv.style.top = "50px";
	winDiv.style.textAlign = "center";
	winDiv.style.fontFamily = "times";
	winDiv.style.fontWeight = "bold";
	winDiv.style.fontSize = "14px";
	winDiv.style.color = "#222222";
	var winText = document.createTextNode("Gain : ");
	winDiv.appendChild( winText );
	
	winValueDiv = document.createElement("div");
	winValueDiv.style.position = "absolute";
	winValueDiv.style.width = "70%";
	winValueDiv.style.left = "35%";
	winValueDiv.style.height = "10px";
	winValueDiv.style.top = "50px";
	winValueDiv.style.textAlign = "left";
	winValueDiv.style.fontFamily = "times";
	winValueDiv.style.fontStyle = "italic";
	winValueDiv.style.fontWeight = "bold";
	winValueDiv.style.fontSize = "14px";
	winValueDiv.style.color = "#333333";
	linkDialogWin = document.createTextNode("Hooky");
	winValueDiv.appendChild( linkDialogWin );
	
	// Bet
	betDiv = document.createElement("div");
	betDiv.style.position = "absolute";
	betDiv.style.width = "30%";
	betDiv.style.height = "24px";
	betDiv.style.top = "76px";
	betDiv.style.textAlign = "center";
	betDiv.style.fontFamily = "times";
	betDiv.style.fontWeight = "bold";
	betDiv.style.fontSize = "14px";
	betDiv.style.color = "#222222";
	var betText = document.createTextNode("Mise : ");
	betDiv.appendChild( betText );
	
	betValueDiv = document.createElement("div");
	betValueDiv.style.position = "absolute";
	betValueDiv.style.width = "70%";
	betValueDiv.style.left = "35%";
	betValueDiv.style.height = "10px";
	betValueDiv.style.top = "76px";
	betValueDiv.style.textAlign = "left";
	betValueDiv.style.fontFamily = "times";
	betValueDiv.style.fontStyle = "italic";
	betValueDiv.style.fontWeight = "bold";
	betValueDiv.style.fontSize = "14px";
	betValueDiv.style.color = "#333333";
	linkDialogBet = document.createTextNode("KDor");
	betValueDiv.appendChild( linkDialogBet );
	
	// Desc
	descDiv = document.createElement("div");
	descDiv.style.position = "absolute";
	descDiv.style.left = "2%";
	descDiv.style.width = "96%";
	descDiv.style.height = "10px";
	descDiv.style.top = "102px";
	descDiv.style.textAlign = "left";
	descDiv.style.fontFamily = "times";
	descDiv.style.fontWeight = "bold";
	descDiv.style.fontSize = "14px";
	descDiv.style.color = "#222222";
	linkDialogDesc = document.createTextNode("Description");
	descDiv.appendChild( linkDialogDesc );
	
	linkDialogDiv.appendChild( titleDiv );
	linkDialogDiv.appendChild( typeDiv );
	linkDialogDiv.appendChild( typeValueDiv );
	linkDialogDiv.appendChild( betDiv );
	linkDialogDiv.appendChild( betValueDiv );
	linkDialogDiv.appendChild( winDiv );
	linkDialogDiv.appendChild( winValueDiv );
	linkDialogDiv.appendChild( descDiv );
	document.getElementById('map_map_int').appendChild( linkDialogDiv );
}