/* Mailmask */
function noSpam(){if(document.getElementById){var at="@";var links=document.getElementsByTagName('a');for(var i=0;i<links.length;i++){var linkElem=links[i];if(linkElem.className=='escape'){var mail=linkElem.firstChild;var domain=linkElem.lastChild;mail.nextSibling.firstChild.innerHTML=at;linkElem.href="mailto:"+mail.data+at+domain.data;}}}}

(function ($, window, document, undefined) {
	
	$(document)
		.ready(function(){
			noSpam();
			$('body').removeClass('js-disabled').addClass('js-enabled');
						
			$('.videoEntry').bind('click', function(){
				// extract video num from id
				videoID = $(this).attr('id').split('-')[1];
				$('#player')
					.addClass('enabled')
					.html(videoEntries[videoID])
					.children('iframe')
						.attr('id', '#player-' + videoID)
						.attr('height', '100%')
						.attr('width', '100%');
				window.location.hash = '#player-' + videoID;
			});
			
			hash = window.location.hash;
			hash = hash.split('-');
			if(hash.length == 2 && hash[0] == '#player'){
				$('#videoEntry-' + hash[1]).trigger('click');
			}
			
			console.log(videoEntries);
		});

})(jQuery, window, document);
