/**
 * @author simone / spark
 */

$(document).ready(function(){
	initMenu();
	initObraPics();
	
	

});


initMenu = function()
{
	$('#menuitems #obrId li a').each(function(a,b){
		if( $(this).next().size() > 0 )
		{
			$(this).toggle(openMenu, closeMenu);
			$(this).mouseout(tryClosemenu);
		}
	});
}
/**
 * @alias closeSubs
 * @param {Object} item elemento DOM - LINK que foi clicado
 * @author spark
 * @return true
 * @classDescription Fecha todos os menus abertos no mesmo nivel do menu clicado
 */
closeSubs = function(item)
{
	$(item).parent().parent().find('.open').removeClass('open');
	return true;
}
openMenu = function()
{
	closeSubs(this);
	$(this).parent('li').addClass('open');
	$(this).next('ul').addClass('open');
	return false;
}

closeMenu = function()
{
	closeSubs(this);
	return false;
}

tryClosemenu = function()
{
	
}

initObraPics = function()
{
	$('#content #thumbs a').click(destacaFoto);
}

destacaFoto = function()
{
	$('#content #fotoimg').attr('src', this.href);
	return false;
}