function changeList( listname, source, key, all ) {
	var list = eval(document.getElementById(listname));

	// empty the list
	for (i in list.options.length) {
		list.options[i] = null;
	}
	i = 0;

	if(all) {
	// make option all
		opt = new Option();
		opt.value = 0;
		opt.text = all;

		list.options[i++] = opt;
	}
	for (x in source) {
		if (source[x][0] == key) {
			opt = new Option();
			opt.value = source[x][1];
			opt.text = source[x][2];

			list.options[i++] = opt;
		}
	}
	list.length = i;
}

function count(obj, span, max) {
	objLength = max - document.getElementById(obj).value.length;
	if(objLength <= 0) {
		document.getElementById(obj).value = document.getElementById(obj).value.substring(0, max);
		objLength = 0;
	}
	document.getElementById(span).innerHTML = objLength;
}

function trOver(row){
	row.className=row.className.replace('out','over');
}
function trOut(row){
	row.className=row.className.replace('over','out');
}
//return true if the pressed key is numeric
function isNumberKey(evt) {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
}
function winOpen(url, target) {
	if(!target) target= '_self';
	window.open(url, target);
}
var hide800 = false;
function dOnResize()
{
	var ver = navigator.appVersion;
	var dom = document.getElementById ? 1: 0;
	var nIE5 = ( ver.indexOf('MSIE 5') > -1 && dom ) ? 1 : 0;
	var nIE6 = ( ver.indexOf('MSIE 6') > -1 && dom ) ? 1 : 0;
	var nIE7 = ( ver.indexOf('MSIE 7') > -1 && dom ) ? 1 : 0;
//	var nIE4 = ( document.all && !dom ) ? 1 : 0;
	var nNS5 = ( dom && parseInt(ver) >= 5 ) ? 1 : 0;
	var nNS4 = ( document.layers && !dom ) ? 1 : 0;

	if( nIE5 || nIE6 || nIE7 ) width = 950;
		else width = 1050;

	if (!hide800 && document.body.clientWidth <= width)
	{
		hide800 = true;
		var google = document.getElementById("google_120x600");
		if (google != null)
		{
			google.style.display = "none";
			//document.getElementById("page").style.width = "805px";
		}
	} else if (hide800 && document.body.clientWidth > width)
	{
		hide800 = false;
		var google = document.getElementById("google_120x600");
		if (google != null)
		{
			google.style.display = "";
			//document.getElementById("page").style.width = "955px";
		}
	}
}
window.onresize = dOnResize;