﻿

getSilverlightVersion = function() {
	var SLVersion = "0.0";
	try {
		try {
			var control = new ActiveXObject('AgControl.AgControl');
			if (control.IsVersionSupported("3.0"))
				SLVersion = "3.0";
			else if (control.IsVersionSupported("2.0"))
				SLVersion = "2.0";
			else
				SLVersion = "1.0";
			control = null;
		}
		catch (e) {
			var plugin = navigator.plugins["Silverlight Plug-In"];
			if (plugin) {
				if (plugin.description === "1.0.30226.2")
					SLVersion = "2.0";
				else
					SLVersion = plugin.description[0];
			}
			else
				SLVersion = "0.0";
		}
	}
	catch (e) {
		SLVersion = "0.0";
	}
	return SLVersion;
}

getIsSilverlightInstalled = function() {
	var isSilverlightInstalled = "No";
	try {
		//check on IE
		try {
			var slControl = new ActiveXObject('AgControl.AgControl');
			isSilverlightInstalled = "Yes";
		}
		catch (e) {
			//either not installed or not IE. Check Firefox
			if (navigator.plugins["Silverlight Plug-In"]) {
				isSilverlightInstalled = true;
			}
		}
	}
	catch (e) {
	}
	return isSilverlightInstalled;
} 

