
function goTo(i) {
    location.href="index.php?page="+i;
}
function ShowHide(h,s) {
    $("#"+h).hide();
    $("#"+s).show();
}
function popUp(i) {
	switch(i) {
		case "_2":
			var username = "press";
			var hostname = "lisacorti.com";
			location.href = "mailto:" + username + "@" + hostname;    
			break;
		case "_3":
			   var w = 316;
			   var h = 500;
			   var l = Math.floor((screen.width-w)/2);
			   var t = Math.floor((screen.height-h)/2);
			   window.open("/copyright.html","","width=" + w + ",height=" + h + 
					   ",top=" + t + ",left=" + l +" ,toolbar=no, scrollbars=yes");
			break;
		case "_4":
			   var w = 300;
			   var h = 200;
			   var l = Math.floor((screen.width-w)/2);
			   var t = Math.floor((screen.height-h)/2);
			   window.open("/credits.html","","width=" + w + ",height=" + h + 
					   ",top=" + t + ",left=" + l +" ,toolbar=no, scrollbars=yes");
			break;
		case "_5":
			   var w = 320;
			   var h = 377;
			   var l = Math.floor((screen.width-w)/2);
			   var t = Math.floor((screen.height-h)/2);
			   window.open("/conferma.html","","width=" + w + ",height=" + h + 
					   ",top=" + t + ",left=" + l +", toolbar=no, scrollbars=no, menubar=no, location=no");
			break;
		default:
			   var w = 300;
			   var h = 432;
			   var l = Math.floor((screen.width-w)/2);
			   var t = Math.floor((screen.height-h)/2);
			   window.open("/where.php?number="+ i,"","width=" + w + ",height=" + h + 
					   ",top=" + t + ",left=" + l +" ,toolbar=no, scrollbars=yes");
	}
    /*location.href="index.php?page="+i;*/
}
function popUpNatale() {
	var w = 1024;
	var h = 724;
	var l = Math.floor((screen.width-w)/2);
	var t = Math.floor((screen.height-h)/2);
	window.open("/popup_natale.html","","width=" + w + ",height=" + h + 
			",top=" + t + ",left=" + l +", toolbar=no, scrollbars=no, menubar=no, location=no");
}

function show_next_press(i) {
    switch(i) {
    case 10:
        $('.first').hide();
        $('#press_2010_1').hide();
    //
        $('#press_2010_2').show();
        $('.second').show();
    break;
    case 11:
        $('.second').hide();
        $('#press_2010_2').hide();
        $('.first').show();
        $('#press_2010_1').show();
    break;
    case 0:
	$('.first').hide();
	$('#press_2009_1').hide();
	//
	$('#press_2009_2').show();
	$('.second').show();
	break;
      case 1:
	$('.second').hide();
	$('#press_2009_2').hide();
	$('.first').show();
	$('#press_2009_1').show();
	break;
      case 2:
	$('.first').hide();
	$('.third').hide();
	$('#press_2008_1').hide();
	$('#press_2008_3').hide();
	$('#press_2008_2').show();
	$('.second').show();
	break;
      case 3:
	$('.second').hide();
	$('.third').hide();
	$('.first').show();
	$('#press_2008_2').hide();
	$('#press_2008_3').hide();
	$('#press_2008_1').show();
	break;
      case 33:
	$('.first').hide();
	$('.second').hide();
	$('.third').show();
	$('#press_2008_2').hide();
	$('#press_2008_3').show();
	$('#press_2008_1').hide();	
	break;
      case 4:
	$('.first').hide();
	$('#press_2007_1').hide();
	//
	$('#press_2007_2').show();
	$('.second').show();
	break;
      case 5:
	$('.second').hide();
	$('#press_2007_2').hide();
	$('.first').show();
	$('#press_2007_1').show();
	break;
      case 6:
	$('.first').hide();
	$('#press_2006_1').hide();
	//
	$('#press_2006_2').show();
	$('.second').show();
	break;
      case 7:
	$('.second').hide();
	$('#press_2006_2').hide();
	$('.first').show();
	$('#press_2006_1').show();
	break;
      case 8:
	$('.first').hide();
	$('.third').hide();
	$('#press_2005_1').hide();
	$('#press_2005_3').hide();
	$('#press_2005_2').show();
	$('.second').show();
	break;
      case 9:
	$('.second').hide();
	$('.third').hide();
	$('.first').show();
	$('#press_2005_2').hide();
	$('#press_2005_3').hide();
	$('#press_2005_1').show();
	break;
      case 88:
	$('.first').hide();
	$('.second').hide();
	$('.third').show();
	$('#press_2005_2').hide();
	$('#press_2005_3').show();
	$('#press_2005_1').hide();	
	break;
    }
}
var LisaCorti = {}
LisaCorti.news_and_press = function() {
    var privacy = false;
    var public = {
        init_eventi_gui : function() {
            $("#nome").focus();
        },

        togglePrivacy : function () {
	        if (privacy == true) {
                privacy = false;
                document.getElementById("privacy_img").src="img/NW_newsletter/privacy_on.png";
                document.getElementById("flag_img").src="img/NW_newsletter/flag_on.png";
                document.getElementById("submit_img").src="img/NW_newsletter/submit_on.png";
            }
            else {
                privacy = true;
                document.getElementById("privacy_img").src="img/NW_newsletter/privacy_off.png";
                document.getElementById("flag_img").src="img/NW_newsletter/flag_off.png";
                document.getElementById("submit_img").src="img/NW_newsletter/submit_off.png";
            }
        },

        submit_form_newsletter : function () {
	        if (privacy == true) {
                var query = 'nome=' + encodeURIComponent($('#nome').val()) +
                            '&email=' + encodeURIComponent($('#email').val());
                $.post( "/ajax_services/newsletter_subscribe.php",
                        query,
                        function (data) {
                            alert(data.message);
                            if (data.ok) {
                                $('#nome').val('');
                                $('#email').val('');
                            }
                        },
                        "json" );
            }
            else {
                alert ("Attenzione: occorre accettare Le condizioni di tutela della privacy.");
            }
        }
    };

    return public;
}();

