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")){
			if(anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "external nofollow" || anchor.getAttribute("rel") == "nofollow external"){
				anchor.target = "_blank";
            }
		}
    }
}


var counter = 1;
function getImg(limit){
	var id = counter;
    var img = new Image();
	if((id-1) >= 0){
	    $('#img'+(id-1)).fadeOut(1500);
	}else if(!$('#img'+limit).attr('class').match(/loading/gi)){
	    $('#img'+limit).fadeOut(1500);
	}
	
	if($('#img'+id).attr('class').match(/loading/gi)){
		$(img).load(function() {
			$(this).css('display', 'none');
			$('#img'+id).removeClass('loading').append(this);
			$(this).fadeIn(1500);
		}).attr('src', $('#img'+id).attr('title'));
		$('#img'+id).removeAttr('title');
	}else{
		$('#img'+id).fadeIn(1500);
	}
	var wait = $('#img'+id).attr('class').replace(/loading /,'');
	if(counter >= limit){
		counter = 0;
	}else{
		counter = counter + 1;
	}
	setTimeout('getImg('+limit+');',wait);

}

$(window).load(function(){
	externalLinks();
});
function activateLightbox(){
	$('#gallery a').lightBox();
}
function SetText(txt){
	$('#right').html(txt);
}

$(function() {
	activateLightbox();
});

