function init_js(){
	if (self.parent.frames.length != 0) self.parent.location='/';	
	rollOvers();
	prel('menu-on-01.gif','menu-on-02.gif','menu-on-03.gif','menu-on-04.gif','menu-on-05.gif','top-on.gif');	
}

function prel() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=prel.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src='/images/'+a[i];}}
}

function rollOvers(){
	if (!document.getElementById) return
	
	var imgOriginSrc;
	var MouseOverHappened;
	var oldtop;
	var imgTemp = new Array();
	var imgarr = document.getElementsByTagName('img');
	
	for (var i = 0; i < imgarr.length; i++) {
		//Attribut hsrc pour Rollovers
		if (imgarr[i].getAttribute('hsrc')) {
			imgTemp[i] = new Image();
			imgTemp[i].src = imgarr[i].getAttribute('hsrc');
			imgarr[i].onmouseover = function() {
				imgOriginSrc = this.getAttribute('src');			
				this.setAttribute('src',this.getAttribute('hsrc'));
				MouseOverHappened=true;
			}
			imgarr[i].onmouseout = function() {
				if(MouseOverHappened)
					this.setAttribute('src',imgOriginSrc);
			}
		}
	
		//Attribut csrc pour action de click comme boutons
		if (imgarr[i].getAttribute('csrc')) {
			imgTemp[i] = new Image();
			imgTemp[i].src = imgarr[i].getAttribute('csrc');
			imgarr[i].onmousedown = function() {
				imgOriginSrc = this.getAttribute('src');			
				this.setAttribute('src',this.getAttribute('csrc'));
				MouseOverHappened=true;
			}
			imgarr[i].onmouseup = function() {
				if(MouseOverHappened)
					this.setAttribute('src',imgOriginSrc);
			}
		}
	}
}

window.onload=init_js;

function sendMessage(hndl){
	
	if(validForm(hndl)){
		callAjax(url+'_addDemande.php',null,document.getElementById("formContainer"),hndl);
	}
}

sfHover = function() {
	var sfEls = document.getElementById("MenuUL").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
