$(document).keyup(function(e){

    if(e.keyCode === 27)
    {
        $("#fullScreenLoginDiv").hide();
        $("#fullScreenMapDiv").hide();
        $("#fullScreenEventDetailDiv").hide();
        $("#fullScreenNewsletterSignupDiv").hide();
    }
});

function fullScreenLogin(acctid) 
{
	if(acctid > 0)
	{
		document.formItinLogin.action = "/functions/verifyitinuser.php?acctid="+acctid+"&return="+window.location.href;
	}

	var widthValue = $( window ).width() - 40;
	var heightValue = $( window ).height() - 40;

	$( "#fullScreenLoginDiv" ).css("height",heightValue+"px");
	$( "#fullScreenLoginDiv" ).css("width",widthValue+"px");

	var loginDivMargin = ($( window ).height() - $( "#logindiv" ).outerHeight())/2;
	// alert($( window ).height()+"    "+$( "#logindiv" ).outerHeight());
	$( "#logindiv" ).css("margin-top",loginDivMargin+"px");

	$( "#fullScreenLoginDiv" ).show();	
}

function fullScreenEventDetail(eventid,eventdate) 
{
	$("#eventdetailpopupdiv").html('<img src="/images/ajax-loader.gif"/>');

    var height = $(window).height();
    // $('#photogalleryiframe').css('height', height * 0.8 | 0);

    var width = $(window).width();
    var detailwidth = $(window).width();
    
    if(detailwidth > 1000)
    {
    	detailwidth = 1000;
    }

    $('#eventdetailpopupdiv').css('width', detailwidth * 0.8 | 0);

    $( "#fullScreenEventDetailDiv" ).css("height",height+"px");
    $( "#fullScreenEventDetailDiv" ).css("width",width+"px");
    $( "#fullScreenEventBackground" ).css("height",height+"px");
    $( "#fullScreenEventBackground" ).css("width",width+"px");

    $( "#fullScreenEventDetailDiv" ).show();

    // $('#eventdetailpopupdiv').html(eventid);

    jQuery.ajax({
        type: "GET",
        url: "https://www.travelmedford.org/inserts/eventsdetailpopup.php",
        data: { id: eventid,
        		eventdate: eventdate
              },
        success: function(msg) {
            $("#eventdetailpopupdiv").html(msg);
        }
    });

}

function fullScreenNewsletterSignup() 
{
	var widthValue = $( window ).width() - 40;
	var heightValue = $( window ).height() - 40;

	$( "#fullScreenNewsletterSignupDiv" ).css("height",heightValue+"px");
	$( "#fullScreenNewsletterSignupDiv" ).css("width",widthValue+"px");
    $( "#fullScreenNewsLetterBackground" ).css("height",heightValue+"px");
    $( "#fullScreenNewsLetterBackground" ).css("width",widthValue+"px");

	$( "#fullScreenNewsletterSignupDiv" ).show();	
}
