//
// Pour ouvrir une fenetre titrée avec une image à l'interieur de celle-ci. La fenêtre prend automatiquement la taille de l'image
//
 
function open_popup_image(t,f,n)
{
	b=":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
	s=""

	s=s+"<html>\n\n"
	s=s+"<title>"+t+" - "+b+b+b+b+b+"<\/title>\n\n"

	s=s+"<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onload=\"fun()\">\n"
	s=s+"<img src=\""+n+"\" name=\"toto\" id=\"toto\">\n\n"

	s=s+"<script>\n"

	s=s+"function fun()\n"
	s=s+"{\n"

	if ( is.ns5)
	{
		s=s+"wf = document.getElementById(\"toto\").width\n"
		s=s+"hf = document.getElementById(\"toto\").height\n"
		s=s+"resizeTo(wf+9,hf+27)\n"
		s=s+"x=\"\"\n"
		s=s+"x=x+\"<div id='tab' style='position:absolute; width:\"+wf+\"px; height:\"+hf+\"px; z-index:1; left: 0px; top: 0px; background-image: url("+n+"); layer-background-image: url("+n+")'>\"\n"
		s=s+"x=x+\"<table cellspacing=0 cellpadding=0 vspace=0 hspace=0 border=0 width=\"+wf+\" height=\"+hf+\">\"\n"
		s=s+"x=x+\"<tr>\"\n"	
		s=s+"x=x+\"<td align=right valign=bottom>\"\n"	
		s=s+"x=x+\"<a href='#' onclick='javascript:window.close()'>"+f+"<\/a>&nbsp;<br>\"\n"	
		s=s+"x=x+\"<\/td>\"\n"	
		s=s+"x=x+\"<\/tr>\"\n"	
		s=s+"x=x+\"<\/table>\"\n"

		s=s+"x=x+\"</div>\"\n"
		s=s+"document.write(x)\n"
	
	}

	

	if ( is.ie )
	{
				
		s=s+"w=document.images.toto.width\n"
		s=s+"h=document.images.toto.height\n"
		s=s+"self.resizeTo(w+10,h+29)\n\n"

		s=s+"x=\"<div id='fermer' style='position:absolute; width:\"+w+\"px; height:\"+h+\"px; z-index:1; left: 0px; top: 0px'>\"\n"
		s=s+"x=x+\"<table cellspacing=0 cellpadding=3 vspace=3 hspace=3 border=0 width=\"+w+\" height=\"+h+\" background='"+n+"'>\"\n"
		s=s+"x=x+\"<tr>\"\n"	
		s=s+"x=x+\"<td align=right valign=bottom>\"\n"	
		s=s+"x=x+\"<a href='#' onclick='javascript:window.close()'>"+f+"<\/a>&nbsp;<br>\"\n"	
		s=s+"x=x+\"<\/td>\"\n"	
		s=s+"x=x+\"<\/tr>\"\n"	
		s=s+"x=x+\"<\/table>\"\n"
		s=s+"x=x+\"</div>\"\n"

		s=s+"document.write(x)\n\n"
		s=s+"document.title='"+t+" - "+b+b+b+b+b+b+b+"'\n\n"		
	}
	s=s+"}\n"
	
	s=s+"<\/script>\n"	

	s=s+"</body>\n"
	s=s+"</html>\n"

//	alert(s)

    newWindow=window.open('','','width=200,height=200,toolbar=no,scrollbars=no')
 	newWindow.document.open("text/html", "replace")
  	newWindow.document.write(s)
  	newWindow.document.close()

	if ( is.ns4 )
	{
		w=newWindow.document.images[0].width
		h=newWindow.document.images[0].height
		newWindow.close()	

		s=""
		s=s+"<html>\n\n"
		s=s+"<title>"+t+" - "+b+b+b+b+b+"<\/title>\n\n"
		s=s+"<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>\n"
		s=s+"<table cellspacing=0 cellpadding=3 vspace=0 hspace=0 border=0 width="+w+" height="+h+" background='"+n+"'>"
		s=s+"<tr>\n"	
		s=s+"<td align=right valign=bottom>"
		s=s+"<a href='#' onclick='javascript:window.close()'>"+f+"</a>&nbsp;<br>\n"	
		s=s+"</td>\n"
		s=s+"</tr>\n"	
		s=s+"</table>\n"
		s=s+"</body>\n"
		s=s+"</html>\n"

		p="width="+w+",height="+h+",toolbar=no,scrollbars=no"
	    newWindow=window.open('','',p)
	 	newWindow.document.open("text/html", "replace")
	  	newWindow.document.write(s)
	  	newWindow.document.close()

	}

} 



//-----------------------------------------------------------------------------
// Propriétés de la page et de la fenêtre.
//-----------------------------------------------------------------------------

function getWindowWidth() 
{
  if (is.ns)  return window.innerWidth;
  if (is.ie)  return document.body.clientWidth;
}

function getWindowHeight() 
{
  if (is.ns)  return window.innerHeight;
  if (is.ie)  return document.body.clientHeight;
}

function getPageWidth() 
{
  if (is.ns)  return document.width;
  if (is.ie)  return document.body.scrollWidth;
}

function getPageHeight() 
{
  if (is.ns)  return document.height;
  if (is.ie)  return document.body.scrollHeight;
}

function getPageScrollX() 
{
  if (is.ns)  return window.pageXOffset;
  if (is.ie)  return document.body.scrollLeft;
}

function getPageScrollY() 
{
  if (is.ns)  return window.pageYOffset;
  if (is.ie)  return document.body.scrollTop;
}

// Pour ouvrir une fenêtre popup.

//	1. url
//	2. width
//	3. height

function openPopup(u,w,h)
{
	str='width='+w+',height='+h
	open(u,null,str);
}

// Pour ouvrir une fenêtre.

//	01. url
//	02. width
//	03. height
//	04. location
//	05. directories
//	06. resizable
//	07. menubar
//	08. status
//	09. scrollbars

function openWin(u,w,h,l,d,r,mb,s,sb,tb)
{
	str='width='+w+',height='+h+',location='+l+',directories='+d+',resizable='+r+',menubar='+mb+',status='+s+',scrollbars='+sb;
	n=open(u,null,str);
	n.moveTo(0,0);
	return n;
}

//
// pour ouvrir une fenetre popup une seule fois durant la session
//

function cookie_scan(tmp_var)
{

	my_cookie = document.cookie;
	tmp_var += "=";
	cookie_scan_test = my_cookie.indexOf(tmp_var,0);

	if (cookie_scan_test <= -1)
	{
		return("0");
	}
	else
	{
		end = my_cookie.indexOf(";",cookie_scan_test)
		
		if (end <= -1)
		{
			return( unescape(my_cookie.substring(cookie_scan_test+tmp_var.length,my_cookie.length)) );
		}
		else
		{
			return( unescape(my_cookie.substring(cookie_scan_test+tmp_var.length,end)) );
		}
	}
}

function cookie_create(c_name,c_val,persist)
{
	if(persist)
	{
		dateExp = new Date(2020,11,11);
		dateExp = dateExp.toGMTString();
		cookie_create_persist = '; expires=' + dateExp + ';';
	}
	else
	{
		cookie_create_persist = '';
	}

	document.cookie = c_name + '=' + escape(c_val) + cookie_create_persist;
}

try 
{ 
	if(cookie_scan("already_pop")==0)
	{
	tmp='toolbar='+pop_toolbar+',location='+pop_location+',directories='+pop_directorie+',status='+pop_status+',scrollbars='+pop_scrollbar+',resizable='+pop_resize+',copyhistory='+pop_copyhistory+',menuBar='+pop_menubar+',width='+pop_width+',height='+pop_height

	window.open(pop_file,'_blank',tmp);
	cookie_create("already_pop","oui",false)
	}
} 
catch(er) 
{
  
} 

//
// Pour maximiser la taille de la fenetre au maximum
//

function maximum_size()
{
	window.moveTo(0,0);

	if (is.ie) 
	{
		window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (is.ns) 
	{
		if (window.outerHeight<screen.availHeight||window.outerWidth<screen.availWidth)
		{
			window.outerHeight = screen.availHeight;
			window.outerWidth = screen.availWidth;
		}
	}
}


