
function showcase(arg, sp){
	var s = "";
	for(var i=0; i<arg.length; i++)
		s += arg[i] + sp;

	s = s.substring(0,s.length-1);
	return s;
}

function msg(){
	alert(showcase(arguments,","));
}

function msgln(){
	alert(showcase(arguments,"\n"));
}

function print(){
	document.write(showcase(arguments,","));
}

function println(){
	document.write(showcase(arguments,"<br>"));
}

function tip(){
	window.status = (showcase(arguments,","));
}

function showfor(e, sp){
	var s = "";
	for(var v in e)
		s += v +":"+ e[v] +sp;

	return s;
}

function forini(e){
	print(showfor(e, "<br>"));
}

function forini2(e){
	msg(showfor(e, "\n"));
}

function $id(e){
	return document.getElementById(e);
}

function $name(e){
	return document.getElementsByName(e);
}

function $tag(e){
	return document.getElementsByTagName(e);
}

window.onerror = function(a,b,c){
	tip(c +"ÐÐ,"+ a);
	return true;
}

function split1(str1,reg1){
	var str2 = str1;
	var reg2 = new RegExp(reg1,"ig");
	str2 = str2.split(reg2);
	return str2;
}

function replace1(str1,reg1,rep1){
	var str2 = str1;
	var reg2 = new RegExp("("+ reg1 +")","ig");
	while(reg2.test(str2)){
		str2 = str2.replace(RegExp.$1,rep1);
	}
	return str2;
}

function replace2(str1,reg1,rep1){
	var str2 = str1;
	var reg2 = new RegExp(reg1,"ig");
	str2 = str2.replace(reg2,rep1);
	return str2;
}

function search1(str1, reg1){
	var str2 = str1;
	var reg2 = new RegExp(reg1,"ig");
	if(str2.search(reg2) == -1)
		return false;

	return true;
}

function match1(str1, reg1){
	var str2 = str1;
	var reg2 = new RegExp(reg1,"ig");
	if(str2.match(reg2) == null)
		return false;

	return true;
}

function setCopy(s){
	window.clipboardData.setData('text', s);
}

function getCopy(){
	return window.clipboardData.getData('text');
}

//<span id="vcodespan">loading...</span>

//							<script src="/js/dojs.js" type="text/javascript"></script>
// Script language=javascript
//	gethttp("vcodespan","vcode.aspx");
//</Script>

function gethttp(sid, url) {

    if (!search1(url, "\\?")) {
        url += "?ra=" + Math.random();
    }
    else {
        url += "&ra=" + Math.random();
    }

    if (window.XMLHttpRequest) {
        var req = new XMLHttpRequest();
        if (req.overrideMimeType) {
            req.overrideMimeType('text/html');
        }
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                if (req.status == 200) {
                    //alert(id+" "+req.responseText);
                    document.getElementById(sid).innerHTML = req.responseText;
                }
                else {
                    alert("error: " + req.statusText);
                }
            }
        }

        try {
            req.open("GET", url, true); //GET
        }
        catch (e) {
            alert("3error: " + e);
        }

        req.setRequestHeader("Cache-Control", "no-cache");
        req.setRequestHeader("If-Modified-Since", new Date(0));
        req.setRequestHeader("Content-length", url.length);
        //req.setRequestHeader("Content-Type", "text/html; charset=utf8");
        req.setRequestHeader("Connection", "close");

        req.send(null);
    }
    else
        if (window.ActiveXObject) {

        try {
            var req = new ActiveXObject("Msxml2.XMLHTTP");
            req.setRequestHeader("Content-Type", "text/xml");
            req.setRequestHeader("Content-Type", "gb2312");
        } catch (e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) { }
        }

        //req = new ActiveXObject("Microsoft.XMLHTTP");

        if (req) {
            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    if (req.status == 200) {
                        //alert(id+" "+req.responseText);
                        document.getElementById(sid).innerHTML = req.responseText;
                    }
                    else {
                        alert("2error: " + req.statusText);
                    }
                }
            }
            req.open("GET", url, true); //GET

            req.setRequestHeader("Cache-Control", "no-cache");
            req.setRequestHeader("If-Modified-Since", new Date(0));
            req.setRequestHeader("Content-length", url.length);
            req.setRequestHeader("Connection", "close");

            req.send(null);
        }

    }
}

//function gethttp(div,url){
// var XmlHttp = new ActiveXObject("Microsoft.XMLhttp");
// XmlHttp.Open("POST",url,true);
// XmlHttp.send(null);
// XmlHttp.onreadystatechange = function(){
//  if (XmlHttp.readystate==4 || XmlHttp.readystate=='complete'){
//   document.getElementById(div).innerHTML = XmlHttp.responsetext;
//  }
// }
//}

function jsbug(msg){
	$id("jsbug").innerHTML += ":--"+ msg +"<br>";
}

//

function csgo(instr){
	var gostr = instr.split('@');

	msg(gostr[0]);
	location.href = gostr[1];
}

function getdate(now){
	var s = now.getDate();
	return s;
}

function getday(now){
	var s = now.getDay();
	return s;
}

function getyear(now){
	var s = now.getFullYear();
	return s;
}

function gethour(now){
	var s = now.getHours();
	return s;
}

function getmill(now){
	var s = now.getMilliseconds();
	return s;
}

function getmin(now){
	var s = now.getMinutes();
	return s;
}

function getmon(now){
	var s = now.getMonth() +1;
	return s;
}

function getsec(now){
	var s = now.getSeconds();
	return s;
}

function gettime(now){
	var s = now.getTime();
	return s;
}

function getnow(){
	return new Date();
}

function getnow2(s){ //"2008/1/1 12:34:56"
	return new Date(s);
}

function setdate(now,s){
	now = now.setDate(s);
	return new Date(now);
}

function setyear(now,s){
	now = now.setFullYear(s);
	return new Date(now);
}

function sethour(now,s){
	now = now.setHours(s);
	return new Date(now);
}

function setmill(now,s){
	now = now.setMilliseconds(s);
	return new Date(now);
}

function setmin(now,s){
	now = now.setMinutes(s);
	return new Date(now);
}

function setmon(now,s){
	now = now.setMonth(s-1);
	return new Date(now);
}

function setsec(now,s){
	now = now.setSeconds(s);
	return new Date(now);
}

function settime(now,s){
	now = now.setTime(s);
	return new Date(now);
}

function toestr(now){
	return now.toLocaleString();
}

function toInt(s){
	return parseInt(s);
}

function toFlot(s){
	return parseFloat(s);
}

function diday(s1,s2){
	var ss1 = getnow2(s1);
	var ss2 = getnow2(s2);
	var ss3 = ss2 -ss1;
	return toInt(ss3 /1000 /60 /60 /24);
}

function dihour(s1,s2){
	var ss1 = getnow2(s1);
	var ss2 = getnow2(s2);
	var ss3 = ss2 -ss1;
	return toInt(ss3 /1000 /60 /60 );
}

function dimin(s1,s2){
	var ss1 = getnow2(s1);
	var ss2 = getnow2(s2);
	var ss3 = ss2 -ss1;
	return toInt(ss3 /1000 /60 );
}

function disec(s1,s2){
	var ss1 = getnow2(s1);
	var ss2 = getnow2(s2);
	var ss3 = ss2 -ss1;
	return toInt(ss3 /1000 );
}

function adyear(now, s){
	var s1 = getnow2(now);
	var s2 = getyear(s1);
	var s3 = setyear(s1, s2 +s);
	return s3;
}

function admon(now, s){
	var s1 = getnow2(now);
	var s2 = getmon(s1);
	var s3 = setmon(s1, s2 +s);
	return s3;
}

function adday(now, s){
	var s1 = getnow2(now);
	var s2 = getdate(s1);
	var s3 = setdate(s1, s2 +s);
	return s3;
}

function adhour(now, s){
	var s1 = getnow2(now);
	var s2 = gethour(s1);
	var s3 = sethour(s1, s2 +s);
	return s3;
}

function admin(now, s){
	var s1 = getnow2(now);
	var s2 = getmin(s1);
	var s3 = setmin(s1, s2 +s);
	return s3;
}

function adsec(now, s){
	var s1 = getnow2(now);
	var s2 = getsec(s1);
	var s3 = setsec(s1, s2 +s);
	return s3;
}

function dateformat(now, s){ //@yy-@m1-@dd @hh:@m2:@ss
	var s1 = s;
	var s2 = getnow2(now);

	s1 = replace1(s1,"@yy",getyear(s2));
	s1 = replace1(s1,"@m1",getmon(s2));
	s1 = replace1(s1,"@dd",getdate(s2));
	s1 = replace1(s1,"@hh",gethour(s2));
	s1 = replace1(s1,"@m2",getmin(s2));
	s1 = replace1(s1,"@ss",getsec(s2));

	return s1;
}

function tostr(x){
	return x.toString();
}

function cstru(s){
	var str1 = "";
	var len = s.length;
	for (var i=0; i<len; i++){
		str1 += "&#"+ s.charCodeAt(i) +";";
	}
	return str1;
}

function cstr(s){
	var s1 = s;

	s1 = replace1(s1, String.fromCharCode(39), String.fromCharCode(39 +65248));
	for (var i=65; i<91; i++){
		s1 = replace1(s1, String.fromCharCode(i), String.fromCharCode(i +65248));
	}
	for (var i=97; i<123; i++){
		s1 = replace1(s1, String.fromCharCode(i), String.fromCharCode(i +65248));
	}
	for (var i=48; i<58; i++){
		s1 = replace1(s1, String.fromCharCode(i), String.fromCharCode(i +65248));
	}

	return s1;
}

function restr(s){
	var s1 = s;

	s1 = replace1(s1, String.fromCharCode(39 +65248), String.fromCharCode(39 ));
	for (var i=65; i<91; i++){
		s1 = replace1(s1, String.fromCharCode(i +65248), String.fromCharCode(i ));
	}
	for (var i=97; i<123; i++){
		s1 = replace1(s1, String.fromCharCode(i +65248), String.fromCharCode(i ));
	}
	for (var i=48; i<58; i++){
		s1 = replace1(s1, String.fromCharCode(i +65248), String.fromCharCode(i ));
	}

	return s1;
}

function pref(){
	return document.referrer;
}

function exe(s){
	window.execScript(s);
}

function esc(s){
	return escape(s);
}

function uesc(s){
	return unescape(s);
}

function evl(s){
	eval(s);
}

function purl(){
	return location.href;
}

function getmodel(str1,reg1,dep1){
	var str2 = "";
	var reg2 = new RegExp(reg1,"ig");
	while(reg2.test(str1)){
		switch(dep1){
			case 1: str2 += RegExp.$1 +"\n";
			break;
			case 2: str2 += RegExp.$2 +"\n";
			break;
			case 3: str2 += RegExp.$3 +"\n";
			break;
			case 4: str2 += RegExp.$4 +"\n";
			break;
			case 5: str2 += RegExp.$5 +"\n";
			break;
			case 6: str2 += RegExp.$6 +"\n";
			break;
			case 7: str2 += RegExp.$7 +"\n";
			break;
			case 8: str2 += RegExp.$8 +"\n";
			break;
			case 9: str2 += RegExp.$9 +"\n";
			break;
		}

	}
	return str2;
}

function getpass(s){
	return hex_md5(s);
}

function getcode(){
	var s1 = dateformat(getnow(),"T@yy@m1@dd@hh@m2@ss");
	return s1;
}

function getcodes(){
	var s1 = getcode() + getra(17);
	return s1;
}

function getra(s){
	var s1 = "";
	while (s1.length <s){
		var s2 = tostr(Math.random());
		s2 = s2.substring(2,s2.length);
		s1 += s2;
	}
	return s1.substring(0,s);
}

function cutstr(s, len){
	var i=0;
	for (i=0; i<s.length && len>0; i++){
		len -= 2;
		if (s.charCodeAt(i) <255){
			len += 1;
		}
	}
	return s.substring(0,i);
}

function cutstr2(s){
	var len =0;
	for (var i=0; i<s.length ; i++){
		len += 2;
		if (s.charCodeAt(i) <255){
			len -= 1;
		}
	}
	return len;
}

function flush(){
	location.reload();
}

function tagname(s){
	return s.tagName;
}

function tolower(s){
	return s.toLowerCase();
}

function toupper(s){
	return s.toUpperCase();
}

function trim(s){
	s = replace1(s,"^ +","");
	s = replace1(s," +$","");
	return s;
}

function gethttp2(jsss, url, div){
	$id(jsss).src = url +"&div="+ div +"&ra="+getra(15);
}

function html(id, s){
	$id(id).innerHTML =s;
}

function setval(id, k, v){
	evl("$id('"+ id+"')."+ k+" ='"+ v+"';");
}
