$(document).ready(function(){
		  	$(".first").hover(
				  	function(){
						$(this).parent().addClass("first-hover");
					  	},
					  	function(){
						  	$(this).parent().removeClass("first-hover");
					  	}
			);
		  	$(".second").hover(
				  	function(){
						$(this).parent().addClass("second-hover");
					  	},
					  	function(){
						  	$(this).parent().removeClass("second-hover");
					  	}
			);
		  	$(".one-command-button > a").hover(
				  	function(){
						$(this).parent().addClass("one-command-button-hover");
					  	},
					  	function(){
						  	$(this).parent().removeClass("one-command-button-hover");
					  	}
			);
		  	$(".box-header:not(.no-toggle)").click(
		  			function(){
		  				$(this).next(".box-content").toggle("blind","",1000);
		  			}
		  	)
		  	/*
		  	$("#dialog").dialog({
		  	   close: function(event, ui) {
		  		$(this).html("");},
		  		autoOpen : false,
		  		width : 700,
		  		height : 400
		  	});
		  	*/
		  	$("a.dialog").click(function(){
		  		var dialog = $("<div/>");
		  		$(dialog).attr("id",dialog).appendTo("body");
		  		$(dialog).dialog({
				  	   close: function(event, ui) {
			  		$(this).html("");
			  		$(this).replaceWith("");
			  		},
			  		bgiframe: true,
			  		autoOpen : false,
			  		width : 700,
			  		height : 400
			  	});
		  		var url = $(this).attr("href");
		  		//url = url+"&template=notemplate";
		  		
		  		if(url.indexOf("?")>0){
		  			url = url+"&template=notemplate";
		  		}else{
		  			url = url+"?template=notemplate";
		  		}
		  		
		  		$(dialog).load(url);
		  		$(dialog).dialog("open");
		  		return false;
		  	});
			$('.longtext').each(function() {
				if ($(this).attr('scrollWidth') > $(this).width()) {
					$more = $('<b class="more">&hellip;</b>');
					$more.attr("title",$(this).html());
					// add it to the dom first, so it will have dimensions
					$(this).append($more);
			
					// now set the position
					$more.css({
						top: '-' + $(this).height() + 'px',
						left: ($(this).attr('offsetWidth') - $more.attr('offsetWidth')) + 'px'
					});
				}
			});
			$("#attenzione").dialog({
				bgiframe: true,
				modal: true,
				buttons: {
					Ok: function() {
						$(this).dialog('close');
						submitForm();
					}
				},
				resizable: false,
				autoOpen: false
			});
});
var _form = null;
function dialog(form){
	_form = form;
	$('#attenzione').dialog('open');
	return false;
}
function submitForm(){
	_form.submit();
}

var _form;

