$(document).ready(function() {
	$('.menu').each(function() {
		$(this).menu({
			content: $(this).next().html(),
			showSpeed: 100 
		});
	});

	var imgs = new Array();
	
	$('#backToTop').mouseover(function () {
		$(this).attr('src', $(this).attr('src').replace(/_out/, '_in'));
	}).mouseout(function () {
		$(this).attr('src', $(this).attr('src').replace(/_in/, '_out'));
	});
	$('#content img').each(function() {
		$(this).attr('id', $(this).attr('src').replace(/\./g,'').replace(/\/uploads\//g, '')); 
		imgs.push($(this).attr('src'))
	});
	
	$('.mOver').mouseover(function () {
		$(this).css('background', '#c3bbaf');
	}).mouseout(function() {
		$(this).css('background', '#e1ddd7');	
	});
	
	$('.linkMenu').mouseover(function() {
		killAllMenus();
	});
	
	$.ajax({
	    type: 'POST',
	    url: '/getImages.php',
	    data: 'images='+imgs.toString(),
	    success: function(msg) {
	    	var images = msg.split('\n');
	
			for (var i = 0; i < images.length; i++) {
				var image = images[i].split(',');
				
				if (image[0] != '') {
					$('#'+image[0]).wrap('<a class="lightbox" href="/'+image[1]+'" ></a>');
				}				
			}
			$('a.lightbox').jboxed();
	    }
	});
});