function showMenu(obj, repere) {
	
	if(document.getElementById('ul_orange')) document.getElementById('ul_orange').style.display = "none";
	if(document.getElementById('ul_vert')) document.getElementById('ul_vert').style.display = "none";
	if(document.getElementById('ul_rose')) document.getElementById('ul_rose').style.display = "none";
	if(document.getElementById('ul_bleu')) document.getElementById('ul_bleu').style.display = "none";
	
	document.getElementById('ul_'+repere).style.position = "absolute";
	var posX = document.getElementById('men_'+repere).offsetLeft;
	//alert(posX);
	var posY = document.getElementById('men_'+repere).offsetTop;	
	
	var IE6 = false 
	var strChUserAgent = navigator.userAgent; 
	var intSplitStart = strChUserAgent.indexOf("(",0); 
	var intSplitEnd = strChUserAgent.indexOf(")",0); 
	var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd); 
	if(strChMid.indexOf("MSIE 6") != -1) IE6 = true;	


	var IE7 = false 
	var strChUserAgent = navigator.userAgent; 
	var intSplitStart = strChUserAgent.indexOf("(",0); 
	var intSplitEnd = strChUserAgent.indexOf(")",0); 
	var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd); 
	if(strChMid.indexOf("MSIE 7") != -1) IE7 = true;	

	
	if(IE6) {
		posY = posY+270;
		posX = posX+15;
	}else if(IE7) {
		posY = posY+263;
		posX = posX+15;		
	}else{
		posY = posY+45;
	}
	document.getElementById('ul_'+repere).style.left = posX+"px";
	document.getElementById('ul_'+repere).style.top = posY+"px";
	document.getElementById('ul_'+repere).style.display = "block";
	
}

function hideMenu(obj, repere) {
	document.getElementById('ul_'+repere).style.display = "none";
}


var fondDiv = false;
var dataDiv = false;

function addPanier(idForm)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '395px',
	   height: '253px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-125) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/panier-change-ajax.php',
		{
			method: 'get',
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {
			
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$('select.visiblect').setStyles({visibility: 'visible' });				
				$$(dataDiv).setStyles({visibility: 'visible' });

				new Ajax(
					'/ajax/updatePanier.php',
					{
						update: $('header_panier'),
						data:$(idForm).toQueryString(),
						onSuccess: function(req2) {
							new Ajax(
								'/ajax/updatePanier2.php',
								{							
									update: $('panier_gauche')
								}
							).request();
						}
					}
				).request();
				
			},
			evalScripts: true
		}
	).request();
	
}


function removeDivPanier()
{
	if(fondDiv){
		$(fondDiv).remove();
		fondDiv = false;
	}	

	if(dataDiv){
		$(dataDiv).remove();
		dataDiv = false;
	}	
	
	$$('select').setStyles({visibility: 'visible' });		
}

function processPanier(v, id){ 
	
	var save = document.getElementById('qte'+id).value;

	if (v == "plus") {
		document.getElementById('qte'+id).value = parseInt(save,10) + 1; 
	}else{
		document.getElementById('qte'+id).value = save-1; 

	}
}


function openFormCatalogue() {
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '395px',
	   height: '435px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-217) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});	
	
	new Ajax(
		'/ajax/openFormCatalogue.php',
		{
			method: 'get',
			update: dataDiv,
			data:"",
			onSuccess: function(req) {
			
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$('select.visiblect').setStyles({visibility: 'visible' });				
				$$(dataDiv).setStyles({visibility: 'visible' });


				
			},
			evalScripts: true
		}
	).request();	
	
}

function checkopenformcatalogue(on) {
	new Ajax(
		'/ajax/openFormCatalogue.php',
		{
			method:'post',
			update: dataDiv,
			data:$('formnewsletter').toQueryString(),
			onSuccess: function(req) {
				update:$('arrDebug')
			},
			evalScripts: true
		}
	).request();		


}


function openFormCatalogueBlock() {
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '395px',
	   height: '435px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-217) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});	
	
	new Ajax(
		'/ajax/openFormCatalogueBlock.php',
		{
			method: 'get',
			update: dataDiv,
			data:"",
			onSuccess: function(req) {
			
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$('select.visiblect').setStyles({visibility: 'visible' });				
				$$(dataDiv).setStyles({visibility: 'visible' });


				
			},
			evalScripts: true
		}
	).request();	
	
}

function checkopenformcatalogueBlock(on) {
	new Ajax(
		'/ajax/openFormCatalogueBlock.php',
		{
			method:'post',
			update: dataDiv,
			data:$('formnewsletter').toQueryString(),
			onSuccess: function(req) {
				update:$('arrDebug')
			},
			evalScripts: true
		}
	).request();		
	
	
	
	

}


function blocksite() {
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '395px',
	   height: '308px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-154) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});	
	
	new Ajax(
		'/ajax/blocksite.php',
		{
			method: 'get',
			update: dataDiv,
			data:"",
			onSuccess: function(req) {
			
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$('select.visiblect').setStyles({visibility: 'visible' });				
				$$(dataDiv).setStyles({visibility: 'visible' });


				
			},
			evalScripts: true
		}
	).request();		
}


function lockCoordonnee() {
	$('adresse_societe2').readOnly  = true;
	$('acivilite_id').disabled  = true;
	$('client_nom').readOnly  = true;
	$('client_prenom').readOnly  = true;
	$('adresse_rue').readOnly  = true;
	$('adresse_rue2').readOnly  = true;
	$('adresse_cp').readOnly  = true;
	$('adresse_ville').readOnly  = true;
	$('apays_id').disabled  = true;
	$('adresse_telephone').readOnly  = true;
	
	
	$('adresse_societe').readOnly  = true;
	$('acivilite_id2').disabled  = true;
	$('client_nom2').readOnly  = true;
	$('client_prenom2').readOnly  = true;
	$('adresse_rue21').readOnly  = true;
	$('adresse_rue22').readOnly  = true;
	$('adresse_cp2').readOnly  = true;
	$('adresse_ville2').readOnly  = true;
	$('apays_id2').disabled  = true;
	$('adresse_telephone2').readOnly  = true;	
	
}

function unlockLivraison() {
	$('adresse_societe').readOnly  = false;
	$('acivilite_id').disabled  = false;
	$('client_nom').readOnly  = false;
	$('client_prenom').readOnly  = false;
	$('adresse_rue').readOnly  = false;
	$('adresse_rue2').readOnly  = false;
	$('adresse_cp').readOnly  = false;
	$('adresse_ville').readOnly  = false;
	$('apays_id').disabled  = false;
	$('adresse_telephone').readOnly  = false;	
}


function unlockFacturation() {
	$('adresse_societe').readOnly  = false;
	$('acivilite_id2').disabled  = false;
	$('client_nom2').readOnly  = false;
	$('client_prenom2').readOnly  = false;
	$('adresse_rue21').readOnly  = false;
	$('adresse_rue22').readOnly  = false;
	$('adresse_cp2').readOnly  = false;
	$('adresse_ville2').readOnly  = false;
	$('apays_id2').disabled  = false;
	$('adresse_telephone2').readOnly  = false;		
}



function openFormDoc(doc) {
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '395px',
	   height: '435px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-217) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});	
	
	new Ajax(
		'/ajax/openFormDoc.php',
		{
			method: 'post',
			update: dataDiv,
			data:"doc="+doc,
			onSuccess: function(req) {
			
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$('select.visiblect').setStyles({visibility: 'visible' });				
				$$(dataDiv).setStyles({visibility: 'visible' });


				
			},
			evalScripts: true
		}
	).request();	
	
}

function checkopenformdoc(on) {
	new Ajax(
		'/ajax/openFormDoc.php',
		{
			method:'post',
			update: dataDiv,
			data:$('formnewsletter').toQueryString(),
			onSuccess: function(req) {
				update:$('arrDebug')
			},
			evalScripts: true
		}
	).request();		


}
