// neads mootools.js to work (class Options)

/* facebookManager
	@class 		:	A documenter 
	Lancement  du script : 	new  facebookManager({ mode : 2, parentID : "nom de l'id parent" });
	mode 1  : likebox with connection
	mode 2  : likebox no connection
	mode 3 : Like button with connection
	mode 4 : Like button no connection
*/

var facebookManager = new Class({
	options : {
		id : null, //String id
		mode : 1, //Integer
		parentID : null, //parent elment id
		connections : 6,
		height : 100
	},
	
	initialize : function(options){
	
		this.setOptions(options);
		this.width = $(this.options.parentID).offsetWidth;
		var oID =  this.options.parentID;
		//var string = this.getIframe();
		var string = this['getIframe' + this.options.mode]();
		$(oID).innerHTML = string;
		
	},

	getIframe1 : function() {
		var _s = '<iframe src="http://www.facebook.com/plugins/likebox.php?id=' + this.options.id + '&amp;width=' + this.width+ '&amp;height=' + this.options.height + '&amp;connections=' + this.options.connections + '&amp;stream=false&amp;header=false&amp;footer=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'+ this.width +'px; height:' + this.options.height + 'px;" allowTransparency="true"></iframe>';
		return _s;
	},
	
	getIframe2 : function() {
		var _s = '<iframe src="http://www.facebook.com/plugins/likebox.php?id=' + this.options.id + '&amp;width=' + this.width+ '&amp;height=' + this.options.height + '&amp;stream=false&amp;header=false&amp;footer=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'+ this.width +'px; height:' + this.options.height + 'px;" allowTransparency="true"></iframe>';
		
		return _s;
	},
	
	getIframe3 : function() {
		var _s = '<iframe src="http://www.facebook.com/plugins/like.php?href='+ encodeURI(document.location) +'&amp;layout=standard&amp;height=' + this.options.height + '&amp;show_faces=true&amp;width='+this.width+'&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'+ this.width +'px; height:' + this.options.height + 'px;" allowTransparency="true"></iframe>';
		return _s;

	},
	getIframe4 : function() {
		var _s = '<iframe src="http://www.facebook.com/plugins/like.php?href='+encodeURI(document.location)+'&amp;layout=standard&amp;height=' + this.options.height + '&amp;show_faces=false&amp;width='+this.width+'&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'+ this.width +'px; height:' + this.options.height + 'px;" allowTransparency="true"></iframe>';
		return _s;

	}

	
});

facebookManager.implement(new Options);


