/*
	PopupBesteseller
	Ok!nteractif
*/

function PopupBestseller(){
	this.title =	'';
	this.price =	'';
	this.editor =	'';
	this.author =	'';
	this.imgSrc =	'';
	this.imgId =	'';
	this.bookId=	'';
	this.href=		'livre.asp?id=';
	
	this.output = function (){
		var html="";
		var popup_header='';
		var popup_body='';
		var formatedPrice = this.formatPrice();
		
		this.href += this.bookId;
		
		popup_header += "<img src='inc_moda_navigation/medias/accueil/meilleur_vendeur_popup_box_top.png' />";
		
		popup_body += "<a class='btn_popup_meilleur_vendeur' href='"+ this.href +"'>";
			popup_body += "<div class='meilleur_vendeur_popup_centre'>";							
				popup_body += "<div class='meilleur_vendeur_popup_content'>";	
										
					popup_body += "<span class='meilleur_vendeur_popup_titre'>";
						popup_body += this.title;
					popup_body += "</span><br />";
					
					popup_body += "<span class='meilleur_vendeur_popup_label'>";
						popup_body += "Par ";
					popup_body += "</span>";
					popup_body += this.author + "<br />";							
					
					popup_body += "<span class='meilleur_vendeur_popup_label'>";
						popup_body += "Les &eacute;ditions ";
					popup_body += "</span>";
					popup_body += this.editor + "<br />";
					
					popup_body += "<span class='meilleur_vendeur_popup_prix'>";	
						popup_body += formatedPrice[0]+',';
						popup_body += "<sup>"+ formatedPrice[1] +"$</sup>";
					popup_body += "</span>";
					
				popup_body += "</div>";	
			popup_body += "</div>";

			popup_body += "<img src='inc_moda_navigation/medias/accueil/meilleur_vendeur_popup_box_bottom.png' />";
		popup_body += '</a>';
		
		html += '<div class="nouv_prim_livre" id="nouv_prim_livre_'+ this.imgId +'" title="header=['+ popup_header +'] body=['+ popup_body +'] offsety=[-130] offsetx=[0]">';
			html += '<table class="table_nouv_prim_livre"><tr><td>';
				html += '<a class="btn_livre_meilleur_vendeur" href="'+ this.href +'">';
					html += '<img class="nouv_prim_img" src="'+ this.imgSrc +'" width="137" alt="'+ this.title +'" title="'+ this.title +'" />';
				html += '</a>';
			html += '</td></tr></table>';
		html += '</div>';
		
		return html;	
	}
	
	this.formatPrice = function(){
		var formated = ['', ''];
		var sepCar = '.';
		
		if (this.price.indexOf(',', 0)){
			sepCar = ',';
		}
		
		formated[0] = this.price.substring(0, this.price.indexOf(sepCar, 0));
		formated[1] = this.price.substring(this.price.indexOf(sepCar, 0)+1, this.price.length);
		
		return formated;
	}
};
