﻿function GetOrganizationInfo(orgIntID, newsListId, updateCookie) {
    if (orgIntID != -1) {
        jQuery.ajax({
            type: "POST",
            url: "/Services/OrganizationService.asmx/GetOrganizationTopMenuInfo",
            data: "{ orgIntID : " + orgIntID + " }",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                jQuery("#" + newsListId).html(msg.d)
				    .show()
				    .next("div")
				    .hide();
            },
            error: function(er) {
                jQuery("#" + newsListId).hide()
				    .next("div")
				    .show();
            }
        });
        if (updateCookie) {
            jQuery.cookie('OrgIntID', null);
            var expiresDate = new Date();
            expiresDate = new Date(expiresDate.getFullYear() + 1, expiresDate.getMonth(), expiresDate.getDate());
            document.cookie = "OrgIntID=" + orgIntID + " ;expires=" + expiresDate;
        }
    }
    else {
        jQuery("#" + newsListId).hide()
				    .next("div")
				    .show();
    }
	return false;
}

function DisplayRegionForm() {
	jQuery("#SiteMenu div.regionNewsList").hide();
	jQuery("#SiteMenu div.regionForm").show();
}

function HideRegionForm() {
	jQuery("#SiteMenu div.regionNewsList").show();
	jQuery("#SiteMenu div.regionForm").hide();
}

function RegionForm_GetRegionAndOrganization(e) {
	var postalCode = e.value.trim().replace(" ", "");
	if (!isNaN(postalCode) && postalCode.length == 5) {
		jQuery("#MembershipLocation_AjaxLoader").show();
		eval(postalCodePostbackReference);
	}
}