//
// ##################################################################
// All parts of Devious Codeworks software and products are copyright protected.
// Unauthorised use or distribution of any part of this software is strictly forbidden.
//                              Copyright ?2007 - Devious Codeworks
// ##################################################################
//
var dcsignal = 0;
var dcsecu = 0;
var dcbarc = 1;

System.Gadget.settingsUI = "dc-settings.html";

function LaunchPowerApplet()	{
	System.Shell.execute("control.exe" ,"/name Microsoft.NetworkAndSharingCenter");
}

function GadgetUpdate() {

	dcsignal = System.Network.Wireless.signalStrength;

	if (dcsignal == null) { dcsignal = 0 };

	dcstatus.width = dcsignal * 1.16;
	dcstatus.height = 10;

	if (dcsignal < 1) {
		dcpercent.innerText = "None Detected";
		dcnetworkid.innerText = "ID: ----";
		dcipaddress.innerText = "IP: ----";
		} else {
		dcpercent.innerText = dcsignal + "%";
		dcnetworkid.innerText = "ID: " + System.Network.Wireless.ssid;
		dcipaddress.innerText = "IP: " + System.Network.Wireless.address;
	};

	var currentSetting = System.Gadget.Settings.read("dcbarcolour");

	if (currentSetting != "") { dcbarc = currentSetting };

	if (dcbarc == 1 || dcbarc == 0 || dcbarc == null) { dcstatus.src = "./images/dc-wireless-blue.png" };
	if (dcbarc == 2) { dcstatus.src = "./images/dc-wireless-green.png" };
	if (dcbarc == 3) { dcstatus.src = "./images/dc-wireless-red.png" };
	if (dcbarc == 4) { dcstatus.src = "./images/dc-wireless-purple.png" };

	dcsecu = System.Network.Wireless.secureConnection;

	if (dcsecu == 0) {
		dcsecure.src = "./images/dc-wireless-nolock.png";
		} else {
		dcsecure.src = "./images/dc-wireless-lock.png";
	};

	setTimeout("GadgetUpdate()", 400);
}
