//Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

function makevisible(cur,which){
strength=(which==0)? 1 : 0.2

if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}

<!-- 
function stopError() 
{ 
return true; 
} 
window.onerror=stopError; 
//--> 

function popUp(url)
	{
    fenetre=window.open(url,"calendrier","resizable=no,width=400,height=200,scrollbars=no,left=250,top=220");
	fenetre.focus();
	}

//var message="";
  // function clickIE() {if (document.all) {(message);return false;}}
  // function clickNS(e){
  //   if (document.layers||(document.getElementById&&!document.all)) {
   //    if (e.which==2||e.which==3) {(message);return false;}}}
   //  if (document.layers){
    //   document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
    // }
    // else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
  //   document.oncontextmenu=new Function("return false")

function Start(page) {

OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no,alwaysRaised=yes,width=550,height=500")

}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function printpage()
{
window.print()
}


function show(menu)
{
document.all(menu).style.visibility="visible";
}
function hide(menu)
{
document.all(menu).style.visibility="hidden"
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized

  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

function popupcentree(page,largeur,hauteur,options)
{
var top=(screen.height-hauteur)/2;
var left=(screen.width-largeur)/2;
window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function CheckForm(form)
{
	var i;
	var arr;
	var str;
	var x;
	
	for (i=0;i<form.elements.length;i++)
	{
		if(form.elements[i].name.substr(0,4) == "CHK_")
		{			
			
			str = GetFieldValueByName(form,form.elements[i].name.substr(4));
			
			if(str != null)
			{
			
				str = Trim(str);
							
				arr = form.elements[i].value.split("|");			
				
				switch(arr[0])
				{
					case "STR":
						//check mandatory field							
						if ((str.length == 0) && (arr[3] == "True"))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check min length	
						if (str.length < parseInt(arr[1]))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check max length
						if (str.length > parseInt(arr[2]))
						{
							alert("" + arr[4] + "");
							return false;
						}
							break;
							case "NUM":
						//check mandatory field							
						if ((str.length == 0) && (arr[3] == "True"))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check min length	
						if (str.length < parseInt(arr[1]))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check max length
						if (str.length > parseInt(arr[2]))
						{
							alert("" + arr[4] + "");
							return false;
						}
						//check sanity
						if(!(IsNumeric(str)))
						{
							alert("" + arr[4] + "");
							return false;
						}
							break;
							
						case "EMAIL":
	
					if (str.indexOf('@')==-1)
					{
					alert("" + arr[4] + "");
							return false;
						}
					if (str.indexOf('.')==-1)
					{
					alert("" + arr[4] + "");
							return false;
						}
					break;
						
					case "INT":
																
						//check mandatory field
						if ((str.length == 0) && (arr[3] == "True"))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check sanity
						if(!(IsNumeric(str)))
						{
							alert("" + arr[4] + "");
							return false;
						}
												
						//check min value
						if (arr[1] != "x")
						{
							if (parseInt(str) < parseInt(arr[1]))
							{
								alert("" + arr[4] + "");
								return false;
							}
						}
						
						//check max length
						if (arr[2] != "x")
						{
							if (parseInt(str) > parseInt(arr[2]))
							{
								alert("" + arr[4] + "");
								return false;
							}
						}
						
						break;
					
					case "FLOAT":
																		
						//check mandatory field
						if ((str.length == 0) && (arr[3] == "True"))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check sanity
if(!(IsNumeric(str)))
						{
							alert("" + arr[4] + "");
							return false;
						}
												
						//check min value
						if (arr[1] != "x")
						{
							if (parseFloat(str) < parseFloat(arr[1]))
							{
								alert("" + arr[4] + "");
								return false;
							}
						}
						
						//check max length
						if (arr[2] != "x")
						{
							if (parseFloat(str) > parseFloat(arr[2]))
							{
								alert("" + arr[4] + "");
								return false;
							}
						}
						
						break;
										
						
					case "DATE":
						
						//check mandatory field
						if ((str.length == 0) && (arr[3] == "True"))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check sanity
						if(!(IsDate(str)))
						{
							alert("" + arr[4] + "");
							return false;
						}
						
						//check min value
						if (arr[1] != "x")
						{
							if (GetDate(str) < GetDate(arr[1]))
							{
								alert("" + arr[4] + "");
								return false;
							}
						}
						
						//check max length
						if (arr[2] != "x")
						{
							if (GetDate(str) > GetDate(arr[2]))
							{
								alert("" + arr[4] + "");
								return false;
							}
						}
						
						break;
				}
			}
		}
	}

}

//============================================================================================

function Replace(string,replacechar,replacewith) 
{
	var temp = "";
	var i;
	
	string = '' + string;
	splitstring = string.split(replacechar);
	for(i = 0; i < splitstring.length; i++)
	{
		if(i < (splitstring.length -1))
			temp += splitstring[i] + replacewith;
		else
			temp += splitstring[i];
	}
	return temp;
}

//============================================================================================

function GetFieldValueByName(form,name)
{
	var i;
	
	for (i=0;i<form.elements.length;i++)
	{
		if(form.elements[i].name == name)
			return (form.elements[i].value);
	}
	return null
}

/*

======================= STANDARD HELPER FUNCTIONS BELOW =======================================

*/
function IsNumeric(str)
{
	var i;
	for(i=0;i<str.length;i++)
	{
		if(!(	((str.charAt(i) <= '9') && (str.charAt(i) >= '0')) ||
				(str.charAt(i) == ' ') || (str.charAt(i) == '.') || (str.charAt(i) == '-')))
			return(false);
	}
	return(true);
}

//============================================================================================

function IsAlphaNumeric(str)
{
	var i;
	for(i=0;i<str.length;i++)
	{
		if(!(	((str.charAt(i) <= '9') && (str.charAt(i) >= '0')) ||
				((str.charAt(i) <= 'z') && (str.charAt(i) >= 'a')) ||
				(str.charAt(i) == ' ') || (str.charAt(i) == '-') ||
				(str.charAt(i) == 'ü') || (str.charAt(i) == 'ä') ||
				(str.charAt(i) == 'ö') || (str.charAt(i) == 'Ü') ||
				(str.charAt(i) == 'Ä') || (str.charAt(i) == 'Ö') ||
				(str.charAt(i) == 'é') || (str.charAt(i) == 'ß') ||
				((str.charAt(i) <= 'Z') && (str.charAt(i) >= 'A')) ))
			return(false);
	}
	return(true);
}

//============================================================================================

function IsAlpha(str)
{
	var i;
	
	for(i=0;i<str.length;i++)
	{
		if(!(	((str.charAt(i) <= 'z') && (str.charAt(i) >= 'a')) ||
				(str.charAt(i) == ' ') || (str.charAt(i) == '-') ||
				(str.charAt(i) == 'ü') || (str.charAt(i) == 'ä') ||
				(str.charAt(i) == 'ö') || (str.charAt(i) == 'Ü') ||
				(str.charAt(i) == 'Ä') || (str.charAt(i) == 'Ö') ||
				(str.charAt(i) == 'é') || (str.charAt(i) == 'ß') ||
				((str.charAt(i) <= 'Z') && (str.charAt(i) >= 'A')) ))
			return(false);

	}
	return(true);
}

//============================================================================================

function Trim(str)
{
	//trim leding spaces
	while(true)
	{
		if(str.charAt(0) == ' ')
			str = str.substr(1);
		else
			break;
	}
	
	//trim trailing spaces
	while(true)
	{
		if(str.charAt(str.length-1) == ' ')
			str = str.substr(0,str.length-1);
		else
		break;
	}
	return(str);	
}

//============================================================================================

function IsDate(argDate)
{
	var date_split;
	var i;
	var tdate, tmonth, tyear;
	
	date_split = argDate.split('/');
	
	//check for date parts
	if(date_split.length != 3)
		return(false);
		
	//check for zero values
	for(i=0;i<date_split.length;i++)
	{
		if(parseInt(date_split[i]) == 0)
			return(false);
	}
	
	//check for 4-digit year
	if(date_split[2].length != 4)
		return(false);
		
	//check for valid date, e.g. 02/29/1997
	tdate = parseInt(date_split[1]);
	tmonth = parseInt(date_split[0]);
	tyear = parseInt(date_split[2]);
	
	var date = new Date(parseInt(date_split[2]),parseInt(date_split[0])-1,parseInt(date_split[1]));
	
	if(date.getDate() != tdate)
		return(false);
	
	if(date.getMonth() != (tmonth-1))
		return(false);
	
	if(date.getFullYear() != tyear)
		return(false);
		
	return(true);
}


function GetDate(argDate)
{
	//use IsDate() first !!!!
	
	var date_split;	
	var tdate, tmonth, tyear;
	
	date_split = argDate.split('/');
	
		
	
	tdate = parseInt(date_split[1]);
	tmonth = parseInt(date_split[0]);
	tyear = parseInt(date_split[2]);
	
	return date = new Date(parseInt(date_split[2]),parseInt(date_split[0])-1,parseInt(date_split[1]));
		
}




var list; // global list variable cache
var tickerObj; // global tickerObj cache
var hex = 255;

function fadeText(divId) {
  if(tickerObj)
  {
    if(hex>0) {
      hex-=5; // increase color darkness
      tickerObj.style.color="rgb("+hex+","+hex+","+hex+")";
      setTimeout("fadeText('" + divId + "')", fadeSpeed); 
    } else
      hex=255; //reset hex value
  }
}

function initialiseList(divId) {
  tickerObj = document.getElementById(divId);
  if(!tickerObj)
    reportError("Could not find a div element with id \"" + divId + "\"");
  list = tickerObj.childNodes;
  if(list.length <= 0)
    reportError("The div element \"" + divId + "\" does not have any children");
  for (var i=0; i<list.length; i++) {
    var node = list[i];
    if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
              tickerObj.removeChild(node);
  }
  run(divId, 0);
}

function run(divId, count) {
  fadeText(divId);
  list[count].style.display = "block";
  if(count > 0)
    list[count-1].style.display = "none";
  else
    list[list.length-1].style.display = "none";
  count++;
  if(count == list.length)
    count = 0;
  window.setTimeout("run('" + divId + "', " + count+ ")", interval*1000);
}
function reportError(error) {
  alert("The script could not run because you have errors:\n\n" + error);
  return false;
}

var interval = 3; // interval in seconds
var fadeSpeed = 40; // fade speed, the lower the speed the faster the fade.  40 is normal.



