function det(ki){
	var trs = document.getElementById('tableau').getElementsByTagName('tr');
	
	for(i=1 ; i<trs.length ; i++){
		if(trs[i] && trs[i].className!='gamme' && trs[i].className!='top'){
			trs[i].className='ligne';
		}
	}
	document.getElementById('ligne'+ki).className='tabon';
}
function visib(){				
	if(iepourri){
		to = parseInt(document.documentElement.scrollTop);
		document.getElementById('tophead').style.top=to+'px';
		document.getElementById('tophead').style.position='absolute';
	}
	else{
		to = parseInt(window.pageYOffset);
	}
	if(to>310) document.getElementById('tophead').style.display='block';
	else document.getElementById('tophead').style.display='none';
	setTimeout('visib()',100);				
}


function envoyer(val,ret)  { 
	var xajax = null; 
	if(document.getElementById(ret)){
		var div = document.getElementById(ret);
		div.innerHTML = 'chargement...<br>'+div.innerHTML;
	}
		if(window.XMLHttpRequest) xajax = new XMLHttpRequest(); 
		else if(window.ActiveXObject) xajax = new ActiveXObject("Microsoft.XMLHTTP"); 
		else return(false); 
		xajax.open("POST",path+"/ajax.php?path="+path,false); 
		xajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
		xajax.send(val); 
		if(xajax.readyState == 4) {
			if(document.getElementById(ret)){
				div.innerHTML = xajax.responseText; 
				return true;
			}
			else{
				return xajax.responseText; 
			}
		} 		
	return false;
}

function addpanier(ki,ou){
	maj = envoyer('act=majbox&quant=1&id='+ki);
	if(ou){
		if(maj==false){
			ou.innerHTML=" ERROR #1";	
		}
		else{
			ou.innerHTML=maj;
		}
	}
	else{
		return maj;	
	}
}
function refreshpage(){
	dat=new Date();
		document.getElementById('comm').action=path+chem+'?d='+dat.getTime()+'#tab';
		document.getElementById('comm').submit();
}
function majcom(ki,quant,ou){
	maj = envoyer('act=majbox&id='+ki+'&quant='+quant);
	if(maj==false){
		ou.innerHTML=" ERROR #1";	
	}
	else{
		refreshpage();
	}
}
function imprime(){
	if(self.name){
		self.print();
	}
	else{
		var popup = window.open(path+'/commande.php','popup','width=520,height='+(screen.height-30)+',top=15,left=200,resizable=1,scrollbars=1');
		document.getElementById('comm').action=	path+'/commande.php';
		document.getElementById('comm').target='popup';
		document.getElementById('comm').submit();
	}
}
