
	popup = {
		close: function ()
		{
			$("#Overlay, #OverlayField").fadeOut("fast", function () {

				$("#Overlay").remove();
				$("#OverlayField").remove();

			});

			return false;
		},
		show: function (o)
		{

            $.ajax({
              url: "/program/issue_ajax/" + o.id + "/" ,
              dataType: 'html'
              })    
              .success(function(data){
                  
                    $("body").append(data);
                  
                    $("#PopUp select").SelectList({
                        Prefix: 'SearchBox'
                    });

                    change($("input[name=typeError]").val(), 1);

                    $("input[name=typeError]").change(function () {
                        change($(this).val(), 1);
                    });

                    $("#Overlay, #OverlayField").fadeIn("fast");

              })
              .error(function() {
              });
             
			return false;
		},
		viewFieldMSG: function (v, a)
		{
			if (v == a)
			{
				$("#PopUpMessage").css('display', 'block');
			}
			else
			{
				$("#PopUpMessage").css('display', 'none');
			}
		}
	}
$(document).ready(function () {

	if ($.browser.msie && $.browser.version == 7) $("#Content").css('overflow', 'hidden');

	$(".MenuItem").hover(function () {

		$(this).children(".SubMenuItem").css({ display: 'none' }).fadeIn("fast");

	},
	function () {

		$(this).children(".SubMenuItem").css({ display: 'none' });

	});

	$("#SearchBox select").SelectList({
		Prefix: 'SearchBox'
	});

	$(".MapsPageLink").click(function () {

		$(".MapsPageLink").removeClass("MapsPageLinkActive");
		$(this).addClass("MapsPageLinkActive");

		var active = $(this).index();

		$("#MapsField").animate({ left: -active*980+'px' }, "fast");

		return false;
	});

	if ($("input"))
	{
		var memoryI = new Array();

		$("input[memory=true]").focus(function () {

			$iI = $(this).index("input");
			$tI = $(this);

			if (memoryI[$iI] == $tI.val() || !memoryI[$iI])
			{
				memoryI[$iI] = $tI.val();

				$tI.val('');
			}
		});

		$("input[memory=true]").blur(function () {

			$iI = $(this).index("input");
			$tI = $(this);

			if ($tI.val() == '') $tI.val(memoryI[$iI]);
		});


	}
});

function change(v, a) {
    if (v == a)
    {
        $("#PopUpMessage").css('display', 'block');
    }
    else
    {
        $("#PopUpMessage").css('display', 'none');
    }
}
