$(function(){
	var w = $("html").width();
    if(w < 1010 && w > 850){
        $("body").css({overflowX : "hidden"});
    }
	$(".delme").focus(function(){
		if ($(this).is('input')) {
			var orival = $(this).val();
			$(this).val("");
		}else{
			var orival = $(this).html();
			$(this).html("");
		}
		
		$(this).blur(function(){
			if($(this).is('input')){
				if ($(this).val() != "" && $(this).val() != orival) {
					$(this).removeClass('delme').unbind('blur').unbind('focus');		
				}else{
					$(this).val(orival);
				} 
			}else{
				if ($(this).html() != "" && $(this).html() != orival) {
					$(this).removeClass('delme').unbind('blur').unbind('focus');
				}else if ($.browser.safari && $(this).val() != "" && $(this).val() != orival) {
					$(this).removeClass('delme').unbind('blur').unbind('focus');
				}else{
					$(this).html(orival);
				}
			}
			
		});
	});
//	$("form#commentform").submit(function(){
//		$(this).find("input[type=text], textarea").removeClass('errorc')
//		var el = $(this).find("input.delme[type=text]:not(.optional), textarea[value=Testo], textarea[value=''], input[type=text]:not(.optional)[value='']").addClass('errorc');
//		if(el.size() != 0){
//			$('.errorcomment').show();
//			return false;
//		}else{
//			//return true;
//		}
//
//	});
	/*
	 * Gestione link con immagini
	 */
	$(".entry a img").parent().addClass('link-with-image');
	$(".widget_categories .children li:last-child").addClass('last');
	
});