// -----------------------------------------------------------------------------------
// Ben Lomax 30 Oct 2011
// -----------------------------------------------------------------------------------

var FaceBook = Class.create();

FaceBook.prototype = {
   initialize: function() {   
	
	var currenturl = window.location.toString();
		
	var _url = "http://www.facebook.com/plugins/like.php?";
	  _url += "show_faces=false";
      _url += "&width=90";
      _url += "&height=20";
      _url += "&action=like";
      _url += "&font=arial";
      _url += "&colorscheme=light";

	   $$('.divFaceBookLike').each(function(obj) { 
	   		if(currenturl.indexOf('gt1.asp') >= 0) {
				_url += "&href=http://www.gamepod.co.uk/gt1.asp";
			} else if(currenturl.indexOf('gt2.asp') >= 0) {
				_url += "&href=http://www.gamepod.co.uk/gt2.asp";
			} else {
				_url += "&href=http://www.gamepod.co.uk/";
			}
			var likeHTML = new Element ('iframe', {
				scrolling: "no",
				frameBorder: "0",
				allowTransparency: true,
				src:_url + "&layout=standard"
			});
			obj.insert(likeHTML);
		});
		$$('.divFaceBookLikeBox').each(function(obj) { 
			if(currenturl.indexOf('gt1.asp') >= 0) {
				_url += "&href=http://www.gamepod.co.uk/gt1.asp";
			} else if(currenturl.indexOf('gt2.asp') >= 0) {
				_url += "&href=http://www.gamepod.co.uk/gt2.asp";
			} else {
				_url += "&href=http://www.gamepod.co.uk/";
			}
			var likeHTML = new Element ('iframe', {
				scrolling: "no",
				frameBorder: "0",
				allowTransparency: true,
				src:_url + "&layout=button_count"
			});
			obj.insert(likeHTML);
		});
		$$('.divFaceBookLikeSkin').each(function(obj) { 
			_url += "&href=http://www.gamepod.co.uk/live/forzaskins/"+ obj.id +".asp";
			var likeHTML = new Element ('iframe', {
				scrolling: "no",
				frameBorder: "0",
				allowTransparency: true,
				src:_url + "&layout=standard"
			});
			obj.insert(likeHTML);
		});
		
   }

}

document.observe('dom:loaded', function () { new FaceBook(); });
