var GlueProject = function() {
	function init() {
		$(document.body).addClass('js');
		
		pngFix();
		attachDropdown();
		attachGallery();
		attachYoutubePlaylist();
		attachQuotes();
		$(document).gaTracking({
					gaAccountID : 'UA-2766471-35',
					embedGACode : false
		});
	}
	
	function pngFix() {
		if (typeof(jQuery.fn.pngFix) == 'function') {
			$(document).pngFix();
		}	
	}

	function attachDropdown(){
		if ($('.language-select').length > 0) {
			$(".language dt a, .language-select .arrow").click(function() {
				$(".language dd ul").toggle();
				return false;
			});
			
			$(".language dd ul li a").click(function() {
				$(".language dd ul").toggle();
			});
		}
	}

	function attachGallery() {
		$('#gallery').galleryView({
			panel_width: 930,
			panel_height: 400,
			frame_width: 90,
			frame_height: 70,
			theme_path: '/img/',
			nav_theme: 'light'
		});
	}
	
	function attachYoutubePlaylist() {
		$('a.youtubethumb').click(function(event) {
			event.preventDefault();
						
			$(this).parents('.container').find('.youtube-container').html(
			    '<object width="620" height="390">' +
				'<param name="movie" value="http://www.youtube.com/v/' + $(this).attr('rel') + '?fs=1&amp;hl=en_GB"></param>' +
				'<param name="allowFullScreen" value="true"></param>' +
				'<param name="allowscriptaccess" value="always"></param>' +
				'<embed src="http://www.youtube.com/v/' + $(this).attr('rel') + '?fs=1&amp;hl=en_GB" type="application/x-shockwave-flash" width="640" height="390" allowscriptaccess="always" allowfullscreen="true"></embed>' +
			    '</object>');

			return false;
		});	
	}
	
	function attachQuotes() {
		$('.game_quotes').cycle({
			fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		});
	}
	
	return {
		init: init
	}
}();

$(document).ready(function(){
	GlueProject.init();
});

