/**
 * @author midj
 */

function toggleBlock(pEl){
	block = $(pEl).next();

	if(block.getStyle('display') == 'none'){
		new Effect.BlindDown(block,{duration: 0.2});
	}else{
		new Effect.BlindUp(block, {duration: 0.2});

	}
}

function buildSubmenu(pId){
	new Ajax.Updater('subnav', '/navbar/build?id=' + pId );

}

window.onload=function(){
	notice = $('notify');
	if(notice){
		Effect.Fade('notify', { duration: 6.0 })
	}
	for(var i = 1;i < 7;i++){
		if($('menu_' + i)){
			Menu.init("menu_" + i, {"orientation": Menu.HORIZONTAL, "hidePause": 0.5});
		}
	}
	setupZoom();
	/*var all_bullets = $$('a.bullet');
	for (var i = 0; i < all_bullets.length; i++) {
  	all_bullets[i].observe('click', function(event){
		  $('bullet_on').next().replace('<img alt="Bullet_on" src="/images/bullet_off.jpg"/>');
			//$('bullet_on').writeAttribute('id','')
			$(this).firstDescendant().replace('<img alt="Bullet_on" src="/images/bullet_on.jpg"/>');
			$(this).setAttribute('id','bullet_on')

			// -> '<ul id="favorite"><li>kiwi</li><li>banana</li><li>apple</li></ul>'

  	});
  }*/



//alert(linput.length);

}

	var pack_validity = '';
	var pack_pack = '';
	var product = '';
	var type_produit = '';
	function slEl(pEl, other, val, pack, type_prd){
		type_produit = type_prd;
		for(var i = 0;i < other.length;i++)
		{
			other[i].setAttribute('src','/images/btn_puce_off.png');
		}
		pEl.setAttribute('src','/images/btn_puce.png');		
		if(val)
		{
			$('et_2').writeAttribute("class","txt_bold");
			var array_val = new Array();
			array_val["S"] = 1;
			array_val["M"] = 3; 
			array_val["L"] = 6; 
			array_val["XL"] = 12; 
			$('type_pack').update(array_val[val]);
			pack_validity = array_val[val];
			$('pack_td2').show();
		}
		if(pack)
		{
			$('et_3').writeAttribute("class","txt_bold");
			var array_pack = new Array();
			array_pack["S"] = 5;
			array_pack["M"] = 20; 
			array_pack["L"] = 50; 
			array_pack["XL"] = 100; 
			$('nb_fl').update(array_pack[pack]);
			pack_pack = array_pack[pack];
		}
		if(pack_validity && pack_pack)
		{
			product =  type_produit + ' ' + pack_validity + 'mois, ' + pack_pack + ' Flashcodes'
			//$('w_validity').update(pack_validity);
			//$('w_pack').update(pack_pack);
			var array_val_price = new Array();
			array_val_price[1] = 100;
			array_val_price[3] = 200; 
			array_val_price[6] = 400; 
			array_val_price[12] = 650; 
			
			var array_pack_price = new Array();
			array_pack_price[5] = 1.5;
			array_pack_price[20] = 1.8; 
			array_pack_price[50] = 2; 
			array_pack_price[100] = 3; 
			var v1 = 0;
			var v2 = 0;
			v1 = array_val_price[pack_validity];
			v2 = array_pack_price[pack_pack];
			$('form_validate').show();
			$('total').update(v1*v2);
			$('item_product').setAttribute('value',product);
			$('item_price').setAttribute('value',v1*v2);
			//$('et_4').show();
		}
	}


