var flag = false;
function ImgLoad() 
{
    if (document.images) 
	{
        Search_on = new Image(); Search_on.src = WebSite+"/img/adt/Search_on.gif";
		Localisation_on = new Image(); Localisation_on.src = WebSite+"/img/adt/Localisation_on.gif";
		Contact_on = new Image(); Contact_on.src = WebSite+"/img/adt/Contact_on.gif";
		News_on = new Image(); News_on.src = WebSite+"/img/adt/News_on.gif";
		SiteMap_on = new Image(); SiteMap_on.src = WebSite+"/img/adt/SiteMap_on.gif";
        return (flag = true);  // set the flag and let the function know know it can work
    }
}
if (document.images) 
{
	Search_off = new Image(); Search_off.src = WebSite+"/img/adt/Search_off.gif";
	Localisation_off = new Image(); Localisation_off.src = WebSite+"/img/adt/Localisation_off.gif";
	Contact_off = new Image(); Contact_off.src = WebSite+"/img/adt/Contact_off.gif";
	News_off = new Image(); News_off.src = WebSite+"/img/adt/News_off.gif";
	SiteMap_off = new Image(); SiteMap_off.src = WebSite+"/img/adt/SiteMap_off.gif";
}
function rollIn(imgName) 
{
    if (document.images && (flag == true)) 
		document[imgName].src = eval(imgName + "_on.src");
}
function rollOut(imgName) 
{
    if (document.images)
		document[imgName].src = eval(imgName + "_off.src");
}
/*function openWindow(url, name, theFeats) 
{
	popupWin = window.open(url, name, theFeats);
	popupWin.focus();
}
*/
function openWindow(url, name, thewidth, theheight, theFeats) 
{
	if (theFeats == 1 || theFeats == 'minimal')
	{
		theFeats =   "top=0,left=0,location=no,menubar=no,resizable,scrollbars=no,status=no,toolbar=no";
		popupWin = window.open(url, name, theFeats+',width='+thewidth+',height='+theheight)
	}
	if (theFeats == 2 || theFeats == 'maximal')
	{
		theFeats =   "top=0,left=0,resizable,menubar,toolbar,location,directories,status,scrollbars,dependent";
		popupWin = window.open(url, name,theFeats+',width='+thewidth+',height='+theheight)
	}
	if (theFeats == 3 || theFeats == 'medium')
	{
		theFeats =   "top=0,left=0,resizable,menubar,toolbar,location,status,scrollbars,dependent";
		popupWin = window.open(url, name,theFeats+',width='+thewidth+',height='+theheight)
	}
	else
	{
		if (theFeats)
		{
			popupWin = window.open(url, name,theFeats+',width='+thewidth+',height='+theheight)
		}
		else
		{
			popupWin = window.open(url, name,+',width='+thewidth+',height='+theheight)
		}
	}
	popupWin.focus();
}
var errfound_search_form = false;
function stripSpaces(item) {
    while (item.substring(0,1) == ' ') item = item.substring(1);
    while (item.substring(item.length-1,item.length) == ' ') item = item.substring(0,item.length-1);
	return item;
}
function error_search_form(elem, text) {
	if (errfound_search_form) return;
	window.alert(text);
	elem.select();
	elem.focus();
	errfound_search_form = true;
	}
	
function error(elem, text) {
	if (Admin_errfound) return;
	window.alert(text);
	elem.select();
	elem.focus();
	Admin_errfound = true;
	}
function ListFind(item) 
{
	var List = location.pathname;
	List = List.split('/');
	var CharFound = false;
	for (j = 0;  j < List.length;  j++)
	{
		if (item == List[j])
		{
		    CharFound = true;
			break;
		}
	}
  return CharFound;
}
function ValidEmail(item) {
	if (!TailleMin(item, 6)) return false;
	if (item.indexOf ('@', 0) == -1) return false;
	if (item.indexOf ('.', 0) == -1) return false;
	if (!CharValidMail(item)) return false;
	return true;
	}
function noframe() {
	if (top.frames.length!=0)
	{
		if (top.frames[0].name != 'textedit' && (!(ListFind("Chat") || ListFind("chat"))))
			top.location=self.document.location; 
	}
}
function TailleMin(item, len) 
{
	return (item.length >= len);
}
