/********************************************************************************************************************************************************
	TOOLTIP
*********************************************************************************************************************************************************/

function tipz() {
	
		$$('.tipz').each(function(element,index) {
		    var content = element.get('title');
		    element.store('tip:title', content);
		});
		
		//create the tooltips
		var tipz = new Tips('.tipz',{
		    className: 'tipz',
		    fixed: false,
		    showDelay: 0,
		    hideDelay: 0
		});
		  
}

/********************************************************************************************************************************************************
	MOVE X Y
*********************************************************************************************************************************************************/

function moveItemNoY(item,x,t){

	item.set('tween', {duration: t});
	item.tween('margin-left', x);
				
}

function moveItemNoX(item,y,t){

	item.set('tween', {duration: t});
	item.tween('margin-top', y);
				
}

/********************************************************************************************************************************************************
	GO PAGE
*********************************************************************************************************************************************************/

function goPage(p,b){
	
	if(b == 1) {
	window.open(p);
	}else {
	window.location.href=''+p+'';
	}

}

/********************************************************************************************************************************************************
	MENU
*********************************************************************************************************************************************************/

function menuBG(i,n) {
	
	var s = parseFloat(i)*143;
	
	for(z=0;z<n;z++) {
	
		$('menuTitle'+z).style.color = '#373737';
	
	}
	
	moveItemNoY($('menuBG'),s,400);
	
	$('menuTitle'+i).style.color = '#FFFFFF';
	
}

function menuActive() {

	var i = $('menuActive').value;
	
	menuBG(i,6);
	
}

function menuActive2(c) {

	$('menuActive').value = c;
	
	menuBG(c,6);
	
}

function menuMouse() {
	
	(function wait() {
		
		var m = $('menuMouse').value;
		
		if(m == 0) {
		
			menuActive();
		
		} 
	
	}).delay(500);

}

/********************************************************************************************************************************************************
	PRODUITS SWITCH
*********************************************************************************************************************************************************/

function pbSwitch_products(z) {

	var nb = $('nbItems').value;
	
	for(i=0;i<nb;i++) {
	
		$('pb'+i).className = 'produits_blocBG';
		$('pit'+i).className = 'productImgTitle';
		
		$('contentContainer'+i).style.display = 'none';
		$('content'+i).style.display = 'none';
		
		var o = new Fx.Morph('content'+i, {duration: 0});
		o.start({'opacity': 0});
		
	}
	
	$('pb'+z).className = 'produits_blocBG2';
	$('pit'+z).className = 'productImgTitle2';
	
	$('contentContainer'+z).style.display = 'inline';
	$('content'+z).style.display = 'inline';
	
	var o = new Fx.Morph('content'+z, {duration: 500});
	o.start({'opacity': [0,1]});

}

function pbSwitch_products2(z) {

	var nb = $('nbItems').value;
	
	for(i=0;i<nb;i++) {
	
		$('pb'+i).className = 'produits_blocBG3';
		$('pit'+i).className = 'productImgTitle3';
		
		$('contentContainer'+i).style.display = 'none';
		$('content'+i).style.display = 'none';
		
		var o = new Fx.Morph('content'+i, {duration: 0});
		o.start({'opacity': 0});
		
	}
	
	$('pb'+z).className = 'produits_blocBG4';
	$('pit'+z).className = 'productImgTitle4';
	
	$('contentContainer'+z).style.display = 'inline';
	$('content'+z).style.display = 'inline';
	
	var o = new Fx.Morph('content'+z, {duration: 500});
	o.start({'opacity': [0,1]});

}

/********************************************************************************************************************************************************
	CONTACT FORM
*********************************************************************************************************************************************************/

function viderForm() {

	$('firstname').value = '';
	$('name').value = '';
	$('company').value = '';
	$('tva').value = '';
	
	$('address').value = '';
	$('numero').value = '';
	$('cp').value = '';
	$('city').value = '';
	$('country').value = '';
	
	$('phone').value = '';
	$('gsm').value = '';
	$('mail').value = '';
	
	$('sujet').value = '';
	$('message').value = '';

}

/********************************************************************************************************************************************************
	SHOP
*********************************************************************************************************************************************************/

function shopMoveTitleBG(i) {

	var s = i*143;
	var s2 = i*160;
	
	moveItemNoY($('shopTitleBG'),s,350);
	
	moveItemNoX($('shopMoveContainer'),-s2,350);

}

function changeComboShop(n,nCombo) {
	
	var s = $('comboShop_'+n+'_'+nCombo).selectedIndex;
	var v = $('comboShop_'+n+'_'+nCombo).options[s].value;
	
	$(n+'_'+nCombo).style.display = 'none';
	$(v+'_'+nCombo).style.display = 'inline';

}

function changeComboShop2(n,nCombo) {
	
	var s = $('comboShop_'+n+'_'+nCombo).selectedIndex;
	var v = $('comboShop_'+n+'_'+nCombo).options[s].value;
	
	$('div_'+n+'_'+nCombo).style.display = 'none';
	$('div_'+v+'_'+nCombo).style.display = 'inline';
	
	$('comboShop_'+n+'_'+nCombo).selectedIndex = n;
	
}


/********************************************************************************************************************************************************
	SHOP
*********************************************************************************************************************************************************/

function products_ajaxItem(id,sID) {
	
	new Request({
	url: 'products_ajaxItem.php?id='+id+'&sID='+sID+'', 
	evalScripts: true,
	onComplete: function(response) {
	    
	        $('detailItem').set('html', response);
	        
	        Mediabox.scanPage();
	    
	}}).send();
	

}

function ajouterPanier(id) {
	
	$('ajouter_panierBG'+id).style.display = 'inline';
	$('ajouterForm'+id).style.display = 'inline';
	$('ajouter_panier_close'+id).style.display = 'inline';
	
	var b = $('basketHidden'+id).value;
	
	if(b == 0) {
	
		new FormCheck('formNbItems'+id, {
		ajaxEvalScripts : true,
		submitByAjax : true
		});
		
		$('basketHidden'+id).value = 1;
		
	}

}

function fermerPanier(id) {
	
	$('ajouter_panier_close'+id).style.display = 'none';
	$('ajouterForm'+id).style.display = 'none';
	$('ajouter_panierBG'+id).style.display = 'none';
	
}

function visualiserPanier() {
	
	new Request({
	url: 'products_ajaxPanier.php', 
	evalScripts: true,
	onComplete: function(response) {
	    
	        $('detailItem').set('html', response);
	        
	        Mediabox.scanPage();
	        
	        new FormCheck('formAcheter');
	        	    
	}}).send();

}

function supprimerItem(idShop) {
	
	new Request({
	url: 'products_ajaxItemDelete.php?idShop='+idShop+'', 
	evalScripts: true,
	onComplete: function(response) {
	    
	        visualiserPanier();
	    
	}}).send();
	

}

function aa(t) {

	alert(t);

}

function fcItem($idShop) {

	var inp = $('formQtyHidden'+$idShop).value;
	
	if(inp == 0) {
	
		new FormCheck('formQty'+$idShop, {
		ajaxEvalScripts : true,
		submitByAjax : true
		});
		
		$('formQtyHidden'+$idShop).value = 1;
		
		$('submitButton'+$idShop).style.display = 'inline';
	
	}
	
}

function noPhoneNumber(id) {
	
	(function wait() {
	
		var c = $('noPhoneNumber'+id).checked;
		
		if(c == true) {
			
			$('recharge_number_input'+id).style.color = "#ffffff";
			$('recharge_number_input'+id).value = "111";
			
			var tab1top = new Fx.Morph('tab1top'+id, {duration: 500});
			tab1top.start({'opacity': [1,0]});
			
			var tab2top = new Fx.Morph('tab2top'+id, {duration: 500});
			tab2top.start({'margin-top': '-30px', 'margin-bottom': '30px'});
			
			var numPort = new Fx.Morph('numPort'+id, {duration: 0});
			numPort.start({'opacity': 0});
			
			(function wait() {
			
				$('numPort'+id).style.display = 'inline';
			
				var numPort = new Fx.Morph('numPort'+id, {duration: 500});
				numPort.start({'opacity': 1});
			
			}).delay(500);
				
		} else {
			
			$('recharge_number_input'+id).value = "";
			$('recharge_number_input'+id).style.color = "#0166a1";
			
			var tab1top = new Fx.Morph('tab1top'+id, {duration: 500});
			tab1top.start({'opacity': [0,1]});
			
			var tab2top = new Fx.Morph('tab2top'+id, {duration: 500});
			tab2top.start({'margin-top': '0px', 'margin-bottom': '0px'});
			
			var numPort = new Fx.Morph('numPort'+id, {duration: 500});
			numPort.start({'opacity': 0});
			
			(function wait() {
			
				$('numPort'+id).style.display = 'none';
				
			}).delay(500);
			
		}
	
	}).delay(250);
	

}




/********************************************************************************************************************************************************
	FAQ
*********************************************************************************************************************************************************/

function slideFunc(i) {
		
		var slide = new Fx.Slide('slide'+i);
		
		var sHidden = $('sHidden'+i).value;
		
		if(sHidden == 0) {
		
			slide.slideIn();
			
			$('sHidden'+i).value = 1;
		
		} else {
		
			slide.slideOut();
		
			$('sHidden'+i).value = 0;
		
		}

}

/********************************************************************************************************************************************************
	HOMEPAGE PRIVE
*********************************************************************************************************************************************************/

function png70(i) { 
	
	if(i != 0) {
	
		for(z=1;z<=4;z++) {
	
			$('blocLeftImg'+z).src = 'images/empty.png';
			
			$('tinyArrow'+z).style.visibility = 'hidden';
			
			$('blocBG'+z).style.visibility = 'hidden';
		
		}
	
		$('blocLeftImg'+i).src = 'images/pix.gif';
		
		$('tinyArrow'+i).style.visibility = 'visible';
		
		$('blocBG'+i).style.visibility = 'visible';
		
		
	
	} else {
	
		for(z=1;z<=4;z++) {
	
			$('blocLeftImg'+z).src = 'images/pix.gif';
			
			$('tinyArrow'+z).style.visibility = 'hidden';
			
			$('blocBG'+z).style.visibility = 'hidden';
		
		}
	
	}

}

function blocInit() {
	
	var blocInit = $('blocInit').value;
	
	//alert(blocInit);
	
	(function wait() {
	
		if(blocInit == 1) {
			
			$('blocInit').value = 0;
			
			png70(0);
		
		}
		
		startInit();
			
	}).delay(10);
	
}

function startInit() {

	 blocInit();

}

/********************************************************************************************************************************************************
	DEALERS
*********************************************************************************************************************************************************/

function showProvince(i) {

	for(z=1;z<=11;z++) {
	
		$('m'+z+'pic').style.display = 'none';
	
	}
	
	$('m'+i+'pic').style.display = 'inline';

}

function showDealers(i) {
	
	for(z=1;z<=11;z++) {
	
		$('zone'+z).style.display = 'none';
		
		var o = new Fx.Morph('zone'+i, {duration: 0});
		o.start({'opacity': 0});
	
	}
	
	(function wait() {
	
		$('zone'+i).style.display = 'inline';
		
		var o = new Fx.Morph('zone'+i, {duration: 500});
		o.start({'opacity': [0,1]});
	
	}).delay(200);
	

}

/********************************************************************************************************************************************************
	DEFILEMENT SLOGANS HOMEPAGE PRIVE
*********************************************************************************************************************************************************/

function slogans() {

	var nb = $('nbSlogans').value;
	var s = parseFloat($('stepSlogans').value);
	
	var d = $('slogansDelay').value;
	
	(function wait() {
	
		if(s < nb) {
			
			var step = s*50;
			
			if(s < (nb-1)) 	{$('stepSlogans').value = s+1;}
			else			{$('stepSlogans').value = 0;}
			
			moveItemNoX($('sloganMove'),-step,1000);
			
			slogans();
		
		}
	
	}).delay(d);
	


}



/********************************************************************************************************************************************************
	SHOP SWITCH
*********************************************************************************************************************************************************/

function pbSwitch_shop(z,familyGroup,sID,docID) {
	
	var nb = $('nbItems').value;
	
	for(i=0;i<nb;i++) {
	
		$('pb'+i).className = 'produits_blocBG';
		$('pit'+i).className = 'productImgTitle';
				
	}
	
	$('pb'+z).className = 'produits_blocBG2';
	$('pit'+z).className = 'productImgTitle2';
	
	$('detailItem').set('html', '<div align="center" style="margin-top:50px;"><img src="images/ajax-loader.gif" /></div>');
	
	(function wait() {
	
			new Request({
			url: 'shopAjax.php?sID='+sID+'&familyGroup='+familyGroup+'&docID='+docID+'', 
			evalScripts: true,
			onComplete: function(response) {
			    
			        $('detailItem').set('html', response);
			        
			        Mediabox.scanPage();
			    
			}}).send();
	
	}).delay(300);
	
}

function pbSwitch_shop2(z,familyGroup,sID,docID,lg) {
	
	var s = 1;
	
	if($('shopServer')) {
	
		var s = $('shopServer').value;
			
	}
	
	// pas de probleme serveur 
	
	if(s == 1) {
	
			var nb = $('nbItems').value;
			
			for(i=0;i<nb;i++) {
			
				$('pb'+i).className = 'produits_blocBG3';
				$('pit'+i).className = 'productImgTitle3';
						
			}
			
			$('pb'+z).className = 'produits_blocBG4';
			$('pit'+z).className = 'productImgTitle4';
			
			$('detailItem').set('html', '<div align="center" style="margin-top:50px;"><img src="images/ajax-loader.gif" /></div>');
			
			(function wait() {
			
					new Request({
					url: 'shopAjax.php?z='+z+'&sID='+sID+'&familyGroup='+familyGroup+'&docID='+docID+'&lg='+lg+'', 
					evalScripts: true,
					onComplete: function(response) {
					    
					        $('detailItem').set('html', response);
			        
			       			Mediabox.scanPage();
					    
					}}).send();
			
			}).delay(300);
	
	// le serveur est down 
	
	} else {
	
					new Request({
					url: 'shopOnOff_serverDown.php', 
					evalScripts: true,
					onComplete: function(response) {
					    
					        $('detailItem').set('html', response);
					    
					}}).send();
	
	}
	
}

/*
function custom_fax(el) {

var v = $('nrp').checked;
var v2 = $('recharge_number_fax').value;

if (v == true && v2 == '') {el.errors.push('this field is required !'); return false;} 
else {return true;}


}
*/


function changeDiv_BelgiumGN(idCountry,cntForDiv) {
	
	var divActive = $(idCountry+'_divActive').value;
	
	var s = $(idCountry+'_combo_'+cntForDiv).selectedIndex;
	var v = $(idCountry+'_combo_'+cntForDiv).options[s].value;
	
	$(idCountry+'_divActive').value = v;
	
	$(idCountry+'_'+divActive).style.display = 'none';
	$(idCountry+'_'+v).style.display = 'inline';
	
}



function changeShopCombo(i,gn){

	var s = $('combo_item_'+i).selectedIndex;
	var v = $('combo_item_'+i).options[s].value;
	
	/* on split la valeur pour avoir l'ID et le prix */
	
	var s = v.split('|');
	var c = s.length;
	
	// id
	
	$('id_item_'+i).value = s[0];
	
	// price
	
	var combo = $('cc_item_'+i);
	
	if(combo) {
	
		var t = $('cc_item_'+i).selectedIndex;
		var cc = $('cc_item_'+i).options[t].value;
		
		var nr_portability = $('nr_portability_item_'+i).value;
		var nr_portability2 = $('nr_portability2_item_'+i).value;
		
		s[1] = parseFloat(s[1])+parseFloat(cc)+parseFloat(nr_portability)+parseFloat(nr_portability2);
		
		s[1] = s[1].toFixed(2);
	
	}
	
	$('price2_item_'+i).set('text',s[1]);
	
	// ins_charge
	
	var charge = s[2];
	
	$('charge_item_'+i).value = parseFloat(charge);
	$('insCharge_item_'+i).set('text',charge);
	
	
	// month_charge
	
	if(gn == 0) {
	
		var month = s[3];
	
		$('month_item_'+i).value = parseFloat(month);
		$('monthCharge_item_'+i).set('text',month);
	
	}
	
	

}

function updateCallCredit_Belgium(i,n) {
	
	var s = $('cc_item_'+i).selectedIndex;
	var callCredit = $('cc_item_'+i).options[s].value;
	
	$('callCredit_item_'+i).value = callCredit;
		
	var yearlyFee = $('charge_item_'+i).value;
	
	var total = parseFloat(callCredit)+parseFloat(yearlyFee);
	
		var n1 = $('nr_portability_item_'+i).value;
		var n2 = $('nr_portability2_item_'+i).value;
	
		total = total+parseFloat(n1)+parseFloat(n2);
		
		
	total = total.toFixed(2);
	
	$('price_item_'+i).value = total;
	$('price2_item_'+i).set('text',total);
	
}


function updateCallCredit(i,n) {
	
	var s = $('cc_item_'+i).selectedIndex;
	var callCredit = $('cc_item_'+i).options[s].value;
	
	$('callCredit_item_'+i).value = callCredit;
		
	var charge = $('charge_item_'+i).value;
	
	var total = parseFloat(callCredit)+parseFloat(charge);
	
	if(n == 2) {
	
		var n1 = $('nr_portability_item_'+i).value;
		var n2 = $('nr_portability2_item_'+i).value;
	
		total = total+parseFloat(n1)+parseFloat(n2);
	
	}
	
	total = total.toFixed(2);
	
	$('price_item_'+i).value = total;
	$('price2_item_'+i).set('text',total);
	
}

function update_price_BelgiumGN(i,calc,p,b) {

		// Addition
		
		if(calc == 'yes') {
			
			
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(p)+parseFloat(price);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = p;
					
					$('loa'+i).style.display = 'inline';
					
					$('nr1_portability_'+i).value = 1;
					$('nr2_portability_'+i).value = 0;
			
			
		
		}
		
		if(calc == 'no') {
			
			
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(price)-parseFloat(p);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = 0;
					
					$('nr1_portability_'+i).value = 0;
					$('nr2_portability_'+i).value = 1;
			
			
		
		}

}

function update_price_faxCredit(i,calc,p,b) {

		// Addition
		
		if(calc == 'yes') {
			
			var s = $('nr1_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(p)+parseFloat(price);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = p;
					
					$('loa'+i).style.display = 'inline';
					
					$('nr1_portability_'+i).value = 1;
					$('nr2_portability_'+i).value = 0;
			}
			
		
		}
		
		if(calc == 'no') {
			
			var s = $('nr2_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(price)-parseFloat(p);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = 0;
					
					$('loa'+i).style.display = 'none';

					$('nr1_portability_'+i).value = 0;
					$('nr2_portability_'+i).value = 1;
			
			}
		
		}

}

function update_price_bng(i,calc,p,b) {

		// Addition
		
		if(calc == 'yes') {
			
			var s = $('nr3_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(p)+parseFloat(price);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = p;
					
					$('loa'+i).style.display = 'inline';
					
					$('nr3_portability_'+i).value = 1;
					$('nr4_portability_'+i).value = 0;
			}
			
		
		}
		
		if(calc == 'no') {
			
			var s = $('nr4_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(price)-parseFloat(p);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = 0;
					
					$('loa'+i).style.display = 'none';

					$('nr3_portability_'+i).value = 0;
					$('nr4_portability_'+i).value = 1;
			
			}
		
		}

}

function update_price_bng2(i,calc,p,b) {

		// Addition
		
		if(calc == 'yes') {
			
			var s = $('nr5_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(p)+parseFloat(price);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = p;
					
					$('loa'+i).style.display = 'inline';
					
					$('nr5_portability_'+i).value = 1;
					$('nr6_portability_'+i).value = 0;
			}
			
		
		}
		
		if(calc == 'no') {
			
			var s = $('nr6_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(price)-parseFloat(p);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('price2_item_'+i).set('text',total);
					
					$('nr_portability'+b+'_item_'+i).value = 0;
					
					$('loa'+i).style.display = 'none';

					$('nr5_portability_'+i).value = 0;
					$('nr6_portability_'+i).value = 1;
			
			}
		
		}

}

function update_price_bng3(i,calc,p,b) {

		// Addition
		
		if(calc == 'yes') {
			
					var price = $('price'+i).value;
					
					var total = parseFloat(p)+parseFloat(price);
					
					total = total.toFixed(2);
					
					$('price'+i).value = total;
					
					$('loa'+i).style.display = 'inline';
					
					$('priceShown'+i).set('text',total);
					
					$('nr_portability_item_'+i).value = parseFloat(p).toFixed(2);
			
		
		}
		
		if(calc == 'no') {
					
					$('loa'+i).style.display = 'none';
					
					var priceStart = parseFloat($('priceStart'+i).value);
					
					$('price'+i).value = priceStart;
					
					var priceStart = priceStart.toFixed(2);
					
					$('priceShown'+i).set('text',priceStart);
					
					$('nr_portability_item_'+i).value = '';
		
		}

}

function update_price_package(i,calc,p,b) {

		// Addition
		
		if(calc == 'yes') {
			
			var s = $('nr3_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(p)+parseFloat(price);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('nr_portability'+b+'_item_'+i).value = p;
					$('loa'+i).style.display = 'inline';
					$('nr3_portability_'+i).value = 1;
					$('nr4_portability_'+i).value = 0;
					
					/* div plus */
					
					var inp = $('nr5_portability_'+i).value
					
					if(inp == 1) {
					
						var totalPlus = parseFloat(12.10) + parseFloat(121.00);
						
					} else {
					
						var totalPlus = '12.10';
					}
					
					$('price2_item_'+i).set('text',totalPlus);
					
					$('plus'+i).style.display = 'inline';
						
					
			}
			
		
		}
		
		if(calc == 'no') {
			
			var s = $('nr4_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(price)-parseFloat(p);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('nr_portability'+b+'_item_'+i).value = 0;
					$('loa'+i).style.display = 'none';
					$('nr3_portability_'+i).value = 0;
					$('nr4_portability_'+i).value = 1;
					
					/* div plus */
					
					var inp = $('nr5_portability_'+i).value
					
					if(inp == 0) {
					
						$('plus'+i).style.display = 'none';
					
					} else {
					
						$('price2_item_'+i).set('text','121.00');
						
						$('plus'+i).style.display = 'inline';
					
					}
			
			}
		
		}

}

function update_price_package2(i,calc,p,b) {

		// Addition
		
		if(calc == 'yes') {
			
			var s = $('nr5_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(p)+parseFloat(price);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('nr_portability'+b+'_item_'+i).value = p;
					$('loa'+i).style.display = 'inline';
					$('nr5_portability_'+i).value = 1;
					$('nr6_portability_'+i).value = 0;
					
					/* div plus */
					
					var inp = $('nr3_portability_'+i).value
					
					if(inp == 1) {
					
						var totalPlus = parseFloat(12.10) + parseFloat(121.00);
						
					} else {
					
						var totalPlus = '121.00';
					}
					
					$('price2_item_'+i).set('text',totalPlus);
					
					$('plus'+i).style.display = 'inline';
			}
			
		
		}
		
		if(calc == 'no') {
			
			var s = $('nr6_portability_'+i).value;
			
			if(s == 0) {
			
					var price = $('price_item_'+i).value;
					
					var total = parseFloat(price)-parseFloat(p);
					
					total = total.toFixed(2);
					
					$('price_item_'+i).value = total;
					$('nr_portability'+b+'_item_'+i).value = 0;
					$('loa'+i).style.display = 'none';
					$('nr5_portability_'+i).value = 0;
					$('nr6_portability_'+i).value = 1;
					
					/* div plus */
					
					var inp = $('nr3_portability_'+i).value
					
					if(inp == 0) {
					
						$('plus'+i).style.display = 'none';
					
					} else {
					
						$('price2_item_'+i).set('text','12.10');
						
						$('plus'+i).style.display = 'inline';
					
					}
			
			}
		
		}

}


function update_price_specialNumbers(id,p) {

		$('s_nr_portability'+id).value = p;
		
		var priceBase = $('priceBase'+id).value;
		
		var total = parseFloat(priceBase)+parseFloat(p);
		
		total = total.toFixed(2);
		
		$('price'+id).value = total;
		
		$('priceShown'+id).set('text',total);
		
		if($('pdfDownload'+id)) {
		
		if(p == '100') 	{$('pdfDownload'+id).style.display = 'inline';}
		else 			{$('pdfDownload'+id).style.display = 'none';}
		
		}

}


function changeComboShop_ni(idCountry,cntForDiv) { // numero international
	
	var s = $('comboShop_'+idCountry+'_'+cntForDiv).selectedIndex;
	var v = $('comboShop_'+idCountry+'_'+cntForDiv).options[s].value;
	
	$(idCountry+'_'+cntForDiv).style.display = 'none';
	$(v).style.display = 'inline';
	
}


function changeComboShop_nomadic(n) {
	
	var nomadicActive = $('nomadicActive').value;
	
	var s = $('comboNomadic'+n).selectedIndex;
	var v = $('comboNomadic'+n).options[s].value;
	
	$('nomadicActive').value = v;
	
	$('divNomadic'+nomadicActive).style.display = 'none';
	$('divNomadic'+v).style.display = 'inline';
	
	$('comboNomadic'+n).selectedIndex = nomadicActive;
	
	
}

/********************************************************************************************************************************************************
	SEND TO FRIEND
*********************************************************************************************************************************************************/

function stf() {

	var v1 = $('firstnameFrom').value;
	var v2 = $('mailFrom').value;
	var v3 = $('firstnameTo').value;
	var v4 = $('mailTo').value;
	
	$('firstnameFrom').style.display = 'none';
	$('mailFrom').style.display = 'none';
	$('firstnameTo').style.display = 'none';
	$('mailTo').style.display = 'none';
	$('submitForm').style.display = 'none';
	
	$('firstnameFrom2').set('text',': '+v1);
	$('mailFrom2').set('text',': '+v2);
	$('firstnameTo2').set('text',': '+v3);
	$('mailTo2').set('text',': '+v4);
	
	

}

function macaron(nb) {
	
	if(nb > 0) {
	
		$('macaron').style.display = 'inline';
		
		$('macaronText').set('text',nb);
	
	} else {
	
		$('macaron').style.display = 'none';
		
		$('macaronText').set('text',0);
	
	}

}

/********************************************************************************************************************************************************
	CONFIGURATOR
*********************************************************************************************************************************************************/

function configurator(z,type) {

	if(type == 'p') { // Plus
	
		var s = $('s'+z).value;
		
		var up = parseFloat(s) + 1;
		
		if(up <= 50) {
			
			new Fx.Morph('n'+z+'_'+s, {duration: 500}).start({'opacity': 0.2});
			
			new Fx.Morph('n'+z+'_'+up, {duration: 500}).start({'opacity': 1});
			
			/********************/
			
			var step = parseFloat(up*40) - 40;
			
			moveItemNoX($('configurator_move'+z),-step,500);
			
			$('s'+z).value = up;
			
			
		
		}
	
	} else { // Moins
	
		var s = $('s'+z).value;
		
		var up = parseFloat(s) - 1;
		
		if(up >= 0) {
			
			new Fx.Morph('n'+z+'_'+s, {duration: 500}).start({'opacity': 0.2});
			
			new Fx.Morph('n'+z+'_'+up, {duration: 500}).start({'opacity': 1});
			
			/********************/
			
			var step = parseFloat(up*40) - 40;
			
			moveItemNoX($('configurator_move'+z),-step,500);
			
			$('s'+z).value = up;
			
			
		
		}
	
	}
	
	configuratorTotal();
	
}

function configuratorTotal() {

	var total1 = parseFloat($('price1').value).toFixed(2) * parseFloat($('s1').value).toFixed(2);
	
	$('detail_t1').set('text',total1.toFixed(2));
	
	$('detail_h1').set('text',$('s1').value);
	
	/********************/
	
	var total2 = parseFloat($('price2').value).toFixed(2) * parseFloat($('s2').value).toFixed(2);
	
	$('detail_t2').set('text',total2.toFixed(2));
	
	$('detail_h2').set('text',$('s2').value);
	
	/********************/
	
	var total3 = parseFloat($('price3').value).toFixed(2) * parseFloat($('s3').value).toFixed(2);
	
	$('detail_t3').set('text',total3.toFixed(2));
	
	$('detail_h3').set('text',$('s3').value);
	
	/********************/
	
	var total4 = parseFloat($('price4').value).toFixed(2) * parseFloat($('s4').value).toFixed(2);
	
	$('detail_t4').set('text',total4.toFixed(2));
	
	$('detail_h4').set('text',$('s4').value);
	
	/********************/
	
	var total = parseFloat(total1) + parseFloat(total2) + parseFloat(total3) + parseFloat(total4);
	
	$('detail_t5').set('text',total.toFixed(2));
	
	$('ctn').set('text',total.toFixed(2));
	
	/********************/
	
	
	
}


/********************************************************************************************************************************************************
	LOGIN
*********************************************************************************************************************************************************/

function loginOpen() {

	new Fx.Morph('loginContainer', {duration: 300}).start({'margin-top': '0px'});
	
	(function wait() {
	
		new Fx.Morph('loginMain', {duration: 300}).start({'margin-top': '0px'});
	
	}).delay(150);
	
	(function wait() {
	
		$('dLogin').highlight('#bebebe');
	
	}).delay(450);
	
	(function wait() {
	
		$('dPassword').highlight('#bebebe');
	
	}).delay(650);

}

function loginClose() {
	
	$('dLogin').value = '';
	 
	$('dPassword').value = '';
	
	new Fx.Morph('loginMain', {duration: 300}).start({'margin-top': '-90px'});
	
	new Fx.Morph('loginContainer', {duration: 300}).start({'margin-top': '-110px'});
	
	if(ls == 1) {
		
		(function wait() {
		
			new Fx.Morph('loginMain', {duration: 0}).start({'margin-top': '-110px'});
			
			new Fx.Morph('loginContainer_closeButton', {duration: 0}).start({'margin-top': '5px'});
			
			new Fx.Morph('loginTab1', {duration: 0}).start({'opacity': 1});
				
			new Fx.Morph('loginTab2', {duration: 0}).start({'opacity': 0});
		
		}).delay(310);
	
	}
	
}

function loginPush() {
	
	var dLogin = $('dLogin').value;
	
	var dPassword = $('dPassword').value;
	
	var d = 0;
	
	if(dLogin == '') {$('dLogin').highlight('#bebebe'); var d = 200;}
	
	(function wait() {if(dPassword == '') {$('dPassword').highlight('#bebebe');}}).delay(d);
			
	if(dLogin != '' && dPassword != '') {
		
		loginCheck();
	
		new Request({
		url: 'loginAjax.php?dLogin='+dLogin+'&dPassword='+dPassword+'', 
		evalScripts: true
		}).send();
	
	}

}

ls = 0;

function pwdSend() {
	
	ls = 1;
	
	$('login').value = '';
	 
	$('password').value = '';
	
	new Fx.Morph('loginTab2', {duration: 0}).start({'opacity': 0});
	
	(function wait() {
	
		$('loginTab2').style.display = 'inline';
	
	}).delay(50);
	
	(function wait() {
	
		new Fx.Morph('loginMain', {duration: 300}).start({'margin-top': '-45px'});
		
		new Fx.Morph('loginContainer_closeButton', {duration: 300}).start({'margin-top': '50px'});
		
		new Fx.Morph('loginTab1', {duration: 300}).start({'opacity': [1,0]});
			
		new Fx.Morph('loginTab2', {duration: 300}).start({'opacity': 1});
	
	}).delay(100);

}

function loginSend() {

	var email = $('email').value;
	
	if(email == '') {$('email').highlight('#bebebe');}
			
	if(email != '') {
	
		alert(email);
	
	}

}

function loginLoad(link,ag) {
	
	(function wait() {
	
		$('loginTab2').set('html','<div align="center" style="color:#FFFFFF; margin-top:24px; font-size:11px;">'+ag+'</div>');
	
	}).delay(1500);
	
	(function wait() {
	
		goPage(link,0);
	
	}).delay(3000);

}

function loginCheck() {
	
	$('loginTab2').empty();
	
	new Fx.Morph('loginTab2', {duration: 0}).start({'opacity': 0});
	
	(function wait() {
	
		$('loginTab2').style.display = 'inline';
	
	}).delay(50);
	
	(function wait() {
		
		new Fx.Morph('loginMain', {duration: 300}).start({'margin-top': '-45px'});
		
		new Fx.Morph('loginTab1', {duration: 300}).start({'opacity': [1,0]});
			
		new Fx.Morph('loginTab2', {duration: 300}).start({'opacity': 1});
	
	}).delay(100);
	
	(function wait() {
	
		$('loginTab2').set('html','<div align="center" style=" margin-top:18px;"><img src="images/loginLoader.gif" alt="loginLoader" width="35" height="32" /></div>');
	
	}).delay(200);

}

function wrongCode() {
	
	$('loginTab2').empty();
	
	new Fx.Morph('loginTab2', {duration: 0}).start({'opacity': 0});
	
	(function wait() {
	
		$('loginTab2').style.display = 'none';
	
	}).delay(50);
	
	(function wait() {
		
		new Fx.Morph('loginMain', {duration: 300}).start({'margin-top': '0px'});
		
		new Fx.Morph('loginTab1', {duration: 300}).start({'opacity': 1});
			
		new Fx.Morph('loginTab2', {duration: 300}).start({'opacity': 0});
	
	}).delay(100);
	
	(function wait() {
	
		$('dLogin').highlight('#990000');
	
		(function wait() {$('dPassword').highlight('#990000');}).delay(200);
	
	}).delay(400);
	

}

/********************************************************************************************************************************************************
	SHOP : DEALERS
*********************************************************************************************************************************************************/

function openDealerAchatType() {

	new Fx.Morph('dcmContainer', {duration: 300}).start({'height': '40px'});
	
	$('pixClic').style.display = 'none';
	
	new Fx.Morph('tad', {duration: 300}).start({'opacity': [1,0]});
	
	moveItemNoX($('dcmMove'),0,300);
	
}

atc = 1;

function achatTypeClic(i) {
	
	var step = (i*24)-24;

	if(i == 1) {
	
			new Fx.Morph('dcmContainer', {duration: 300}).start({'height': '16px'});
	
			$('pixClic').style.display = 'inline';
	
			new Fx.Morph('tad', {duration: 300}).start({'opacity': 1});
			
			moveItemNoX($('dcmMove'),-step,300);
			
			/*************/
			
			(function wait() {
			
					new Fx.Morph('comboMiddle', {duration: 500}).start({'height': '0px'});
					
					new Fx.Morph('comboClient', {duration: 500}).start({'opacity': 0});
					
					(function wait() {
					
							new Fx.Morph('dButton', {duration: 300}).start({'opacity': 0});
					
					}).delay(300);
					
					(function wait() {
					
					    $('comboClient').style.visibility = 'hidden';
					    
					    $('dButton').style.visibility = 'hidden';
					
					}).delay(700);
			
			}).delay(300);
			
			/**************/
			
			$('dealer_listZone').empty();
			
			new Fx.Morph('dealer_listClientsBG', {duration: 500}).start({'opacity': 0,'margin-left': '296px'});
			
			(function wait() {
			
				$('dealer_listClientsContainer').style.display = 'none';
			
			}).delay(500);
			
			
	}
	
	if(i == 2) {
			
			new Fx.Morph('dcmContainer', {duration: 300}).start({'height': '16px'});
	
			$('pixClic').style.display = 'inline';
	
			new Fx.Morph('tad', {duration: 300}).start({'opacity': 1});
			
			moveItemNoX($('dcmMove'),-step,300);
			
			if(atc == 1) {
			
					new Fx.Morph('comboClient', {duration: 0}).start({'opacity': 0});
			
					new Fx.Morph('dButton', {duration: 0}).start({'opacity': 0});
					
					new Fx.Morph('dealer_listClientsBG', {duration: 0}).start({'opacity': 0});
					
					(function wait() {
					
						$('comboClient').style.visibility = 'visible';
						
						$('dButton').style.visibility = 'visible';
						
						$('dealer_listClientsContainer').style.display = 'inline';
					
					}).delay(300);
					
					(function wait() {
					
						new Fx.Morph('comboClient', {duration: 300}).start({'opacity': 1});
						
						new Fx.Morph('comboMiddle', {duration: 500}).start({'height': '90px'});
						
					}).delay(350);
					
					(function wait() {
					
						new Fx.Morph('dealer_listClientsBG', {duration: 500}).start({'opacity': 1,'margin-left': '0px'});
					
					}).delay(600);
					
					(function wait() {
					
							$('dealer_listZone').set('html','<div align="center" style="margin-top:130px;"><img src="images/ajaxLoader.gif" alt="Loading" width="35" height="32" /></div>');
							
							(function wait() {
							
									new Request({
									url: 'shop_dealer_listClientAjax.php', 
									evalScripts: true,
									onComplete: function(response) {
										
										new Fx.Morph('dealer_listZone', {duration: 300}).start({'opacity': [1,0]});
										
										(function wait() {
										
											$('dealer_listZone').empty();
										
										}).delay(300);
										
										(function wait() {
										
											$('dealer_listZone').set('html', response);
										
										}).delay(350);
										
										(function wait() {
										
											new Fx.Morph('dealer_listZone', {duration: 300}).start({'opacity': 1});
										
										}).delay(400);
										    
									}}).send();
							
							}).delay(500);
							
					}).delay(800);
			
			}
	
	}

	atc = i;

}


/********************************************************************************************************************************************************
	REFERENCE DU MOIS (Homepage Pro)
*********************************************************************************************************************************************************/

rs = 0;

function refStart() {
	
	var cRef = $('cRef').value;
	
	if(rs < cRef && cRef > 1) {
	
			step = (rs * 210) + 210;
			
			(function wait() {
			
			    moveItemNoX($('bigBlocContainerRefMove'),-step,500);
			    
			    rs = parseFloat(rs) + 1;
			    
			    refStart();
			
			}).delay(7000);
	
	} else {
		
		if(cRef > 1) {
		
		rs = 0;
		
		moveItemNoX($('bigBlocContainerRefMove'),0,500);
		
		refStart();
		
		}
		
	}

}













