function getStyle(el,styleProp)
{
  var x = document.getElementById(el);
  if (x.currentStyle)
    var y = x.currentStyle[styleProp];
  else if (window.getComputedStyle)
    var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
  return y;
}

function validate_date(alerttxt, day, month, year)
{
	if (day == "" || (day < 1 || day > 31) || month == "" || (month < 1 || month > 12) || year == "")
	{alert(alerttxt); return false;}
	var date = new Date();
	var my_date = new Date(year, month - 1, day);
	if (date.getTime() > my_date.getTime())
	{alert("Indiquez une date ultérieure."); return false;}
	else {return true;}
}

function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		var patt1=new RegExp(/^.+@.+\..{2,3}$/);
		if (patt1.test(value) == false )
		{alert(alerttxt);return false;}
		else {return true;}
	}
}

function validate_min25(field, alerttxt)
{
	with (field)
	{
		if (isNaN(value) || value < 25)
		{alert(alerttxt);return false;}
		else {return true}
	}
}

function validate_min300(field, alerttxt)
{
	with (field)
	{
		if (isNaN(value) || value < 300)
		{alert(alerttxt);return false;}
		else {return true}
	}
}

function validate_code(field,alerttxt)
{
	with (field)
		{
			if (isNaN(value) || value==null||value=="")
			{alert(alerttxt);return false;}
			else {return true}
		}
}

function validate_num(field,alerttxt)
{
	with (field)
		{
			if (isNaN(value) || value==null||value=="")
			{alert(alerttxt);return false;}
			else {return true}
		}
}

function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="")
		{alert(alerttxt);return false;}
		else {return true}
	}
}

startList = function() {
if (document.all && document.getElementById) {
navRoot = document.getElementById("menubar");
for (i=0; i<navRoot.childNodes.length; i++) {
  node = navRoot.childNodes[i];
  if (node.nodeName=="DIV") {
  node.onmouseover=function() {
  this.className+=" over";
    }
  node.onmouseout=function() {
  this.className=this.className.replace
      (" over", "");
   }
   }
  }
 }
}
window.onload=startList;

function safe_submit(mform, message)
{
	if (confirm(message))
	{
		document.getElementById(mform).submit();
	}
}

function loadDoc()
{
document.getElementById("leftcolumn").style.height = getStyle("contentcolumn","height");
document.getElementById("leftbottom").style.top = getStyle("contentcolumn","height");
}


function openPopUp(url, name) {
	newWindow = window.open(url, name, 'height=810,width=810');
	if (window.focus) {newWindow.focus()}
	return false;
}

PositionX = 100;
PositionY = 100;

defaultWidth  = 500;
defaultHeight = 500;


var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;


function popImage(imageURL,imageTitle){
	if (isNN){
		imgWin=window.open('about:blank','',optNN);
	}
	if (isIE){
		imgWin=window.open('about:blank','',optIE);
	}
	with (imgWin.document){
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');
		writeln('window.resizeTo(300,300);');
		writeln('width=300-(document.body.clientWidth-document.images[0].width);');
		writeln('height=300-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNN){');       
		writeln('window.innerWidth=document.images["George"].width;');
		writeln('window.innerHeight=document.images["George"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		if (!AutoClose) 
			writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else 
			writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
		close();
	}
}

