/* The following three variables are for setting the properties of your table contained within the div. */
var tborder="0";
var cspace="0";
var cpad="0";
var tabheight=100; // Set the height of table
var tabwidth=500; // Set the width of table
var td1height=10;
var td2height=30;
var boxt="";

//var msgtop=((window.innerHeight/2) - (tabheight / 2)).toString(); // Set the top position of the div
//var msgleft=((window.innerWidth/2) - (tabwidth / 2)).toString(); // Set the left position of the div

var msgtop;
var msgleft;
var redirectID;

function DoFormbox(msgtext, sentRedirectID, yesStr, noStr)
{
	redirectID = sentRedirectID;
	theString = '<table width="'+tabwidth+'" height="'+tabheight+'" border="'+tborder+'" cellspacing="'+cspace+'" cellpadding="'+cpad+'"><tr><td height="'+td1height+'" class="boxTd1" align="center">';
	theString += ''+msgtext+'</td></tr><tr><td height="'+td2height+'" align="center" class="boxTd2"><a href="javascript:Domsg(\'Yes\')" class="boxLink">'+yesStr+'</a>&nbsp; &nbsp;<a href="javascript:Domsg(\'No\')" class="boxLink">'+noStr+'</a></td></tr></table>';

	if (document.layers) // Netscape 4.0+
	{
		if (!window.innerHeight)
		{
			msgtop=((document.body.offsetHeight/2) - (tabheight / 2)).toString();
			msgleft=((document.body.offsetWidth/2) - (tabwidth / 2)).toString();
		}
		else
		{
			msgtop=((window.innerHeight/2) - (tabheight / 2)).toString();
			msgleft=((window.innerWidth/2) - (tabwidth / 2)).toString();
		}
		document.formbox.document.write(theString);
		document.formbox.document.close();
		document.formbox.left=msgleft;
		document.formbox.top=msgtop+40;
		document.formbox.visibility="show";
	}
	else
	{
		if(document.getElementById) // Internet Explorer 5.0+ and Netscape 6.0+
		{		
			if (document.documentElement.clientHeight && document.documentElement.clientHeight != 0)
			{
				msgtop=((document.documentElement.clientHeight/2) - (tabheight / 2)).toString();
				msgleft=((document.documentElement.clientWidth/2) - (tabwidth / 2)).toString();
			}
			else if (document.body.offsetHeight && document.body.offsetHeight != 0)
			{
				msgtop=((document.body.offsetHeight/2) - (tabheight / 2)).toString();
				msgleft=((document.body.offsetWidth/2) - (tabwidth / 2)).toString();
			}
			else
			{
				msgtop=((window.innerHeight/2) - (tabheight / 2)).toString();
				msgleft=((window.innerWidth/2) - (tabwidth / 2)).toString();
			}
			
			elm=document.getElementById("formbox");
			elm.innerHTML=theString;
			elm.style.top=""+msgtop+"px";
			elm.style.left=""+msgleft+"px";
			
			elm.style.visibility = "visible";
		}
	}
}

function Domsg(flag)
{
	hidebox(); // Hide the box after clicking on text link in box
	if(flag=="Yes")
	{
		window.location.replace("SousChapitre.php?ID=232&fromConfirmBox=1&redirectID="+redirectID);
	}	
}

// This function is for hiding the div
function hidebox()
{
	if (document.layers) // Netscape 4.0+
	{
		document.formbox.visibility="hidden";
	}
	if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
	{
		elm.style.visibility="hidden";
	}
}
