
/**
 * Manipulation de popup style overlay
 */
var popup = {

	/**
	 * Creation de popup
	 */
	creation:function(width, height, titre, withControl){

		if(width == undefined){width = 800;}
		if(titre == undefined){titre = 'L\'imprimerie générale';}
		if(height == undefined){height = 600;}

		var btn;

		if(withControl == undefined || withControl == false){

			btn = '';

		}else{

			btn = '<div class="popup_bouttons" id="popup_bouttons">\n\
						<a href="javascript:void(0)" onclick="popup.destroy()">\n\
							<img src="assets/img/icones/close_box_red.png" alt="[Fermer]" />\n\
						</a>\n\
					</div>';

		}

		$('body').append('<div class="popup" id="popup"><div class="popup_titre" id="popup_titre">'+titre+'</div>'+btn+'<div class="popup_content_data" id="popup_content_data"></div></div>');

		$('#popup').css('width', width + 'px');
		$('#popup').css('height', height + 'px');
		$('#popup_content_data').css('height', height - 50 + 'px');
		sharedTools.centerDiv('popup');
		
		//On met des bords arrondis au popup
		$('#popup').corner('10px');	
		$('#popup_titre').corner('10px top');
		
		$('#popup').draggable({handle: '#popup_titre'});
		$("#conteneur").fadeTo('0', 0.5);
		

	},

	/**
	 * Charge un contenu dans la popup
	 */
	loadContent:function(html){
		$('#popup_content_data').html(html);
	},


	/**
	 * Detruit la popup
	 */
	destroy:function(){
		$('#popup').remove();
		$("#conteneur").fadeTo('0', 1);
	}


}
