function set_act(obj,act){
	obj.act.value = act;
}

var newWin;
var flagModify = 0;
var wins = new Array();

function open_win(url,width,height,name){
	winopt =	"toolbar=no," +
				"scrollbars=yes," +
				"resizable=yes," +
				"location=no," +
				"status=yes," +
				"width=" + width + "," +
				"height=" + height;
	if (name == ""){
		name = "subwin";
	}
	newWin = window.open(url,name,winopt);
	newWin.focus();
	wins[wins.length] = newWin;
}

function close_all_window(){
	for(i = 0; i < wins.length; i++){
		if (!wins[i].closed){
			wins[i].close();
		}
	}
}

function open_close(src){
	var child,parent,childNum = 0;

	parent = src.parentNode;
	for (var i = 0; i < parent.childNodes.length; i++){
		if (parent.childNodes[i].nodeType != 1) continue;
		if (childNum != 1){
			childNum++;
			continue;
		}else{
			child = parent.childNodes[i];
		}
	}
	if (null != child &&
		"LI" == parent.tagName &&
		"UL" == child.tagName){
		parent.className = ("close" == parent.className ? "open":"close");
		child.className = ("expanded" == child.className ? "none":"expanded");
	}
}

function set_cookie_top(){
	document.cookie = "shlist='';path=/";
}

function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
	tmp1 = " " + document.cookie + ";";
	xx1 = xx2 = 0;
	len = tmp1.length;
	while (xx1 < len) {
		xx2 = tmp1.indexOf(";", xx1);
		tmp2 = tmp1.substring(xx1 + 1, xx2);
		xx3 = tmp2.indexOf("=");
		if (tmp2.substring(0, xx3) == key) {
			return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
		}
		xx1 = xx2 + 1;
	}
	return("");
}

function setCookie(key, val, tmp) {
	tmp = key + "=" + escape(val) + "; ";
	tmp += "path=/; ";
//	tmp += "expires=Tue, 31-Dec-2030 23:59:59; ";
	document.cookie = tmp;
}
function clearCookie(key) {
	document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
}

function format_number(num){
	var s = "" + num;
	var p = s.indexOf(".");
	if (p < 0) {
		p = s.length;
	}
	var r = s.substring(p,s.length);
	for (var i = 0; i < p; i++) {
		var c = s.substring(p - 1 - i, p - 1 - i + 1);
		if (c < "0" || c > "9") {
			r = s.substring(0, p - i) + r;
			break;
		}
		if (i > 0 && i % 3 == 0) {
			r = "," + r;
		}
		r = c + r;
	}
	return r;
}

function set_language(lang){
	setCookie("language",lang);
	window.location.href="/";
}


