$(function(){
	copyRightLinks();
	showHomePicTitles();
	showStuffPicTitles();
	menuColorize();
	goBack();
	colorHomeTitles();
});


function copyRightLinks(){
	if($('#copyright a').lenght==0){return false;}
	$('#copyright a').css({"opacity":"0.4"});
	$('#copyright a').hover(function(){
		
		$(this).stop().animate({"opacity":1}, 200);
	},function(){
		$(this).stop().animate({"opacity":0.4}, 200);
	});
}

function showHomePicTitles(){	
	if($('.home .box .title').length===0){return false;}		
	$('.home .box').hover(function(){
		$(this).children('.title').stop().animate({"height":"35px"},200 );
	},function(){
		$(this).children('.title').stop().animate({"height":"0"},400 );
	});	
}

function showStuffPicTitles(){	
	if($('.stuff .pic .title').length===0){return false;}		
	$('.stuff .pic').hover(function(){
		$(this).children('.title').stop().animate({"height":"35px"},200 );
	},function(){
		$(this).children('.title').stop().animate({"height":"0"},400 );
	});	
}

function menuColorize(){
	if($('#menu a').length===0){return false;}
	var el = $('#menu a');
	
	for (i = 0; i < (el.length); i++) {		
		var selected = $(el[i]).children('img');
		var old_src = selected.attr('src');
		var spl = old_src.split('_1.gif');
		var new_src = spl[0]+'_2.gif';		
		if($(el[i]).hasClass('sel')==true){			
			selected.attr('src', new_src);
		}		
	}
}

function goBack(){	
	$('a.back').click(function(e){
		e.preventDefault();
		history.go(-1);
	});
}

function colorHomeTitles(){
	if($('#homeContent').legth===0){return false;}
	$('#homeContent .title').css({
		opacity:0,
		display: 'block'
	});
	
	$('#homeContent .left a, #homeContent .right a')
	.hover(function(){
		$(this).parent().children('.title').stop().animate({opacity:1}, 300);
	},function(){
		$(this).parent().children('.title').stop().animate({opacity:0}, 300);
	});
	
	
}
