var ns4=(document.layers)? true:false;
var ie4=((document.all)&&(!document.getElementById))? true:false;
var ope=(window.opera)? true:false;
var ie =(document.all&&!ope)? true:false;
var dom=document.getElementById;

var bookmarkurl="http://www.agrisalon.com"
var bookmarktitle="Agrisalon.com - Votre cybermagazine d'information agricole et agroalimentaire"

function addbookmark()			{ if (document.all) window.external.AddFavorite(bookmarkurl,bookmarktitle) }
function is_num(str)			{ if(!str) return false; for(var i=0; i<str.length; i++) { var ch=str.charAt(i); if("0123456789".indexOf(ch) ==-1) return false; }; return true; }
function is_date (obj)			{ var dateStr=obj; var DateSeparator = /^(\d+)[-\/\.](\d+)[-\/\.](\d{4})$/; var matchSep=dateStr.match(DateSeparator); var DateRep = RegExp.$1+"-"+RegExp.$2+"-"+RegExp.$3; var correct = false; if(matchSep) { if((DateRep.length < 11) && (DateRep.length > 7)) { j = DateRep.substring(0,2); m = DateRep.substring(3,5); a = DateRep.substring(6,DateRep.length); bi = ((parseInt(a) % 4) == 0); if(((m=="01")||(m=="03")||(m=="05")||(m=="07")||(m=="08")||(m=="10")||(m=="12"))&&((Math.round(j) >= 1) && (Math.round(j) <= 31))) { correct = true; } else { if(((m=="04")||(m=="06")||(m=="09")||(m=="11"))&&((Math.round(j) >= 1)&&(Math.round(j) <= 30))) { correct = true; } else { if((Math.round(j) >= 1)&&(Math.round(j) <= 29)) { if(bi) correct = (((Math.round(j) >= 1)&&(Math.round(j) <= 29))&&(m == "02")); else correct = (((Math.round(j) >= 1)&&(Math.round(j) <= 28))&&(m == "02")); }}}}; if (correct) obj.value=DateRep; }; return correct; }
function is_datetime (obj)		{ var correct=false; if((obj.length < 20)&&(obj.length > 11)) { ladate = obj.substring(0,10); heure = obj.substring(11,13); minute = obj.substring(14,16); seconde = obj.substring(17,obj.length); if(is_date(ladate)&&(Math.round(heure) >= 0)&&(Math.round(heure) <= 23)&&(Math.round(minute) >= 0)&&(Math.round(minute) <= 59)&&(Math.round(seconde) >= 0)&&(Math.round(seconde) <= 59)) correct=true; if(obj.substring(10,11)!=" ") correct=false; }; return correct; }
function openWin(zURL,zName,zf)	{ window.open(zURL,zName,zf); }
function pop_up_s(url)			{ var newin = window.open(url,"newin","top=0,left=0,height=200,width=200,scrollbars=yes,status=no"); newin.focus(); }
function is_email(emailStr)		{ return emailCheck(emailStr) }
function emailCheck (emailStr)	{
	var checkTLD=1; var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; var emailPat=/^(.+)@(.+)$/; var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; var validChars="\[^\\s" + specialChars + "\]"; var quotedUser="(\"[^\"]*\")"; var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; var atom=validChars + '+'; var word="(" + atom + "|" + quotedUser + ")"; var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); var matchArray=emailStr.match(emailPat); if (matchArray==null) { return false; }; var user=matchArray[1]; var domain=matchArray[2]; for (i=0; i<user.length; i++) { if (user.charCodeAt(i)>127) { return false; } }
	for (i=0; i<domain.length; i++) { if(domain.charCodeAt(i)>127) { return false; } }; if (user.match(userPat)==null) { return false; }; var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { for(var i=1; i<=4; i++) { if (IPArray[i]>255) { return false; }}; return true; }; var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i<len;i++) { if(domArr[i].search(atomPat)==-1) { return false; } }; if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) { return false; }; if (len<2) { return false; }; return true; 
	}

function pub() {
	if(ns4) {
		document.publicite.left = ((window.innerWidth/2)-96);
		document.menuleft.left = ((window.innerWidth/2)-407);
		document.sky.left = ((window.innerWidth/2)+380);
		}
	else if(ie) {
		publicite.style.left = parseInt((document.body.clientWidth)/2)-88;
		menuleft.style.left = parseInt((document.body.clientWidth)/2)-399;
		sky.style.left = parseInt((document.body.clientWidth)/2)+388;
		}
	else {
		document.getElementById("publicite").style.left = ((window.innerWidth/2)-96);
		document.getElementById("menuleft").style.left = ((window.innerWidth/2)-407);
		document.getElementById("sky").style.left = ((window.innerWidth/2)+380);
		}
	}

function rotapub() {
	document.write("<div align='center' id='publicite' style='position:absolute; top:12px; height:60px; width:468px;' name='publicite'>");
	document.write("<IFRAME src='/pub/rotapub.php' width=468 height=60 scrolling=no frameborder='0'>Publicit&eacute; agricole</IFRAME>");
	document.write("</div>");
	}

function rotapubnew() {
	document.write("<div id='publicite' style='position:absolute; height:60px; width:468px;'>");
	document.write("<IFRAME src='/pub/rotapub.php' width=468 height=60 scrolling=no frameborder='0'>Publicit&eacute; agricole</IFRAME>");
	document.write("</div>");
	}

function rotasky() {
	document.write("<div align='center' id='sky' style='position:absolute; top:85px; left:1000px; height:600px; width:120px;' name='sky'>");
	document.write("<IFRAME src='/pub/rotasky.php' width=120 height=600 scrolling=no frameborder='0'>Publicit&eacute; agricole</IFRAME>");
	document.write("</div>");
	}

function rotaskynew() {
	document.write("<div align='center' id='skynew' style='position:absolute; top:120px; left:780px; height:600px; width:120px;' name='skynew'>");
	document.write("<IFRAME src='/pub/rotasky.php' width=120 height=600 scrolling=no frameborder='0'>Publicit&eacute; agricole</IFRAME>");
	document.write("</div>");
	}