/*
 * Document Ready
 */

$(document).ready(function() 
{
	


/*
 * Funzione che richiama il dialog con il form per salvare e modificare
 */

	$(".openPopUp").click(function () {

		$("#popup").dialog('destroy');
	
		if($(this).attr("title"))		
			var title = $(this).attr("title");
		else
			var title = $(this).html();

		var tmpSize = (searchGet($(this).attr("href"), "size"));
		var size = tmpSize.split("x");
	
		if(!size[0] || !size[1])
		{
			size[0] = 250;
			size[1] = 100;			
		}

		$('#popup').load($(this).attr("href"), function() {

			
			$("#popup").dialog({
				bgiframe: true,
				modal: true,
				autoOpen: false,
				title:title,
				width:Math.round(size[0]),
				height:Math.round(size[1])
			});
 			$("#popup").dialog('open');
		});	
		return(false);
	});
});	






function intCntLink(link)
{
	if(link.search("&"))
		return("&");
	else
		return("?");	
}


function searchGet(link, get)
{
	var i;
	arLink = link.split(/([?&])/);
	
	for(i=0;i<arLink.length;i++)
	{
		thisGet = null;
		thisGet = arLink[i].split("=");
		if(thisGet[0] == get)
			return(thisGet[1]);		
	}
}

function refresh(timeOut)
{
	if(!timeOut)
		window.location.reload();
	else
		setTimeout("window.location.reload()", timeOut);
}


function hideBanner()
{
	$(".banner-header, .box-sn, .banner-side, .banner-foot").hide();
}

function showBanner()
{
	$(".banner-header, .box-sn, .banner-side, .banner-foot").show();
}





