/****************************************************************
*   Funzioni di configurazione
****************************************************************/
//modal popup
function hideModal() {
	$('#popUpBackGround').remove();
	var popup = $("#lavora-con-noi");
	popup.removeClass("popUpBody");
	popup.hide();

	window.onresize = function () {
		setFlashContent();
	}
}
function showModal(){
	var clientWidth = $(window).width();
	var clientHeight = $(window).height();

	var sfondo = $('<div id="popUpBackGround" />');
	sfondo.height((document.documentElement.scrollHeight ? document.documentElement.scrollHeight : document.body.scrollHeight) + 'px');
	sfondo.width((document.documentElement.scrollWidth ? document.documentElement.scrollWidth : document.body.scrollWidth) + 'px');
	sfondo.appendTo(document.body);


	var popup = $("#lavora-con-noi");
	popup.addClass("popUpBody");
	popup.css("left", ((clientWidth / 2) - (popup.width() / 2) + 'px'));
	popup.css("top", ((clientHeight / 2) - (popup.height() / 2) + 'px'));
	popup.show();

	window.onresize = function () {
		sfondo.height((document.documentElement.scrollHeight ? document.documentElement.scrollHeight : document.body.scrollHeight) + 'px');
		sfondo.width((document.documentElement.scrollWidth ? document.documentElement.scrollWidth : document.body.scrollWidth) + 'px');
		var clientWidth = $(window).width();
		var clientHeight = $(window).height();
		popup.css("left", ((clientWidth / 2) - (popup.width() / 2) + 'px'));
		popup.css("top", ((clientHeight / 2) - (popup.height() / 2) + 'px'));

		setFlashContent();
	}
}

//funzione per il resize dello scermo
function centerResize() {
	var main = $('#main');
	var clientHeight = $(window).height();
	var clientWidth = $(window).width(); ;
	main.css("top", ((clientHeight / 2) - (main.height() / 2) + 'px'));
	main.css("left", ((clientWidth / 2) - (main.width() / 2) + 'px'));
}
function setFlashContent() {
	var flash = $('#myFlashContent');
	var clientHeight = $(window).height();
	var clientWidth = $(window).width();

	if (clientHeight >= 562) {
		flash.height(clientHeight);
	} else {
		flash.height(562);
	}

	if (clientWidth >= 960) {
		flash.width(clientWidth);
	} else {
		flash.width(1003);
	}
}

/****************************************************************
*   Funzioni utente modificabili                                *
****************************************************************/
//
// funzioni per l'apertura di popUp
function privacy() {
	w = 600;
	h = 400;
	LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
	settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=' + w + ',height=' + h + ',left=' + LeftPosition + ', top=' + TopPosition + ',screenX=' + LeftPosition + ',screenY=' + TopPosition + '';
	win = window.open('moduli/privacy.html', 'normativa', settings)
}
function popUp(){
	w = 580;
	h = screen.height;
	LeftPosition = 0;//(screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = 0;//(screen.height) ? (screen.height-h)/2 : 0;
	settings = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+w+',height='+h+',left='+LeftPosition+', top='+TopPosition+',screenX='+LeftPosition+',screenY='+TopPosition+'';
	win = window.open('normativa.html','normativa',settings)
}
