﻿/// <reference path="../Nm.js" />
(function ($) {
	
	var createShadow = function () {
		Nm.loadScript("~/Scripts/Nm/jquery.dropshadow.js", function () {
			$("#formcontainer-inner").dropShadow({
				top: 4,
				left: 4,
				blur: 2
			}).hide().fadeIn("fast");
		});
	};

	$(document).ready(function () {
		var toggleScanType,
			scanType;


		toggleScanType = function () {
			var visibleType = scanType.filter(":checked").val();
			if (visibleType === "SmartScan") {
				$("#ipRangeScanFields").hide();
				$("#smartScanFields").show();
			} else if (visibleType) {
				$("#smartScanFields").hide();
				$("#ipRangeScanFields").show();
			}
		};

		$("#emailSettingsRbnBtn").click(function () {
			Nm.openAspFormDialog({
				url: "/NmConsole/Configuration/DlgGlobalSmtpSettings/DlgGlobalSmtpSettings.asp",
				close: function () {
					Nm.reloadPage();
				}
			});
		});

		$("#credentialsLibraryRbnBtn").click(function () {
			Nm.openAspFormDialog({
				url: "/NmConsole/Configuration/DlgCredentialLibrary/DlgCredentialLibrary.asp",
				close: function () {
					Nm.reloadPage();
				}
			});
		});

		scanType = $("[name=ScanType]");
		if (scanType.length > 0) {
			toggleScanType();

			scanType.click(function () {
				toggleScanType();
			});
		}

		$("#formcontainer").css("margin", "0").center();
		createShadow();
	});

})(jQuery);
