//LISTENERS

$(document).ready(function() {
  init();
	setTips();
	setZoom();
	setPics();
	setSC();
	setScrollpane();
	setExtLinx();
	IEwarning();
});

// FUNCTIONS

function init() {
}

function setTips() {
	$('a.tip[title]').qtip( {
		style : {
			background : '#000000',
			name : 'dark',
			tip : true
		}
	});
}

function setZoom() {
	$('.imghome .zoom').removeAttr('href');
	$('.imghome .zoom').click(function() {
		var src = $(this).siblings('img').attr('src');
		$.fancybox( {
			href : src
		});
	});
}

function setScrollpane() {
	$('body #container #content').jScrollPane();
	$('body #container #content').show();
}

function setPics() {
	$('#pics a').fancybox({ 'onStart' : setScrollpane });
	window.setTimeout(setScrollpane,1000);
}

function setSC() {
	$('a.soundcloud').each(function() {
		var scbox = $(this);
		var scsrc = scbox.html();
		
		scbox.removeAttr('href');
				
		scbox.flash( {
			swf : scsrc,
      width : '90%',
      height : '18',
      wmode : 'transparent',
      allowscriptaccess : 'always'
		});
	});
}

function setExtLinx() {
    $('.entrymessage p a').each(function() {
        $(this).attr('target','blank');
    });
}

function IEwarning() {

	if (jQuery.browser.msie && jQuery.browser.version.substr(0, 1) < 7) {
		var warningText = 'The web browser that you are using is outdated, unsafe and affects the quality of this website. Please click here for an update.';
		$('body').prepend($('<a/>', {
			id : 'IEwarning',
			text : warningText,
			href : 'http://www.browserchoice.eu/',
			target : '_blank'
		}));
		$('body').css('border-top', 'none');
		$('#IEwarning').hide().slideDown();
	}
}

