/* Author:

 */

$(document).ready( function() {
	$('a.add-new-comment').click( function() {
		var id =$(this).attr('rel');
		$('.comments_page_'+id).parent().parent().slideToggle();
		return false;
	});
	
	
	if(align=='der'){
		$('#menu-menu-nuevo').css('float','right');
		
		var cantLi=0;
		$('.elementosDelMenu').each(function(){
			cantLi++;
			
		});
		$('#menu-item-'+(cantLi-1)).css('margin-right','0px');
	}
	
	if(align=='cent'){
		var y=0;
		var cont=0;
		$('.elementosDelMenu').each(function(){
			
			if(cont==0){
				cont=1;
				y=y+$(this).width();
			}else{
				y=y+$(this).outerWidth(true);	
			}
			
			
		});
		
		$('#menu-menu-nuevo').each(function(){
			var z=$(this).parent().parent().width();
			var aux=z/2-y/2;
			
			$(this).css('margin-left',aux+'px');
		});
		
	}
	
	
	$('img.size-full').each(function(){
		$(this).parent().css('text-align','center');
	});
	
	/*$('.imagenesPost img').each(function(){
		$(this).addClass("fotosPost");
	});*
	/*
	$(".fotosPost").wrap("<div class='contenedorImgPost' />");
	$('.contenedorImgPost').css({'position': 'relative'});
	$('.fotosPost').css({'margin':'0px', 'top':'0', 'left':'0'});
	$('.contenedorImgPost').prepend($("<div />", { 'class':'watermarkGif', 'css':{'z-index':'999'}}));
	$('.contenedorImgPost').append($("<img />", { 'class':'watermark','src':path}));
	
	$('.watermark').css({'position':'absolute','width': '50', 'height': '50','z-index':'1000', 'top':'0', 'left':'0'});
	*/

});


function mainmenu(){


	var timer = $.timer(function() {
    	//alert("Entra al timer");
    	$('nav ul li ul').hide();
    });

    timer.set({ time : 500, autostart : false });

	// Defino que submenus deben estar visibles cuando se pasa el mouse por encima
	$(".elementosDelMenu").mouseenter(function(){
			//reseteo counter
			//alert("Entra al mouseenter");
			$('nav ul li ul').hide();
   			$('ul',this).show();
   			timer.stop();
   			//alert("Para el timer");
	});
	
	$(".elementosDelMenu").mouseleave(function(){
		//Restart counter
		//alert("Entro al mouseleave y activo timer");
		timer.play();
	});
	
	
}


$(document).ready(function(){
    mainmenu();
});



