/* SkySoft.js
 * ==============
 * kernel of SkySoft js source, copyright by oursky.net, all rights reserved.
 * any use of this code or part of these code, must keep these lines
 *
 */

SSObj = function()
{
	this.loaded = false;
	this.hookLoad = "";
	this.hookUnload = "";
	this.errorHandling = true;
	this.returnErrors = true;
	this.onLoadCodes = [];
	this.onUnLoadCodes = [];
	this.onResizeCodes = [];
}
SSp = SSObj.prototype;
SSp.include = function(src) {
	src = src.split(".");
	if (src[src.length-1] == 'js') src.length -= 1;
	if (src[0] != 'skysoft' || src[2] && src[1] != 'common') return alert('发生错误 请在[技术支持]报告错误 或者发快信给 Xuefer');
	this.includex(src.join("."), false)
}
SSp.loadGroup = function(group) {
	if (!self.scripturl)
		self.scripturl = (self.rooturl||'')+'/scripts';
	document.write('<script language="Javascript1.2" src="'+self.scripturl+'/loadjs.php?filegroup='+group+'"><\/script>');
}
SSp.includex = function(filename, trans) {
	if (!self.scripturl)
		self.scripturl = (self.rooturl||'')+'/scripts';

	if (!filename) return;
	filename = filename.replace( /\./g , "/").replace("common/","").replace("skysoft/","")

	if (typeof trans == 'undefined' || trans)
		document.write('<script language="Javascript1.2" src="'+self.scripturl+'/loadjs.php?files='+filename+'.js&trans=1&c='+(is.charset||'')+'"><\/script>');
	else
		document.write('<script language="Javascript1.2" src="'+self.scripturl+'/loadjs.php?files='+filename+'.js"><\/script>');
}
SSp.addLoadFunction = function(f, name) {
	name = name||this.onLoadCodes.length;
	this.onLoadCodes[name] = f;
	return name;
}
SSp.delLoadFunction = function(name) {
	delete(this.onLoadCodes[name]);
}
SSp.addUnLoadFunction = function(f) {
	name = name||this.onUnLoadCodes.length;
	this.onUnLoadCodes[name] = f;
	return name;
}
SSp.delUnLoadFunction = function(f) {
	delete(this.onUnLoadCodes[name]);
}
SSp.addResizeFunction = function(f) {
	name = name||this.onResizeCodes.length;
	this.onResizeCodes[name] = f;
	return name;
}
SSp.delResizeFunction = function(f) {
	delete(this.onResizeCodes[name]);
}
SSp.loadHandler = function() {
	this.created = true;
	eval(this.onLoadCodes.join(";"));
	if (this.onLoad) this.onLoad();
	this.loaded=true;
	eval(this.hookLoad);
}
SSp.unloadHandler = function() {
	eval(this.onUnLoadCodes.join(";"));

	if (this.onUnload) this.onUnload();
	eval(this.hookUnload);
}
SSp.resizeHandler = function() {
	eval(this.onResizeCodes.join(";"));
	if (this.onResize) this.onResize();
}

// dreamwaver's findObject
SSp.findObject = function(n, d) {
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];

	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=this.findObject(n,d.layers[i].document);
	if(!x && d.getElementById)
		x=d.getElementById(n);
	return x;
}

// newest plugin version
SSp.InsertFlash = function(src, w, h, trans, newest)
{
	this.insertFlash(src, w, h, trans, true);
}
// common plugin version
SSp.insertFlash = function(src, w, h, trans, newest)
{
	w=w||100;
	h=h||100;
	var codebase = (swlf.resurl||self.rooturl||"http://www.our-sky.com") +
		"/" + "flash/plugin/swflash.cab#version="+
		(newest?"6,0,23,0":"5,0,0,0") +
		">"
		;
	document.write('\
		<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+codebase+'"\
		    width="'+w+'" height="'+h+'" \
		  <param name=movie value="'+src+'">\
		  ' +
		  (trans?'<param name=wmode value=transparent>':'')+ '\
		  <param name=quality value=high>\
		  <embed src="'+src+'" \
		    '+
		    (trans?'wmode=':'transparent')+' \
		    quality=high \
		    pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" \
		    type="application/x-shockwave-flash" width="'+w+'" height="'+h+'>\
		  </embed> \
		</object>\
		'
	);
}
// shortcut
SSp.obj = SSp.findObject;

// create object
SS = SkySoft = new SSObj();

// install handler
if (self.DynAPI||self.dynapi)
{
	if (!self.dynapi) dynapi = self.DynAPI;
	DynAPI.addLoadFunction("SkySoft.loadHandler();");
	DynAPI.addUnLoadFunction("SkySoft.unloadHandler();");
	DynAPI.addResizeFunction("SkySoft.resizeHandler();");
}
else
{
	SkySoft.hookLoad=window.onload;
	SkySoft.hookUnload=window.onunload;
	onload = function() { SkySoft.loadHandler(); }
	onunload = function() { SkySoft.unloadHandler(); }
	onresize = function() { SkySoft.resizeHandler(); }
}
// we need cookie functions
SkySoft.cookies = {
	save : function(name,value,days) {
		if (days) {
			var date=new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires="; expires="+date.toGMTString();
		}
		else expires = "";
		document.cookie = name+"="+escape(value)+expires+"; path=/";
	},
	read : function(name) {
		var nameEQ=name+"=";
		var ca=document.cookie.split(';');
		for(var i=0;i<ca.length;i++) {
			var c=ca[i];
			while (c.charAt(0)==' ') c=c.substring(1,c.length);
			if (c.indexOf(nameEQ)==0) {
				var str = unescape(c.substring(nameEQ.length));
				return str;
			}
		}
		return null;
	},
	del : function(name) {
		SkySoft.cookies.save(name,"",-1);
	}
};
SkySoft.cookies.write = SkySoft.cookies.save;

if (self.DynAPI) {
	self.DynAPI.cookies = SkySoft.cookies;
}

/* code from dynapi3, Powered by oursky.net
 */
function Browser() {
	var b = navigator.appName;
	var v = this.version = navigator.appVersion;
	var ua = navigator.userAgent.toLowerCase();
	this.v = parseInt(v);
	this.safari = ua.indexOf("safari")>-1;	// always check for safari & opera
	this.opera = ua.indexOf("opera")>-1;	// before ns or ie
	this.ns = !this.opera && !this.safari && (b=="Netscape");
	this.ie = !this.opera && (b=="Microsoft Internet Explorer");

	if (this.ns) {
		this.ns4 = (this.v==4);
		this.ns6 = (this.v>=5);
		this.b = "Netscape";
	}
	else if (this.ie) {
		this.v=parseInt(v.substr(v.indexOf("MSIE")+4));
		if (this.v > 7) {}
		else if (this.v >= 6) {this.ie6 = true;}
		else if (this.v >= 5) {this.ie5 = true;}
		else if (this.v >= 4) {this.ie4 = true;}
		this.b = "MSIE";
	}
	else if (this.opera) {
		this.v=ua.substr(ua.indexOf("opera")+6,1) * 1; // set opera version
		if (this.v >= 7) {this.opera7 = true;}
		else if (this.v >= 6) {this.opera6 = true;}
		this.b = "Opera";
	}
	else if (this.safari) {
		this.ns6 = (this.v>=5);	// ns6 compatible correct?
		this.b = "Safari";
	}
	this.dom = (document.createElement && document.appendChild && document.getElementsByTagName)? true : false;
	this.def = (this.ie||this.dom);
	this.win32 = ua.indexOf("win")>-1;

	if (this.win32) {
		this.win = true;
		if (ua.indexOf("nt")>-1) {
			this.nt = true;
			if (ua.indexOf("nt 5")>-1) {
				this.nt5 = true;
				if (ua.indexOf("nt 5.1")>-1) {
					this.nt51 = true
				}
			}
		}
	}
	else if (ua.indexOf("mac")>-1) { this.mac = true; }
	else if (ua.indexOf("x11")>-1) { this.x = true; }

	this.other = (!this.win32 && !this.mac);
	this.detectCharset();

	var minver = navigator.appMinorVersion||'';
	minver = ';'+minver.replace(/ /, '')+';';
	if (minver.indexOf('SP1')) this.sp1 = true;

	this.hand = this.ie ? 'hand' : 'pointer';
	this.blankpage = this.opera ? siteurl + '/blank.html' : '';
	this.cssCompatMode = !document.compatMode||document.compatMode=='BackCompat';

	this.supported = (this.def||this.ns4||this.ns6||this.opera)? true:false;
	if (!this.supported) window.status = '无法识别的浏览器. 本站脚本可能不支持该浏览器.';

	if (!window.navigate) {
		window.navigate = function(url) {
			window.location.href = phpurl(url);
		}
	}
}
Browser.prototype.detectCharset = function () {
	if (!self.document) return setTimeout("is.detectCharset()", 0);
	this.en = this.english = self.english;
	this.charset = (document.charset||document.characterSet||"").toLowerCase();
	var c = this.charset;
	this.cht	= (c=="big5"||c=="big5-hkscs"||c=="euc-tw");
	// gb2312 hz-gb-2312 x-gbk
	this.chs	= (c.indexOf("gb")>=0?true:false);
}

is = SkySoft.browser = new Browser();
var ie = is.ie;
var ns = is.ns

SS.cookies.save("TZ", - (new Date()).getTimezoneOffset(), 30);
if (is.sp1) {
	SS.cookies.save("SP1", 1, 30);
}

var p=parent;
if (p==self) p=window.opener;
var _p = p;

function require(js) { return SS.includex(js, false); }

function myonselectstart(e) {
	e = e||window.event; if (!e) return;
	var o = e_getSrc(e);
	if (o.tagName == "INPUT" || o.tagName == "TEXTAREA") {
		//if (o.getAttribute('selectable') === null)
			return;
	}

	if (o.getAttribute('selectable') === null)
		e.returnValue=false;
}
function myoncontextmenu(e) {
	e = e||window.event; if (!e) return;
	var o = e_getSrc(e);
	if(!o.contextmenu && o.tagName != "A" && o.tagName != "INPUT" && o.tagName != "TEXTAREA")
		e.returnValue =  false;
}

function pureurl(url) {
	url = (url||window.location.href).toString();
	if (url.indexOf("PHPSESSID")) {
		url = url.replace(new RegExp("PHPSESSID=.*", ""), "");
		if (url.substr(url.length - 1) == "&") url = url.substr(0, url.length - 1);
		if (url.substr(url.length - 1) == "?") url = url.substr(0, url.length - 1);
	}
	return url;
}
function pageurl() { return phpurl(window.location.href); }

function phpurl(url) {
	if (!self.PHPSESSID) { return url; }
	if (url.indexOf("PHPSESSID") != -1) { return url; }
	if (url.indexOf("?") == -1) url += "?";
	else url += "&";

	url += "PHPSESSID="+(self.PHPSESSID||SS.cookies.read("PHPSESSID"))
	return url;
}

// 以后将改为 /help.php?id=$helpid 之类的
function showhelp(url) {
	if (url.indexOf('/') == -1) {
		url = '/help.php?id=' + url;
	}
	return _open(url, 'srSM');
}
function showsendpage(comment) {
	if (!comment) comment = "";
	if (!self.pageurl) {
		self.pageurl = document.location.toString()
	}
	_open("/misc/sendpage.php?"+self.pageurl()+"&comment="+comment, '', 4, 4);
}
function mailto(uid,subject,body) {
	_open("/user/mailto.php?id="+(uid||"")+
		"&subject="+(subject||"")+
		"&body=" + (body||""), '', 4, 4);
}
function showuser(userid) { _open(typeof userid == 'object' ? userid.href : "/user/viewinfo.php?id="+userid, 'slrSM'); }
function shownews(newsid,chan) { _open("/news/show.php?chan="+(chan||'')+"&id="+newsid, 'slrM'); }
function showRegister() { _open('/user/register.php','slrSM'); }
function readtopic(p1,page,fpage,anchor) {
	var url;
	if (typeof p1 == 'string') url = p1;
	else {
		url = "/club/readtopic.php?id=" + p1;
		if (page) url += "&tpage=" + page
		if (fpage) url += "&fpage=" + fpage
	}
	url += (anchor||'');
	_open(url,'slrS', 790, 550);
}
function showann(annid) { _open("/club/showann.php?id="+annid,'sl',78,55); }
function goChat(clubid,e) {
	e = e||window.event;
	if (e && (e.ctrlKey || e.shiftKey)) return;

	showChat(is.cht? "%A4%D1%AA%C5%BCs%B3%F5":"%CC%EC%BF%D5%B9%E3%B3%A1");
	if (e) e.returnValue = false;
	return false;
}
function showChat(chan) {
	_open('/chat/mainframe.php?chan='+(chan||"our-sky"), 'rM');
}

function showVChat(id) {
	id=(id||"1").toString();
	var url = (self.siteurl||self.rooturl||"") + "/vc/index.php?room="+id;
	var wnd = self.open(url);
	wnd.focus();
	return wnd;
}

function showart(artid,chan) { _open("/article/show.php?id="+artid, 'Mslr'); }
function showupload() { /*openmaxsl('/user/upload.php'); */ return _open("/misc/upload.php", '!', 400, 450, 'uploadmanager', 100, 100); }
function showmsg_read(id) { return showmsgadv_read(id); }
function showmsg_send(name) { return showmsgadv_send(name); }
function showmsger() { return showmsgeradv(); }
function showmsgadv_read(id) {
	self.msgerpage = 'readmsg';
	if (!id) id = -1;
	self.msgid = id;
	msgeradv_go();
}
function showmsgadv_send(name) {
	self.msgerpage = 'readmsg';
	self.msgto = name;
	msgeradv_go();
}
function showmsgeradv() {
	self.msgerpage = 'recvbox';
	msgeradv_go();
}

function winHelper() {
	if (!is.ie) return window;

	var obj = new Object();
	obj.open = function(url, name, param, replace)
	{
		var w, h, x, y, fullscreen, center;
		var p = param.toLowerCase(), pp;
		p = p.split(",");
		// scan params;
		var yes = true, no = false;
		for (var i in p)
		{
			pp = p[i].split("=");
			switch (pp[0]) {
			case 'width':  w = eval(pp[1]); break;
			case 'height': h = eval(pp[1]); break;
			case 'left':   x = eval(pp[1]); break;
			case 'top':    y = eval(pp[1]); break;
			case 'xfullscreen':
				if ((is.ie55||is.ie6)&&is.sp1) break;
				param = param.replace(/xfullscreen=/, 'fullscreen=');
			case 'fullscreen': fullscreen = eval(pp[1]); break;
			}
		}

		if (!is.ie || !window.showModalDialog)
		{
			var pop=self.open(url||is.blankpage, name, param, replace);
		}
		else
		{
			var pop=self.open(is.blankpage, name, param, replace);
			if (!pop) {
				return;
			}

			var href = pop.location.href.toString();
			var loc;
			//((loc=href.indexOf(url)) == -1 || href.substr(loc) != url)
			if ( href == 'about:blank' || href == is.blankpage || href == '' || !sameurl(href, url)) {
				try {
					pop.document.open("text/html", true);
					pop.document.write("<title>Loading ...</title>"+
						'<font face="Tahoma" style="font-size:12px">Loading...</font>');
					pop.document.close();
					while (!pop.document||!pop.document.body) if (pop.closed) return false;
				} catch(e) { }

				var mw = pop.document.body.clientWidth;
				pop.resizeBy(1, 0);

				if (pop.document.body.clientWidth != mw) {
					pop.resizeBy(-1, 0);
				} else
				{
					pop.opener = self; pop.close();
					pop = null;
					self.showModalDialog("javascript:\"<"+"script language=javascript>self.open('"+url+"','"+name+"','"+param+"');window.close();"+"</"+"script>\"","","dialogWidth:0px;dialogHeight:0px");
					pop=self.open(is.blankpage, name, param, true);
					if (pop.opener != self) pop.opener = self
				}

				try { pop.location.replace(url); }
				catch(e) { pop.location.href = url; }
			}
		}

		if (fullscreen) {
			pop.resizeTo(w, h);
		}
		if (center) {
			var sw = (screen.availWidth||screen.width);
			var sh = (screen.availHeight||screen.height);
			pop.moveTo((sw-w)/2,(sh-h)/2);
		}
		pop.focus();
		return pop;
	}

	return obj;
}
function msgeradv_go() {
	var url = phpurl("/msger/mainframe.php");
	var wnd = _wndopen(is.opera ? url : is.blankpage, "msger", "xfullscreen=1,scrollbars=0", true, true);
	if (!wnd) return;
	wnd.opener = self;
	wnd.focus();
	if (wnd.frameloaded) { wnd.opener = self; if(wnd.go) wnd.go(); return true; }

	var px = is.ie ? -1000 : 100, py = is.ie ? 0 : 100;
	var myheight = 400, mywidth = 200;
	if (is.ns) { myheight+=26; mywidth +=6; }
	else if (is.opera) { myheight+=31; mywidth +=12; }

	wnd.resizeTo(mywidth, myheight);
	wnd.moveTo(px, py);
	if (!is.opera) {
		wnd.location.href = url;
	}
}
function url2name(url) {
	return url.toString().replace(new RegExp("[.:&/\\?\\(\\)=]*", "g"), "");
}

function wndchgsize(w,h) {
	var sw = (screen.availWidth||screen.width);
	var sh = (screen.availHeight||screen.height);
	if (screen.width < 800) { return; }
	if (!is.ie) return;
	if (document.body.clientWidth > 800) {
		window.resizeTo(w||800,h||550);
	} else {
		window.resizeTo(sw, sh);
	}
}
var lastOpenWnd = null;
function _wndopen(url, name, param, replace, usehelper) {
	var wnd;
	var helper = usehelper ? winHelper():window;
	var purl = phpurl(url);
	try{
		wnd = helper.open(purl, name||url2name(url), param, replace);
	}
	catch (e) {
		try { if (wnd) wnd.close(); } catch(e) {}

		try { wnd = helper.open(purl, name, param, replace); }
		catch (e) {
			try { if (wnd) wnd.close(); } catch(e) {}
			wnd = helper.open(purl, '', param, replace);
		}
	}
	if (wnd === false) return null; // closed
	if (!wnd) { alert(ebg("sorry, can't open window", "礚猭穝秨怠", "无法新开窗口")); return null; }
	// if (!wnd.opener) wnd.opener = self;
	lastOpenWnd = wnd;
	try { wnd.focus(); } catch(e) {}
	return wnd;
}

// , w, h, name, x, y
function _open(url) {
	var name;
	var max = false;
	var sw = screen.availWidth||screen.width
	var sh = screen.availHeight||screen.height

	var p_arg = 1;
	var args = _open.arguments;

	if (typeof args[1] != 'string') opt = '';
	else opt = args[p_arg++]||'';

	if (opt.indexOf('M') != -1)
	{
		max = true;
		w = sw;
		h = sh;
	}
	else
	{
		w = args[p_arg++] || 300;
		h = args[p_arg++] || 250;
	}
	name = args[p_arg++] || '';
	x = args[p_arg++] || 0;
	y = args[p_arg++] || 0;

	if (w < 100) w *= 10; if (w < 100) w *= 10;
	if (h < 100) h *= 10; if (h < 100) h *= 10;

	// common size fix
	if (!max && sh <= 600) {
		if (h > 500 && opt.indexOf('l') != -1) h -= 32;
		if (h > 500 && opt.indexOf('S') != -1) h -= 20;
	}

	var center    = (opt.indexOf('c') != -1);
	if (center) { w = (sw-w)/2; h = (sh-h)/2; }

	var param = 'top='+y+',left='+x+',width='+w+',height='+h;
	var opts = ['toolbar','scrollbars','resizable',
		'location','Status','fullscreen','menubar'];
	for (var i in opts)
	{
		var key = opts[i].substr(0, 1);
		param += ',' + opts[i] + '=' + (opt.indexOf(key) == -1 ? 'no':'yes');
	}

	var usehelper = (opt.indexOf('!') != -1);

	var wnd = _wndopen(url, name, param, false, usehelper);
	if (!wnd) return null; // failed or closed
	try { if (max) wnd.resizeTo(w, h);
	} catch(e) {}

	return wnd;
}

function openw(url,w,h,name) { return _open(url, '', w, h, name); }
function openwl(url,w,h,name) { return _open(url, 'l', w, h, name); }
function openwsl(url,w,h,name) { return _open(url, 'sl', w, h, name); }
function openmaxsl(url,name) { return _open(url, 'slrM', name); }

function win3x3(url,name) { openw(url, 300, 300,name); }
function win3x4(url,name) { openw(url, 300, 400,name); }
function win3x5(url,name) { openw(url, 300, 500,name); }
function win4x4(url,name) { openw(url, 400, 400,name); }
function win4x5(url,name) { openw(url, 400, 500,name); }
function win5x4(url,name) { openw(url, 500, 400,name); }
function win5x5(url,name) { openw(url, 500, 500,name); }
function win6x4(url,name) { openw(url, 600, 400,name); }
function win6x5(url,name) { openw(url, 600, 500,name); }
function win65x5(url,name) { openw(url, 650, 500,name); }
function win7x5(url,name) { openw(url, 700, 500,name); }
function win7x55l(url,name) { openwl(url, 700, 540,name); }
function win75x5(url,name) { openw(url, 750, 500,name); }
function win75x55(url,name) { openw(url, 750, 540,name); }
function win78x55(url,name) { openw(url, 780, 540,name); }
function win78x56(url,name) { openw(url, 780, 540,name); }

function win3x3s(url,name) { openws(url, 300, 300,name); }
function win3x4s(url,name) { openws(url, 300, 400,name); }
function win3x5s(url,name) { openws(url, 300, 500,name); }
function win4x4s(url,name) { openws(url, 400, 400,name); }
function win4x5s(url,name) { openws(url, 400, 500,name); }
function win5x4s(url,name) { openws(url, 500, 400,name); }
function win5x5s(url,name) { openws(url, 500, 500,name); }
function win6x4s(url,name) { openws(url, 600, 400,name); }
function win6x5s(url,name) { openws(url, 600, 500,name); }
function win65x5s(url,name) { openws(url, 650, 500,name); }
function win7x5s(url,name) { openws(url, 700, 500,name); }
function win7x55l(url,name) { openwl(url, 700, 540,name); }
function win75x5s(url,name) { openws(url, 750, 500,name); }
function win75x55s(url,name) { openws(url, 750, 540,name); }
function win78x55s(url,name) { openws(url, 780, 540,name); }
function win78x56s(url,name) { openws(url, 780, 540,name); }

function win3x4l(url,name) { openwl(url, 300, 400,name); }
function win3x5l(url,name) { openwl(url, 300, 500,name); }
function win4x4l(url,name) { openwl(url, 400, 400,name); }
function win4x5l(url,name) { openwl(url, 400, 500,name); }
function win5x4l(url,name) { openwl(url, 500, 400,name); }
function win5x5l(url,name) { openwl(url, 500, 500,name); }
function win6x4l(url,name) { openwl(url, 600, 400,name); }
function win6x5l(url,name) { openwl(url, 600, 500,name); }
function win65x5l(url,name) { openwl(url, 650, 500,name); }
function win7x5l(url,name) { openwl(url, 700, 500,name); }
function win7x55l(url,name) { openwl(url, 700, 540,name); }
function win75x5l(url,name) { openwl(url, 750, 500,name); }
function win75x55l(url,name) { openwl(url, 750, 540,name); }
function win78x55l(url,name) { openwl(url, 780, 540,name); }
function win78x56l(url,name) { openwl(url, 780, 540,name); }

function win3x4sl(url,name) { openwsl(url, 300, 400,name); }
function win3x5sl(url,name) { openwsl(url, 300, 500,name); }
function win4x4sl(url,name) { openwsl(url, 400, 400,name); }
function win4x5sl(url,name) { openwsl(url, 400, 500,name); }
function win5x4sl(url,name) { openwsl(url, 500, 400,name); }
function win5x5sl(url,name) { openwsl(url, 500, 500,name); }
function win6x4sl(url,name) { openwsl(url, 600, 400,name); }
function win6x5sl(url,name) { openwsl(url, 600, 500,name); }
function win65x5sl(url,name) { openwsl(url, 650, 500,name); }
function win7x5sl(url,name) { openwsl(url, 700, 500,name); }
function win7x55sl(url,name) { openwsl(url, 700, 540,name); }
function win75x5sl(url,name) { openwsl(url, 750, 500,name); }
function win75x55sl(url,name) { openwsl(url, 750, 540,name); }
function win78x55sl(url,name) { openwsl(url, 780, 540,name) }
function win78x56sl(url,name) { openwsl(url, 780, 540,name); }

function barmenu_onclick(base,e) {
	return;
}

// value to str, for debug
function v2str(){
	var i, s, numargs = arguments.length;
	s = "";
	for (i = 0; i < numargs; i++)
	{
		s += " "+arguments[i].toString();
	}
	return(s);
}

var titleCurTitle = null;
var titleCurObj = null;
var titleDiv = null;
var titleDiv1 = null;
var titleAlpha = 80;
var title_tmr = 0;
var titlehide_tmr = 0;
var titleShowing = false;
var titleHalfShowing = false;
var titleHideDelay = 100;
var titleShowDelay = 300;
var titleInitized = false;
var titleEvent = [];
var titleHoverobj = null;

SS.addLoadFunction("if (is._ns6 && !document.onmousemove)document.onmousemove=trackTitle;");
SS.addLoadFunction("if (!document.onmouseout)document.onmouseout=trackTitle;");
var title_ifmhtml = '<iframe id="mytitle1" frameborder="0" scroll="no" style="display:none"></iframe>';

function insertTitle() {
	if (is._ie55) {
		document.write(title_ifmhtml);
		titleDiv1 = document.getElementById("mytitle1");
	}
	document.write('<div id="mytitle"></div>');
	titleDiv = SS.findObject("mytitle");
}

function titleInit()
{
	if (titleDiv1) {
		var ts1 = titleDiv1.style;
		ts1.position = "absolute";
		ts1.display = "none";
		try { ts1.filter = "alpha(opacity=1)"; }
		catch(e) {}
	}

	var t = titleDiv
	t.align = "left";
	var s = t.style
	s.position = 'absolute';
	s.width = "auto";
	s.color = "black";
	s.display = "none";
	s.border = "solid";
	s.borderColor = "black";
	s.borderWidth = 1;
	s.backgroundColor = "RGB(202,255,252)";
	s.cursor = 'default';
	// try {
	titleHalfShowing = true;
	s.filter = "progid:DXImageTransform.Microsoft.dropShadow(OffX=5, OffY=5, Color='#3a5f5c',Positive='true') alpha(opacity="+Math.floor(titleAlpha/2)+")";
	// } catch(e) {}
	s.padding = "2px";
	s.fontSize = "12px";
	titleInitized = true;
}

function titleCreate()
{
	var b = document.body;
	if (is._ie55) {
		b.insertAdjacentHTML("BeforeEnd", title_ifmhtml);
		titleDiv1 = document.getElementById("mytitle1");
	}
	if (is.dom || b.appendChild) {
		titleDiv = document.createElement("DIV");
		b.appendChild(titleDiv);
	}
	else return false;
}

function titleDetection(o)
{
	var p = o;
	var e_parent;

	if (is.ie) e_parent = "parentElement";
	else if (is.def) e_parent = "parentNode";
	else return;

	var re = /(\n|\\n)/g;

	// search for title
	for (var depth = 0; p && depth<=2; depth++, p=p[e_parent])
	{
		if (!p.tagName) continue;
		if (p.mytitle) {
			o.mytitle = p.mytitle;
			if (o.alt) o.alt = '';
			if (o.title) o.title = '';
			break;
		}
		var title = p.getAttribute('title')||p.getAttribute('alt');

		if (typeof title == 'string')
		{
			title = title.toString().replace(re, "<br>")
			if (!o.mytitle) o.mytitle = title
			p.mytitle = title
			if (p.alt) p.alt = '';
			if (p.title) p.title = '';
			break;
		}
	}
}

function trackTitle(e) {
	if (is.ie5) return;
	if (!is.ie && !is._ns6) return;

	// this build of mozilla have bug that can't let trackTitle work!
	if (is.ns && navigator.productSub == "20011221") return;
	e=e||window.event; if (!e) return;
	if (titleShowing&&(e.shiftKey||e.ctrlKey||e.altKey)) return;

	if (!SS.loaded && !titleDiv) return;
	var o = !is.ie ? e_getSrc(e) : document.elementFromPoint(e.clientX, e.clientY);
	if (!o) return;

	if (!titleDiv||!titleInitized) {
		// create element;
		if (!titleDiv) { if (titleCreate() === false) return; }
		titleInit();
	}
	if (o.tagName == 'NOBR') o=o.parentElement||o.parentNode;
	if (o.id && o.id == titleDiv.id) return; // mouse over the title?!

	if (titleCurObj == o) return;
	if (e.type == "mouseout") ;
	else if (typeof o.mytitle == "undefined")
	{
		titleDetection(o);
	}
	if (!o.mytitle && !titleCurTitle) return;

	var mytitle = o.mytitle
	if (e.type == "mouseout") mytitle = "";

	if (mytitle && mytitle != titleCurTitle) {
		titleCurTitle = mytitle;
		titleCurObj = o;
		// copy needed info for showtitle
		titleEvent.x = e.x; titleEvent.y = e.y
		titleEvent.pageX = e.pageX; titleEvent.pageY = e.pageY
		if (titlehide_tmr) { clearTimeout(titlehide_tmr); titlehide_tmr = 0}
		if (title_tmr) { clearTimeout(title_tmr); title_tmr = 0; }
		if (titleShowing) showtitle(); // update now
		else title_tmr = setTimeout(showtitle, titleShowDelay*.7);
	} else if (!mytitle && titleCurTitle) {
		titleCurTitle = null;
		titleCurObj = null;
		if (titlehide_tmr) clearTimeout(titlehide_tmr);
		titlehide_tmr = setTimeout(hidetitle, titleHideDelay*.7);

		if (title_tmr) clearTimeout(title_tmr);
		title_tmr = setTimeout('titleShowing = false;', titleShowDelay);
		return;
	}
}
function hidetitle(hide)
{
	if (hide)
	{
		if(titleDiv) titleDiv.style.display = "none";
		if(titleDiv1)titleDiv1.style.display = "none"
	}
	else
	{
		titlehide_tmr = setTimeout("hidetitle(true)", titleHideDelay*.3);
		if (titleDiv) { titleHalfShowing = true; try{titleDiv.filters.item("alpha").opacity = Math.floor(titleAlpha/2);}catch(e){} }
	}
}
function showtitle(updnow)
{
	var e = titleEvent;
	if(!titleDiv||!titleCurTitle) return;

	var b = document.body, t = titleDiv, ts = titleDiv.style;
	var sclLeft = b.scrollLeft;
	var sclTop  = b.scrollTop;

	// where we place
	var x = is.ie?e.x+sclLeft:e.pageX;
	var y = is.ie?e.y+sclTop :e.pageY;
	var docWidth  = is.ie? b.clientWidth  : window.innerWidth;
	var docHeight = is.ie? b.clientHeight : window.innerHeight;

	t.innerHTML = "<nobr>"+titleCurTitle+"</nobr>";
	ts.display = 'inline'
	var divWidth  = t.offsetWidth ||t.scrollWidth;
	var divHeight = t.offsetHeight||t.scrollHeight;
	ts.display = 'none'

	var maxX = sclLeft + docWidth - divWidth - 30;
	var maxY = sclTop  + docHeight - divHeight - 30;

	if (divWidth) x = Math.max(5, Math.min(x, maxX));
	if (divHeight && y>maxY) y = maxY - divHeight*2; y = Math.max(5, y);

	ts.left = (x - 5) + 'px';
	ts.top = (y + 24) + 'px';

	ts.display = 'inline';
	titleShowing = true;
	if (titleHalfShowing)
	{
		title_tmr = setTimeout(function(){try{titleDiv.filters.item("alpha").opacity = titleAlpha;titleHalfShowing=false}catch(e){}}, titleShowDelay*.3)
	}

	if (titleDiv1) {
		var ts = titleDiv1.style;
		ts.display = 'inline';
		ts.width = divWidth + "px";
		ts.height = divHeight + "px";
		ts.left = (x - 5) + 'px'
		ts.top = (y + 24) + 'px';
	}
}

function scrollstart(e,w) {
	trackTitle(e)
}

function setfocus() {
	var numargs = arguments.length;
	var o;
	for (i = 0; i < numargs; i++)
	{
		o = SS.findObject(arguments[i]);
		if (o) {
			try{ if(!o.value) { o.focus(); break; }
			} catch(e) {}
		}
	}
}

// functions for event
function e_Prepair(e)
{
	if (!e.srcElement) e.srcElement = e.target;
	if (!e.srcElement) return false;
	if (e.srcElement.nodeName=="#text") e.srcElement = e.srcElement.parentElement;

	var o = e.srcElement;

	e.x = e.x||e.pageX;
	if (typeof e.offsetX == 'undefined')
	{
		e.offsetX = e.pageX - o.offsetLeft;
		e.offsetY = e.pageY - o.offsetTop;
	}

	if (typeof e.pageX == 'undefined')
	{
		e.pageX = e.x + document.body.scrollLeft;
		e.pageY = e.y + document.body.scrollTop;
	}
}
function e_getX(e) {
	return e.x||e.clientX||e.offsetX||e.pageX;
}
function e_getY(e) {
	return e.y||e.clientY||e.offsetY||e.pageY;
}
function e_getPageX(e)
{
	return is.ie?e.clientX+document.body.scrollLeft:e.pageX;
}
function e_getPageY(e)
{
	return is.ie?e.clientY+document.body.scrollTop :e.pageY;
}
function e_getSrc(e)
{
	var o = e.srcElement||e.target;
	if (!o) return null;
	if (o.nodeName=="#text") o=o.parentNode;
	return o;
}
var SS_PLI = [];
var SS_PLI_ID = 0;
//preload image
function PLI() {
	var src;
	for (var i = 0; i < arguments.length; i ++) {
		src = arguments[i];
		if (typeof src == 'string') {
			SS_PLI_ID ++;
			SS_PLI[SS_PLI_ID] = new Image();
			SS_PLI[SS_PLI_ID].src = src;
		} else if (typeof src == 'array') {
			for (var j = 0; j < arguments.length; j ++) {
				SS_PLI_ID ++;
				SS_PLI[SS_PLI_ID] = new Image();
				SS_PLI[SS_PLI_ID].src = src[j];
			}
		}
	}
}

function showHide(o) {
	if (typeof o == "string") o = SS.findObject(o);
	if (!o||!o.style) return;
	o.style.display = (o.style.display == "none")?"":"none";
}

function enterNext(o,e) {
	if (typeof o == "string") o = SS.findObject(o);
	if (!e) e=window.event;
	if (e.keyCode == 13) { o.focus(); e.returnValue = false; e.cancelBubble = true; }
}

function o_getComputedStyle(o)
{
	if (typeof o == "string") o = SS.findObject(o);
	return o.currentStyle||o.getComputedStyle();
}

// english big5 gbk
function ebg(en, cht, chs)
{
	return is.en ? en : ( is.cht ? cht : chs);
}
function ec(en, ch)
{
	return is.en ? en : ch;
}
// fine for absolute url only.
function sameurl(url1, url2)
{
	return _sameurl(url1, url2) || _sameurl(url2, url1)
}
function _sameurl(url1, url2)
{
	var loc = url1.indexOf(url2);
	if (loc < 0) return false;
	if (url1.substr(loc) != url2) return false;
	return true;
}
function back2url(url, target) {
	if (!target) target = self
	if (sameurl(target.document.location.href, url)) { return false; }
	else if (sameurl(target.document.referrer, url)) { target.history.go(-1); return false }
}
function o_absLeft(o)
{
	var ie = is.ie;

	var l = o.offsetLeft;
	var p = o.offsetParent;

	while (p != null)
	{
		if(ie && p.tagName == "TD")
		{
			l += p.clientLeft;
		}

		l += p.offsetLeft;
		p = p.offsetParent;
	}
	return l;
}

function o_absTop(o)
{
	var ie = is.ie;

	var l = o.offsetTop;
	var p = o.offsetParent;

	while (p != null)
	{
		if(ie && p.tagName == "TD")
		{
			l += p.clientTop;
		}

		l += p.offsetTop;
		p = p.offsetParent;
	}
	return l;
}
function o_scrollIntoView(o, bAlignToTop) {
	if (typeof bAlignToTop == 'undefined') bAlignToTop = true;
	if (is.ie) o.scrollIntoView(bAlignToTop)
	else {
		window.scrollTo(0, o_absTop(o));
	}
}
function res(obj) {
	switch(typeof obj)
	{
	case 'number': return obj.toString();
	case 'string': return obj;
	case 'function': return obj();
	case 'object':
		if (obj.src) return obj.src;
		else return obj.toString();
	default:
		return '';
	}
}
