var Idxa = 0;
var aff = 0;
var numaff;
var num1;

function pull(){
	if (window.drawit)
		clearInterval(drawit)
	pullit=setInterval("pullengine()",10)
}

function draw(){
	clearInterval(pullit)
	drawit=setInterval("drawengine()",10)
}

function pullengine(){
	if (document.all&&themenu.style.pixelTop<rightboundary)
		themenu.style.pixelTop+=10
	else if(document.layers&&themenu.top<rightboundary)
		themenu.top+=10
	else if (window.pullit) {
		if (document.all) {
			if ( nav == 'ie_mac_4.5' ) {
				themenu.style.pixelTop=45
			} else {
				themenu.style.pixelTop=45
			}
		} else {
			themenu.top=45
		}
		clearInterval(pullit)
		if (document.all) {
			themenu.style.zIndex=3;
		} else {
			themenu.zIndex=3;
		}	
		if (document.all){
			document.all.sorti1.style.visibility='visible';
			document.all.sorti2.style.visibility='visible';
		} else {
			document.layers.sorti1.visibility='show';
			document.layers.sorti2.visibility='show';
		}
	}	
}

function drawengine(){
	if (document.all&&themenu.style.pixelTop>leftboundary)
		themenu.style.pixelTop-=10
	else if(document.layers&&themenu.top>leftboundary){
		themenu.top-=10
		}
	else if (window.drawit) {
		clearInterval(drawit)
		if ( num1 != numaff ) {
			affiche(numaff);
		} 
	}  
}

function affiche(num){

	if ( num != 0 ) {
		numaff = num;
		if ( aff == 0 ) {
			verifpos();
			menu(num);
			affecte();			
			pull();
			aff = 1;
			num1 = num;
		} else {
			active();
			draw();
			aff = 0;
		}	
	} else {
		active();
		draw();
		aff = 0;	
	}	
}

function active(){
	if (document.all) {
		themenu.style.zIndex=1;
	} else {
		themenu.zIndex=1;
	}	
	if (document.all){
		document.all.sorti1.style.visibility='hidden';
		document.all.sorti2.style.visibility='hidden';
	} else {
		document.layers.sorti1.visibility='hidden';
		document.layers.sorti2.visibility='hidden';
	}
}

function menu(num) {
	if (document.all){
		tmenu='document.all.sousmenu'+num;
		themenu=eval(tmenu);
	} else {
		tmenu='document.layers.sousmenu'+num;
		themenu=eval(tmenu);
	}
}

function affecte() {
	if (document.all){
		if ( nav == 'ie_mac_4.5' ) {
			leftboundary=-themenu.offsetHeight-85;
		} else {
			leftboundary=-eval(themenu.offsetHeight)+45;
		}
	} else {
		leftboundary=45-themenu.clip.height;
	}
	rightboundary=35;	
}

function verifpos() {
	for ( i = 1; i < 7; i++){
 		menu(i);
 		if (document.all&&themenu.style.pixelTop>-85) {
			if ( nav == 'ie_mac_4.5' ) {
				leftboundary=-themenu.offsetHeight-85;
			} else {
				leftboundary=-themenu.offsetHeight+45;
			}
			themenu.style.pixelTop=leftboundary;
		}	
		else if(document.layers&&themenu.top>-85) {
			leftboundary=45-themenu.clip.height;
			themenu.top=leftboundary;
		}	
	} 
}

function ent(num) {
	string = "" + num;
	if (string.indexOf('.') == -1) return string;
	separation = string.length - string.indexOf('.');
	return string.substring(0,string.length-separation);
}
