﻿//window.onload = onWindowLoad;

/*=============================== </event hanlers> ====================================*/

function SetDivHTML(ctrlID, displayText) {
	var el = document.getElementById(ctrlID);
	el.innerHTML = displayText;
}

function AddToFavorites(obj, title, url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url, '');
		return false;
	}
	else if (window.external) {
		window.external.AddFavorite(url, title);
		return false;
	}
	else if (window.opera && window.print) {
		obj.setAttribute('href', url);
		obj.setAttribute('title', title);
		obj.setAttribute('rel', 'sidebar');
		obj.FireEvent('onclick');
		return false;
	}
}

function SetHomePage(HomePage) {
	if (document.all) {
		document.body.style.behavior = 'url( #default#homepage )';
		document.body.setHomePage(HomePage);

	}
	else if (window.sidebar) {
		if (window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch (e) {
				alert("this action was aviod by your browser，if you want to enable，please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
			}
		}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage', HomePage);
	}
}



function CheckIsDecimal() {
	var AsciiCode = event.keyCode;

	if (
			AsciiCode == 13 || /*enter*/
			AsciiCode == 8 || /*backspace*/
			AsciiCode == 39 || /*arrowleft*/
			AsciiCode == 37 || /*arrowright*/
			AsciiCode == 46 || /*delete*/
			AsciiCode == 65  /*ctrl + a*/
		) {
		event.returnValue = true;
	}
	else if (((AsciiCode < 48 && AsciiCode != 44) || AsciiCode > 57) ||
        (event.srcElement.value.indexOf(",") > 0 && AsciiCode == 44) ||
        (event.srcElement.value.length == 0 && AsciiCode == 44)) {
		event.cancelBubble = true;
		event.returnValue = false;
	}
}

