/*	=Various
	------------------------------------------------------ */
$(document).ready(function(){

	//remove titles from images
	$('img').removeAttr("title");

	//carousel on the home page
	var carrousel = $("ul.slides").carrousel({
		direction:		'left',
		easing:			'easeInOutQuart',
		speed:			1500,
		dispTimeout:	7000,
		dispNumber:		3,
		scroll:			3,
		auto:			false
	});
	$('#next').click(function () {
		carrousel.next();
		return false;
	});
	$('#prev').click(function () {
		carrousel.prev();
		return false;
	});

	//collapsing blogarchive months
	$('h2.archives-month small a').click(function(){
		$(this).toggleClass('off');
		$(this).parent().parent().next('ul.collapsible').toggle();
	});

	//our work image fader
	$("#content ul.works li a img").mouseenter(function(){$(this).stop().fadeTo('fast', 0.1)}).mouseleave(function(){$(this).stop().fadeTo('fast', 1)});

	//single portfolio item slider
	$.fn.loopedSlider.defaults.addPagination = true;
	$('#loopedSlider').loopedSlider();

	//clients items arrange and fade in
	$('#clients').masonry({
		singleMode: true,
		itemSelector: '.clients'
	});
	//$('.clients').fadeTo('slow', 1);

});

/*	=external links (rel="external")
	------------------------------------------------------ */
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i];
	if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}  
}  
window.onload = externalLinks;


