//vars
var arr = new Array("col", "contact", "show");
//start
$(document).ready(function(){

	//replace e-mail address in document / replace external with blank
	$('a').each(function(){
		replaceEA($(this));
		if($(this).attr('rel') == 'external'){
			$(this).attr({'target':'_blank'});
		}
	});
	
	//start slideshow
	$('#galery').cycle({
		fx: 'fade',
		speed:  500, 
		next:   '#show', 
		timeout: 0 
	});
	
	//set
	$('#col, #contact').hide();
	
	//set tooltips
	$('a, acronym, #show img').tooltip({
		showURL	: false, 
		track	: true,
		fade	: 250
	});	
	
});

//function to replace e-mail addresses
function replaceEA(id){
	var txt = id.html();
	var href = id.attr('href');
	id.html(txt.replace('[(ad)]','@').replace('[(dot)]','.'));
	id.attr({'href':href.replace('[(ad)]','@').replace('[(dot)]','.').replace('[(m2)]','mailto')});
}

//function to show
function show(id){
	for(i=0; i<arr.length; i++){
		if('#'+arr[i] == id){
			$('#'+arr[i]).show();
		}else{
			$('#'+arr[i]).hide();
		}
	}
}


