document.writeln ('<div id="PaysDiv" class="PaysClass"></div>');

var offsetxpoint=-0 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["PaysDiv"] : document.getElementById? document.getElementById("PaysDiv") : ""


function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ShowLabelMobile(thetext, thecolor, thewidth){
	thewidth = 300;
	if (ns6||ie){
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor

		
		nameSplitted = thetext.split("<BR>");
		sHTML = "<TABLE class='TooltipTable'>";

		sHTML = sHTML + "<TR><TD>";
		sHTML = sHTML + "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0'><TR>";
		sHTML = sHTML + "<TD class='TooltipTitle'>" + nameSplitted[0] + "</<TD>";

		sHTML = sHTML + "</TR></TABLE>";
		for(i=1; i<nameSplitted.length; i++)
		{
			sHTML = sHTML + "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='2' CELLSPACING='0' bgcolor='#909090'><TR>";
//			sHTML = sHTML + "<TD class='TooltipText' VALIGN='top'><FONT SIZE='1' FACE='Arial' COLOR='white'>" + nameSplitted[i] + "</FONT></TD>";
			sHTML = sHTML + "<TD class='TooltipText' VALIGN='top'>" + nameSplitted[i] + "</TD>";

			sHTML = sHTML + "</TD></TR></TABLE>";
		}
		sHTML = sHTML + "</TD></TR></TABLE>";

	tipobj.innerHTML=sHTML;
	enabletip=true;
	return false;
	}
}

function positiontip(e){

if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight) {
	tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
}
else
{
tipobj.style.top=curY+offsetypoint+"px";
tipobj.style.visibility="visible";
}
}
}

function hideLabelMobile(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}


function showLabelSimple() {
   document.getElementById("Pays").style.visibility = "visible";
}

function HideLabel(delay) {
		date = new Date();
		var curDate = null;

		do { var curDate = new Date(); }
		while(curDate-date < delay);

		document.getElementById("Pays").style.visibility = "hidden";
}


function ShowLabelStatic(name) {
	nameSplitted = name.split("<BR>");
  var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

	sHTML = "<TABLE WIDTH='300' BORDER='0' CELLPADDING='2'CELLSPACING='0' BGCOLOR='#FFFFFFF'>";
	sHTML = sHTML + "<TR><TD>";
	sHTML = sHTML + "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0'><TR><TD>";
	sHTML = sHTML + "<FONT SIZE='1' FACE='Arial' COLOR='black'><B>" + nameSplitted[0] + "</B></FONT>";
	sHTML = sHTML + "</TD></TR></TABLE>";
	for(i=1; i<nameSplitted.length; i++)
	{
		sHTML = sHTML + "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='2' CELLSPACING='0' bgcolor='#909090'><TR><TD VALIGN='top'>";
		sHTML = sHTML + "<FONT SIZE='1' FACE='Arial' COLOR='white'>" + nameSplitted[i] + "</FONT>";
		sHTML = sHTML + "</TD></TR></TABLE>";
	}
	sHTML = sHTML + "</TD></TR></TABLE>";

	if (ns4up){
		document.layers['Pays'].top=ypos;
		document.layers['Pays'].left=xpos;
		document.layers['Pays'].document.write(sHTML);
		document.layers['Pays'].document.close();
	}
	else {
		ypos=event.clientY+(document.body.scrollTop)+5;
		xpos=event.clientX+(document.body.scrollLeft)+30;

		document.all.Pays.innerHTML=sHTML;

		document.all.Pays.style.top=ypos;
		document.all.Pays.style.left=xpos;
		}
	showLabelSimple();
	setTimeout("document.getElementById('Pays').style.visibility = 'hidden';",5000);
	}

function openNewImage1(sFilename, sTheme, sAuteur, sAge, sPays, sDidascalie, sPaysLan, sThemeLan){
	sDim = "height=" + 10 + ", width=" + 10 + ", ";
	sDim="";
	//OpenWindow=window.open("", "", sDim + "toolbar=no,left=0,top=0, menubar=no,scrollbars=yes,resizable=yes");
	//OpenWindow=window.open("");
	OpenWindow=window.open("", "", sDim + "scrollbars=no,menubar=no,resizable=yes,toolbar=no,location=no,status=no");
	
	sHTML= "<HTML><HEAD><TITLE>Enfants du Monde - PhotoGallery</TITLE>";
	sHTML = sHTML + "<META http-equiv=Content-Type content='text/html; charset=utf-8'></HEAD>";
	sHTML = sHTML + "<form name='FormData' action='../includes/CreaPhoto1.php' method='POST'>";
	sHTML = sHTML + "<input type='hidden' name='Filename' value='" + sFilename +"'>";
	sHTML = sHTML + "<input type='hidden' name='Theme' value='" + sTheme +"'>";
	sHTML = sHTML + "<input type='hidden' name='Auteur' value='" + sAuteur +"'>";
	sHTML = sHTML + "<input type='hidden' name='Age' value='" + sAge +"'>";
	sHTML = sHTML + "<input type='hidden' name='Pays' value='" + sPays +"'>";
	sHTML = sHTML + "<input type='hidden' name='Didascalie' value='" + sDidascalie.replace(/'/g,"`") +"'>";
	sHTML = sHTML + "<input type='hidden' name='PaysLan' value='" + sPaysLan +"'>";
	sHTML = sHTML + "<input type='hidden' name='ThemeLan' value='" + sThemeLan +"'>";
	sHTML = sHTML + "</form>";
	sHTML = sHTML + "<body></body></html>";
	
	OpenWindow.document.write(sHTML);
	OpenWindow.document.close;
	
	OpenWindow.document.FormData.submit();	
	
	//document.write(sHTML);
	//document.FormData.submit();	
		
}

function openNewImage(sFilename, sTheme, sAuteur, sAge, sPays, sDidascalie, width, height, sPaysLan, sThemeLan){

	if (height > 500)
	 	height = 500;

	height1=height+160;
	width1=width+50;

	sDim = "height=" + height1	+ ", width=" + width1 + ", ";
	sDim1 = "height=" + height;

	OpenWindow=window.open("", "", sDim + "toolbar=no,left=0,top=0, menubar=no,scrollbars=yes,resizable=yes");

	sHTML = "<TITLE>" + sThemeLan + " - " + sAuteur + ", " + sAge + " - " +  sPaysLan + "</TITLE>";
	sHTML = sHTML + "<body bgcolor='#000000' text='#ffffff' align='center'>";
	sHTML = sHTML + "<TABLE align=center>" + "\n";
	sHTML = sHTML + "<TR><TD align=center><font face='BrushScrD' size=6>" + sThemeLan + "</font></TD></TR>";
	sHTML = sHTML + "<TR><TD align=center><img border='3' " + sDim1 + " src='../Photo/" + sTheme + "/" + sFilename + ".jpg'></TD></TR>" + "\n";
	sHTML = sHTML + "<TR><TD align=center><font face='BrushScrD' size=4>" + sAuteur + ", " + sAge + " - " +  sPaysLan  + "</font></TD></TR>" + "\n";
	sHTML = sHTML + "<TR><TD align=center><font face='BrushScrD' size=4>" +  sDidascalie + "</font></TD></TR>" + "\n";

	sHTML = sHTML + "</TABLE>";

	OpenWindow.document.write(sHTML);
	OpenWindow.document.write("</BODY>");
	OpenWindow.document.write("</HTML>");
	OpenWindow.document.close();
}

document.onmousemove=positiontip;

function GotoTheme(sTheme){
	//alert(sTheme);	
	FormDataGrid.Auteur.value='';
	FormDataGrid.Pays.value='';
	FormDataGrid.Partner.value='';
	FormDataGrid.Theme.value=sTheme;
	//FormDataGrid.action="regards_photo.php";
	FormDataGrid.submit();
}

function GotoAuteur(sAuteur){
	FormDataGrid.Theme.value='';
	FormDataGrid.Pays.value='';
	FormDataGrid.Partner.value='';
	FormDataGrid.Auteur.value=sAuteur;
	FormDataGrid.submit();
}

function GotoPartner(sPartner){
	//FormDataGrid.action="";
	FormDataGrid.Theme.value='';
	FormDataGrid.Auteur.value='';
	FormDataGrid.Pays.value='';
	FormDataGrid.Partner.value=sPartner;
	FormDataGrid.submit();
}

function GotoPays(sPays){
	//alert(sPays);	
	//FormDataGrid.action="";
	FormDataGrid.Theme.value='';
	FormDataGrid.Auteur.value='';
	FormDataGrid.Partner.value='';
	FormDataGrid.Pays.value=sPays;
	FormDataGrid.submit();
}

function GotoHome(){
//	FormDataGrid.action="first.php";
	//FormDataGrid.action="?what=";

	FormDataGrid.Langue.value='<?php echo $Sess_Lan?>';
	FormDataGrid.submit();
}


function GotoPage(sPag){	
	FormDataGrid.pag.value=sPag;
	FormDataGrid.action="";
	FormDataGrid.submit();
}