/*implements Select object by D.PECCHIOLI*/

	var xPos,yPos,xpas,ypas,lgimg,opac;
	var wid;var d;
	var display=true;/*display or not fade*/
	var interval=null;
	var xPosInit,yPosInit;

Basket.prototype.constructor = Basket;

	function Basket(cat,ss_cat,listing_type,site){
		this.Tcat=new Array('ann');
		this.Tss_cat=this.Tcat;
		this.site=site;
		this.Tss_cat['ann']=new Array('auto','moto','od','bateau-moteur','voilier','moteur','divers');
		this.lgimgInit=(listing_type=='listing'?52:110);
		this.X_end_ani = 650;/*end X basket ani*/
		this.Y_end_ani = 700;/*end Y basket ani*/
		this.listing_type = listing_type;
		this.PreferedDelay = 45;
		this.delay = this.PreferedDelay;
		this.StepNumber = 20;
		this.cat=cat;
		this.ss_cat = ss_cat;
		this.maxbs = 20;
		this.data_= null;
		this.xmlhttp = null;
		this.xmlhttp_details = null;
		this.split_ = "-------\n";
		this.picto_bs_id = null;
		this.inter = null;
		this.inter_show = null;
		this.IE = document.all?true:false;
		this.off_top = (typeof(document.images['top_px'])=='undefined'?null:parseInt(document.images['top_px'].offsetTop)+6);
		this.Details = null;/*tableau des objets compars*/
		this.sessid = this.get_Sessid();/*get php_sessid*/
		this.initData();
		if(this.isBasket()){
			this.request('/ze_basket.php?sessid='+this.sessid);/*load bs object from database*/
		}
	}
	
	Basket.prototype.request = function(dest) {
		try { // Moz supports XMLHttpRequest. IE uses ActiveX.
			// browser detection is bad. object detection works for any browser
			this.xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e) { alert('Votre navigateur ne supporte pas ajax !');
			// browser doesn't support ajax. handle however you want
		} // the xmlhttp object triggers an event everytime the status changes
		if(this.xmlhttp!=null){
			this.xmlhttp.onreadystatechange = triggered;// triggered() function handles the events
			// open takes in the HTTP method and url.
			this.xmlhttp.open("GET", dest+'&uncache='+Math.random());
			// Moz is fine with just send(); but
			// IE expects a value here, hence we do send(null);
			this.xmlhttp.send(null);
		}
	}
	
	Basket.prototype.initData = function(){
		var i,j;
		this.data_ = new Array;
		for(i=0;i<this.Tcat.length;i++){
			this.data_[this.Tcat[i]] = new Array;
			for(j=0;j<this.Tss_cat[this.Tcat[i]].length;j++){
				this.data_[this.Tcat[i]][this.Tss_cat[this.Tcat[i]][j]] = new Array;
			}
		}
	}
	
	Basket.prototype.unserialize = function(ser_data){
		var tmp,line_,i,j;
		this.data_ = new(Array);
		var Tret = ser_data.split(this.split_);
			for(i=0;i<Tret.length;i++){
				tmp = Tret[i].split("\n");
				for(j=0;j<tmp.length;j++){
					if(tmp[j].length>0){
						line_ = tmp[j].split(";");
						if(this.data_[line_[0]]==null)this.data_[line_[0]] = new Array;
						if(this.data_[line_[0]][line_[1]]==null)this.data_[line_[0]][line_[1]] = new Array;
						if(line_[2]!='')this.data_[line_[0]][line_[1]]=line_[2].split(',');
					}
				}
			}
		this.setIsBasket();
	}	
	
	Basket.prototype.modifiePanier = function(inAnnonce,ss_cat)
	{
		if(inAnnonce=='')return false;
		if(this.sessid.length>1){
			var pos = this.isInBasket(ss_cat,inAnnonce);
			var action_ = (pos>-1?'del':'add');
			if(pos==-1 && this.data_['ann'][ss_cat].length>=this.maxbs){
				alert('Vous ne pouvez pas sélectionner plus de '+this.maxbs+' éléments dans votre sélection '+this.ss_cat_to_string(ss_cat)+'.');
				return false;
			}
	 		this.request('/ze_basket.php?sessid='+this.sessid+'&id='+inAnnonce+'&cat=ann&ss_cat='+ss_cat+'&action='+action_);
	 	}
	}
	
	Basket.prototype.delete_from_Cat = function(inAnnonce)
	{
		if(this.sessid.length>1){
	 		this.request('/ze_basket.php?sessid='+this.sessid+'&id='+inAnnonce+'&cat='+this.cat+'&ss_cat='+this.ss_cat+'&action=del');
	 	}
	}
	
	Basket.prototype.delete_id = function (cat,ss_cat,num){
		this.cat = cat;
		this.ss_cat = ss_cat;
		this.delete_from_Cat(num);
		return true;
	}
	
	Basket.prototype.setIsBasket = function(){
		var i,j,found;
		found = false;
		i=0;
		while(i<this.Tcat.length && !found){
			j=0;
			while(j<this.Tss_cat[this.Tcat[i]].length && !found){
				found = (this.data_[this.Tcat[i]][this.Tss_cat[this.Tcat[i]][j]].length>0);
				j++;
			}
			i++;
		}
		var largeExpDate = new Date ();
    largeExpDate.setTime(largeExpDate.getTime() + (86400 * 1000));
		this.setCookie('isBasket',(found?'true':''),largeExpDate);
	}
	
	Basket.prototype.isBasket = function(){
		return this.getCookie('isBasket')=='true';
	}
	
	Basket.prototype.get_Sessid = function(){
		return this.getCookie('php_sessid');
	}
	
	Basket.prototype.getCookie = function(key_id)
	{
		var i,j;
		var cookie = document.cookie;
		i = cookie.indexOf(key_id+'=');
		if(i==-1)return false;
		j = cookie.indexOf(";",i);		
		if(j==-1)j=cookie.length;
		return (unescape(cookie.substring(i+key_id.length+1,j)));
	}
	
	Basket.prototype.isIn = function(cat,ss_cat,id_){
		var i=0;
		var pos=-1;
		while(pos==-1 && i<this.data_[cat][ss_cat].length){
			if(this.data_[cat][ss_cat][i]==id_)pos=i;
			i++;
		}
		return pos;
	}
	
	Basket.prototype.isInBasket = function(ss_cat,id_){
		var i=0;
		var pos=-1;
		while(pos==-1 && i<this.data_['ann'][ss_cat].length){
			if(this.data_['ann'][ss_cat][i]==id_)pos=i;
			i++;
		}
		return pos;
	}
	
	Basket.prototype.refresh_listing = function(cat,ss_cat,id_s,site){
		if(cat==null)return;
		if(ss_cat==null)return;
		if(id_s==null)return;
		if(site==null)return;
		var Tid = id_s.split(',');
		var i,pic_id;
		
		if (cat=='ann')
		{
			for(i=0;i<Tid.length;i++)
			{
				if((link_id = document.getElementById(cat+'_'+ss_cat+'_'+Tid[i]))!= null)
				{
					if(bs.isIn(cat,ss_cat,Tid[i])>-1)
					{
						link_id.innerHTML='Retirer de ma s&eacute;lection';
						link_id.title='Retirer de ma sélection';
						link_id.style.cursor='pointer';
						link_id.className = 'BtnSelect'
					}
					else
					{
						link_id.innerHTML='Ajouter &agrave; ma s&eacute;lection';
						link_id.title='Ajouter à ma sélection';
						link_id.style.cursor='pointer';
						link_id.className = 'BtnSelect'
					}
				}
			}
		}
		else
		{
			for(i=0;i<Tid.length;i++){
				if((pic_id = document.images[cat+'_'+ss_cat+'_'+Tid[i]])!= null){
					if(bs.isIn(cat,ss_cat,Tid[i])>-1){
						pic_id.src='/images/'+site+'_fr/moins.gif';
						pic_id.title='Retirer de ma sélection';
						pic_id.alt='Retirer de ma sélection';
						pic_id.style.cursor='pointer';
						if(this.IE)pic_id.style.filter = '';
						else pic_id.style.opacity='';
						}else{
							pic_id.src='/images/'+site+'_fr/plus.gif';
							pic_id.title='Ajouter à ma sélection';
							pic_id.alt='Ajouter à ma sélection';
							pic_id.style.cursor='pointer';
							if(this.IE)pic_id.style.filter = '';
							else pic_id.style.opacity='';
					}
				}
			}
		}
	}
	
	Basket.prototype.req_details = function(cat,ss_cat) {
		try {
			this.xmlhttp_details = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
			}
		catch (e) { alert('Votre navigateur ne supporte pas ajax !');
		} 
		if(this.xmlhttp_details!=null){
			this.cat = cat;
			this.ss_cat = ss_cat;
			this.xmlhttp_details.onreadystatechange = triggered_details;
			this.xmlhttp_details.open("GET", '/ze_proxy.php?ws='+(this.cat=='ann'?'get_mini_detail_'+this.site:'get_mini_fichtech_'+this.site)+'&user=js&password=none&out=js&categorie='+ss_cat+(this.cat=='ft' && this.listing_type==null?'&photo=1':'')+'&id='+bs.data_[cat][ss_cat]);
			this.xmlhttp_details.send(null);
		}
	}
	
	Basket.prototype.delete_from = function(cat,ss_cat){
		var i;
		if(cat==null || ss_cat==null)return;
		var To_delete=new Array();
		for(i=0;i<bs.data_[cat][ss_cat].length;i++){
			if(document.getElementById('sel_'+cat+'_'+ss_cat+'_'+bs.data_[cat][ss_cat][i]).checked)
				To_delete[To_delete.length]=bs.data_[cat][ss_cat][i];
		}
		if(To_delete.length==0){
			alert('Vous devez sélectionner au moins un élément à retirer.');
			return false;
		}
		this.cat = cat;
		this.ss_cat = ss_cat;
		this.delete_from_Cat(To_delete);
		return true;
	}
	
	Basket.prototype.Compare = function(cat,ss_cat){
		if(cat==null || ss_cat==null)return;
		var i;
		var To_compare=new Array();
		for(i=0;i<bs.data_[cat][ss_cat].length;i++){
			if(document.getElementById('sel_'+cat+'_'+ss_cat+'_'+bs.data_[cat][ss_cat][i]).checked)
				To_compare[To_compare.length]=bs.data_[cat][ss_cat][i];
		}
		if(To_compare.length<2){
			alert('Vous devez sélectionner au moins 2 éléments à comparer.');
			return;
		}else if(To_compare.length>4){
			alert('Vous devez sélectionner au plus 4 éléments à comparer.');
			return;
		}
		this.setCookie('compare',cat+'|'+ss_cat+'|'+To_compare);
		window.location.href = '/prepare_and_compare.php';
	}
	
	Basket.prototype.getCompare = function(){
		var Tcompare = this.getCookie('compare').split('|');
		this.cat=Tcompare[0];
		this.ss_cat=Tcompare[1];
		return Tcompare[2].split(',');
	}
	
	Basket.prototype.encode_to_lc_url = function(chaine){
		return chaine.replace(new RegExp('/','g'),'*').replace(new RegExp('\\+','g'),'~').replace(new RegExp('\'','g'),'`').replace(new RegExp('-','g'),'_').replace(new RegExp('&','g'),'^').replace(new RegExp(' ','g'),'+');
	}
	
	Basket.prototype.decode_from_lc_url = function(chaine){
		return chaine.replace(new RegExp('\\*','g'),'/').replace(new RegExp('~','g'),'+').replace(new RegExp('`','g'),'\'').replace(new RegExp('_','g'),'-').replace(new RegExp('\\^','g'),'&');
	}
	
	Basket.prototype.encode_od_to_lc_url = function(chaine){
		return chaine.replace(new RegExp('"','g'),'`').replace(new RegExp(';','g'),'.').replace(new RegExp(',','g'),'.').replace(new RegExp(' ','g'),'+').replace(new RegExp(':','g'),'_').replace(new RegExp('\\\\','g'),'|').replace(new RegExp('/','g'),'|');
	}
	
	Basket.prototype.hide_and_show = function(cat,ss_cat,myHeight){
		var i,j;
		this.cat = cat;
		this.ss_cat = ss_cat;
		var ele = document.getElementById(cat+'_detail_'+ss_cat);
		if(ele.style.display==''){
			ele.style.display='none';
			this.define_title(cat,ss_cat);
		}
		else{
			ele.style.display='';
			for(i=0;i<this.Tcat.length;i++){
				for(j=0;j<this.Tss_cat[this.Tcat[i]].length;j++){
					if((this.cat!=this.Tcat[i]) || (this.ss_cat!=this.Tss_cat[this.Tcat[i]][j]))
					{
						if (document.getElementById(this.Tcat[i]+'_detail_'+this.Tss_cat[this.Tcat[i]][j]))
							document.getElementById(this.Tcat[i]+'_detail_'+this.Tss_cat[this.Tcat[i]][j]).style.display='none';
					}
					this.define_title(this.Tcat[i],this.Tss_cat[this.Tcat[i]][j]);
				}
			}
			if(!/[a-zA-Z]/.test(ele.innerHTML))bs.req_details(this.cat,this.ss_cat);
		}
/*		var i,j;
		this.cat = cat;
		this.ss_cat = ss_cat;
		var ele = document.getElementById(cat+'_detail_'+ss_cat);
		if(ele.style.display==''){
			ele.style.display='none';
			this.define_title(cat,ss_cat);
			myHeight.hide();myHeight.toggle();
		}
		else{
			ele.style.display='';
			for(i=0;i<this.Tcat.length;i++){
				for(j=0;j<this.Tss_cat[this.Tcat[i]].length;j++){
					if((this.cat!=this.Tcat[i]) || (this.ss_cat!=this.Tss_cat[this.Tcat[i]][j]))
						document.getElementById(this.Tcat[i]+'_detail_'+this.Tss_cat[this.Tcat[i]][j]).style.display='none';
					this.define_title(this.Tcat[i],this.Tss_cat[this.Tcat[i]][j]);
				}
			}
			if(!/[a-zA-Z]/.test(ele.innerHTML))bs.req_details(this.cat,this.ss_cat);
			else {
				myHeight.hide();
				myHeight.toggle();
			}
		}*/
	}
	
	Basket.prototype.cat_to_string = function(chaine){
		if(chaine=='ann')return 'Annonces';
		if(chaine=='ft')return 'Fiches tech.';
	}
	
	Basket.prototype.ss_cat_to_string = function(chaine){
		if(chaine=='auto')return 'Voitures';
		if(chaine=='moto')return 'Motos';
		if(chaine=='od')return 'Accessoires';
		if(chaine=='bateau-moteur')return 'Bateaux à moteur';
		if(chaine=='voilier')return 'Voiliers';
		if(chaine=='moteur')return 'Moteurs';
		if(chaine=='divers')return 'Divers';
	}
	
	Basket.prototype.define_title = function(cat,ss_cat){
		if (document.getElementById('main_'+cat+'_'+ss_cat))
		{
			if(cat=='ann'){			
				document.getElementById('main_'+cat+'_'+ss_cat).innerHTML = '<table width="100%"><tr><td>Ma s&eacute;lection d'+(ss_cat=='od'?'\'':'e ')+'<b>'+this.ss_cat_to_string(ss_cat)+
				'</b> ('+this.data_[cat][ss_cat].length+') </td><td>'+
				(bs.data_[cat][ss_cat].length>0?'<a href="#" style="color:#54a8ff;font-weight:bold;font-size:11px;text-decoration:underline;float:right;display:inline" onClick="bs.hide_and_show(\''+cat+'\',\''+ss_cat+'\',myHeight);return false;">'+(document.getElementById(cat+'_detail_'+ss_cat).style.display=='none'?'Afficher</a>':'Masquer</a>'):'&nbsp;')
				+'</td></tr></table>';
			}else if(cat=='ft'){
				document.getElementById('main_'+cat+'_'+ss_cat).innerHTML = '<table width="100%"><tr><td width="200px">Ma s&eacute;lection de <b>Fiches tech.</b> ('+this.data_[cat][ss_cat].length+') </td><td>'+
				(bs.data_[cat][ss_cat].length>0?'<a href="#" style="color:#54a8ff;font-weight:bold;font-size:11px;text-decoration:underline;float:right;display:inline" onClick="bs.hide_and_show(\''+cat+'\',\''+ss_cat+'\',myHeight);return false;">'+(document.getElementById(cat+'_detail_'+ss_cat).style.display=='none'?'Afficher</a>':'Masquer</a>'):'&nbsp;')
				+'</td></tr></table>';
			}
		}
	}
	
	Basket.prototype.build_detail = function(cat,ss_cat,T){
		if(cat == 'ann'){
			if (this.site=='lc') {
				return '<ul><li><span class="BasketPrice">'+this.FormatNumber(T['PRICE'],' ',3)+'&nbsp;&euro;</span><span class="BasketPhoto Multi"><a href="detail_'+ss_cat+'.php?annonce='+T['ID']+'&from=basket"><img src="'+(T['IS_PHO']>0?T['photo'][0]:'/images/lc/vignette_type_'+ss_cat+'.png')+'" /></a></span><a href="detail_'+ss_cat+'.php?annonce='+T['ID']+'&from=basket"><span class="BasketMarque">'+T['BRAND']+'</span><span class="BasketModele">'+T['MODEL']+'</span></a>'
							+'<span class="BasketYear">'+T['YEARMODEL']+'</span><span class="BasketMileage">'+this.FormatNumber(T['MILEAGE'],' ',3)+' km</span><div class="BasketNavIn"><span class="LinkL"><a href="detail_'+ss_cat+'.php?annonce='+T['ID']+'&from=basket">Afficher</a></span><span class="LinkM">'
							+(ss_cat=='auto'?'<a href="fiche-technique-voiture-'+this.encode_to_lc_url(T['BRAND'].toLowerCase())+'-'+this.encode_to_lc_url(T['MODEL'].toLowerCase())+'-'+this.encode_to_lc_url(T['VERSION'].toLowerCase())+'-'+T['YEARMODEL']+'.html">Fiche tech.</a>':'')+'</span><span class="LinkR"><a href="javascript:;" onClick="bs.delete_from_Cat('+T['ID']+')">Retirer</a></span></div></li></ul>';
			}
			else
			{
				return '<ul><li>'+(T['BO_PRICE']!=''?'<span class="BasketPrice">'+this.FormatNumber(T['BO_PRICE'],' ',3)+'&nbsp;&euro;</span>':'')+'<span class="BasketPhoto Multi"><a href="detail_'+ss_cat+'.php?annonce='+T['ID']+'&from=basket"><img src="'+(T['IS_PHO']>0?T['photo'][0]:'/images/lc/vignette_type_'+ss_cat+'.png')+'" /></a></span><span class="BasketMarque">'+T['BRAND']+'</span><span class="BasketModele">'+T['MODEL']+'</span>'
							+'<span class="BasketYear"></span><span class="BasketMileage">'+T['YEAR']+'</span><div class="BasketNavIn"><span class="LinkL"><a href="detail_'+ss_cat+'.php?annonce='+T['ID']+'&from=basket">Afficher</a></span><span class="LinkR"><a href="javascript:;" onClick="bs.delete_from_Cat('+T['ID']+')">Retirer</a></span></div></li></ul>';
			}	
		}
	}
	
	Basket.prototype.build_list = function(cat,ss_cat,T){
		if(cat == 'ann'){
			return '<tr style="height:43px;" onClick="bs.reload_one_Compar('+T['ID']+');" onMouseOver="bs.maintain_list();this.style.backgroundColor=\'#80BFFF\';" onMouseOut="this.style.backgroundColor=\'#FFFFFF\';">'
						+'<td style="width:2px"></td><td width="52px"><img style="width: 52px; height: 39px;" id="picto_bs_'+T['ID']
						+'_'+ss_cat+'" border="0" src="'
						+(T['IS_PHO']>0?T['photo'][0]:'/images/lc/vignette_type_'+ss_cat+'.png')+'" />'
						+(T['M']==1?'<img src="/images/lc/multi-photo.gif" alt="Multi-photos" border="0" style="margin:-12px 0px 0px 0px;">':'')
						+'</td><td style="width:5px">&nbsp;</td><td style="font-family:Arial;font-size:10px;">'
						+(ss_cat=='od'?T['OB_TEXT']:T['BRAND']+' '+T['MODEL'] + ' '+T['VERSION']+'&nbsp')
						+'</td></tr>';
		}
	}
	
	Basket.prototype.setDetails = function(Tdetail){
		this.Details = Tdetail;
	}
	
	Basket.prototype.startCompare = function(Tid,compare_label){
		var i;
		for(i=0;i<Tid.length;i++){
			detail[i] = new Detail(this.cat,this.ss_cat,Tid[i],i,detail,this,compare_label,Tid.length);
		}
		compare_label.setDetails(detail);
		this.setDetails(detail);
		for(i=0;i<Tid.length;i++){
			detail[i].request(detail[i].seeFT);
		}
		return detail;
	}
	
	Basket.prototype.maintain_list = function(){
		if(typeof(this.inter)!='undefined')window.clearInterval(this.inter);
		this.inter = setInterval('document.getElementById(\'select_another_item_shadow\').style.display=\'none\';document.getElementById(\'select_another_item\').style.display=\'none\';', 2000);
	}
	
	Basket.prototype.reload_one_Compar = function(id_){
		var i;
		if(typeof(this.inter)!='undefined')window.clearInterval(this.inter);
		document.getElementById('select_another_item_shadow').style.display='none';
		document.getElementById('select_another_item').style.display='none';
			
		for(i=0;i<this.Details.length;i++){
			this.Details[i].ready=false;
			if(this.cat=='ann')this.Details[i].seeFT=false;
			this.Details[i].compare = false;
		}			
				
		if(compare_label.reload_item==true){
			/*reload an item in comparator*/
			if(this.cat=='ann'){
				for(i=0;i<actif;i++)this.Details[i].Build(null);
				for(i=actif+1;i<this.Details.length;i++)this.Details[i].Build(null);
			}else{
				for(i=0;i<actif;i++)this.Details[i].Build_FT(null);
				for(i=actif+1;i<this.Details.length;i++)this.Details[i].Build_FT(null);
			}
			this.Details[actif].reloadMe(this.Details[actif].cat,this.Details[actif].ss_cat,id_,actif,this.Details,this);			
		}else{
			/*add an item in comparator*/
			for(i=0;i<this.Details.length;i++){
				detail[i].setWidthByNbEl(detail.length+1);
				detail[i].leftX=null;
				detail[i].div.style.left='-170px';
				detail[i].comptMV = 0;
			}
			this.Details[this.Details.length]=new Detail(this.cat,this.ss_cat,id_,this.Details.length,this.Details,this,compare_label,this.Details.length+1);
			this.Details[this.Details.length-1].request(this.Details[this.Details.length-1].seeFT);
			this.Details[this.Details.length-1].div.style.left='-170px';
			if(this.cat=='ann'){
				for(i=0;i<this.Details.length-1;i++)this.Details[i].Build(null);
			}
			else {
				for(i=0;i<this.Details.length-1;i++)this.Details[i].Build_FT(null);
			}
		}
		this.req_details(this.cat,this.ss_cat);
	}
	
	Basket.prototype.add_element = function(){
		var i;
		i=0;
		while(i<this.Details.length && this.Details[i].placed)i++;
		if(i<this.Details.length)return;
		compare_label.reload_item=false;
		if(typeof(this.inter)!='undefined')window.clearInterval(this.inter);
		if(typeof(this.inter_show)!='undefined')window.clearInterval(this.inter_show);
		this.inter = setInterval('document.getElementById(\'select_another_item_shadow\').style.display=\'none\';document.getElementById(\'select_another_item\').style.display=\'none\';', 2000);
		var el=document.getElementById('select_another_item');
		var el_shadow=document.getElementById('select_another_item_shadow');
		var top_ref = (document.getElementById('add_element').offsetTop+this.off_top);
		el.style.top = top_ref+'px';
		el_shadow.style.top = (top_ref-6)+'px';
		var left_ref = (document.getElementById('add_element').offsetLeft+5);
		el.style.left = left_ref+'px';
		el_shadow.style.left = (left_ref-6)+'px';
		el.style.display = '';
		if(this.IE){
			opac = 10;
			el.style.filter = 'alpha(opacity='+opac+');';
			el_shadow.style.filter = 'alpha(opacity='+(opac/3)+');';
			this.inter_show = setInterval('opac+=15;if(opac>100)window.clearInterval(bs.inter_show);document.getElementById(\'select_another_item_shadow\').style.filter = \'alpha(opacity=\'+(opac/3)+\');\';document.getElementById(\'select_another_item\').style.filter = \'alpha(opacity=\'+opac+\');\';',25);
		}
		else {
			opac = 0.1;
			el.style.opacity=opac;
			el_shadow.style.opacity=(opac/3);
			this.inter_show = setInterval('opac+=0.15;if(opac>1)window.clearInterval(bs.inter_show);document.getElementById(\'select_another_item_shadow\').style.opacity = (opac/3);document.getElementById(\'select_another_item\').style.opacity = opac ;',25);
		}
		var height_ref = document.images['select_another_item_bas'].offsetTop;
		if(!this.IE){
			document.images['shadow_top_menu'].src='images/lc_fr/shadows/bg_top_shadow_267.png';
			document.images['shadow_center_menu'].src='images/lc_fr/shadows/bg_middle_shadow_267.png';
			document.images['shadow_bas_menu'].src='images/lc_fr/shadows/bg_bas_shadow_267.png';
		}
		document.images['shadow_center_menu'].style.height = (height_ref-5)+'px';
		el_shadow.style.display = '';
	}
	
	Basket.prototype.select_another_item = function(){
		var i;
		i=0;
		while(i<this.Details.length && this.Details[i].ready)i++;
		if(i<this.Details.length){
			alert('Veuillez attendre la fin du chargement.');
			return;
		}
		compare_label.reload_item=true;
		if(typeof(this.inter)!='undefined')window.clearInterval(this.inter);
		if(typeof(this.inter_show)!='undefined')window.clearInterval(this.inter_show);
		this.inter = setInterval('document.getElementById(\'select_another_item_shadow\').style.display=\'none\';document.getElementById(\'select_another_item\').style.display=\'none\';', 2000);
		var el=document.getElementById('select_another_item');
		var el_shadow=document.getElementById('select_another_item_shadow');
		var top_ref = (document.images['select_'+actif].offsetTop+this.off_top);
		el.style.top = top_ref+'px';
		el_shadow.style.top = (top_ref-6)+'px';
		if(this.Details!=null){
			var left_ref = (parseInt(this.Details[actif].div.style.left.substring(0,this.Details[actif].div.style.left.length-2))+((this.Details[actif].width_-140)/2));
			el.style.left = left_ref+'px';
			el_shadow.style.left = (left_ref-6)+'px';
			if(this.IE){
				opac = 10;
				el.style.filter = 'alpha(opacity='+opac+');';
				el_shadow.style.filter = 'alpha(opacity='+(opac/3)+');';
				this.inter_show = setInterval('opac+=15;if(opac>100)window.clearInterval(bs.inter_show);document.getElementById(\'select_another_item_shadow\').style.filter = \'alpha(opacity=\'+(opac/3)+\');\';document.getElementById(\'select_another_item\').style.filter = \'alpha(opacity=\'+opac+\');\';',25);
			}
			else {
				opac = 0.1;
				el.style.opacity=opac;
				el_shadow.style.opacity=(opac/3);
				this.inter_show = setInterval('opac+=0.15;if(opac>1)window.clearInterval(bs.inter_show);document.getElementById(\'select_another_item_shadow\').style.opacity = (opac/3);document.getElementById(\'select_another_item\').style.opacity = opac ;',25);
			}
			el.style.display = '';
			var height_ref = document.images['select_another_item_bas'].offsetTop;
			if(!this.IE){
				document.images['shadow_top_menu'].src='images/lc_fr/shadows/bg_top_shadow_267.png';
				document.images['shadow_center_menu'].src='images/lc_fr/shadows/bg_middle_shadow_267.png';
				document.images['shadow_bas_menu'].src='images/lc_fr/shadows/bg_bas_shadow_267.png';
			}
			document.images['shadow_center_menu'].style.height = (height_ref-5)+'px';
			el_shadow.style.display = '';
		}
	}
	
	Basket.prototype.ShowTip = function(){
		var i,j,count,ob;
		if((ob = document.images['bulle_compar']) && !this.getCookie('compare')){
			count = 0;
			for(i=0;i<this.Tcat.length;i++){
				for(j=0;j<this.Tss_cat[this.Tcat[i]].length;j++){
					count += this.data_[this.Tcat[i]][this.Tss_cat[this.Tcat[i]][j]].length;
				}
			}
			if(count){
				if(typeof(tip_inter)=='undefined'){
					if(this.IE){
						opac_tip = 5;
						ob.style.filter = 'alpha(opacity='+opac_tip+');';
						setTimeout('document.images[\'bulle_compar\'].style.display=\'\';tip_inter=setInterval(\'document.images[\\\'bulle_compar\\\'].style.filter=\\\'alpha(opacity=\\\'+opac_tip+\\\');\\\';if(opac_tip>=95)clearInterval(tip_inter);else opac_tip+=5;\',25);',1000);
						setTimeout('tip_inter=setInterval(\'if(opac_tip<5){clearInterval(tip_inter);document.images[\\\'bulle_compar\\\'].style.display="none";}else{document.images[\\\'bulle_compar\\\'].style.filter=\\\'alpha(opacity=\\\'+opac_tip+\\\');\\\';opac_tip-=5;}\',25)',15000);
					}		
					else {
						opac_tip = 0.05;
						ob.style.opacity=opac_tip;
						setTimeout('document.images[\'bulle_compar\'].style.display=\'\';tip_inter=setInterval(\'document.images[\\\'bulle_compar\\\'].style.opacity=opac_tip;if(opac_tip>=0.95)clearInterval(tip_inter);else opac_tip+=0.05;\',25)',1000);
						setTimeout('tip_inter=setInterval(\'if(opac_tip<0.05){clearInterval(tip_inter);document.images[\\\'bulle_compar\\\'].style.display="none";}else{document.images[\\\'bulle_compar\\\'].style.opacity=opac_tip;opac_tip-=0.05;}\',25)',15000);
					}
				}
			}
		}
	}
	
	Basket.prototype.purge = function(T_id,cat,ss_cat){
		var i,j;
		var To_delete = new Array();
		for(i=0;i<this.data_[cat][ss_cat].length;i++){
			found = false;
			j=0;
			while(!found && j<T_id.length){
				found = (T_id[j]['ID'] == this.data_[cat][ss_cat][i]);
				if(!found)j++;
			}
			if(!found)To_delete[To_delete.length]=this.data_[cat][ss_cat][i];
		}
		if(To_delete.length>0){
			this.delete_from_Cat(To_delete);
			alert(To_delete.length+' élément'+(To_delete.length>1?'s':'')+' de votre sélection '+this.ss_cat_to_string(ss_cat)+' '+(To_delete.length>1?'ont été supprimés car il n\'existent plus.':'a été supprimé car il n\'existe plus.'));
			return true;
		}
		return false;
	}
	
	Basket.prototype.setCookie = function (name, value, expires, path, secure) {
		var domain;
		var myReg = new RegExp('\.lacentrale\.fr');
		domain = (myReg.test(window.location)?'.lacentrale.fr':'');
		document.cookie= name + '=' + escape(value) +
		((expires) ? '; expires=' + expires.toGMTString() : '') +
		((path) ? '; path=' + path : '; path=/') +
		((domain.length) ? '; domain=' + domain : '') +
		((secure) ? '; secure' : '');
	}
	
	Basket.prototype.FormatNumber = function (val,sep,count){
		var num = (parseInt(val)).toString();
		var str = '';
		var i=(num.length-1);
		while(num.length){
			if(num.length>=count){
				str = num.substr(num.length-count) + (str!=''?sep:'') + str;
				num = num.substr(0,num.length-count);
			}
			else {
				str = num +(str!=''?sep:'') + str;
				num = '';
			}
		}
		return str;
	}

