﻿if( typeof(gLang) == 'undefined' ){
	var gLang = new Array();
}
var NtLanguage = 'zh_CN';
gLang['zh_CN'] = new (function () {
	this.zhBlank = "　";
	this.userIdHead = "guest";
	this.userNameHead = "游客";
	this.guestSessionId = "NtalkerGuestUserSessionID";
	this.pageGroupsEntranceTip = ["打开%1", "点击进入%1聊天", "点击这里开始聊天"];
	this.pageStatusTip  = "跟我聊天";
	this.toolbarGroupTip = "请点击这里开始群聊";
	this.adminUserName= "管理员";
	this.replaceExpression  = ["[表情]", "[图片]"];	this.requestChat = ["请求与您会话", "聊天请求", "聊天消息", "群组消息"];
	this.requestAddFriend = ["加您为好友", "加好友请求"];
	this.onlineText = "刚刚上线";
	this.requestSessionTitle = "请求与你 %1";
	this.audioSession = "音视频会话";
	this.videoSession = "音频会话";
	this.fileTransfer = "传输文件";
	this.receiveMessageTitle  = "%1 说：%2";
	this.popupWindowTitle  = "聊天窗口";
	this.promptTitle = "【%1】%2 - %3";	this.noInstallFlash = "Flash插件未安装或版本过低,请重新安装.";
	this.loadFlashFailure = "Flash装载失败，请点击此处重新连接...";
	this.notLogin = "您还没有登录，请先登录！";
	this.connectErr = "连接失败，请稍候重试！";
	this.buddylistWindowTitle  = "好友列表";
	this.buddylistNotLoginAlter = "您尚未登录，请登录后再使用好友列表！";	this.sd_Buddylist = "好友列表";
	this.sd_closeGroupWindow = "关闭群聊窗";
	this.sd_closeNQuanWindow = "关闭能圈";
	this.sd_closeChatWindow  = "关闭一对一聊窗";
	this.sd_eventOpen   = "打开";
	this.sd_eventClose  = "关闭";
	this.sd_GroupWindow = "群聊窗";
	this.sd_NQuanWindow = "能圈";
	this.sd_ChatWindow  = "一对一聊窗";
	this.sd_eventType = ["(主)","(被)","(携)"];
	this.sd_superPromotionMessage = "收到superuser推广的nquan消息";
	this.sd_openSystemMessageBoxDesc = "打开消息盒子系统消息标签";	this.minWindowTitle = "与 %1 对话";
	this.sayContent = "说 %1";
	this.messageBoxTitle = "通知";
	this.CONST_siteApplication = "站内应用";
	this.LoadingText = "载入中...";
	this.buddylistButtonText = ["联系人(%1/%2)", "好友(%1/%2)"];
	this.groupButtonText = "群组(%1)";
	this.systemButtonText = "通知";
	this.scrollButtonText = ["向前滚动", "向后滚动"];
	this.myAppButtonText = "我的中心";
	this.hotFocusButtonText = ["热点聚焦", "最新帖", "最热帖"];
	this.systemMessageBoxText = ["动态消息", "系统消息"];
	this.spanSwitchButtonText = ["显示工具栏", "隐藏工具栏"];
	this.spanConfigurationText = "设置";
	this.configurationMenuDynamicMessages = ["动态消息","接收原创消息","接收评论消息"];
	this.configurationMenuGroupSetting = ["群组设置","使用群组自身消息设置","屏蔽所有群组消息"];
	this.configurationMenuOtherSettings = ["其它设置","好友上线提示","允许接收陌生人消息","系统声音提示"];
	this.configurationMenuLinkText = "查看所的聊天记录";	this.nullMessage = ["暂无%1","暂无%1消息"];
	this.viewPhotoTitle = "图片浏览";
	this.ApplicationName = {};
	this.ApplicationName['1'] = '图片浏览';
	this.ApplicationName['2'] = '团购';	this.customApplicationButtonText = '直播';	this.myAppButtonTextLength=6;	this.spanBuddylistlength=0;	this.spanGroupslength=0;	this.spanNoticelength=0; 
	this.sheetFileName = 'ntalkerToolbar.css';
})();
var Ntalker = {
	unKey:"imNt_uLoad_ctWind",
	ctKEY:"systemMessage",
	gpKEY:"groupMessage",
	guestUserNoKEY:"imNt_guestNo",
	tbModelKEY:"toolbarMode" 
};
Ntalker.version = {
	script_version: "[TimeOfIssue]",
	presence_flash : "3.2.16",
	buddylist_flash: "3.2.16",
	webchat_flash : "3.2.18",
	group_flash : "3.2.16",
	nquan_flash : "3.2.16",
	traing_flash : "1.0.0",
	activity_flash: "1.0.1"
};
Ntalker.variable = {
	openHistoryWindow: false,
	presenceConnet: false,
	ExMsg: [],
	myApp:[],
	applicationOpened: false,
	onlineChat: 10,	offlineChatList: [],
	siteid: null,
	user_id: null,
	user_name: null,
	user_sid: null,
	userparam: null,
	popupWindow: null,
	scriptPath: "",
	buddylistTag: null,
	iframes:[]
};
Ntalker.temp = {
	webchatDataModReady: false,
	current_tag:[],
	cssLoaded: false,
	chatDataFlashReady:true,
	presenceFlashGoUrl: null,
	buddylistFlashGoUrl: null,
	notify_id: 0,
	userSpanArray: null,
	resetwintop: new Array(),
	pageId: null,
	Tip: null,
	imSid: null,
	ready: false
};
Ntalker.Config = {
	services: "http://" + "down2.ntalker.com/res",
	hotserver: "",
	waitRetuenServiceUrl: false,
	publicDIR: "",
	imagesDIR: "",
	customDIR: "",
	skin:"",
	bColor:"",
	bgColor:"",
	logo: "",
	buddylistlogo:"",
	chatlogo:"",
	nquanlogo:"",
	grouplogo:"",
	chatroomlogo:"",
	startlogo:"",
	groupstartlogo:"",
	chatWidth:384,
	chatHeight:416,
	groupWidth:460,
	groupHeight:532,
	IMWidth:248,
	IMHeight:532,
	IMtabIndex: 0,
	customtoolbarButtons: [],	 
	application:[], 
	customparams: []
};
Ntalker.room = {
	roomid:null,
	roomname:null
};
var chatWindowManager = null;
var promptwindow = null;
var im_myIMWindow = null;
var IMToolBar = null;
var NtLang = null;
var NtExecCommandTimer = 0;
var $$B, $$O, $$selector, $$A, $$F, $$D, $$E, $$S, $$C, $$J;
(function(){
$$B = (function(ua){
	var b = {
		msie: /msie/.test(ua) && !/opera/.test(ua),
		opera: /opera/.test(ua),
		safari: /webkit/.test(ua) && !/chrome/.test(ua),
		mozilla: /mozilla/.test(ua) && !/(compatible|webkit)/.test(ua),
		firefox: /firefox/.test(ua),
		chrome: /chrome/.test(ua),
		maxthon3: /maxthon/.test(ua) && /safari/.test(ua)
	};
	var vMark = "";
	for (var i in b) {
		if (b[i]) { vMark = "safari" == i ? "version" : i; break; }
	}
	b.version = vMark && RegExp("(?:" + vMark + ")[\\/: ]([\\d.]+)").test(ua) ? RegExp.$1 : "0";
	b.safari2 = b.safari && parseInt(b.version) < 522 && !/adobeair/i.test(ua);
	b.ie = b.msie;
	b.ie6 = b.msie && parseInt(b.version) == 6;
	b.ie7 = b.msie && parseInt(b.version) == 7;
	b.ie8 = b.msie && parseInt(b.version) == 8;
	b.QuirksModel = b.msie && document.compatMode=="BackCompat";
	b.StrictMode = document.compatMode=="CSS1Compat";
	try{
		b.maxthon = external&&external.max_version!=undefined;
	}catch(e){}
	return b;
})(window.navigator.userAgent.toLowerCase());
$$O = function(id){return document.getElementById(id)||null;};
$$selector = function(selector){
	if (document.querySelector){
		return selector.indexOf(',') > -1 ? document.querySelector(selector) : document.querySelectorAll(selector);
	}else if( $$B.ie ){
		var head = document.documentElement.firstChild;
		var styleTag = document.createElement("STYLE");
		head.appendChild(styleTag);
		document.__qsResult = [];
		try{
			styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsResult.push(this))}";
			window.scrollBy(0, 0);
			head.removeChild(styleTag);
		}catch(e){}
		var result = [];
		for (var i in document.__qsResult)
			result.push(document.__qsResult[i]);
		return result;
	}else{
		return null;
	}
};
$$A = function(){
	var ret = {
		isArray: function( b ) {
			return b instanceof Array;
		},
		each: function( array, callback){
			if ( array.length == undefined ){
				for ( var name in array ){
					callback.apply(this, [array[name], name]);
				}
			} else {
				for ( var i = 0, len = array.length; i < len; i++ ) {
					callback.apply(this, [array[i], i]);
				}
			}
		}
	};
	return ret;
}();
$$F = {
	isFunction:function(fn){
		return typeof(fn) == "function";
	}
};
$$D = {
	create: function(tagName, arrt, par, where){
		var doc,htmls=[], elem;
		doc = document;
		par = par || doc.body || doc.documentElement || null;
		if(par.insertAdjacentHTML && where){
			htmls.push('<' + tagName);
			for(var k in arrt) 
				k && htmls.push(' '+(k=="className" ? "class" : k)+'="' + arrt[k] + '"');
			htmls.push('></'+tagName+'>');
			htmls = htmls.join('');
			where = where? where.toLowerCase() : "afterbegin";
			switch(where){
				case "beforebegin":
					par.insertAdjacentHTML('BeforeBegin', htmls);return par.previousSibling;
				case "beforeend":
					par.insertAdjacentHTML('BeforeEnd', htmls);return par.lastChild;
				case "afterend":
					par.insertAdjacentHTML('AfterEnd', htmls);return par.nextSibling;
				default :
					par.insertAdjacentHTML('AfterBegin', htmls);return par.firstChild;
			}
		}else {
			if( tagName.toLowerCase() == 'text' )
				elem = doc.createTextNode(arrt.text);
			else{
				elem = doc.createElement(tagName);
				for(var k in arrt){
					switch(k){
						case "className": elem.className = arrt[k];break;
						case "style": elem.style.cssText = arrt[k];break;
						default : elem.setAttribute(k, arrt[k]);
					}
				}
			}
			par.appendChild(elem);
			return elem;
		}
	},
	insert: function(elem, h, where) {
		where = where ? where.toLowerCase() : 'afterbegin';
		if (elem.insertAdjacentHTML) {
			switch (where) {
				case "beforebegin":elem.insertAdjacentHTML('BeforeBegin', h);return elem.previousSibling;
				case "afterbegin": elem.insertAdjacentHTML('AfterBegin', h);return elem.firstChild;				case "afterend":elem.insertAdjacentHTML('AfterEnd', h); return elem.nextSibling;
				default :elem.insertAdjacentHTML('BeforeEnd', h);return elem.lastChild;
			}
			throw 'Illegal insertion point -> "' + where + '"';
		}
		var range = elem.ownerDocument.createRange();
		var frag;
		switch (where) {
		case "beforebegin":range.setStartBefore(elem);frag = range.createContextualFragment(h);elem.parentNode.insertBefore(frag, elem);return elem.previousSibling;
		case "afterbegin":
			if (elem.firstChild) {
				range.setStartBefore(elem.firstChild);frag = range.createContextualFragment(h);elem.insertBefore(frag, elem.firstChild);return elem.firstChild;
			} else {
				elem.innerHTML = h;return elem.firstChild;
			}
		case "beforeend":
			if (elem.lastChild) {
				range.setStartAfter(elem.lastChild);frag = range.createContextualFragment(h);elem.appendChild(frag);return elem.lastChild;
			} else {
				elem.innerHTML = h;return elem.lastChild;
			}
		case "afterend":range.setStartAfter(elem);frag = range.createContextualFragment(h);elem.parentNode.insertBefore(frag, elem.nextSibling);return elem.nextSibling;
		}
		throw 'Illegal insertion point -> "' + where + '"';
	},
	getScrollTop: function(elem){
		var doc = elem==document||!elem ? document : elem.ownerDocument;
		return Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
	},
	getScrollLeft: function(elem){
		var doc = elem==document||!elem ? document : elem.ownerDocument;
		return Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
	},
	rect: function(elem){
		var parent	   = elem.parentNode, 
			offsetChild  = elem,
			offsetParent = elem.offsetParent,
			doc		  = elem.ownerDocument,
			fixed		= $$D.css(elem, "position") == "fixed";
		var left = 0, top = 0, right = 0, bottom = 0, width = 0, height = 0, x = 0, y = 0;
		if ( elem.getBoundingClientRect ) {
			var box = elem.getBoundingClientRect();
			left = box.left + this.getScrollLeft(elem);
			top  = box.top + this.getScrollTop(elem);
			left -= doc.documentElement.clientLeft;
			top -= doc.documentElement.clientTop;
		}else{
			left = elem.offsetLeft;
			top  = elem.offsetTop;
			while (offsetParent) { 
				left += offsetParent.offsetLeft; 
				top  += offsetParent.offsetTop; 
				if ( $$B.mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || $$B.safari && !$$B.safari2 ){
					left += (parseInt($$D.css(offsetParent, "borderLeftWidth")) || 0 ); 
					top  += (parseInt($$D.css(offsetParent, "borderLeftTop")) || 0 ); 
				}
				if ( !fixed && $$D.css(offsetParent, "position") == "fixed" )
					fixed = true;
				offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
				offsetParent = offsetParent.offsetParent;
			};
			while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
				if ( !/^inline|table.*$/i.test($$D.css(parent, "display")) ){
					left -= parent.scrollLeft; top  -= parent.scrollTop;
				}
				if ( $$B.mozilla && $$D.css(parent, "overflow") != "visible" ){
					left += (parseInt($$D.css(parent, "borderLeftWidth")) || 0 ); 
					top  += (parseInt($$D.css(parent, "borderLeftTop")) || 0 ); 
				}
				parent = parent.parentNode;
			}
			if ( ($$B.safari2 && (fixed || $$D.css(offsetChild, "position") == "absolute")) || 
			($$B.mozilla && $$D.css(offsetChild, "position") != "absolute") ){
					left -= doc.body.offsetLeft; top  -= doc.body.offsetTop;
			}
			if ( fixed ){
				left += this.getScrollLeft(elem); top  += this.getScrollTop(elem);
			}
			right = left + elem.offsetWidth; 
			bottom = top + elem.offsetHeight;
		};
		try{
			width = elem.offsetWidth || 0;
			height = elem.offsetHeight || 0;
		}catch(e){}
		return {
			left: left,
			top: top,
			right: right,
			bottom: bottom,
			w: width,
			h: height
		};
	},
	clientRect: function(elem){
		elem = typeof elem=='string' ? $$O(elem) : elem;
		var rect = this.rect(elem), 
			sLeft = this.getScrollLeft(elem), 
			sTop = this.getScrollTop(elem);
		rect.left -= sLeft; 
		rect.top -= sTop; 
		rect.right -= sLeft;
		rect.bottom -= sTop;
		return rect;
	},
	windowRect: function(obj){
		var d = {x: 0,y: 0,w: 0,h: 0,_w:0};
		d.x = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
		d.y = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
		d.w = window.innerWidth || document.body.clientWidth || document.body.clientWidth || 0;
		d.h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
		d._w = d.w;
		return d;
	},
	css: function(elem, name, value){
		if(!elem) return;
		if(typeof value != 'undefined'){
			if (typeof name == "string") { var s = name; style = {}; style[s] = value; }
			for (var name in style) {
				var value = style[name];
				switch(name.toLowerCase()){
					case "float": elem.style[ $$B.ie ? "styleFloat" : "cssFloat" ] = value;break;
					case "scrollleft":elem.scrollLeft = value;break;
					case "scrolltop":elem.scrollTop = value;break;
					case "opacity": 
						if( $$B.ie ){
							elem.style.filter = (elem.currentStyle.filter || "").replace( /alpha\([^)]*\)/, "" ) + "alpha(opacity=" + value * 100 + ")";
							break;
						}
					default: 
						if( elem.style ) elem.style[$$S.camelize( name )] = value;
				}
			};
		}else{
			if( 'scrollleft' == name.toLowerCase() )
				return elem.scrollLeft || 0;
			else if( 'scrolltop' == name.toLowerCase() )
				return elem.scrollTop || 0;
			else if(document.defaultView){
				var style = document.defaultView.getComputedStyle(elem, null);
				return name in style ? style[ name ] : style.getPropertyValue( name );
			}else{
				var style = elem.currentStyle;
				if (name == "opacity") {
					if ( /alpha\(opacity=(.*)\)/i.test(style.filter) ) {
						return parseFloat(RegExp.$1)/100 || 1;
					}
					return 1;
				}
				if (name == "float") { name = "styleFloat"; }
				var ret = style[ name ] || style[$$S.camelize( name )];
				if ( !/^\-?\d+(px)?$/i.test( ret ) && /^\-?\d/.test( ret ) ) {
					style = elem.style; left = style.left; rsLeft = elem.runtimeStyle.left;
					elem.runtimeStyle.left = elem.currentStyle.left;
					style.left = ret || 0;
					ret = style.pixelLeft + "px";
					style.left = left;
					elem.runtimeStyle.left = rsLeft;
				}
				return ret;
			}
		}
	},
	addClass: function( elem, className ){
		if( !this.indexOfClass(elem, className) ){
			elem.className = elem.className.split(/\s+/).join(" ") + " " + className;
		}
	},
	removeClass: function( elem, className ){
		if(elem && elem.className.length>0 ){
			var reg = new RegExp( "\\b" + className + "\\b", "gi" );
			elem.className = elem.className.replace( reg, "" );
		}
	},
	replaceClass:function( elem, oldclassName, className){
		this.addClass(elem, className);
		this.removeClass(elem, oldclassName);
	},
	indexOfClass: function(elem, className){
		if(!elem || !elem.className ){
			return false;
		}else{
			var reg = new RegExp( "\\b" + className + "\\b", "gi" );
			return reg.test(elem.className);
		}
	},
	filter: function(Nodes, where){		var reg, className, cNodes = [], Ns = [];
		for(var i=0; i<Nodes.length; i++){
			Nodes[i].tagName && Nodes[i].nodeType!=8 && cNodes.push(Nodes[i]);
		}
		   if( where != undefined ){
			   var m = /^\s*?(\w+)$|^\.(\w+)$/.exec( where );
			if (m[1]){
				for(var i=0; i<cNodes.length; i++){
					cNodes[i].tagName.toLowerCase()==m[1].toString().toLowerCase() && Ns.push(cNodes[i]);
				}
				cNodes = Ns;
			}
			else if (m[2]){
				className = m[2].replace(/\-/g, "\\-");
				reg = new RegExp("\\b" + className + "\\b");
				for(var i=0; i<cNodes.length; i++){
					reg.test(cNodes[i].className) && Ns.push(cNodes[i]);
				}
				cNodes = Ns;
			}
		}
		cNodes.first = function(){
			return !cNodes.length ? null : cNodes[0];
		};
		cNodes.last = function(){
			return !cNodes.length ? null : cNodes.slice(-1)[0];
		};
		return cNodes;
	},	animate: function(elements, prams, speed, easing, callback ) {
		var elements = !$$A.isArray( elements ) ? [elements] : elements;
		var opt = {
			complete: callback || !callback && easing || $$F.isFunction(speed) && speed,
			duration: speed,
			easing: callback && easing || easing && easing.constructor != Function && easing
		};
		opt.duration = (opt.duration && opt.duration.constructor == Number ? 
			opt.duration : 
			{ slow: 600, fast: 200 }[opt.duration]) || 400;
		var self = this;
		$$A.each(elements, function(elem){
			if( !$$D.queue.add(elem) || elem.nodeType != 1){
				return false;
			}
			for ( var p in prams ){
				if ( p == "height" || p == "width" ){
					opt.display = $$D.css(elem, "display");
					opt.overflow = $$D.css(elem, "overflow");
				}
				if ( $$A.isArray( prams[p] ) ) {
					(opt.specialEasing = opt.specialEasing || {})[p] = prams[p][1];
					opt[p] = prams[p] = prams[p][0];
				}
			}
			opt.curAnim = prams;
			$$A.each(prams, function(val, name){
				var obj = new $$D.animExt( elem,  opt, name);
				var parts = val.toString().match(/^([+-]=?)?([\d+-.]+)(.*)$/),
					start = parseFloat( $$D.css(elem, name) ) || 0;
				if( name == 'opacity' ){
					start = $$B.msie ? start : start*100;
				}
				if( parts ){
					var end = parseFloat(parts[2]),
						unit = parts[3] || "px";
					if( parts[1] )
						end = ((parts[1].indexOf('-')>-1 ? -1 : 1) * end) + (parts[1].indexOf('=')>-1 ? 0 : start);
					obj.custom(start, end, unit);
				}
				else
					obj.custom(start, val, "");
			});
		});
	},
	easing: {
		swing: function( p, n, firstNum, diff ) {
			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
		},
		easeOutCubic: function (x, t, b, c, d) {
			return c*((t=t/d-1)*t*t + 1) + b;
		},
		easeOutQuart: function (x, t, b, c, d) {
			return -c * ((t=t/d-1)*t*t*t - 1) + b;
		},
		easeOutQuint: function (x, t, b, c, d) {
			return c*((t=t/d-1)*t*t*t*t + 1) + b;
		},
		easeInOutQuint: function (x, t, b, c, d) {
			if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
			return c/2*((t-=2)*t*t*t*t + 2) + b;
		},
		easeInOutElastic: function (x, t, b, c, d) {
			var s=1.70158;var p=0;var a=c;
			if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
			if (a < Math.abs(c)) { a=c; var s=p/4; }
			else var s = p/(2*Math.PI) * Math.asin (c/a);
			if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
			return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
		},
		easeOutElastic: function (x, t, b, c, d) {
			var s=1.70158;var p=0;var a=c;
			if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
			if (a < Math.abs(c)) { a=c; var s=p/4; }
			else var s = p/(2*Math.PI) * Math.asin (c/a);
			return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
		},
		easeInBounce: function (x, t, b, c, d) {
			return c - $$D.easing.easeOutBounce (x, d-t, 0, c, d) + b;
		},
		easeOutBounce: function (x, t, b, c, d) {
			if ((t/=d) < (1/2.75)) {
				return c*(7.5625*t*t) + b;
			} else if (t < (2/2.75)) {
				return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
			} else if (t < (2.5/2.75)) {
				return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
			} else {
				return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
			}
		},
		easeInOutBounce: function (x, t, b, c, d) {
			if (t < d/2) return $$D.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
			return $$D.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
		}
	},
	queue: {
		queue: [],
		add: function(obj){
			var Q = this.queue;
			for(var i = 0; i < Q.length; i++ ){
				if ( Q[i] == obj ) return false;
			}
			Q.push(obj);
			return true;
		},
		remove:function(obj){
			var Q = this.queue, NQ = [];
			for(var i = 0; i < Q.length; i++ ){
				 Q[i] != obj && NQ.push(Q[i]);
			}
			this.queue = NQ;
		}
	},
	timers: [],
	timerId: null,
	animExt: function( elem, options, prop ){
		this.options = options;
		this.elem = elem;
		this.prop = prop;
	},
	ready: function(fn, dom){
		var isReady = false,
			d = dom ? dom : window.document,
			done = function(){
				if(!isReady){
					isReady = true;
					fn.apply(document,arguments);
				}
			};
		if ( d.addEventListener && !$$B.opera)
			d.addEventListener( "DOMContentLoaded", done, false );
		if ( $$B.ie && window == top ) (function(){
			if (isReady) return;
			try {
				d.documentElement.doScroll("left");
			} catch( e ) {
				setTimeout( arguments.callee, 0 );
				return;
			}
			done();
		})();
		if ( $$B.opera )
			document.addEventListener( "DOMContentLoaded", function () {
				if (isReady) return;
				var l = document.styleSheets.length;
				for (var i = 0; i < l; i++)
					if (document.styleSheets[i].disabled) {
						setTimeout( arguments.callee, 0 );
						return;
					}
				done();
			}, false);
		if ( $$B.safari ) {
			var numStyles;
			(function(){
				if (isReady) return;
				if ( document.readyState != "loaded" && document.readyState != "complete" ) {
					setTimeout( arguments.callee, 0 );
					return;
				}
				if ( numStyles === undefined )
					numStyles = $$selector("style, link").length;
				if ( document.styleSheets.length != numStyles ) {
					setTimeout( arguments.callee, 0 );
					return;
				}
				done();
			})();
		}
	}
};
$$D.Doc = document.documentElement || document.body;
$$E = (function(){
	var addEvent, removeEvent, guid = 1;
	if ( window.addEventListener ) {
		addEvent = function( elem, type, handler ){
			elem.addEventListener(type, handler, false);
		};
		removeEvent = function( elem, type, handler ){
			elem.removeEventListener(type, handler, false);
		};
	} else {
		addEvent = function( elem, type, handler ){
			elem.attachEvent( "on"+type, handler);
		};
		removeEvent = function( elem, type, handler ){
			elem.detachEvent("on"+type, handler) ;
		};
	}
	function fixEvent(event) {
		if (event && event.target) return event;
		event = window.event;
		event.pageX = event.clientX + $$D.getScrollLeft();
		event.pageY = event.clientY + $$D.getScrollTop();
		event.target = event.srcElement;
		event.stopPropagation = stopPropagation;
		event.preventDefault = preventDefault;
		switch (event.type) {
			case "mouseout" :
				event.relatedTarget = event.toElement; break;
			case "mouseover" :
				event.relatedTarget = event.fromElement; break;
		};
		return event;
	};
	function stopPropagation() { this.cancelBubble = true; };
	function preventDefault() { this.returnValue = false; };
	function fireEvent(elem, type) {
		if( !elem ) return;
		if( $$B.ie ){
			elem.fireEvent("on" + type);
		}else{
			var e = document.createEvent('HTMLEvents');
			e.initEvent(type, true, true);
			elem.dispatchEvent(e);
		}
	};
	return {
		"addEvent": addEvent,
		"removeEvent": removeEvent,
		"fixEvent": fixEvent,
		"fireEvent":fireEvent
	};
})();
$$S = {
	isDefined: function(a){
		return typeof a != "undefined";
	},
	camelize: function(s){
		return s.replace(/-([a-z])/ig, function(all, letter) { return letter.toUpperCase(); });
	},
	toArray: function(s){
		var a=[],ta=[],tta=[],l;
		ta = s.split(";");l  = ta.length;
		for(i=0; i<l; i++){
			if(ta[i]){
				tta = ta[i].split(':');
				a[tta[0]] = tta[1];
			}
		}
		return a;
	},
	len: function(s){
		if(!s) return 0;
		var c = 0, l = s.length;
		for(var i=0; i<l; i++){
			if(s.charCodeAt(i)>255) c += 2;else c += 1;
		}
		return c;
	},
	cut: function(s,l,e){
		if(!s) return 0;
		var c = 0, ml = l*2, l = s.length, cl = $$S.len(s);
		var cs = "";
		if(cl<=ml)
			return cl%2>0 ? s+" " : s;
		else{
			for(var i=0; i<l; i++){
				if(s.charCodeAt(i)>255){ c += 2;}else{ c += 1;}
				if(c==ml || (e&&c==ml-2) ){
					cs = s.substring(0, i+1) + (e?"..":"");
					break;
				}else if(c>ml || (e&&c>ml-2)){
					cs = s.substring(0, i)+" " + (e?"..":"");
					break;
				}
			}
			return cs;
		}
	},
	indexOf: function(){
	}
};
$$C = {
	load: function(param, remove, callback){
		var head = document.getElementsByTagName(param.parent || 'HEAD')[0], 
			elem, done = false,
			href = param.href ? param.href : param.src;
		if( param.params ){
			for(var k in param.params){
				href += k + '=' + param.params[k] + '&';
			}
		}
		switch( (param.tagName || 'script').toLowerCase()){
			case 'img':
				param.src = href;
				break;
			case 'link':
				param.href = href;
				param.type = 'text/css';
				param.rel = 'stylesheet';
				break;
			default:
				param.tagName = 'script';
				param.src = href;
				param.type = 'text/javascript';
				param.language = 'javascript';
		}
		elem = document.createElement(param.tagName);
		for(var k in param){
			if( !/tagName|parent/.test(k) ){
				try{elem.setAttribute(k, param[k]);}catch(e){}
			}
		}
		elem.onload = elem.onreadystatechange = elem.onerror = function(){
			if ( !done && ( !this.readyState || /loaded|complete/.test(this.readyState) ) ) {
				done = true;
				if( $$F.isFunction(callback) ) callback();
				if( remove !== false ){
					try{head.removeChild( elem );}catch(e){}
				}
			}
		};
		head.appendChild(elem);
		return elem;
	},
	ready: function(srcElement, callback){
		var done = false;
		if( !srcElement ){
			return;
		}
		srcElement.onload = srcElement.onreadystatechange = srcElement.onerror = function(){
			if ( !done && ( !this.readyState || /loaded|complete/.test(this.readyState) ) ) {
				done = true;
				if( $$F.isFunction(callback) ) callback();
			}
		};
	}
};
$$J = (function(){
	function f(n) {
		return n < 10 ? '0' + n : n;
	}
	if (typeof String.prototype.toJSON !== 'function') {
		Date.prototype.toJSON = function (key) {
			return this.getUTCFullYear()   + '-' +
				 f(this.getUTCMonth() + 1) + '-' +
				 f(this.getUTCDate())	  + 'T' +
				 f(this.getUTCHours())	 + ':' +
				 f(this.getUTCMinutes())   + ':' +
				 f(this.getUTCSeconds())   + 'Z';
		};
		String.prototype.toJSON =
		Number.prototype.toJSON =
		Boolean.prototype.toJSON = function (key) {
			return this.valueOf();
		};
	}
	var toJSONString, parseJSON, gap, indent, rep, 
		cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
		escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
		meta = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
	function quote(string) {
		escapable.lastIndex = 0;
		return escapable.test(string) ?
			'"' + string.replace(escapable, function (a) {
				var c = meta[a];
				return typeof c === 'string' ? c :
					'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
			}) + '"' :
			'"' + string + '"';
	}
	function str(key, holder) {
		var i, k, v, length, partial,
			mind = gap,
			value = holder[key];
		if (value && typeof value === 'object' && typeof value.toJSON === 'function') {
			value = value.toJSON(key);
		}
		if (typeof rep === 'function') {
			value = rep.call(holder, key, value);
		}
		switch (typeof value) {
		case 'string':
			return quote(value);
		case 'number':
			return isFinite(value) ? String(value) : 'null';
		case 'boolean':
		case 'null':
			return String(value);
		case 'object':
			if (!value) {
				return 'null';
			}
			gap += indent;
			partial = [];
			if (Object.prototype.toString.apply(value) === '[object Array]') {
				length = value.length;
				for (i = 0; i < length; i += 1) {
					partial[i] = str(i, value) || 'null';
				}
				v = partial.length === 0 ? '[]' :
					gap ? '[\n' + gap +
							partial.join(',\n' + gap) + '\n' +
								mind + ']' :
						  '[' + partial.join(',') + ']';
				gap = mind;
				return v;
			}
			if (rep && typeof rep === 'object') {
				length = rep.length;
				for (i = 0; i < length; i += 1) {
					k = rep[i];
					if (typeof k === 'string') {
						v = str(k, value);
						if (v) {
							partial.push(quote(k) + (gap ? ': ' : ':') + v);
						}
					}
				}
			} else {
				for (k in value) {
					if (Object.hasOwnProperty.call(value, k)) {
						v = str(k, value);
						if (v) {
							partial.push(quote(k) + (gap ? ': ' : ':') + v);
						}
					}
				}
			}
			v = partial.length === 0 ? '{}' : 
				   gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : 
				   '{' + partial.join(',') + '}';
			gap = mind;
			return v;
		}
	}
	toJSONString = function(value, replacer, space){
		var i, gap = '', indent = '';
		if (typeof space === 'number') {
			for (i = 0; i < space; i += 1) {
				indent += ' ';
			}
		} else if (typeof space === 'string') {
			indent = space;
		}
		rep = replacer;
		if (replacer && typeof replacer !== 'function' &&
				(typeof replacer !== 'object' ||
				 typeof replacer.length !== 'number')) {
			throw new Error('JSON.toString');
		}
		return str('', {'': value});
	};
	parseJSON = function(text, reviver){
		var j;
		function walk(holder, key) {
			var k, v, value = holder[key];
			if (value && typeof value === 'object') {
				for (k in value) {
					if (Object.hasOwnProperty.call(value, k)) {
						v = walk(value, k);
						if (v !== undefined) {
							value[k] = v;
						} else {
							delete value[k];
						}
					}
				}
			}
			return reviver.call(holder, key, value);
		}
		text = String(text);
		cx.lastIndex = 0;
		if (cx.test(text)) {
			text = text.replace(cx, function (a) {
				return '\\u' +
					('0000' + a.charCodeAt(0).toString(16)).slice(-4);
			});
		}
		if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
						   .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
						   .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
			j = eval('(' + text + ')');
			return typeof reviver === 'function' ?
				walk({'': j}, '') : j;
		}
		throw new SyntaxError('JSON.toJSON');
	};
	return {
		'toJSONString': toJSONString,
		'parseJSON': parseJSON
	};
})();
IMG = function(src){
	var _img = new Image();
	_img.src = src;
	return _img;
}
if ($$B.ie6) {
	try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(e) {}
};
})();
String.prototype.ntFormat = function() {
    var args = arguments, pattern = /%\d+/g;
    return this.replace(pattern,
    function(capture) {
        return args[capture.match(/\d+/)];
    });
};
$$D.animExt.prototype = {
	update: function(){
		switch(this.prop.toLowerCase()){
			case "scrollleft":
				this.elem.scrollLeft = this.now;break;
			case "scrolltop":
				this.elem.scrollTop = this.now;break;
			case "opacity":
				if ( $$B.msie ) 
					this.elem.style.filter = "alpha(opacity:"+(this.now)+")";
				else if ( $$B.mozilla ) 
					this.elem.style.MozOpacity = this.now/100;
				else{
					this.elem.style.opacity = this.now/100;
				}
				break;
			default: this.elem.style[this.prop] = this.now + this.unit;
		}
	},
	custom: function(from, to, unit){
		this.startTime = +new Date(); 		this.start = from;
		this.end = to;
		this.unit = unit || "px";
		this.now = this.start;
		this.pos = this.state = 0;
		this.update();
		var self = this;
		function t(gotoEnd){
			return self.step(gotoEnd);
		}
		t.elem = this.elem;
		if ( t() && $$D.timers.push(t) && $$D.timerId == null ) {
			$$D.timerId = setInterval(function(){
				var timers = $$D.timers;
				for ( var i = 0; i < timers.length; i++ ){
					if ( !timers[i]() )
						timers.splice(i, 1);
				}
				if ( !timers.length ) {
					clearInterval( $$D.timerId );
					$$D.timerId = null;
				}
			}, 13);
		}
	},
	step: function(gotoEnd){
		var t = +new Date(); 		if( gotoEnd || t > this.options.duration + this.startTime ){
			this.now = this.end;
			this.pos = this.state = 1;
			this.update();
			this.options.curAnim[ this.prop ] = true;
			var done = true;
			for ( var i in this.options.curAnim )
				if ( this.options.curAnim[i] !== true )
					done = false;
			$$D.queue.remove(this.elem);			if ( done && typeof( this.options.complete )=='function' ){
				this.options.complete.apply(this, [this.elem] );
			}
			return false;
		}
		else{
			var n = t - this.startTime;
			this.state = n / this.options.duration;
			var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
			var defaultEasing = this.options.easing || ($$D.easing.swing ? "swing" : "linear");
			this.pos = $$D.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
			this.now = this.start + ((this.end - this.start) * this.pos);
			this.update();
		}
		return true;
	}
};
NtUtil = {};
NtUtil.setCookie = function(a, f, d, c) {
	if (typeof d != "number" && !(d instanceof Date)) {
		d = (1 * 24 * 60 * 60 * 1000);
	}
	var b, e;
	if (d instanceof Date) {
		b = d;
		e = b ? "expires=" + b.toGMTString() + "; ": "";
	} else {
		if ( d == 0 ){
			b = 0;
			e = "expires=0; ";
		}else if (d > 0) {
			b = new Date();
			b.setTime(b.getTime() + d);
			e = b ? "expires=" + b.toGMTString() + "; ": "";
		}
	}
	var k = a + "=" + encodeURIComponent(f) + "; ";
	var g = /([^\.]+(\.com(\.cn)?|\.net(\.cn)?|\.org(\.cn)?|\.gov(\.cn)?|\.cn|\.mobi|\.tel|\.asia|\.me|\.info|\.hk|\.cc|\.biz|\.tv))$/i.exec(document.domain);
	g = c || (g ? g[0] : document.domain);
	var c = "domain=" + g + "; ";
	var h = "path=/; ";
	document.cookie = k + e + c + h;
	return f;
};
NtUtil.delCookie = function(b, a) {
	return NtUtil.setCookie(b, "", new Date(), a);
};
NtUtil.getCookie = function(b) {
	var c = document.cookie;
	if (c.length) {
		var a = new RegExp("(?:^|;)\\s*" + b + "=(.*?)(?:;|$)").exec(c);
		if (a && a.length) {
			return decodeURIComponent(a[1]);
		}
	}
	return null;
};
NtUtil.saveValue = function(userId, key, value){
	var impresenceflash = $$O('impresenceflash');
	if( impresenceflash && impresenceflash.write ){
		impresenceflash.write(userId, key, value);
	}
};
NtUtil.loadValue = function(userId, key){
	var impresenceflash = $$O('impresenceflash');
	if( impresenceflash && impresenceflash.write ){
		return impresenceflash.read(userId, key);
	}
	return '';
};
NtUtil.scrollWidth = function(){
	if($$B.ie6 && document.getElementsByTagName('body')[0].currentStyle["overflowY"] == 'hidden'){
		return 18;
	}else if( ( !$$B.msie && $$D.Doc.scrollHeight>$$D.windowRect().h) || $$B.mozilla && document.defaultView.getComputedStyle(document.getElementsByTagName('html')[0], null)["overflowY"]=="scroll"){
		return 18;
	}else if($$B.ie6){
		return 2;
	}else{
		return 1;
	}
};
NtUtil.insertAfter = function(newElement,targetElement) {
	var parent = targetElement.parentNode;  
	if (parent.lastChild == targetElement)
		parent.appendChild(newElement);  
	else
		parent.insertBefore(newElement,targetElement.nextSibling);  
};
NtUtil.removeChildNodes = function(elem, childNodetagName){
	if(!elem) return;
	var Nodes = childNodetagName ? elem.getElementsByTagName(childNodetagName) : elem.childNodes;
	var l = Nodes.length;
	for(var i=0; i<l;i++){
		var a = Nodes[i].attributes;
		for(var id in a){
			if(typeof(a[id])=="function"){
				if($$B.ie) eval("elem."+id+"=null");
				else{elem.removeAttribute(id);}
			}
		}
		this.removeChildNodes(Nodes[i], childNodetagName);
		elem.removeChild(Nodes[i]);
	}
};
NtUtil.EncodeSpecialChar = function(a){
	if (!a || !a.length) {
		return a;
	}
	a = a.replace(/&quot;/g, '"');
	a = a.replace(/&lt;/g, "<");
	a = a.replace(/&gt;/g, ">");
	a = a.replace(/&apos;/g, "'");
	a = a.replace(/&#39;/g, "'");
	a = a.replace(/&amp;/g, "&");
	return a;
};
NtUtil.clearHTML = function(strSource){
	if(!strSource)
		return "";
	else{
		strSource = strSource.replace(/&lt;/g,"<");
		strSource = strSource.replace(/&gt;/g,">");
		return strSource.replace(/<[^>].*?>/g,"");
	}
};
NtUtil.disposeFlashObj = function(flashObj){
	if(!flashObj || !$$B.ie)
		return;
	for(var id in flashObj){
		if(typeof(flashObj[id]) == "function"){
			if($$B.ie){
				eval("flashObj."+id+"=null");
			}
		}
	}
};
NtUtil.onlyOne = function(key, dtyp, timer){
	if(NtUtil.getCookie(key)==="1"){
		return false;
	}else{
		var d = new Date(), od = new Date();
		switch(dtyp){			case "nd":
				if(d.getHours()<12 ){					d.setDate(d.getDate());d.setHours(12);d.setMinutes(0);d.setSeconds(0);
				}else{					d.setDate(d.getDate() + timer);d.setHours(12);d.setMinutes(0);d.setSeconds(0);
				}
				break;
			case "d": d.setDate(d.getDate() + timer);d.setHours(0);d.setMinutes(0);d.setSeconds(0);break;
			case "h": d.setHours(d.getHours() + timer);d.setMinutes(0);d.setSeconds(0);break;
			case "m": d.setMinutes(d.getMinutes() + timer);d.setSeconds(0);break;
			case "s": d.setSeconds(d.getSeconds() + timer);break;
			default : NtUtil.setCookie(key, "1"); return;
		}
		var t = d.getTime() - od.getTime();
		NtUtil.setCookie(key, "1", t);
		return true;
	}
};
NtUtil.lt = function(ver, bver){
	var V,_ver   = ver+".0.0";
	var bV,_bver = bver+".0.0";
	V = _ver.split(".");
	bV= _bver.split(".");
	V[0]  = parseInt(V[0], 10); V[1] = parseInt(V[1], 10) || 0;  V[2] = parseInt(V[2], 10) || 0;
	bV[0] = parseInt(bV[0], 10);bV[1] = parseInt(bV[1], 10) || 0;bV[2] = parseInt(bV[2], 10) || 0;
	return (V[0] < bV[0] || (V[0] == bV[0] && V[1] < bV[1]) || (V[0] == bV[0] && V[1] == bV[1] && V[2] < bV[2])) ? true: false;
};
NtUtil.Flash = {
	create: function(src, parentElement, id, w, h, fvars, params, attr){
	    var swf, param, strflashvars = '';
	    for(k in fvars)
	    {
	    	if( typeof fvars[k] != 'string' ) continue;
	    	strflashvars += k + '=' + fvars[k] + '&'
	    }
	    if( $$D.msie ){
		    swf = document.createElement("object");
		    swf.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
		    swf.setAttribute("codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28");
		    swf.setAttribute("data", src);		    param = document.createElement("param");
		    param.setAttribute("name","movie");
		    param.setAttribute("value",src);
		    param = document.createElement("param");
		    param.setAttribute("name","flashvars");
		    param.setAttribute("value", strflashvars);
		    for(k in params )
		    {
		    	if( typeof params[k] != 'string' ) continue;
		    	var param=document.createElement("param");
		    	param.setAttribute("name", k);
		        param.setAttribute("value", params[k]);
		        swf.appendChild(param);
		    }
		    for(k in attr)
		    {
		    	if( typeof attr[k] != 'string' ) continue;
		    	swf.setAttribute(k, attr[k]);
		    }
		    swf.appendChild(param);
		}else{
			swf = document.createElement("embed");
		    swf.setAttribute("type","application/x-shockwave-flash");
		    swf.src = src;
		    swf.setAttribute("flashvars", strflashvars);
		    for(k in params)
		    {
		    	if( typeof params[k] != 'string' ) continue;
		    	swf.setAttribute(k, params[k]);
		    }
		    for(k in attr)
		    {
		    	if( typeof attr[k] != 'string' ) continue;
		    	swf.setAttribute(k, attr[k]);
		    }
		}
		parentElement.appendChild(swf);
		swf.setAttribute("width", w);
	    swf.setAttribute("height", h);
	    swf.setAttribute("name", id);
	    if(id) swf.id = id;
	    return swf;
	},
	PlayerVersion: function(versions){
		return {
			major: parseInt(versions[0]) || 0,
		    minor: parseInt(versions[1]) || 0,
		    rev: parseInt(versions[2]) || 0
		}
	},
	getPlayerVersion: function(_1c, _1d) {
	    var rVersion = this.PlayerVersion([0, 0, 0]);
	    if (navigator.plugins && navigator.mimeTypes.length) {
	        var x = navigator.plugins["Shockwave Flash"];
	        if (x && x.description) {
	            rVersion = this.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
	        }
	    } else {
	        try {
	            var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
	            for (var i = 3; axo != null; i++) {
	                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
	                rVersion = this.PlayerVersion([i, 0, 0]);
	            }
	        } catch(e) {}
	        if (rVersion.major > 0) {
	            return rVersion;
	        }else{
	        	try {
	                rVersion = this.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
	            } catch(e) {}
	        }
	    }
	    return rVersion;
	}
};var sTime, sTime1;
function im_connectIM(siteid, userid, username, sessionid, userparam, customParams, param1, param2){
	sTime =+ new Date();	var _C = Ntalker.Config, _DIR, 
		_CP = Ntalker.Config.customparams,
		_V = Ntalker.variable;
	debug('im_connectIM start');
	Ntalker.temp.pageId = String(new Date().getHours()) + String(new Date().getMinutes()) + String(new Date().getUTCSeconds()) + String(Math.floor(Math.random()*100));
	_V['siteid']	= siteid;
	_V['user_id']   = userid;
	_V['user_name'] = username;
	_V['user_sid']  = sessionid;
	_V['userparam'] = userparam;
	if( siteid == 'ntalkerpreview' && customParams['previewsiteid'] ){
		var configJsURL = _V['scriptPath'] + "/configjs/config_"+customParams['previewsiteid']+".js?rnd="+new Date().getTime();
	}else{
		var configJsURL = _V['scriptPath'] + "/configjs/config_"+siteid+".js";
	}	debug("im_connectIM <b>create load configjs before</b>>");
	$$C.load({
		src: configJsURL,
		charset: 'utf-8',
		async: true
	}, false, function(){
		debug('loaded configJs');
		if( typeof Ntalker_Config=='undefined' ){
			_C['IMWidth'] = 248;
			_C['IMHeight'] = 531;
			_C['chatWidth'] = 384;
			_C['chatHeight'] = 416;
			_C['groupWidth'] = 460;
			_C['groupHeight'] = 531;
			_C['skin'] = "hue=0";
			_C['bColor'] = "#86D09C";
			_C['bgColor'] = "#B7DDC4";
			_C['imagesDIR'] = _C['publicDIR'] + "ntalker_skin1/";
			_C['customDIR'] = _C['services'] + siteid+"/";
			_C['logo'] = _C['publicDIR'] + "buddylistlogo."+($$B.ie6 ? 'gif' : 'png');
			_C['groupstartlogo']= _C['publicDIR'] + "/group."+($$B.ie6 ? 'gif' : 'png');
			_C['buddylistlogo']= "/buddylistlogo.png";
			_C['nquanlogo'] = "/nquanlogo.png";
			_C['grouplogo'] ="/nquanlogo.png";
			_C['chatroomlogo'] = "/nquanlogo.png";
			_C['startlogo'] = _C['publicDIR'] + '%1.' + ($$B.ie6?'gif':'png');
			_C['customparams'] = {
				lstupdated: new Date().getTime(),
				intact: 0,
				hiddenmode: 0,
				sys_enableguest: 1,
				introbuddy: 1,
				onlinelist: 1,
				disablegrouptip: 0,
				search: 1,
				avroom: 0,
				entrytype: "toolbar",
				imversion: "1.0",
				order: "1",
				roomtype: 0,
				localeChain: "zh_CN",
				siteurl: "http://www.ntalker.com",
				enablebuddyentry: 1,
				showmode: "show",
				build: "",
				favicon: "",
				enablegroup: 0,
				enableroom: 1,
				softwaretype: "other",
				quanflag:1
			};
		}else{
			var cfg = Ntalker_Config;
			var skinConfig = [[]];
			skinConfig.push(['#86D09C', '#B5DDC3', 'hue=0']);
			skinConfig.push(['#B9CCEC', '#DCDFEA', 'hue=92.92']);
			skinConfig.push(['#C3C6D5', '#D8E4E7', 'hue=101.19,saturation=0.75']);
			skinConfig.push(['#E3BFEF', '#DFD4E5', 'light=-13.78,hue=164.07']);
			skinConfig.push(['#DCD3AC', '#E5E0D5', 'hue=-79.78,light=9.26']);
			skinConfig.push(['#D4C1EA', '#D6D3E4', 'hue=149.96']);
			skinConfig.push(['#D5D5D5', '#C9C9C9', 'saturation=0']);
			skinConfig.push(['#BCDCB5', '#E0E6D6', 'hue=-22.5,light=10.61']);
			skinConfig.push(['#B0DDD6', '#D5E5E1', 'hue=36.73']);
			skinConfig.push(['#E9C5B7', '#E4D3D3', 'hue=-114.81']);
			skinConfig.push(['#bad3f2', '#dff3fc', 'saturation=1.34,hue=65']);
			_C['customDIR'] = _C['services'] + "/images/" + siteid+"/";
			if( cfg['dir'] ){
				_DIR = cfg['dir'];
				_C['imagesDIR'] = _C['publicDIR'] + _DIR;
			}else{
				_DIR = siteid+"/";
				_C['imagesDIR'] = _C['services'] + _DIR;
			}
			for(var i=1; i<skinConfig.length; i++){
				if( cfg["skin"] == 'ntalker_skin'+i ){
					_C['bColor'] = skinConfig[i][0];
					_C['bgColor'] = skinConfig[i][1];
					_C['skin'] = skinConfig[i][2];
				}else if( cfg["skin"] == skinConfig[i][2] ){
					_C['bColor'] = skinConfig[i][0];
					_C['bgColor'] = skinConfig[i][1];
					_C['skin'] = skinConfig[i][2];
				}
			}
			if( cfg['config'] ){
				_C['customparams'] = cfg['config'];
			}
			if( _C['customparams'] ){
				_C['IMWidth'] = _C['customparams']['IMWidth'];
				_C['IMHeight'] = _C['customparams']['IMHeight'];
				_C['chatWidth'] = _C['customparams']['chatWidth'];
				_C['chatHeight'] = _C['customparams']['chatHeight'];
				_C['groupWidth'] = _C['customparams']['groupWidth'];
				_C['groupHeight'] = _C['customparams']['groupHeight'];
			}
			var _L = cfg['logo'];
			if( _L ){
				_C['buddylistlogo'] = _L['buddylistlogo'] ? (_C['customparams']['favicon'] ? _C['customparams']['favicon'] : siteid+"/logo_big.png") : "/buddylistlogo.png";
				_C['chatlogo'] = _L['chatlogo'] ? siteid+"/logo_small.png" :  "/buddylistlogo.png";
				_C['nquanlogo'] = _L['nquanlogo'] ? siteid+"/nquanlogo.png" : "/nquanlogo.png";
				_C['grouplogo'] = _L['grouplogo'] ? siteid+"/grouplogo.png" : "/nquanlogo.png";
				_C['chatroomlogo'] = _L['chatroomlogo'] ? siteid+"/chatroomlogo.png":"/nquanlogo.png";
				if( !_L['buddylistlogo'] ){
					_C['logo'] = _C['imagesDIR'] + "buddylistlogo." + ($$B.ie6 ? 'gif' : 'png');
				}else if( _C['customparams']['favicon'] ){
					_C['logo'] = _C['services'] + "/images/" + _C['customparams']['favicon'];
				}else{
					_C['logo'] = _C['customDIR'] + "/logo_big.png";
				}
			}
			_C['startlogo'] = _L['startlogo'] ? _C['customDIR']+'%1.png' : _C['publicDIR']+'%1.'+($$B.ie6?'gif':'png');
			_C['groupstartlogo']= _C['publicDIR'] + "/group."+($$B.ie6 ? 'gif' : 'png');
			if( cfg['customButtons'] ){
				_C['customtoolbarButtons'] = cfg['customButtons'];
			}
			var _B = _C['customtoolbarButtons'];
			for(var k in _B){
				if(typeof(k)=="string" && _B[k] && _B[k].style){
					_B[k].style = sprintf(_B[k].style, _C.services + "/images/");
				}
				if(typeof(k)=="string" && _B[k] && _B[k].url){
					_B[k].url = sprintf(_B[k].url, _V['user_id'], _V['user_name']);
				}
			}
			var _A = _C['application'] = cfg['application'];
			for(var k in _A){
				_A[k]['ico'] = sprintf(_A[k]['ico'], _C.services + "/images/");				if( gLang[NtLanguage]['ApplicationName'][k] ){
				    _A[k]['name'] = gLang[NtLanguage]['ApplicationName'][k];
				}				_A[k]['image'] = new IMG(_C['publicDIR'] + _A[k]['ico']);
			}
			Ntalker['traing'] = new IMG(_C['publicDIR'] + 'traing_icon.gif');
		}
		_C['customparams']['localeChain'] = NtLanguage;
		NtLang = gLang[_C['customparams']['localeChain']];		if(typeof customParams=='object'){
			for(var k in customParams){
				Ntalker.Config.customparams[k] = customParams[k];
			}
		}
		debug("im_connectIM get customParams>");
		im_runPresence(_V['userparam'], _V['siteid'], _V['user_id'], _V['user_name'], _V['user_sid'], '', '', _CP);
		debug("im_connectIM <b>complete</b>>" + (parseInt(new Date().getTime()) - parseInt(sTime)));
		if( typeof(page_start_time) != 'undefined' ) debug('<b>body start to toolbar end execute time</b>=' + (parseInt(new Date().getTime()) - parseInt(page_start_time)))
	});}
function im_runPresence(userparam, siteid, userid, username, sessionid, flashserver, webchatpageurl, customParams) {
	var _C = Ntalker.Config,
		_CP = Ntalker.Config.customparams,
		_V = Ntalker.variable;	if( userid=='0' || userid==0 || userid=='' || sessionid=='' || typeof(userid)=='undefined' ){
		if( !_CP["sys_enableguest"] ){			return;
		}
		var userNO = NtUtil.getCookie(Ntalker.guestUserNoKEY);
		if(!userNO || userNO===null){
			var t = String(new Date().getTime());
			userNO = t.substr(t.length-8,8) + Math.round(Math.random()*1000);
			userid = NtLang['userIdHead']   + userNO;
			username = NtLang['userNameHead'] + userNO;
		}else{
			userid = NtLang['userIdHead']   + userNO;
			username = NtLang['userNameHead'] + userNO;
		}
		sessionid = NtLang['guestSessionId'];
		NtUtil.setCookie(Ntalker.guestUserNoKEY, userNO, 1000*3600*24*7);
		_V['user_id'] = userid;
		_V['user_name'] = username;
		_V['user_sid'] = sessionid;
	}
	debug("im_connectIM loaded configjs variable>");
	if( userid && sessionid ){
		$$C.load({
			tagName: 'link',
			href: _C['imagesDIR'] + NtLang['sheetFileName']
		}, false,
		function(){
			Ntalker.temp.cssLoaded = true;
		});
	}
	debug("im_connectIM create css element>");
	if( !username || username=='' ){
		_V['user_name'] = 'name';
	}
	debug("im_runPresence get user info complete>");
	$$E.addEvent(window, "unload", im_onUnload);
	im_myIMWindow = new  Ntalker.IMWindow();
	im_myIMWindow.init();
	chatWindowManager = new Ntalker.ChatWindowManager();
	window.chatWindowManager = chatWindowManager;
	debug("im_runPresence <b>create toolbar before</b>>" + (parseInt(new Date().getTime()) - parseInt(sTime1)));
	if(_V['user_sid'] && _V['user_name'] && _V['user_id'] && !_C['customparams'].hiddenmode){
		_CP['showmode'] = _CP['showmode'] == 'hidden' ? 'hidden' : 'show';
		IMToolBar = new ntToolbar();
		IMToolBar.init();
	}
	debug("im_runPresence <b>create toolbar complete</b>>" + (parseInt(new Date().getTime()) - parseInt(sTime1)));
	createGestFlashConnet(siteid);
}
function sprintf() {
	if (!arguments || arguments.length < 1 || !RegExp || !arguments[0]) {
		return
	}
	var b = arguments[0], l = arguments.length;
	for (var a = 1;a < l;a++) {
		b = b.replace(new RegExp("%" + a, "g"), (arguments[a] || "").toString() );
	}
	return b;
}
function searchTag(target, tagName){
	if(!tagName || !target) return target;
	while((target.nodeType!=1 || target.tagName.toLowerCase() != tagName.toLowerCase()) && target.parentNode){ target = target.parentNode;}
	return target;
}
function createGestFlashConnet(siteid){
	var flashvars = [], _C = Ntalker.Config,
		_CP= Ntalker.Config.customparams,
		_V = Ntalker.variable;
	_V['siteid'] = siteid;
	flashvars.push("siteid=" + siteid);
	flashvars.push('&rurl=' + _V['scriptPath']);
	flashvars.push('&surl=' + _C['services']);
	flashvars.push('&pageId=' + Ntalker.temp.pageId);
	flashvars.push('&u=' + encodeURIComponent(_V['user_id']));
	flashvars.push('&n=' + encodeURIComponent(_V['user_name']));
	flashvars.push('&s=' + encodeURIComponent(_V['user_sid']));
	flashvars.push('&p=' + _V['userparam']);
	flashvars.push('&localeChain=' + _CP['localeChain']);
	flashvars.push('&lst=' + _CP['lstupdated']);
	var flashurl  = _V['scriptPath']+"/fs/impresence.swf?version=" + Ntalker.version.presence_flash;
	var flashnode = [];
	flashnode.push('<div id=\"wdk_mini_state\" style=\"display:none;\"></div>');
	flashnode.push('<div id="im_presence_div" style=\"position:absolute;z-index:9996; top: -200px;\">');
	if($$B.ie){
		flashnode.push('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28" ');
		flashnode.push(' id="impresenceflash" width="1" height="1"> ');
		flashnode.push(	'<param name="movie" value="'+flashurl+'" /> ');
		flashnode.push(	'<param name="allowscriptaccess" value="always" /> ');
		flashnode.push(	'<param name="flashvars" value="'+flashvars.join('')+'" /> ');
		flashnode.push('</object>');
	}
	else{
		flashnode.push(	'<embed src="' + flashurl + '" id="impresenceflash" width="1" height="1" flashvars="'+flashvars.join('')+'" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" >');
		flashnode.push(	'</embed>');
	}
	flashnode.push('</div>');
	debug("createGestFlashConnet <b>insert.before</b>>");
	$$D.insert(document.body.firstChild, flashnode.join(''), 'beforebegin');
	debug("createGestFlashConnet <b>insert.complete</b>>");
}
function StartGetUsersStatus(){
	debug('<b>ready: StartGetUsersStatus</b>');
	Ntalker.temp.userSpanArray = new Array();
	var statusSpans = document.getElementsByTagName("SPAN"),
		spanindex = 0,
		_arrSpan = new Array(),
		strUserIDList = "", l = statusSpans.length;
	for(i = 0; i < l; i++){
		var statusSpan = statusSpans[i];
		if(statusSpan.className=="wdk_user_status_span" && statusSpan.id){
			pos = statusSpan.id.indexOf("wdk_user_");
			if(pos>=0){
				var newStatusObj = new Object();
				newStatusObj.destuid = statusSpan.id.substring(pos+"wdk_user_".length, statusSpan.id.length);
				newStatusObj.destnick = statusSpan.title;
				newStatusObj.spanElement = statusSpan;
				_arrSpan.push(newStatusObj);
				if(_arrSpan.length>1) strUserIDList += ",";
				strUserIDList += encodeURIComponent(newStatusObj.destuid);
			}
		}
	}
	var _presenceFlash = $$O("impresenceflash");
	Ntalker.temp.userSpanArray = _arrSpan;
	if( Ntalker.Config.customparams["enablebuddyentry"]){
		if(_presenceFlash && _presenceFlash.requestUserStatus){
			_presenceFlash.requestUserStatus(strUserIDList, _arrSpan.length);
		}
	}
}
function StartGetGroupEntry() {
	var _C = Ntalker.Config, _CP= Ntalker.Config.customparams;
	var enablegroup = _CP['enablegroup'];
	var statusSpans = document.getElementsByTagName("SPAN");
	var spanindex = 0, l = statusSpans.length;
	for (i = 0; i < l; i++) {
		var statusSpan = statusSpans[i];
		if (statusSpan.className == "wdk_group_chat_span" && statusSpan.id) {
			var cursorGroupType = statusSpan.getAttribute("ischatroom");
			pos = statusSpan.id.indexOf("wdk_group_");
			if (pos >= 0 && cursorGroupType=="true" ) {
				var newGroupObj = new Object();
				newGroupObj.groupid   = statusSpan.id.substring(pos + "wdk_group_".length, statusSpan.id.length);
				newGroupObj.groupnick = NtUtil.EncodeSpecialChar(statusSpan.title);
				newGroupObj.roomtype  = 0;
				  im_conncetChatRoom(newGroupObj.groupid, newGroupObj.groupnick);
				var tiptext = sprintf(NtLang['pageGroupsEntranceTip'][0], newGroupObj.groupnick);
				chatLinkStr = "<a  href=\"#\" target=\"_blank\" style=\"display:inline;padding-left:7px; overflow:hidden;\" alt=\"" + tiptext + "\"";
				chatLinkStr += " onClick=\"javascript: im_openWebchatWindow('" + newGroupObj.groupid + "', '" + newGroupObj.groupnick + "', null, 1, 'room', "+newGroupObj.roomtype+",'pageStateEntrance'); return false;\">";
				chatLinkStr += "<img name=\"wdk_presence_image\" tip=\"" + tiptext + "\" style=\"left:0px;top:0px;\" id=\"wdk_presence_" + newGroupObj.groupid + "\" border=\"0\" style=\"display:inline;";
				chatLinkStr += "\" src=\"" + _C['groupstartlogo'] + "\" title=\"" + tiptext + "\"/></a>";
				statusSpan.innerHTML = chatLinkStr;
			}else if(pos >= 0){
				var newGroupObj = new Object();
				newGroupObj.groupid   = statusSpan.id.substring(pos + "wdk_group_".length, statusSpan.id.length);
				newGroupObj.groupnick = NtUtil.EncodeSpecialChar(statusSpan.title);
				var tiptext = sprintf(NtLang['pageGroupsEntranceTip'][1], newGroupObj.groupnick);
				chatLinkStr = "<a href=\"#\" target=\"_blank\" style=\"display:inline;padding-left:7px; overflow:hidden;\" alt=\"" + tiptext + "\"";
				chatLinkStr += " onClick=\"javascript: im_openWebchatWindow('" + newGroupObj.groupid + "', '" + newGroupObj.groupnick + "', null, 1, 'group',0,'pageStateEntrance'); return false;\">";
				chatLinkStr += "<img name=\"wdk_presence_image\" id=\"wdk_presence_" + newGroupObj.groupid + "\" border=\"0\" style=\"display:inline;";
				chatLinkStr += "\" src=\"" + _C['groupstartlogo'] + "\" title=\"" + tiptext + "\"/></a>";
				statusSpan.innerHTML = chatLinkStr;
				$$O("wdk_presence_"+newGroupObj.groupid).onerror = function(){
					$$O("wdk_presence_"+newGroupObj.groupid).onerror = null;
					$$O("wdk_presence_"+newGroupObj.groupid).src = errsrc;
				};
				spanindex++;
			}
		}
	}
}
function JsIM_setHotFocusData(){
	var _C = Ntalker.Config,
		_V = Ntalker.variable;
	imHotFocusJsonp = typeof(imHotFocusJsonp)!='undefined' ? imHotFocusJsonp : typeof(jsonp)!='undefined' ? jsonp : null;
	if( !imHotFocusJsonp ){
		return;
	}
	var _cHt = ['<ul style="border-top:1px solid '+_C['bColor']+';">'];
	if( imHotFocusJsonp['newactivity'].length==0 ) _cHt.push('<li><a href="#">' + sprintf(NtLang['nullMessage'][1], '') + '</a></li>');
	for(var i=0; i < imHotFocusJsonp['newactivity'].length; i++ ){
		var item = imHotFocusJsonp['newactivity'][i];
		_cHt.push('<li><a href="' + item.url + '" target="_blank" title="' + item.title + '">' + $$S.cut(item.title, 18, true) + '</a></li>');
	}
	_cHt.push('</ul>');
	if( $$O('newactivity') ) $$O('newactivity').innerHTML = _cHt.join('');
	_cHt = ['<ul style="border-top:1px solid '+_C['bColor']+';">'];
	if( imHotFocusJsonp.hotactivity.length==0 ) _cHt.push('<li><a href="#">' + sprintf(NtLang['nullMessage'][1], '') + '</a></li>');
	for(var i=0; i < imHotFocusJsonp.hotactivity.length; i++ ){
		var item = imHotFocusJsonp.hotactivity[i];
		_cHt.push('<li><a href="' + item.url + '" title="' + item.title + '">' + $$S.cut(item.title, 18, true) + '</a></li>');
	}
	_cHt.push('</ul>');
	if( $$O('hotactivity') ) $$O('hotactivity').innerHTML = _cHt.join('');
}
function im_openWebchatWindow(destuid, destname, chatid, OpenType, chatType, roomtype, befrom){
	var _C = Ntalker.Config, _CP= Ntalker.Config.customparams, _V = Ntalker.variable;
	var OpenType = OpenType===true||OpenType===1 ? 1 : (OpenType===-1 ? -1 : 0);
	var chatType = /^(chat|group|room|nquan|traing)$/.test(chatType) ? chatType : 'chat';
	var roomtype = roomtype ? 1 : 0;
	var befrom = /^(groupList|feedMsgList|sysMsgList|groupMsgMenu)$/.test(befrom) ? befrom : 'groupList';
		im_openWebchatInPage(destuid, destname, chatid, OpenType, chatType, roomtype, '', befrom);
	if(IMToolBar && /^(group|room|nquan|traing)$/.test(chatType) && IMToolBar.removeGroupMessage){
		IMToolBar.removeGroupMessage('group' + destuid);
	}
}
function im_openWebchatInPage(destuid, destname, chatid, OpenType, chatType, roomtype, userinfo, befrom){
	var _C = Ntalker.Config, _V = Ntalker.variable;
	if(destuid==_V['user_id'] && !/^(group|room|nquan|traing)$/.test(chatType)){
		return;
	}
	if( !Ntalker.temp.chatDataFlashReady && chatType == 'chat' ){
		debug('chatDataFlashReady = false');
		return;
	}
	return chatWindowManager.addChatWindow(destuid, destname, chatid, null, null, OpenType, chatType, roomtype, userinfo, befrom);
}
function im_openBuddyListWindow(OpenType, program){
	var _C = Ntalker.Config;
	setTimeout(function(){
		if( im_myIMWindow ){
			im_myIMWindow.showWindow();
		}else{
			alert(NtLang['buddylistNotLoginAlter']);
		}
	}, 100);
	return true;
}
function IMHashtable(){
	this._hash = new Object();  
	this.add = function(key,value){
		if(typeof(key)!="undefined"){
			if(this.contains(key)==false){
				this._hash[key]=typeof(value)=="undefined"?null:value;
				return true;
			}else {
				return false;
			}
		}else {
			return false;
		}
	};
	this.remove = function(key){delete this._hash[key];};
	this.count = function(){var i=0;for(var k in this._hash){i++;} return i;};
	this.items = function(key){return this._hash[key];};
	this.contains = function(key){ return typeof(this._hash[key])!= "undefined";};
	this.clear = function(){for(var k in this._hash){delete this._hash[k];}};
}
function im_showSiteMessage(siteMsgInfoArray)
{
	Ntalker.variable.ExMsg = [];
	for(var j=0; j<siteMsgInfoArray.length; j++){
		Ntalker.variable.ExMsg.push(siteMsgInfoArray[j]);
	}
	if(IMToolBar&&IMToolBar.countMessageBox){
		IMToolBar.countMessageBox("im",null,true);
	}
}
function im_myMenu(array){
	Ntalker.variable.myApp = array;
	return;
}
function im_openBuddyWindow(type){
	index = 0;
	switch(type){
		case "buddylist":index=0;break;
		case "onlinelist":index=1;break;
		case "grouplist":index=2;break;
		default:index=0;break;
	}	
	Ntalker.Config.IMtabIndex = index;
	if(im_myIMWindow&&IMToolBar&&IMToolBar.onShowBuddylist){
		IMToolBar.onShowBuddylist(null,index);
	}else{
		setTimeout(function(){im_openBuddyWindow(type);},3000);
	}
} 
function im_conncetChatRoom(roomid, roomname)
{
	if( !roomid || !roomname || Ntalker.room.exec) return;
	var presenceFlash = $$O("impresenceflash");
	try{
		if(presenceFlash && typeof(presenceFlash.conncetChatRoom)!='undefined'){
			Ntalker.room.exec = true;
			presenceFlash.conncetChatRoom(Ntalker.variable.siteid, roomid, roomname);
		}
	}catch(e){}
}
function im_openHistoryChatWindow(){
	var _V = Ntalker.variable;
	if(_V['openHistoryWindow']) return;
		_V['openHistoryWindow'] = true;
	if(IMToolBar){
		if(IMToolBar.loadMessageBox){
			IMToolBar.loadMessageBox();
		}
	}
	var k = Ntalker['unKey'] + _V['user_id'];
	var cookieValue = NtUtil.getCookie(k);
	NtUtil.delCookie(k);
	if(!cookieValue) return;
	var currentUid = currentNick = currentChatType = "chat";
	cookieValue = cookieValue.replace(/{/g, "").split("}");
	for(var k in cookieValue){
		if( typeof(cookieValue[k]) != "function") continue; 
		if(IMToolBar && IMToolBar.onMaximize && IMToolBar._Pattern==1){
			IMToolBar.onMaximize();
		}
		chatWindow = $$S.toArray(cookieValue[k]);
		if(typeof(chatWindow)=='undefined'|| !chatWindow) continue; 
		im_openWebchatWindow(chatWindow["uid"], chatWindow["nick"], null, -1, chatWindow["type"]);
		_V['onlineChat'] -= 1;
		if(chatWindow["current"]=="default"){
			currentUid = chatWindow['uid'];
			currentNick = chatWindow['nick'];
			currentChatType = chatWindow['type'];
		}
	}
	if(chatWindowManager && Ntalker.Config.layout!='cascade'){
		if( Ntalker.variable['siteid'] == 'ntalkerpreview' ){
			debug('<b>im_openHistoryChatWindow</b>');
			chatWindowManager.OnTBFocusWindow(currentUid, currentChatType, currentNick);
		}else{
			chatWindowManager.OnTBFocusWindow();
		}
	}
}
function im_onUnload(){
	var _V = Ntalker.variable;
	var _presenceFlashGoUrl = Ntalker.temp.presenceFlashGoUrl;
	var chatWins = chatWindowManager._chatWndsArray;
	var minWindow = IMToolBar.minWindows._hash; 
	var cookieValue = "";
	if(_V['user_id'] && chatWindowManager && chatWins.length>0 ){
		for(var i=0; i<chatWins.length; i++){
			if(/^(group|room|nquan)$/.test(chatWins[i]._chatType) && chatWins[i]._isFlashLoadSuccess){
				cookieValue += "{uid:" + chatWins[i]._destuid+";nick:"+chatWins[i]._destnick+";type:"+chatWins[i]._chatType+";current:"+chatWins[i]._curWindMode+";}";
			}
		}
		if(minWindow){
			for ( k in minWindow){
				var temp=minWindow[k];
				if(temp._chatType=="chat"){
					cookieValue+="{uid:" + temp._destuid+";nick:"+temp._destnick+";type:"+temp._chatType+";current:"+((temp._focus)?"default":"hide")+";}";
				}
			}
		}
		if(cookieValue){
			NtUtil.setCookie(Ntalker['unKey']+_V['user_id'], cookieValue, 1000*3600*1);
		}
	}
	if(minWindow){
		for ( k in minWindow){
			var temp=minWindow[k];
			if(temp._chatType=="chat"){
				fIM_CloseChatWindow(temp._destuid, temp._chatType);
			}
		}
	}
	if(IMToolBar){
		if( IMToolBar.saveMessageBox ){
			IMToolBar.saveMessageBox();
		}
	}
	if(_presenceFlashGoUrl){
		$$C.load({src:_presenceFlashGoUrl});
	}
	if(chatWindowManager) chatWindowManager.closeAll();
	if(im_myIMWindow) im_myIMWindow.close();
	var flashobj = $$O('impresenceflash');
	if(flashobj){
		if(flashobj.closePresence) flashobj.closePresence();
		NtUtil.disposeFlashObj(flashobj);
		flashobj.parentNode.removeChild(flashobj);
	}
}
function fIM_presenceFlashReady(){
	setTimeout(function(){
		if( Ntalker.temp.ready ){
			StartGetUsersStatus();
			StartGetGroupEntry();
		}
		Ntalker.temp.ready = true;
		if($$O("impresenceflash") && $$O("impresenceflash").setPageFocus){
			$$O("impresenceflash").setPageFocus(true);
		}
	}, 50);
	return true;
}
function fIM_chatDataFlashReady(){
	Ntalker.temp.chatDataFlashReady = true;
}
function fIM_setPackageVersion(packageVersion, bbsType, hotserver){
	var _C = Ntalker.Config,
		_V = Ntalker.variable;
	if( !hotserver ){
		debug('function:: hotserver is null');
		return;
	}
	else{
		debug('function:: hotserver = ' + hotserver);
		_C['hotserver'] = hotserver;
		if( _C['waitRetuenHotService'] ){
			url = _C['hotserver'] + '?query=siteactivity&siteid=' + _V['siteid'] + '&uid=' + _V['user_id'] + '&sid=' + _V['user_sid'] + '&maxnum=7&cachemode=true' ;
			$$C.load({src: url}, false, JsIM_setHotFocusData);
		}
	}
	return;
}
function fIM_onGetUserStatus(responseText){
	var _C = Ntalker.Config,
		_CP= Ntalker.Config.customparams,
		_V = Ntalker.variable;
	var _temp= Ntalker.temp;
	if(responseText=="-1" || responseText=="-2" || _CP["hiddenmode"])
		return;
	var userStatusArray = responseText.split(",");
	var l = _temp.userSpanArray.length;
	for(i = 0;i < l; i++){
		var imgsrc = errsrc = '';
		switch(userStatusArray[i]){
		case "0":
			imgsrc = sprintf(_C['startlogo'], "offline");
			errsrc = _C['publicDIR'] + "/offline."+($$B.ie6?"gif":"png");
			break;
		case "1":
			imgsrc = sprintf(_C['startlogo'], "online");
			errsrc = _C['publicDIR'] + "/online."+($$B.ie6?"gif":"png");
			break;
		}
		chatLinkStr =  ' <a  href="javascript:void(0);" style="display:inline;padding:0px;overflow:visible;" alt="' + NtLang['pageStatusTip'] + '"';
		chatLinkStr += "onClick=\"javascript: im_openWebchatWindow('" + _temp.userSpanArray[i].destuid+"', '" + _temp.userSpanArray[i].destnick + "', null, 1, 'chat',0,'pageStateEntrance'); return false;\" >";
		chatLinkStr += '<img name="wdk_presence_image" style="display:inline;left:0px;top:0px;" id="wdk_presence_'+_temp.userSpanArray[i].destuid+'" border="0" src="'+imgsrc+'" />';
		chatLinkStr += '</a>';
		_temp.userSpanArray[i].spanElement.style.border = '';
		_temp.userSpanArray[i].spanElement.innerHTML = chatLinkStr;
		var spanId = "wdk_presence_"+_temp.userSpanArray[i].destuid;
		$$O(spanId).onerror = function(){
			$$O(spanId).onerror = null;
			$$O(spanId).src = errsrc;
		};
	}
}
function fIM_readCookie(userId, key, value){
	var _CP = Ntalker.Config.customparams;
	switch(key){
		case Ntalker['ctKEY']:
			var strSystemMessage = value;
			if( strSystemMessage == null || strSystemMessage == '' ){
				return;
			}
			var jsonSystemMessage = $$J.parseJSON(strSystemMessage);
			for(var k in jsonSystemMessage){
				if( typeof(jsonSystemMessage[k]) != 'object' ) continue;
				var JSON = jsonSystemMessage[k];
				try{
					if( IMToolBar && IMToolBar.addMessageBox ){
						IMToolBar.addMessageBox(JSON.id, JSON.name, JSON.content, JSON.opentype, JSON.iconurl, JSON.msgtype,JSON.activitytype,JSON.activityid,JSON.activityname,JSON.activityicon,JSON.profileurl,JSON.chatid,JSON.isRead,JSON.msgid,JSON.srcuid,JSON.msgtime,JSON.chatsid);
					}
				}catch(e){
				}
			}
			break;
		case Ntalker['gpKEY']:
			var strGroupMessage = value;
			if( strGroupMessage == null || strGroupMessage == '' ){
				return;
			}
			var jsonGroupMessage = $$J.parseJSON(strGroupMessage);
			for(var k in jsonGroupMessage){
				var JSON = jsonGroupMessage[k];
				IMToolBar&&JSON.groupid && IMToolBar.addGroupMessage(JSON.groupid, JSON.groupname, '', '', '', JSON.chattype);
			}
			break;
	}
	NtUtil.saveValue(userId, key, null);
}
function fIM_setConfiguration(strJson){
	if( IMToolBar ){
		IMToolBar.loadConfiguration(strJson);
	}
}
function fIM_presenceSetMyClientID(flashGoUrl){
	Ntalker.temp.presenceFlashGoUrl = flashGoUrl;
}
function fIM_presenceSetIMSid(imsid){
	Ntalker.variable.imsid = imsid;
}
function fIM_onPresenceReceiveChatMsg(destuid, destnick, wid, flashserver, message, chatid, isNotify, isMyFriend, isOnlineMsg, logoUrl, chatsid){
	var _C = Ntalker.Config,
		_CP= Ntalker.Config.customparams,
		_V = Ntalker.variable;
	if(isMyFriend!=2 && _CP["ignoreChatInvite"])
		return;
	if(isNotify){
		if( IMToolBar && IMToolBar.addMessageBox ){
			IMToolBar.addMessageBox(destuid,destnick,destnick+NtLang['requestChat'][0],"chat",logoUrl,"request","","","","","",chatid,false,'','','',(chatid?chatid:""));
		}
	}else{
		var OpenType = isMyFriend==-1 ? 0 : 1;
		if(isOnlineMsg){
			if(_V['onlineChat']>=0){
				chatWindowManager.addChatWindow(destuid, destnick, chatid, message, logoUrl, OpenType, 'chat', 0);
				_V['onlineChat'] -= 1;
			}else if(IMToolBar && IMToolBar.addMessageBox){
				IMToolBar.addMessageBox(destuid,destnick,destnick+NtLang['requestChat'][0],"chat",logoUrl,"request","","","","","",chatid,false,'','','',(chatid?chatid:""));
			}
		}else{
			if(_V['offlineChatList'].length<6){
				chatWindowManager.addChatWindow(destuid, destnick, chatid, message, logoUrl, OpenType, 'chat', 0);
				var openOfflineChatWindow = true;
				for(var k in _V['offlineChatList']){
					if(_V['offlineChatList'][k][0]==destuid && _V['offlineChatList'][k][1]==destnick){
						openOfflineChatWindow = false; break;
					}
				}
				if(openOfflineChatWindow) {
					_V['offlineChatList'].push([destuid, destnick]);
				}
			}else{
				var openOfflineChatWindow = false;
				for(var k in _V['offlineChatList']){
					if(_V['offlineChatList'][k][0]==destuid && _V['offlineChatList'][k][1]==destnick){
						openOfflineChatWindow = true; break;
					}
				}
				if(!openOfflineChatWindow){
					if( IMToolBar && IMToolBar.addMessageBox ){
					IMToolBar.addMessageBox(destuid,destnick,destnick+NtLang['requestChat'][0],"chat",logoUrl,"request","","","","","",chatid,false,'','','',(chatid?chatid:""));
					}
				}
			}
		}
	}
	if(promptwindow){
		debug('fIM_onPresenceReceiveChatMsg startPrompt');
		promptwindow.startPrompt(destnick, NtLang['requestChat'][1], true);
	}
	return true;
}
function fIM_OnPresenceReceiveGroupMsg( groupId, groupName, groupIcon, srcuid, srcnick, msg, isNotify, chattype){
	var _CP = Ntalker.Config.customparams;
	if( (!_CP["enablegroup"] && !_CP["enableroom"]) || !groupId || groupId=="" ){
		return;
	}
	chattype = /^(room|group|nquan|traing)$/.test(chattype) ? chattype : 'group';
	if(IMToolBar && IMToolBar.addGroupMessage){
		IMToolBar.addGroupMessage(groupId, groupName, srcuid, srcnick, msg, chattype);
	}
}
function fIM_onPresenceReceiveAddFriend(destuid, destnick, logoUrl, bconfirm){
	if( bconfirm ){
		if(IMToolBar && IMToolBar.addMessageBox){
			IMToolBar.addMessageBox(destuid,destnick,destnick+NtLang['requestAddFriend'][1],"chat",logoUrl,"confirm","","","","","","",false,'','','','');
		}
		if(promptwindow){promptwindow.startPrompt(destnick, NtLang['requestAddFriend'][1], true);}
	}else{
		if(IMToolBar && IMToolBar.addMessageBox){
			IMToolBar.addMessageBox(destuid,destnick,destnick+NtLang['requestAddFriend'][0],"chat",logoUrl,"alert","","","","","","",false,'','','','');
		}
		if(promptwindow){promptwindow.startPrompt(destnick, NtLang['requestAddFriend'][0], true);}
	}
}
function fIM_onPresenceReceiveUserOnline(destuid, destnick, logoUrl){
	var _C = Ntalker.Config;
	if( im_myIMWindow.isShow || _C['customparams']['enableOnlineHint']===0 ){
		return;
	}
	NotifyManager.add(destuid, destnick, NtLang['onlineText'], 0, logoUrl, "online");
}
function fIM_updateUserHead(uid, src, intStatus, chatType){
	setTimeout(function(){
		var miniWin = IMToolBar.get(uid, chatType || 'chat');
		if(miniWin) miniWin.updateUserHead(src, intStatus);
	}, 50);
}
function fIM_updateUserStatus(statusValue, message){
	setTimeout(function(){
		if(statusValue>0 && statusValue<=4){
			if( Ntalker.temp.Tip ) Ntalker.temp.Tip.show();
			im_openHistoryChatWindow();
		}
	}, 50);
}
function fIM_updateUserNumber(onlineUser, totalUser){
	setTimeout(function(){
		if(IMToolBar && IMToolBar.updateUserNumber){
			IMToolBar.updateUserNumber(onlineUser, totalUser);
		}
		if( Ntalker.variable['siteid'] == 'ntalkerpreview' && Ntalker.temp['OpenBuddyListWindow'] != true){
			Ntalker.temp['OpenBuddyListWindow'] = true;
			setTimeout(function(){
				im_openBuddyListWindow(true);
			}, 800);
		}
	}, 50);
}
function fIM_reLoadFlash(destuid, chatType){
	if( destuid &&  chatType){
		if( chatWindowManager ){
			chatWindowManager.getChatWindow(destuid,chatType).reloadFlash();
		}
	}
	else{
		if(im_myIMWindow){
			im_myIMWindow.reloadFlash();
		}
	}
	return true;
}
function fIM_CloseIMWindow(){
	if(im_myIMWindow){
		im_myIMWindow.minimize();
	}
}
function fIM_CloseChatWindow(destuid, chatType){
	if(chatWindowManager){
		var chatWin = chatWindowManager.getChatWindow(destuid,chatType);
		chatWin && chatWin.close(destuid, chatType);
	}
}
function fIM_MinMaxChatWindow(destuid, chatType){
	var _CP = Ntalker.Config.customparams;	if(chatWindowManager){
		chatWindowManager.getChatWindow(destuid, chatType).MinMax();
		try{
			IMToolBar.get(destuid, chatType).onBlur();
		}catch(e){}
	}
}
function fIM_setChatGoServer(freeChatFlashGoUrl, presenceFlashGoUrl, destuid, chatid, chatType){
	var chatWindow = chatWindowManager.getChatWindow(destuid, chatType);
	if(chatWindow){
		chatWindow._freeChatFlashGoUrl = freeChatFlashGoUrl;
		chatWindow._presenceFlashGoUrl = presenceFlashGoUrl;
		chatWindow._chatid = chatid;
	}
}
function fIM_buddylistFlashInitialization(){
	return true;
}
function fIM_buddylistFlashReady(){
	var buddylistFlash = document.getElementById("wdk_buddylist_flash"),
		_V = Ntalker.variable;
	if(buddylistFlash && buddylistFlash.setBuddylistFlashParam){
		buddylistFlash.setBuddylistFlashParam(_V['user_sid'], _V['user_id'], _V['user_name'], _V['siteid'],"buddylist");
	}
	if(im_myIMWindow){
		im_myIMWindow.onFlashLoadSuccess();
	}
}
function fIM_webchatFlashInitialization(destuid, chatType){
	return true;
}
function fIM_webchatFlashReady(destuid, chatType){
	var chatWindow = chatWindowManager.getChatWindow(destuid, chatType);
	if(chatWindow){
		chatWindow.onFlashLoadSuccess();
	}
	return true;
}
function fIM_webchatDataModReady(){
	Ntalker.temp.webchatDataModReady = true;
	var current_minTag = Ntalker.temp.current_tag;
	var minWindow = IMToolBar.get(current_minTag[0], current_minTag[1]);
	var countMinWnd = 0, minWindows = IMToolBar.minWindows._hash;
	for ( k in minWindows){
		if(minWindows[k]._chatType == "chat"){
			countMinWnd ++;
		}
	}
	if( countMinWnd <=1 || !minWindow )
		return;
	setTimeout(function(){
		IMToolBar.focusTag(minWindow._destuid, minWindow._chatType);
	}, 50);
}
function fIM_setBuddylistFlashParamfunc(){
	var buddylistFlash = document.getElementById("wdk_buddylist_flash"),
		_V = Ntalker.variable;
	if(buddylistFlash && buddylistFlash.setBuddylistFlashParam){
	  buddylistFlash.setBuddylistFlashParam(_V['user_sid'], _V['user_id'], _V['user_name'], _V['siteid'], "buddylist");
	}
}
function fIM_onGetChatroomStatus(chatroominfo)
{
	if(typeof(chatroominfo) == "string")
		chatroominfo   = eval('('+chatroominfo+')');
	var parentNode = $$O("wdk_group_"+chatroominfo.roomid);
	if( parentNode && parentNode.className=="wdk_group_chat_span" && parentNode.innerHTML != "")
		var parentNodeId = "wdk_group_"+chatroominfo.roomid;
}
function fIM_OnFlashFocus()
{
	if(promptwindow) promptwindow.handleFocus();
}
function fIM_OnFlashBlur()
{
	if(promptwindow) promptwindow.handleBlur();
}
function fIM_onWebchatReceiveChatMsg(destuid, destnick, message, chatType, chatid){
	chatType = /^(group|room|nquan|traing)$/.test(chatType) ? chatType : 'chat';
	if(promptwindow){
		debug('fIM_onWebchatReceiveChatMsg startPrompt');
		var flashTitle = /^(group|room|nquan|traing)$/.test(chatType) ? NtLang['requestChat'][3] : NtLang['requestChat'][2];
		promptwindow.startPrompt(destnick, flashTitle, true);
		if(typeof(chatWindowManager) != "undefined"){
			if( chatType == 'chat' ){
				var miniWindow = IMToolBar.get(destuid, chatType);
				if( miniWindow ){
					miniWindow.onReceiveMiniMessage(message);
				}else{
				}
			}else{
				var chatWindow = chatWindowManager.getChatWindow(destuid, chatType);
				if(chatWindow) chatWindow.onReceiveMessage(message);
			}
		}
	}
}
function fIM_onWebchatReceiveEvent(destuid, destnick, eventname, eventcontent){
	if(promptwindow) promptwindow.startPrompt(destnick, eventcontent, true);
	var chatType = "chat";
	if(eventname=="DestOpenWindow" && IMToolBar){
		var miniWindow = IMToolBar.getMiniWindow(destuid, chatType);
		miniWindow.onReceiveMiniMessage(eventcontent);
	}
}
var NotifyManager = {
	_notifyWnds: new IMHashtable(),
	_NotifySPAN: $$D.create('div', {id:"OnlineNotifyGroup"}, null, "afterbegin"),
	_maxNotify: 3,
	_width: 215,
	_height: 130,
	_bottom: 30,
	scroltimerID: null,
	addScrollEvent: false,
	checkonline:function(destuid, destname, type){
		var _Wnd, type = type? type:"online";;
		for(var k in this.showQueue._showList._hash){
			_Wnd = this.showQueue._showList.items(k);
			if(_Wnd.type=="online" && _Wnd.destuid==destuid && _Wnd.destname==destname) return true;
		}
		for(var k in this._notifyWnds._hash){
			_Wnd = this.get(k);
			if(_Wnd.type=="online" && _Wnd.destuid==destuid && _Wnd.destname==destname) return true;
		}
		return false;
	},
	clearonline:function(type){
		type = type ? type : "online";
		for(var k in this._notifyWnds._hash){
			if(this.get(k).type==type) this.remove(k);
		}
	},
	add: function(destuid, destname, message, chatid, headURL, type, BtnType, sendMsg){
		if(this.checkonline(destuid, destname, type)) return;
		var _V = Ntalker.variable;
		Ntalker.temp.notify_id++;
		var notifyWnd	 = new Object();
		notifyWnd.destuid = destuid;
		notifyWnd.destname= destname;
		notifyWnd.message = message;
		notifyWnd.chatid  = chatid;
		notifyWnd.logoUrl = headURL;
		notifyWnd.type	= type? type:"online";
		notifyWnd.BtnType = BtnType;
		notifyWnd.sendMsg = sendMsg;
		notifyWnd.userid  = _V['user_id'];
		if (!notifyWnd.userid)
			return;
		notifyWnd._curNotifyId  = 'Notify' + Ntalker.temp.notify_id + "TYPE" + notifyWnd.type;
		this._notifyWnds.add(notifyWnd._curNotifyId, notifyWnd);
		this.push();
	},
	remove: function(k){
		this._notifyWnds.remove(k);
	},
	get: function(k){
		return this._notifyWnds.items(k);
	},
	push:function(){
		var _sPush = false, _aPush = false;
		for(var k in this._notifyWnds._hash){
			var sLen = this.showQueue._showList.count();
			var aLen = this.alertQueue._showList.count();
			var _Wnd = this.get(k);
			if(sLen<this._maxNotify && !this.showQueue._showing && _Wnd.type=="online"){
				_sPush = true;
				this.showQueue.add(k, this.get(k));this.remove(k);
			}
			if(aLen<1 && !this.alertQueue._showing && _Wnd.type=="alert"){
				_aPush = true;
				this.alertQueue.add(k, this.get(k));this.remove(k);
			}
			if(_sPush && _aPush){break;}
		}
	},
	alertQueue:{
		_showList   : new IMHashtable(),
		_showing	: false,
		add: function(key, notifyWnd){
			var alertNotifys = $$selector("div.ntalker_notify"),
				_C = Ntalker.Config,
				_CP= Ntalker.Config.customparams,
				_V = Ntalker.variable;
			for(var k in alertNotifys){
				if(alertNotifys[k].parentNode) alertNotifys[k].parentNode.removeChild(alertNotifys[k]);
			}
			if( /^(confirm|request)$/.test(notifyWnd.BtnType) || notifyWnd.type == 'alert') {
				IMToolBar && IMToolBar.focusTag();
			}
			this._showList.add(key, notifyWnd);
			var wRt = $$D.windowRect();
			var _width, _height, className;
			if( notifyWnd.chattype === 'nquan' ){
				_width = 275;
				_height = 150;
				className = 'nt_notify_nquan';
			}else{
				_width = NotifyManager._width;
				_height = NotifyManager._height;
				className = 'nt_notify';
			}
			var _top = wRt.y + (wRt.h - _height)/2,
				_left = wRt.x + (wRt.w - _width)/2,
				_headURL = notifyWnd.logoUrl ? notifyWnd.logoUrl:_C['imagesDIR']+"notify_userhead.png",
				_errimg = _C['imagesDIR']+"notify_userhead.png";
			var _openChatWindow = function(){
				im_openWebchatWindow(notifyWnd.destuid, notifyWnd.destname, notifyWnd.chatid, 1, notifyWnd.chattype, 0, 'groupMsgMenu');
				NotifyManager.alertQueue.close( key, notifyWnd.BtnType, notifyWnd.type );
				IMToolBar.removeSystemMessage( notifyWnd.type + notifyWnd.destuid );
			};
			var _Ht = [];
			_Ht.push('<div id="' + key + '" class="ntalker_notify ' + className + '" style="z-index:2147483647;left:' + _left + 'px;top:' + _top + 'px;width:' + _width + 'px;height:' + _height + 'px;">');			_Ht.push(	'<div style="background: url(' + _C['logo'] + ') no-repeat 1px center;margin:8px 8px 0 8px;height:28px;padding:0;text-align:right;">');
			_Ht.push(		'<a href="javascript:NotifyManager.alertQueue.close(\''+key+'\', \'' + notifyWnd.BtnType+'\', \''+notifyWnd.type + '\');IMToolBar.removeSystemMessage(\'' + notifyWnd.type+notifyWnd.destuid + '\');" class="nt_close"></a>');
			_Ht.push(	'</div>');			_Ht.push(	'<div id="' + key + '_IMG" style="margin:10px 20px 0px 20px !imporant;margin-top:0px;margin-left:20px;cursor:pointer;">');
			_Ht.push(	'  <div style="margin:4px;background:#fff;width:65px;height:65px;float:left;"><img src="' + _headURL + '" style="width:61px;_width:60px;height:61px;_height:60px;border:1px solid #ccc;margin:1px;" /></div>');
			_Ht.push(	'  <br style="clear: both;" />');
			_Ht.push(	'</div>');
			_Ht.push(	'<div style="overflow: hidden; position: absolute; left: 95px; top: 40px; width: ' + (notifyWnd.chattype === 'nquan' ? 165 : 105) + 'px;color:#000000;font-size:12px;">');			if( notifyWnd.BtnType && notifyWnd.sendMsg )
				_Ht.push(	'<span style="height: 55px; display: block;"><B>' + $$S.cut(notifyWnd.destname,6,true) + '</B><br />' + sprintf(NtLang['sayContent'], $$S.cut(notifyWnd.sendMsg, 6, true) ) + '</span>' );
			else if(notifyWnd.chattype === 'nquan')
				_Ht.push(	'<span style="height: 80px; display: block;"><B>' + $$S.cut(notifyWnd.destname,6,true) + '</B><br />' + $$S.cut( notifyWnd.message, 40, true) + '</span>' );
			else
				_Ht.push(	'<B>' + $$S.cut(notifyWnd.destname,6,true) + '</B><br />' + $$S.cut( notifyWnd.message, 12, true) + '<br />' );			if( /^(confirm|request)$/.test(notifyWnd.BtnType) ){
				_Ht.push(	'<a href="javascript:im_Confirm(\'' + notifyWnd.destuid + '\', \'' + key + '\', \'' + notifyWnd.BtnType + '\', 1, \'' + notifyWnd.destname + '\',\'' + notifyWnd.type + '\');" style="width:43px;display:block;height:20px;background:url(' + _C['imagesDIR'] + '/notifybtn.png) no-repeat 0 0;float:left;"></a>');
				_Ht.push(	'<a href="javascript:im_Confirm(\'' + notifyWnd.destuid + '\', \'' + key + '\', \'' + notifyWnd.BtnType + '\', 2, \'' + notifyWnd.destname + '\',\'' + notifyWnd.type + '\');" style="width:44px;display:block;height:20px;background:url(' + _C['imagesDIR'] + '/notifybtn.png) no-repeat -43px 0;float:left;"></a>');
			}
			if(notifyWnd.chattype === 'nquan'){
				_Ht.push(	'<a id="' + key + '_VIEW" href="javascript:void(0);" style="display:block;float:right;width:60px;height:20px;background:url(' + _C['imagesDIR'] + '/nquan_viewbtn.png)"></a>');
			}
			_Ht.push(	'</div>');
			_Ht.push('</div>');
			_curElement = $$D.insert(document.body, _Ht.join(''));
			$$O(key + '_IMG')  && $$E.addEvent($$O(key + '_IMG'), 'click', _openChatWindow);
			$$O(key + '_VIEW') && $$E.addEvent($$O(key + '_VIEW'), 'click', _openChatWindow);
			if( $$O(key + '_IMAGES') ){
				$$O(key + '_IMAGES').onerror = function(){
					$$O(key + '_IMAGES').onerror = null;
					$$O(key + '_IMAGES').src = _C['imagesDIR']+"notify_userhead.png";
				};
			}
			this.animate(_curElement, false);
		},
		animate:function(elem, autoclose){
			this._showing = true;
			NotifyManager.alertQueue._showing = false;
			if(autoclose){
				setTimeout(function(){
					$$D.animate(elem, {opacity:10}, 400, "swing", function(){
						if(elem.parentNode)elem.parentNode.removeChild(elem);
						NotifyManager.alertQueue._showList.remove(elem.id);
						setTimeout(function(){NotifyManager.push();}, 500);
					});
				}, 6000);
			}
		},
		close:function(id, btntype,type){
			var _CP= Ntalker.Config.customparams,
				_V = Ntalker.variable;
			elem = $$O(id);
			$$D.animate(elem, {opacity:0}, 400, "swing", function(){
				if(elem.parentNode) elem.parentNode.removeChild(elem);
				NotifyManager.alertQueue._showList.remove(elem.id);			});
		}
	},
	showQueue:{
		_showList: new IMHashtable(),
		_showing: false,
		add: function(key, notifyWnd){
			var wRt = $$D.windowRect();
			var _C = Ntalker.Config,
				_top = wRt.y + wRt.h - NotifyManager._bottom,
				_headURL = notifyWnd.logoUrl?notifyWnd.logoUrl:_C['imagesDIR']+"notify_userhead.png",
				_errimg  = _C['imagesDIR'] + "notify_userhead.png";
			this._showList.add(key, notifyWnd);
			_curElement = $$D.create('div', {id:key,className:"ntalker_notify nt_notify"}, NotifyManager._NotifySPAN);
			_curElement.style.cssText = "z-index:2147483647;"+($$B.ie6 ? 'position:absolute;top:'+_top+'px;' : 'position:fixed;bottom:'+NotifyManager._bottom+'px;')+"right:10px;height:1px;width:"+NotifyManager._width+"px;background:transparent url("+_C['imagesDIR']+"notifybg."+($$B.ie?"gif":"png")+") no-repeat left top;";
			var htmls = ["<div style=\"background: url("+_C['logo']+") no-repeat 1px center; margin:8px 8px 0 8px;height:28px;padding:0;text-align:right;\"><a href=\"javascript:NotifyManager.showQueue.close('"+key+"');\" class=\"nt_close\"></a></div>",
						"<div style=\"margin:0px 10px;cursor:pointer;height:85px;\" onclick=\"im_openWebchatWindow("+notifyWnd.destuid+", '"+notifyWnd.destname+"', '"+notifyWnd.chatid+"', 1);NotifyManager.alertQueue.close('"+key+"');\">",
						"  <div style=\"margin:10px 4px 4px 14px;_margin:10px 4px 4px 4px;background:#fff;width:65px;height:65px;float:left;\"><img id=\""+key+"_IMAGES\" src=\""+_headURL+"\" style=\"width:61px;_width:60px;height:61px;_height:60px;border:1px solid #ccc;margin:1px;\" /></div>",
						"  <div style=\"padding: 10px 5px 0px 0px; float: right; width: 105px; color: #000000; font-size: 14px;font-family:宋体;\">",
						"	<B>" + $$S.cut(notifyWnd.destname, 5, true) + "</B><br />" + notifyWnd.message + "",
						"  </div>",
						"</div>"].join('');
			_curElement.innerHTML = htmls;
			if( $$O(key + '_IMAGES') ){
				$$O(key + '_IMAGES').onerror = function(){
					$$O(key + '_IMAGES').onerror = null;
					$$O(key + '_IMAGES').src = _C['imagesDIR']+"notify_userhead.png";
				};
			}
			var __notifyRepos = function(){
				clearTimeout(NotifyManager.scroltimerID);
				NotifyManager.scroltimerID = setTimeout(function(){
					var count = NotifyManager.showQueue._showList.count();
					if( count == 0 ){
						$$E.removeEvent(window, 'resize', __notifyRepos);
						$$E.removeEvent(window, 'scroll', __notifyRepos);
						NotifyManager.addScrollEvent = false;
						debug('NotifyManager removeEvent scroll&&resize ');
					}
					var list = NotifyManager.showQueue._showList._hash;
					var wRt = $$D.windowRect();
					for(var k in list){
						var key = list[k]._curNotifyId;
						var notifyRect = $$D.clientRect(key);
						var top = wRt.y + wRt.h - notifyRect.h - NotifyManager._bottom;
						$$D.animate($$O(key), {top:top}, 'fast', 'easeInOutBounce', function(){});
					}
				}, 400);
			};
			if( !NotifyManager.addScrollEvent && $$B.ie6 ){
				$$E.addEvent(window, 'resize', __notifyRepos);
				$$E.addEvent(window, 'scroll', __notifyRepos);
				NotifyManager.addScrollEvent = true;
				debug('NotifyManager addEvent scroll&&resize ');
			}
			if($$O('impresenceflash') && $$O('impresenceflash').playNotifySound){
				$$O('impresenceflash').playNotifySound();
			}
			this.animate(_curElement);
		},
		animate:function(elem){
			var newY;
			if(im_myIMWindow){
				if(im_myIMWindow.isShow) return;
			}
			this._showing = true;
			var _preNodes = [];var _curEl = elem;
			while(_curEl.previousSibling){
				_preNodes.push(_curEl.previousSibling);
				_curEl = _curEl.previousSibling;
			}
			function callback(){
				NotifyManager.showQueue._showing = false;
				setTimeout(function(){NotifyManager.push();},500);
				setTimeout(function(){
					if(elem.parentNode)elem.parentNode.removeChild(elem);
					NotifyManager.showQueue._showList.remove(elem.id);
					NotifyManager.push();
				}, 15000);
			}
			for(var i=0; i<_preNodes.length; i++ ){
				if( $$B.ie6 ){
					newY = parseInt($$D.css(_preNodes[i], "top")) - NotifyManager._height;
					$$D.animate(_preNodes[i], {top:newY}, 400, "easeOutQuart");
				}else{
					newY = parseInt($$D.css(_preNodes[i], "bottom")) + NotifyManager._height;
					$$D.animate(_preNodes[i], {bottom:newY}, 400, "easeOutQuart");
				}
			}
			if( $$B.ie6 ){
				newY = parseInt($$D.css(elem, "top")) - NotifyManager._height;
				$$D.animate(elem, {top:newY, height:NotifyManager._height}, 400, "easeOutQuart", callback);
			}else{
				$$D.animate(elem, {height:NotifyManager._height}, 400, "easeOutQuart", callback);
			}
		},
		close:function(elem){
			elem = $$O(elem);
			var _curEl = elem; var _preNodes = [];
			while(_curEl.previousSibling){
				_preNodes.push(_curEl.previousSibling);
				_curEl = _curEl.previousSibling;
			}
			if(elem.parentNode) 
				elem.parentNode.removeChild(elem);
			NotifyManager.showQueue._showList.remove(elem.id);
			for(var i=0; i<_preNodes.length; i++){
				if( $$B.ie6 ){
				newY = parseInt($$D.css(_preNodes[i], "top")) + NotifyManager._height;
				$$D.animate(_preNodes[i], {top:newY}, 400, "easeOutQuart", function(){
					NotifyManager.push();
					});
			}else{
			newY = parseInt($$D.css(_preNodes[i], "bottom")) - NotifyManager._height;
			$$D.animate(_preNodes[i], {bottom:newY}, 400, "easeOutQuart", function(){
					NotifyManager.push();
				});
				}
			}
		}
	}
};
var _p;
Ntalker.IMWindow = function(){
	this._window = window;
	this._doc  = this._window.document;
	this._self = null;
	this.isLoad = 0;
	this.titleHeight = 0;
	this.borderWidth = 0;
	this._width = Ntalker.Config.IMWidth;
	this._height = Ntalker.Config.IMHeight;
	this.m_rlLong = 20;
	this._flashID = 'wdk_buddylist_flash';
	this.m_flashContainerID = "container_" + this._flashID;
	this._flashcontainer = null;
	this._titleid = "wdk_buddylist_title";
	this.timerID = null;
	this._flash = null;
	this.isInited = false;
	this._isFlashLoadSuccess = false;
	this._flashLoadTime = 30000; 
	this._waitFlashAutoLoad = 5000; 
	this._FlashReloadCount = 0;
	this._checkFlashTimerid = null;
	this._waitFlashAutoLoadTimeid = null;
	this._loadFlashTestTimeid = null;
	this.isShow = false;
	this.created = false;
	this._left = 0;
	this._bottom = 0;
	this._right = 0;
	this._top = 0;
};
_p = Ntalker.IMWindow.prototype;
_p.init = function(obj){
	if(this.isInited) return;
	this.isInited = true;
	this.m_jsURLPath = Ntalker.variable.scriptPath;
	this.m_funcURLPath = Ntalker.Config.services;
	var self = this;
	if(this.isLoad == 1) return;
	this.isLoad = 1;
};
_p.moveTo = function(x, y){
	var wRt = $$D.windowRect();
	this._left = x - wRt.x;
	this._top = y - wRt.y;
	this._right =  wRt.x+wRt.w-x;
	this._bottom = wRt.y+wRt.h-y;
	var _CP = Ntalker.Config.customparams;
	if($$B.ie){
		this._self.style.pixelLeft = x;
		if($$B.ie6){
			debug('IMWindow.moveTo ie6 setpiexTop');
			this._self.style.pixelTop  = y;
		}
	}else{
		this._self.style.left = x + "px";
	}
};
_p.resize = function(w, h){
	this._self.style.width  = w + "px";
	this._self.style.height = h + "px";
	var ch = h - 20 - this.borderWidth;
	if(this._flash){
		var fw = Math.max(w - 2 * this.borderWidth, 0);
		var fh = Math.max(h - 2 * this.borderWidth - this.titleHeight, 0);
		this._flash.setAttribute("width", fw);
		this._flash.setAttribute("height", fh);
		this._flash.style.width  = fw + "px";
		this._flash.style.height = fh + "px";
		this._flash.style.left = this.borderWidth + "px";
	}
};
_p.refreshFlashPos = function(){
	if( !this._flash  || this._curWindMode=="min" )
		return;
	var moveOffset = -1;
	if(this._isMoveLeft){
		moveOffset = 1;
		this._isMoveLeft = false;
	}
	else{
		moveOffset = -1;
		this._isMoveLeft = true;
	}
	this._flash.style.zIndex = parseInt($$D.css(this._flash, 'z-index')) + moveOffset
};
_p.createWin = function(tagIndex){
	var wRt  = $$D.windowRect();
	var _r = NtUtil.scrollWidth();
	var _C = Ntalker.Config,
		_CP = Ntalker.Config.customparams,
		_V = Ntalker.variable;
	this.created = true;
	var cacheDom = document.createDocumentFragment();
	$$D.css(_V['buddylistTag'], "display", "block");
	var _TabRect = $$D.clientRect(_V['buddylistTag']);
	this._self = $$D.create('div', {id:"buddylist_tag_con", style:"background:#fafafa;overflow:hidden;visibility:visible;"}, cacheDom);
	this.left = _TabRect.w - 10 - this._width;
	this.bottom = 0;
	this._self.style.position = "absolute";
	this._self.style.left   = this._left+'px';
	this._self.style.bottom = this._bottom+'px';
	this._self.style.zIndex = 9999;
	var flashWidth = this._width - 2*this.borderWidth;
	var flashHeight = this._height - this.titleHeight - 2*this.borderWidth;
	var bWidth = this.borderWidth;
	var sb = [];
	var infoTextSpanStyle = 'display:'+(_CP['enableJavaScriptLoading'] ? 'block' : 'none')+';';
	sb.push("<div id='" + this.m_flashContainerID + "' style='overflow:hidden;width:"+flashWidth+"px;height:"+flashHeight+"px;'>");
	sb.push(	"<div id='infoTextSpan' style='"+infoTextSpanStyle+"cursor:auto;width:"+flashWidth+"px;height:"+flashHeight+"px;line-height:" + flashHeight + "px;background:#EDF5F0 url(" + _C['publicDIR'] + "/loading.gif) no-repeat center center;text-align:center;border:0px solid "+_C['bColor']+"'></div>");
	sb.push(	"<div id='" + this._flashID + "'></div>");
	sb.push("</div>");
	if( $$B.msie ) sb.push('<iframe style="position:absolute;z-index:-1;width:96%;height:92%;top:15px;left:2px;scrolling:no;" frameborder="0" src="about:blank"></iframe>');
	this._self.innerHTML = sb.join('');
	debug('IMWindow.createWin::infoTextSpanStyle='+infoTextSpanStyle);
	delete sb;
	(_V['buddylistTag'] || document.body).appendChild(cacheDom);
	debug('IMWindow.createWin::appendChild');
	this._self.style.display = "block";
	this._flashcontainer = this._doc.getElementById(this.m_flashContainerID);
	this.createFlash(tagIndex);
	this.resize(this._width, this._height);
	$$D.css(this._self, 'bottom', '0px');
};
_p.createFlash = function(tagIndex){
	if(!this._flashcontainer)
		return;
	var swfSrc,
		_C = Ntalker.Config,
		_CP = Ntalker.Config.customparams,
		_V = Ntalker.variable;
	swfSrc = this.m_jsURLPath+"/fs/NtalkerWebMessager.swf";
	var flashvars = {v : Ntalker.version.buddylist_flash,
					 modname: "ContactMod",
					 pageId: Ntalker.temp.pageId,
					 r : this.m_jsURLPath,
					 su: this.m_funcURLPath,
					 k : _C['skin'] || "",
					 t : encodeURIComponent(_V['siteid']),
					 s : encodeURIComponent(_V['user_sid']),
					 u : encodeURIComponent(_V['user_id']), 
					 n : encodeURIComponent(_V['user_name']),
					 l : Ntalker.Config.buddylistlogo ? Ntalker.Config.buddylistlogo : 0,
					 i : tagIndex,
					 lst: _CP['lstupdated'],
					 localeChain: _CP['localeChain'],
					 ps: 6
					 };
	if(_V['userparam'])
		flashvars.p = encodeURIComponent(_V['userparam']);
	if(_C['buddylistlogo'] && _CP['siteurl'])
		flashvars.f = _CP['siteurl'].toLowerCase().replace("http://","");
	else
		flashvars.f = encodeURIComponent(window.location.host);
	if(_CP['previewsiteid']){
		flashvars.previewsiteid = _CP['previewsiteid'];
	}
	if(flashvars.toJSONString)
		delete flashvars.toJSONString;
	var flashmode = "Window";
	var params = {menu:"true", "salign":"LT", "allowScriptAccess":"always", "wmode":flashmode, "allowFullScreen": true};
	var attributes = {};
	var flashWidth = this._width - 2 * this.borderWidth;
	var flashHeight = this._height - 2 * this.borderWidth - this.titleHeight;
	if( parseInt(NtUtil.Flash.getPlayerVersion().major) < 9 ){
		$$D.css(this._flash, 'display', 'none');
		$$D.css($$O('infoTextSpan'), 'background', 'none');
		$$O('infoTextSpan').innerHTML = '<a href="http://www.adobe.com/go/getflashplayer" target="_blank">' + NtLang['noInstallFlash'] + '</a>';
		return;
	}else{
		ntalker_swfobject.embedSWF(swfSrc, this._flashID, flashWidth, flashHeight, "9.0.115", _V['scriptPath']+"/fs/expressInstall.swf", flashvars, params, attributes);		debug('swfobject.embedSWF');
		var self = this;
		this._loadFlashTestTimeid = setTimeout(function(){
			self.LoadFailure();
			debug('IMWindow.createFlash::Not in time='+self._flashLoadTime);
			self._flashLoadTime = self._flashLoadTime*2; 
		}, self._flashLoadTime);
	}
	self._flash = $$O(self._flashID);
	if( !_CP['enableJavaScriptLoading'] ){
		self.setFlashStyle();
	}else if( !$$B.ie6 && !$$B.opera ){
		self.setFlashStyle();
	}
};
_p.setFlashStyle = function(){  
	var fw = Math.max(this._width - 2 * this.borderWidth, 0);
	var fh = Math.max(this._height - 2 * this.borderWidth - this.titleHeight, 0);
	if(this._flash){
		this._flash.style.position = "absolute";
		if( !$$B.ie6 ) this._flash.style.top = (this.borderWidth + this.titleHeight) + "px";
		if( !$$B.ie6 ) this._flash.style.left = this.borderWidth + "px";
		this._flash.style.width  = fw + "px";
		this._flash.style.height = fh + "px";
		this._flashHeight = this._flash.style.height;
	}
};
_p.reloadFlash = function(){
	var _C = Ntalker.Config,
		_CP = Ntalker.Config.customparams;
	if(this._restoreFlash){
		delete this._restoreFlash;
	}
	this._flash = null;
	var _Ht = [];
	var flashWidth = this._width - 2 * this.borderWidth;
	var flashHeight = this._height - 2 * this.borderWidth - this.titleHeight;
	var infoTextSpanStyle = 'display:'+(_CP['enableJavaScriptLoading'] ? 'block' : 'none')+';'
	_Ht.push("<div id='infoTextSpan' style='"+infoTextSpanStyle+"cursor:auto;width:"+flashWidth+"px;height:"+flashHeight+"px;line-height:" + flashHeight + "px;background:#EDF5F0 url(" + _C['publicDIR'] + "/loading.gif) no-repeat center center;text-align:center;border:0px solid "+_C['bColor']+"'></div>");
	_Ht.push(	"<div id='" + this._flashID + "' style=''></div>");
	this._flashcontainer. innerHTML = _Ht.join('');
	debug('IMWindow.reloadFlash::infoTextSpanStyle='+infoTextSpanStyle);
	if(this._waitFlashAutoLoadTimeid) clearTimeout(this._waitFlashAutoLoadTimeid);
	this.createFlash();
};
_p.LoadFailure = function(){
	if(this._isFlashLoadSuccess){
		return;
	}
	var self = this, _C = Ntalker.Config, _CP = Ntalker.Config.customparams;
		this._restoreFlash = this._flash;
	var flashWidth = this._width - 2*this.borderWidth;
	var flashHeight = this._height - this.titleHeight - this.borderWidth*2;
	if(self._flash){
		$$D.css(this._flash, "display", "none");
		try{
			this._flash.parentNode.removeChild(this._flash);
		}catch(e){
			this._flash.style.width = 1 + 'px';
			this._flash.style.height = 1 + 'px';
		}
	}
	var closeButtonId = 'CloseIMWindowButton';
	var reLoadButtonId = 'reLoadFlashButton';
	if( _CP['enableJavaScriptLoading'] ){
		$$D.css($$O('infoTextSpan'), 'backgroundImage', 'none');
		$$D.css($$O('infoTextSpan'), 'display', 'block');
		debug('IMWindow.LoadFailure:: infoTextSpan backgroundImage:none;display:block;');
	}
	var _Ht = [];
	_Ht.push('<div>');
	_Ht.push(	'<div name="winlogo" style="float:left;width:70px;height:20px;background:url(' + _C['logo'] + ') center center no-repeat;"></div>');
	_Ht.push(	'<div name="wintitle" style="float:left;width:132px;height:20px;background:url(' + _C['publicDIR'] + 'titleText.gif) center center no-repeat;"></div>');
	_Ht.push(	'<div id="'+closeButtonId+'" name="btnclose" style="z-index:12;float:right;margin-right:8px;width:26px;height:20px;background:url('+_C['publicDIR'] + 'closewin.gif) center top no-repeat;cursor:pointer;"></div>');
	_Ht.push('</div>');
	_Ht.push('<div style="text-align:center;clear:both;height:' + (flashHeight-20) + 'px;line-height:' + (flashHeight-20) + 'px;">');
	_Ht.push(	'<a id="'+reLoadButtonId+'" href="javascript:void(0)">' + NtLang['loadFlashFailure'] + '</a>');
	_Ht.push('</div>');
	$$D.insert($$O('infoTextSpan'), _Ht.join(''));
	var self = this;
	var __clearClick  = function(e){$$E.fixEvent(e).stopPropagation();};
	var __closeWaitWin = function(e){ self.close();};
	var __reloadFlash = function(){
		clearTimeout(self._waitFlashAutoLoadTimeid);
		self.reloadFlash();
		debug('IMWindow.LoadFailure::Waiting time='+self._waitFlashAutoLoadTimeid);
	};
	if(this._FlashReloadCount < 2 && !this._isFlashLoadSuccess){
		this._FlashReloadCount++;
		this._waitFlashAutoLoadTimeid = setTimeout( __reloadFlash, this._waitFlashAutoLoad);
		debug('IMWindow.LoadFailure:: _waitFlashAutoLoad=' + this._waitFlashAutoLoad);
	}
	if( $$O('infoTextSpan') ) $$O('infoTextSpan').onclick   = __clearClick;
	if( $$O(closeButtonId) ) $$O(closeButtonId).onclick  = __closeWaitWin;
	if( $$O(reLoadButtonId) ) $$O(reLoadButtonId).onclick = __reloadFlash;
};
_p.onFlashLoadSuccess = function(){
	var _CP = Ntalker.Config.customparams;
	this._isFlashLoadSuccess = true;
	clearTimeout(this._loadFlashTestTimeid);
	if( _CP['enableJavaScriptLoading'] ){
		$$D.css($$O('infoTextSpan'), 'display', 'none');
   		this.setFlashStyle();
   		debug('IMWindow.onFlashLoadSuccess:: display:none;setFlashStyle');
	}
};
_p.minimize = function(){
	clearTimeout(this._waitFlashAutoLoadTimeid);
	if(this._self)	this._self.style.visibility = "hidden";
	if(this._flash) this._flash.style.visibility = "hidden";	this.isShow = false;
};
_p.close = function(isShowMini){
	var self = this, _V = Ntalker.variable;
	clearTimeout(self._waitFlashAutoLoadTimeid);
	if(!self._self)
		return;
	promptwindow && promptwindow.handleFocus();
	self.isShow = false;
	if(self._flash){
		if(self._flash.asIM_closeIMBuddyList){
			self._flash.asIM_closeIMBuddyList();
		}
		if(self._flash){
			try{
				NtUtil.disposeFlashObj(self._flash);
				$$D.css(self._flash, "display", "none");
				self._flash.parentNode.removeChild(self._flash);
			}catch(e){}
		}
	}
	if(Ntalker.temp.buddylistFlashGoUrl){
		$$C.load({src:Ntalker.temp.buddylistFlashGoUrl});
		Ntalker.temp.buddylistFlashGoUrl = null;
	}
	self._self.parentNode.removeChild(self._self);
	delete self._self;
	if(_V['buddylistTag']){
		_V['buddylistTag'].style.display = "none";
	}
	$$C.load({tagName:'img', href:Ntalker.Config.services + '/func/statistic.php?', 
		params:{
			siteid: _V['siteid'],
			uid: _V['user_id'],
			type: 7,
			desc: encodeURIComponent(NtLang['sd_eventClose'] + NtLang['sd_Buddylist']),
			rnd: new Date().getTime()
		}, width:1,height:1
	});
};
_p.showWindow = function(){
	var _C  = Ntalker.Config,
		_CP = Ntalker.Config.customparams,
		_V = Ntalker.variable;
	if(_V['user_id']==0 || !_V['user_id']){
		alert(NtLang.notLogin);return;
	}
	if( this.isShow ){
		return;
	}
	this.isShow = true;
	if(this._self == null){
		this.createWin(Ntalker.Config.IMtabIndex);
	}
	else{
		debug('IMWindow.showWindow:: flash visible');
		if(this._self) this._self.style.visibility = "visible";
		if(this._flash) this._flash.style.visibility = "visible";
		IM_BuddyListDOM = $$O("wdk_buddylist_flash");
		if(IM_BuddyListDOM && IM_BuddyListDOM.switchTabIndex)
			IM_BuddyListDOM.switchTabIndex(Ntalker.Config.IMtabIndex);
	}
	if(NotifyManager) {
		NotifyManager.clearonline("online");
	}
	$$C.load({tagName:'img', href:Ntalker.Config.services + '/func/statistic.php?', 
		params:{
			siteid: _V['siteid'],
			uid: _V['user_id'],
			type: 6,
			desc: encodeURIComponent(NtLang['sd_eventClose'] + NtLang['sd_Buddylist']),
			rnd: new Date().getTime()
		}, width:1,height:1
	});
};
_p.OnTBShowBuddylist =function(){
	var self = this;
	if(self.created){
		if(self._self) self._self.style.visibility = "visible";
		if(self._flash) self._flash.style.visibility = "visible";
		self.isShow = true;
		debug('IMWindow.OnTBShowBuddylist:: flash visible');
		IM_BuddyListDOM = self._flash;
		if(IM_BuddyListDOM && IM_BuddyListDOM.switchTabIndex)
			IM_BuddyListDOM.switchTabIndex(Ntalker.Config.IMtabIndex);
	}else{
		debug('IMWindow.OnTBShowBuddylist::showWindow(true)');
		self.showWindow(true);
	}
};
Ntalker.ntGroupWindow = function(destuid, destnick, chatid, layoutmode, chatType, roomtype, OpenType, userinfo, befrom){
	this._destuid = destuid;
	this._destnick = destnick;
	this._chatType = /^(chat|room|group|nquan|traing)$/.test(chatType) ? chatType : "chat";
	this._roomType = roomtype ? 1 : 0;
	this._openType = OpenType;
	this._userInfo = userinfo;
	this._befrom = befrom;
	this._window = window;
	this._doc = this._window.document;
	this._self = null;
	this._selfid = "webchat_window"+destuid+this._chatType;
	this._titleid = "webchat_title"+destuid+this._chatType;
	this._headerid = "webchat_header"+destuid+this._chatType;
	this._width  = (/^(room|group|nquan|traing)$/.test(this._chatType) ? Ntalker.Config.groupWidth : Ntalker.Config.chatWidth);
	this._height = (/^(room|group|nquan|traing)$/.test(this._chatType) ? Ntalker.Config.groupHeight : Ntalker.Config.chatHeight);
	this._titleHeight = 0;  
	this._borderWidth = 0;  
	this._flashHeight = null;
	this._isFlashTitle = false;
	this._flashID = "webchat_flash"+destuid+this._chatType;
	this._flash = null;
	this._flashContainerID = "webchat_container"+destuid+this._chatType;
	this._infoTextSpanID = "infoTextSpan" + destuid + this._chatType;
	this._flashcontainer = '';
	this._jsURLPath = Ntalker.variable.scriptPath;
	this.m_funcURLPath = Ntalker.Config.services;
	this._presenceFlashGoUrl = null; 
	this._freeChatFlashGoUrl = null; 
	this._defaultZIndex = -9;
	this._focusZIndex = -1;
	this._curWindMode = "default"; 
	this._flashTitleTimerID = null;
	this._iframe = null;
	this._top = 0;
	this._bottom = 0;
	this._left = 0; 
	this._right = 0; 
	this._chatid = chatid ? chatid:null;
	this.isInited = false;
	this._isFlashLoadSuccess = false;
	this._flashLoadTime = 30000; 
	this._waitFlashAutoLoad = 5000; 
	this._FlashReloadCount = 0;
	this._flashFailedDiv = null;
	this._checkFlashTimerid = null;
	this._waitFlashAutoLoadTimeid = null;
	this._loadFlashTestTimeid = null;
};
_p = Ntalker.ntGroupWindow.prototype;
_p.showWindow = function(offset, miniWinTabDOM){
	if(this.isInited) return;
	var cacheDom = document.createDocumentFragment();
	this.isInited = true;
	var wRt = $$D.windowRect();
	var _C  = Ntalker.Config,
		_CP = Ntalker.Config.customparams, 
		_V  = Ntalker.variable;
	this._self = $$D.create('div', {style:'background:#fafafa;'}, cacheDom);
	this._self.style.position = "absolute";
	this._self.style.outlineStyle = "none";
	this._left = offset.left;
	this._top = 0 - this._height - offset.bottom;
	this._self.style.left = this._left + "px";
	this._self.style.top  = this._top + "px";
	this._self._ptr = this;
	this._self.style.zIndex = this._defaultZIndex;
	this._self.style.width = this._width+"px";
	this._self.style.height = this._height+"px";
	this._self.tabIndex = parseInt(this._destuid);
	var titleWidth,popBtnLeft,minBtnLeft,closeBtnLeft;
	this._titleText = sprintf(NtLang['minWindowTitle'], this._destnick);
	titleWidth	= this._width; 
	minBtnLeft	= titleWidth - 39;
	closeBtnLeft  = titleWidth - 21;
	var bWidth = this._borderWidth;
	var flashWidth = this._width - this._borderWidth*2;
	var flashHeight = this._height - this._borderWidth*2;
	var infoTextSpanStyle = 'display:'+(_CP['enableJavaScriptLoading'] ? 'block' : 'none')+';'
	var sb = [];
	sb.push("<div id='" + this._flashContainerID + "' style='overflow:hidden; width:"+flashWidth+"px;height:"+flashHeight+"px;'>");
	sb.push(	"<div id='" + this._infoTextSpanID + "' style='"+infoTextSpanStyle+"cursor:auto;width:"+flashWidth+"px;height:"+flashHeight+"px;line-height:" + flashHeight + "px;background:#EDF5F0 url(" + _C['publicDIR'] + "/loading.gif) no-repeat center center;text-align:center;border:0px solid "+_C['bColor']+"'></div>");	sb.push(	"<div id='" + this._flashID + "'></div>");
	sb.push("</div>");
	this._self.innerHTML = sb.join("");
	debug('ntGroupWindow.showWindow::infoTextSpanStyle='+infoTextSpanStyle);
	delete sb;
	(miniWinTabDOM || document.body).appendChild(cacheDom);
	this._flashcontainer = this._doc.getElementById(this._flashContainerID);
	this.createFlash();
	function __clearClick(e){$$E.fixEvent(e).stopPropagation();};
	this._self.onclick = __clearClick;
	this.resize(this._width, this._height);
};
_p.moveTo = function(x, y, isSavePos, curHeight){
	var wRt = $$D.windowRect();
	if( isNaN(x) || isNaN(y) )
		return;
	if(isSavePos){
			this._left   = x - wRt.x;
			this._top	= y - wRt.y;
			this._right  = wRt.x + wRt.w - x - this._width;
			this._bottom = wRt.y + wRt.h - y - ($$S.isDefined(curHeight) ? curHeight : this._height);
	}
	if($$B.msie){
		this._self.style.pixelLeft = x;
		if($$B.ie6)
			this._self.style.pixelTop  = y;
		else
			this._self.style.bottom  = this._bottom + "px";
	}else{
		this._self.style.left = x + "px";
		this._self.style.bottom  = this._bottom + "px";
	}
};
_p.resize = function(w, h){
	this._width = w;
	this._height = h;
	this._self.style.width  = w + "px";
	this._self.style.height = h + "px";
	if(this._flash){
		this.setFlashStyle();
	}
};
_p.hide = function(){
	if(this._curWindMode=='default')
		this.MinMax();
};
_p.show = function(offsetLeft, offsetTop){
	if(this._curWindMode=='hide'){
		this.MinMax();
		if(offsetLeft && offsetTop){
			var wRt = $$D.windowRect();
			this.moveTo(wRt.x + offsetLeft, wRt.y + (offsetTop-this._height) );
		}
	}
};
_p.MinMax = function(){
	var visiblestyle, displaystyle;
	var _C = Ntalker.Config,
		_CP= Ntalker.Config.customparams;
	switch(this._curWindMode){
	case "default":
		visiblestyle = "hidden";
		displaystyle = "none";
		this._curWindMode = "hide";
		this._flashcontainer.style.width = "1px";
		this._flashcontainer.style.height = "1px";
		this._flash.style.width = "1px";
		this._flash.style.height = "1px";
		this._self.style.height = this._titleHeight + "px";
		if(IMToolBar){
			var minWin = IMToolBar.get(this._destuid, this._chatType);
			if(minWin) minWin.onBlur();
		}
		this.moveTo(-2000, 0);
		break;
	case "hide":
		visiblestyle = "visible";
		displaystyle = "block";
		this._curWindMode = "default";
		this._self.style.width = this._width + "px";
		this._self.style.height = this._height+"px";
		this._flash.style.height = this._flashHeight;
		this.resize(this._width, this._height);
		var _r   = NtUtil.scrollWidth();
		var wRt = $$D.windowRect();
		var tRt = $$D.clientRect(IMToolBar.contentElement);
		var x = this._left,y = this._top;
		var minWin = IMToolBar.get(this._destuid, this._chatType);
		var mRt = minWin.onFocus();
		if( /0|1/.test(IMToolBar.currentToolbarMode) ){
			x = mRt.x + IMToolBar.AreaElement.scrollLeft;
			x = x < 21 ? 21 : x;
			x = Math.min(x, tRt.w - this._width - _C['IMWidth'] - 10);
		}else{
			x = mRt.x + mRt.w - this._width;
			if($$D.rect($$O('ntalkerbar-wrapper')).left<this._width){
		   		if(x<0){
					x = Math.max(x,-1*$$D.rect($$O('ntalkerbar-wrapper')).left);
					if($$B.chrome) x+=20;
				}
			}
		}
		debug('ntGroupWindow moveTo X=' + x);
		if($$B.QuirksModel){
			y = mRt.y-this._height + 5;
		}else{
			y = 0-this._height;
		}
		this.moveTo(x, y);
		break;
	default:
		visiblestyle = "visible";
		this._curWindMode = "default";
		break;
	}
};
_p.close = function(){
	clearTimeout(self._waitFlashAutoLoadTimeid);
	$$D.css(this._self, "display", "none");
	this._flash = $$O(this._flashID);
	if(this._checkFlashTimerid){
		clearTimeout(this._checkFlashTimerid);
	}
	if(this._flash){
		if(this._flash.asIM_closeChatWindow)
		   this._flash.asIM_closeChatWindow();		NtUtil.disposeFlashObj(this._flash);
		$$D.css(this._flash, "display", "none");
		this._flash.parentNode.removeChild(this._flash);
		delete this._flash;
	}
	if(this._freeChatFlashGoUrl != null && this._freeChatFlashGoUrl != ''){
		$$C.load({src:this._freeChatFlashGoUrl});
	}
	if(this._presenceFlashGoUrl != null && this._presenceFlashGoUrl != ''){
	   $$C.load({src:this._presenceFlashGoUrl});
	}
	chatWindowManager.removeChatWindow(this._destuid, this._chatType);
	this._self.parentNode.removeChild(this._self);
	delete this._self;
	if(IMToolBar){
		IMToolBar.remove(this._destuid, this._chatType);
	}
	$$O('NtFocusElement') && $$O('NtFocusElement').focus();
	var _V = Ntalker.variable, type, desc;
	if( parseInt(_V['onlineChat']) < 10 ){
		_V['onlineChat'] += 1;
	}else{
		_V['onlineChat'] = 10;
	}
	switch(this._chatType){
		case "group":
		case "room":
			type=3;desc=NtLang['sd_closeGroupWindow'];break;
		case "nquan":
			type=16;
			desc=NtLang['sd_closeNQuanWindow'];
			break;
		default:type=1;desc=NtLang['sd_closeChatWindow'];break;
	};
	$$C.load({tagName:'img', href: Ntalker.Config.services + '/func/statistic.php?', 
		params:{
			siteid: _V['siteid'],
			uid: _V['user_id'],
			destid: /^(room|group|nquan|traing)$/.test(this._chatType) ? 0 : this._destuid,
			groupid: /^(room|group|nquan|traing)$/.test(this._chatType) ? this._destuid : 0,
			type: type,
			desc: encodeURIComponent(desc),
			from: this._befrom,
			rnd: new Date().getTime()
		}, width:1,height:1
	});
};
_p.createFlash = function(){
	if(!this._flashcontainer)
		return;
	var swfSrc,
		_V = Ntalker.variable, 
		_C = Ntalker.Config,
		_CP= Ntalker.Config.customparams;
	swfSrc = this._jsURLPath + "/fs/NtalkerWebMessager.swf";
	var flashvars = {
					   pageId: Ntalker.temp.pageId,
					   r : this._jsURLPath,   
					   su: this.m_funcURLPath,
					   k : _C['skin'],
					   t : encodeURIComponent(_V['siteid']),
					   s : encodeURIComponent(_V['user_sid']),
					   u : encodeURIComponent(_V['user_id']),
					   n : encodeURIComponent(_V['user_name']),
					   d : encodeURIComponent(this._destuid),
					   dn: encodeURIComponent(this._destnick),
					   m : 0,
					   localeChain: _CP['localeChain'],
					   ot: this._openType,
					   ct: this._chatType,
					   lst:_CP['lstupdated']
					};
	switch(this._chatType){
		case "chat":
			flashvars.modname = "ChatMod";
			flashvars.l  = _C['chatlogo'] || ""; 
			flashvars.v  = Ntalker.version.webchat_flash;
			if( this._userInfo ) flashvars.info = this._userInfo;
			break;
		case "group":
		case "room":
			flashvars.modname = "GroupMod";
			flashvars.l  = _C['grouplogo'] || "";					
			flashvars.v  = Ntalker.version.group_flash;			  
			if( _CP['imversion']=='2.0' && _CP.softwaretype.toLowerCase()=='phpwind' ) flashvars.iv = 'pw2.0';
			break;
		case "nquan":
			flashvars.modname = "NQuanMod";
			flashvars.l  = _C['nquanlogo'] || "";					 
			flashvars.v  = Ntalker.version.nquan_flash;			   
			flashvars.befrom = this._befrom;
			if(_V['activityid']&&_V['activitytype']){
				flashvars.activitytype=_V['activitytype'];
				flashvars.activityid=_V['activityid'];
			}
			break;
		case "traing":
			swfSrc = this._jsURLPath+"/fs/TraingMod.swf?version=" + Ntalker.version.traing_flash;
			flashvars.v  = Ntalker.version.traing_flash;
			break;
	} 
	if(_V['userparam'])
		flashvars.p = encodeURIComponent(_V['userparam']);
	if(_C['chatlogo'] && _CP['siteurl'])
		flashvars.f = _CP['siteurl'].toLowerCase().replace("http://","");
	else
		flashvars.f = encodeURIComponent(window.location.host);
	if(this._chatid) 
		flashvars.chatid	= this._chatid;
	if(_CP['previewsiteid']){
		flashvars.previewsiteid = _CP['previewsiteid'];
	}
	if(flashvars.toJSONString)
		delete flashvars.toJSONString;
	var flashmode = $$B.ie?"Opaque":"Window";
	var flashmode = "Window";
	var params = {menu:"true", "salign":"LT", "allowScriptAccess":"always", "wmode":flashmode, "allowFullScreen": true};
	var attributes = {};
	var flashWidth = this._width - this._borderWidth*2;
	var flashHeight = this._height - this._borderWidth*2;
	if( parseInt(NtUtil.Flash.getPlayerVersion().major) < 9 ){
		$$D.css(this._flash, 'display', 'none');
		$$D.css($$O(this._infoTextSpanID), 'background', 'none');
		$$O(this._infoTextSpanID).innerHTML = '<a href="http://www.adobe.com/go/getflashplayer" target="_blank">' + NtLang['noInstallFlash'] + '</a>';
		return;
	}else{
		ntalker_swfobject.embedSWF(swfSrc, this._flashID, flashWidth, flashHeight,  "9.0.115", _V['scriptPath']+"/fs/expressInstall.swf", flashvars, params, attributes);		var self = this;
		this._loadFlashTestTimeid = setTimeout(function(){
			self.LoadFailure();
			debug('ntGroupWindow.createFlash::Not in time='+self._flashLoadTime);
			self._flashLoadTime = self._flashLoadTime*2; 
		}, self._flashLoadTime);
	}
	this._flash = $$O(this._flashID);
	if( !_CP['enableJavaScriptLoading'] ){
		this.setFlashStyle();
	}else if( !$$B.ie6 && !$$B.opera ){
		this.setFlashStyle();
	}
};
_p.setFlashStyle = function(){
	this._flashcontainer.style.position = "absolute";
	this._flashcontainer.style.top	  = this._titleHeight+"px";
	this._flashcontainer.style.left	 = "0px";
	this._flashcontainer.style.width	= this._width+"px";
	this._flashcontainer.style.height   = (this._height-this._titleHeight - this._borderWidth)+"px";
	this._flashcontainer.style.overflow = "hidden";
	var flashWidth = this._width - this._borderWidth*2;
	var flashHeight = this._height - this._borderWidth*2;
	if(this._flash){
		this._flash.style.position = "relative";
		this._flash.style.width  = flashWidth + "px";
		this._flash.style.height = flashHeight + "px";
		this._flash.style.left   = this._borderWidth + "px";
		this._flash.style.top	= "0px";
		this._flashHeight		= this._flash.style.height;
	}
};
_p.restoreFlash = function(){
	if(this._flashFailedDiv){
	   this._flashcontainer.removeChild(this._flashFailedDiv);
	   delete this._flashFailedDiv;
	}
	this._flash = this._restoreFlash;
	this.resize(this._width, this._height);
	this._flash.focus();
};
_p.reloadFlash = function(){
	var _C = Ntalker.Config,
		_CP = Ntalker.Config.customparams;
	if(this._restoreFlash){
		delete this._restoreFlash;
	}
	this._flash = null;
	var _Ht = [];
	var flashWidth = this._width - 2 * this.borderWidth;
	var flashHeight = this._height - 2 * this.borderWidth;
	var infoTextSpanStyle = 'display:'+(_CP['enableJavaScriptLoading'] ? 'block' : 'none')+';'
	_Ht.push("<div id='" + this._infoTextSpanID + "' style='"+infoTextSpanStyle+"cursor:auto;width:"+flashWidth+"px;height:"+flashHeight+"px;line-height:" + flashHeight + "px;background:#EDF5F0 url(" + _C['publicDIR'] + "/loading.gif) no-repeat center center;text-align:center;border:0px solid "+_C['bColor']+"'></div>");
	_Ht.push("<div id='" + this._flashID + "' style=''></div>");
	this._flashcontainer.innerHTML = _Ht.join('');
	debug('ntGroupWindow.reloadFlash::infoTextSpanStyle='+infoTextSpanStyle);
	if(this._waitFlashAutoLoadTimeid) clearTimeout(this._waitFlashAutoLoadTimeid);
	this.createFlash();
	this.setFlashStyle();
};
_p.LoadFailure = function(){
	var _V = Ntalker.variable, _C = Ntalker.Config, _CP = Ntalker.Config.customparams;
	if(this._isFlashLoadSuccess){
		return;
	}
	var self = this;
	this._restoreFlash = this._flash;
	var flashWidth = this._width - 2*this._borderWidth;
	var flashHeight = this._height - this._titleHeight;
	if(self._flash){
		$$D.css(this._flash, "display", "none");
		try{
			this._flash.parentNode.removeChild(this._flash);
		}catch(e){
			this._flash.style.width = 1 + 'px';
			this._flash.style.height = 1 + 'px';
		}
	}
	var closeButtonId = 'CloseIMWindowButton';
	var reLoadButtonId = 'reLoadFlashButton';
	if( _CP['enableJavaScriptLoading'] ){
		$$D.css($$O(this._infoTextSpanID), 'backgroundImage', 'none');
		$$D.css($$O(this._infoTextSpanID), 'display', 'block');
		debug('ntGroupWindow.LoadFailure:: infoTextSpan backgroundImage:none;display:block;');
	}
	var _Ht = [];
	_Ht.push('<div>');
	_Ht.push(	'<div name="winlogo" style="float:left;width:70px;height:20px;background:url(' + _C['logo'] + ') center center no-repeat;"></div>');
	_Ht.push(	'<div name="wintitle" style="float:left;width:280px;height:20px;background:url(' + _C['publicDIR'] + 'titleText.gif) center center no-repeat;"></div>');
	_Ht.push(	'<div id="'+closeButtonId+'" name="btnclose" style="z-index:12;float:right;margin-right:8px;width:26px;height:20px;background:url('+_C['publicDIR'] + 'closewin.gif) center top no-repeat;cursor:pointer;"></div>');
	_Ht.push('</div>');
	_Ht.push('<div style="text-align:center;clear:both;height:' + (flashHeight-20) + 'px;line-height:' + (flashHeight-20) + 'px;">');
	_Ht.push(	'<a id="'+reLoadButtonId+'" href="javascript:void(0)">' + NtLang['loadFlashFailure'] + '</a>');
	_Ht.push('</div>');
	if( $$O(this._infoTextSpanID) ) $$D.insert($$O(this._infoTextSpanID), _Ht.join(''));
	var self = this;
	var __clearClick  = function(e){$$E.fixEvent(e).stopPropagation();};
	var __closeWaitWin = function(e){self.close();};
	var __reloadFlash = function(){
		clearTimeout(self._waitFlashAutoLoadTimeid);
		self.reloadFlash();
		debug('ntGroupWindow.LoadFailure::Waiting time='+self._waitFlashAutoLoadTimeid);
	};
	if(this._FlashReloadCount < 2 && !this._isFlashLoadSuccess){
		debug('ntGroupWindow.LoadFailure _waitFlashAutoLoad=' + this._waitFlashAutoLoad);
		this._waitFlashAutoLoadTimeid = setTimeout( __reloadFlash, this._waitFlashAutoLoad);
	}
	if( $$O(this._infoTextSpanID) ) $$O(this._infoTextSpanID).onclick = __clearClick;
	if( $$O(closeButtonId) ) $$O(closeButtonId).onclick = __closeWaitWin;
	if( $$O(reLoadButtonId) ) $$O(reLoadButtonId).onclick = __reloadFlash;
};
_p.onFlashLoadSuccess = function(){
	var _CP = Ntalker.Config.customparams;
	this._isFlashLoadSuccess = true;
	clearTimeout(this._loadFlashTestTimeid);
	if( _CP['enableJavaScriptLoading'] ){
		$$D.css($$O(this._infoTextSpanID), 'display', 'none');
		if( this._curWindMode == 'default' ){
			this.setFlashStyle();
		}
	}
   	debug('ntGroupWindow.onFlashLoadSuccess:: display:none;setFlashStyle');
};
_p.refreshFlashPos = function(){
	if(!this._flash || this._curWindMode=="min")
		return;
	var moveOffset = -1;
	if(this._isMoveLeft){
		moveOffset = 1;
		this._isMoveLeft = false;
	}
	else{
		moveOffset = -1;
		this._isMoveLeft = true;
	}
	this._flash.style.zIndex = parseInt($$D.css(this._flash, 'z-index')) + moveOffset;
};
_p.onFocus = function(){
	var _V = Ntalker.variable;
	this._self.style.zIndex = this._focusZIndex;
	this._flashcontainer.style.zIndex = this._focusZIndex;
	this._flash.style.zIndex = this._focusZIndex;
	try{
		this._flash.focus();
	}catch(e){}
	if( this._chatType == 'nquan' ){
		showDiv(this._chatType + '_' + this._destuid);
	}	chatWindowManager.focusWindow(this._destuid, this._chatType);
};
_p.onBlur = function(){
	this._self.style.zIndex = this._defaultZIndex;
	this._flashcontainer.style.zIndex = this._defaultZIndex;
	this._flash.style.zIndex = this._defaultZIndex;
	this._flash.style.visibility = "hidden";
	this._flash.style.visibility = "visible";
};
_p.onReceiveMessage = function(message){
	if(this._curWindMode=="min" || this._curWindMode=="hide"){
		var titleText = sprintf(NtLang['receiveMessageTitle'], this._destnick, message);
		if(IMToolBar){
			var miniWindow = IMToolBar.get(this._destuid, this._chatType);
			miniWindow.onReceiveMiniMessage(message);
		}
		var impresenceflash = $$O('impresenceflash');
		if(impresenceflash && impresenceflash.playNotifySound){
			impresenceflash.playNotifySound();
		}
	}
};
_p.onPresenceReceiveChatMsg = function(message){
	if(this._flash && this._flash.presenceReceiveChatMsg)
		this._flash.presenceReceiveChatMsg(message);
};
Ntalker.ntChatWindow = function(destuid, destnick, chatid, layoutmode, chatType, roomtype, OpenType, userinfo, befrom){
	this._destuid = destuid;
	this._destnick = destnick;
	this._chatType = /^(chat|room|group|nquan)$/.test(chatType) ? chatType : 'chat';
	this._roomType = roomtype ? 1 : 0;
	this._openType = OpenType;
	this._userInfo = userinfo;
	this._befrom = befrom;
	this._window = window;
	this._doc = this._window.document;
	this._selfId = "webchat_window"+destuid+this._chatType;
	this._titleId = "webchat_title"+destuid+this._chatType;
	this._flashID = "webchat_flash"+destuid+this._chatType;
	this._flashContainerID = "webchat_container"+destuid+this._chatType;
	this._infoTextSpanID = "infoTextSpan" + destuid + this._chatType;
	this._width  = (/^(room|group|nquan)$/.test(this._chatType) ? Ntalker.Config.groupWidth : Ntalker.Config.chatWidth);
	this._height = (/^(room|group|nquan)$/.test(this._chatType) ? Ntalker.Config.groupHeight : Ntalker.Config.chatHeight);
	this._titleHeight = 0;  
	this._borderWidth = 0;  
	this._flashWidth = this._width - this._borderWidth*2;
	this._flashHeight = this._height - this._borderWidth*2 - this._titleHeight;
	this._isFlashTitle = false;
	this._self = null;
	this._flash = null;
	this._flashcontainer = null;
	this._jsURLPath = Ntalker.variable.scriptPath;
	this._funcURLPath = Ntalker.Config.services;
	this._presenceFlashGoUrl = null;
	this._freeChatFlashGoUrl = null;
	this._defaultZIndex = -9;
	this._focusZIndex = -1;
	this._curWindMode = "default"; 
	this._flashTitleTimerID = null;
	this._top = 0;
	this._bottom = 0;
	this._left = 0; 
	this._right = 0; 
	this._chatid = chatid ? chatid:null;
	this.isInited = false;
	this._isFlashLoadSuccess = false;
	this._flashLoadTime = 30000; 
	this._waitFlashAutoLoad = 5000; 
	this._FlashReloadCount = 0;
	this._flashFailedDiv = null; 
	this._checkFlashTimerid = null;
	this._waitFlashAutoLoadTimeid = null;
};
_p = Ntalker.ntChatWindow.prototype;
_p.showWindow = function(offset, miniTagElement){
	var _C  = Ntalker.Config,
		_CP = Ntalker.Config.customparams, 
		_V  = Ntalker.variable;
	if(this.isInited){
		return;
	}
	this.isInited = true;
	var cacheDom = document.createDocumentFragment();
	var position = 'absolute';
	this._left = offset.left || 0;
	this._self = $$D.create('div', {
		style:'width:'+this._width+'px;height:'+this._height+'px;position:'+position+';bottom:0px;left:'+this._left+'px;outlineStyle:none;zIndex:'+this._defaultZIndex+';background:#fafafa;'
	}, cacheDom);
	this._titleText = this._chatType!='chat' ? this._destnick : sprintf(NtLang['minWindowTitle'], this._destnick);
	var sb = [];
	sb.push("<div id='" + this._flashContainerID + "' style='position:absolute;left:" + this._borderWidth + "px;top:"+(this._borderWidth+this._titleHeight)+"px;overflow:hidden; width:"+this._flashWidth+"px;height:"+this._flashHeight+"px;'>");
	sb.push(	"<div id='" + this._infoTextSpanID + "' style='cursor:auto;width:"+this._flashWidth+"px;height:"+this._flashHeight+"px;line-height:" + this._flashHeight + "px;background:url(" + _C['publicDIR'] + "/loading.gif) no-repeat center center;text-align:center;'></div>");	sb.push(	"<div id='" + this._flashID + "'></div>");
	sb.push("</div>");
	this._self.innerHTML = sb.join("");
	delete sb;
	(miniTagElement || document.body).appendChild(cacheDom);
	this._flashcontainer = $$O(this._flashContainerID);
	this.createFlash();
	var self = this;
	function __clearClick(e){$$E.fixEvent(e).stopPropagation();};
	this._self.onclick = __clearClick;
	this.resize(this._width, this._height);
};
_p.moveTo = function(x, y, animate){
	if( animate ){
		if( $$B.ie6 ){
			$$D.animate(this._self, {left:x,top:y});
		}else{
			$$D.animate(this._self, {left:x,bottom:this._bottom});
		}
	}else{
		$$D.css(this._self, 'left', x+'px');
		if( $$B.ie6 ){
			$$D.css(this._self, 'top', y+'px');
		}else{
			$$D.css(this._self, 'bottom', this._bottom+'px');
		}
	}
};
_p.resize = function(w, h){
	this._width = w;
	this._height = h;
	$$D.css(this._self, 'width', w+'px');
	$$D.css(this._self, 'height', h+'px');
	if(this._flash){
		this.setFlashStyle();
	}
};
_p.hide = function(){
	if(this._curWindMode=='default')
		this.MinMax();
};
_p.show = function(offsetLeft, offsetTop){
	if(this._curWindMode=='hide'){
		this.MinMax();
		if(offsetLeft && offsetTop){
			var wRt = $$D.windowRect();
			this.moveTo(wRt.x + offsetLeft, wRt.y + (offsetTop-this._height) );
		}
	}
};
_p.MinMax = function(){
	var wRt = $$D.windowRect();
	var visiblestyle, displaystyle;
	var _C = Ntalker.Config
		_CP= Ntalker.Config.customparams;
	switch(this._curWindMode){
	case "default":
		visiblestyle = "hidden";
		displaystyle = "none";
		this._curWindMode = "hide";
		this._flashcontainer.style.width = "1px";
		this._flashcontainer.style.height = "1px";
		this._flash.style.width = "1px";
		this._flash.style.height = "1px";
		this._self.style.height = this._titleHeight + "px";
		this.moveTo(-2000, 0);
		break;
	case "hide":
		visiblestyle = "visible";
		displaystyle = "block";
		this._curWindMode = "default";
		this._self.style.width = this._width + "px";
		this._self.style.height = this._height+"px";
		this._flash.style.height = this._flashHeight;
		this.resize(this._width, this._height);
		var _r   = NtUtil.scrollWidth();
		var x = this._left,y = this._top;
		var tRt = $$D.clientRect(IMToolBar.contentElement);
		var minWin = IMToolBar.get(arguments[0]||this._destuid, arguments[1]||this._chatType);
		if(!minWin) return;
		var mRt = minWin.getPost();
		if( /0|1/.test(IMToolBar.currentToolbarMode) ){
			x = Math.min(mRt.x + IMToolBar.AreaElement.scrollLeft, tRt.w - this._width - _C['IMWidth'] - 10);
		}else{
			x = mRt.w + mRt.x - this._width;			var tLeft = wRt.w - tRt.w - 40;
			x = tLeft + x  < 0 ? (0 - tLeft) : x;
		}
		if($$B.QuirksModel){
			y = mRt.y-this._height + 5;
		}else{
			y = 0-this._height;
		}
		this.moveTo(x, y);
		break;
	default:
		visiblestyle = "visible";
		this._curWindMode = "default";
		break;
	}
};
_p.switchChatWindow = function(arrayParam){
	this._flash = $$O(this._flashID);
	if(this._flash){
		debug('tagName='+this._flash.tagName+', id='+this._flash.id+' | '+this._flashID);
		try{
			if( this._flash.switchChatWindow ){
				debug('switchChatWindow');
				this._flash.switchChatWindow(arrayParam);
			}
		}catch(e){
		}
	}
};
_p.close = function(destuid, chatType){
	var _V   = Ntalker.variable;
	if( parseInt(_V['onlineChat']) < 10 ){
		_V['onlineChat'] += 1;
	}else{
		_V['onlineChat'] = 10;
	}
	if(this._flash && this._flash.closeChatWindow){
		this._flash.closeChatWindow(destuid);
		debug('closeChatWindow('+destuid+')');
	}
	var tagWindowCount = IMToolBar.getTagCount('chat');
	if( tagWindowCount>1 ){
		IMToolBar.remove(destuid || this._destuid, chatType || this._chatType);
		return;
	}
	chatWindowManager.removeChatWindow(this._destuid, this._chatType);
	this._flash = $$O(this._flashID);
	if(this._checkFlashTimerid){
		clearTimeout(this._checkFlashTimerid);
	}
	if(this._flash){
		if(this._flash.asIM_closeChatWindow)
		   this._flash.asIM_closeChatWindow();
		NtUtil.disposeFlashObj(this._flash);
		$$D.css(this._flash, "display", "none");
		this._flash.parentNode.removeChild(this._flash);
		delete this._flash;
	}
	IMToolBar.remove(destuid || this._destuid, chatType || this._chatType);
	if( !this._self ){
		return;
	}
	$$D.css(this._self, "display", "none");
	this._self.parentNode.removeChild(this._self);
	delete this._self;
	if(this._freeChatFlashGoUrl != null && this._freeChatFlashGoUrl != ''){
		$$C.load({src: this._freeChatFlashGoUrl});
	}
	if(this._presenceFlashGoUrl != null && this._presenceFlashGoUrl != ''){
	   $$C.load({src: this._presenceFlashGoUrl});
	}
	var type, from, desc; 
	switch(this._chatType){
		case "group":
		case "room":
			type=3;desc=NtLang['sd_closeGroupWindow'];break;
		case "nquan":
			type=16;
			desc=NtLang['sd_closeNQuanWindow'];
			from = this._befrom;
			break;
		default:type=1;desc=NtLang['sd_closeChatWindow'];
	};
	$$C.load({tagName:'img', href:Ntalker.Config.services + '/func/statistic.php?', 
		params:{
			siteid: _V['siteid'],
			uid: _V['user_id'],
			destid: /^(room|group|nquan|traing)$/.test(this._chatType) ? 0 : this._destuid,
			groupid: /^(room|group|nquan|traing)$/.test(this._chatType) ? this._destuid : 0,
			type: type,
			desc: encodeURIComponent(desc),
			from: from,
			rnd: new Date().getTime()
		}, width:1,height:1
	});
};
_p.createFlash = function(){
	if(!this._flashcontainer)
		return;
	var _V = Ntalker.variable, _C = Ntalker.Config, _CP= Ntalker.Config.customparams;
	var swfSrc = this._jsURLPath + '/fs/NtalkerWebMessager.swf';
	var flashvars = {v : Ntalker.version.webchat_flash,
					   pageId: Ntalker.temp.pageId,
					   r : this._jsURLPath,   
					   su: this._funcURLPath,
					   k : _C['skin'],
					   t : encodeURIComponent(_V['siteid']),
					   s : encodeURIComponent(_V['user_sid']),
					   u : encodeURIComponent(_V['user_id']),
					   n : encodeURIComponent(_V['user_name']),
					   d : encodeURIComponent(this._destuid),
					   dn: encodeURIComponent(this._destnick),
					   m :0, 
					   localeChain: _CP['localeChain'],
					   ot: this._openType,
					   ct: this._chatType,
					   lst:_CP['lstupdated']
					};
	switch(this._chatType){
		case "chat":
			flashvars.modname = "ChatMod";
			flashvars.l  = _C['chatlogo'] || ""; 
			flashvars.v  = Ntalker.version.webchat_flash;
			if( this._userInfo ) flashvars.info = this._userInfo;
			break;
		case "group":
		case "room":
			flashvars.modname = "GroupMod";
			flashvars.l  = _C['grouplogo'] || "";					
			flashvars.v  = Ntalker.version.group_flash;			  
			if( _CP['imversion']=='2.0' && _CP.softwaretype.toLowerCase()=='phpwind' ) flashvars.iv = 'pw2.0';
			break;
		case "nquan":
			flashvars.modname = "NQuanMod";
			flashvars.l  = _C['nquanlogo'] || "";					 
			flashvars.v  = Ntalker.version.nquan_flash;			   
			flashvars.befrom = this._befrom;
			if(_V['activityid']&&_V['activitytype']){
				flashvars.activitytype=_V['activitytype'];
				flashvars.activityid=_V['activityid'];
			}
			break;
	} 
	if(_V['userparam'])
		flashvars.p = encodeURIComponent(_V['userparam']);
	if(_C['chatlogo'] && _CP['siteurl'])
		flashvars.f = _CP['siteurl'].toLowerCase().replace("http://","");
	else
		flashvars.f = encodeURIComponent(window.location.host);
	if(this._chatid) 
		flashvars.chatid = this._chatid;
	if(_CP['previewsiteid']){
		flashvars.previewsiteid = _CP['previewsiteid'];
	}
	if(flashvars.toJSONString)
		delete flashvars.toJSONString;
	var flashmode = "Window";
	var params = {menu:"true", "salign":"LT", "allowScriptAccess":"always", "wmode":flashmode, "allowFullScreen": true};
	var attributes = {};
	if( parseInt(NtUtil.Flash.getPlayerVersion().major) < 9 ){
		$$D.css(this._flash, 'display', 'none');
		$$D.css($$O(this._infoTextSpanID), 'background', 'none');
		$$O(this._infoTextSpanID).innerHTML = '<a href="http://www.adobe.com/go/getflashplayer" target="_blank">' + NtLang['noInstallFlash'] + '</a>';
		return;
	}else{
		ntalker_swfobject.embedSWF(swfSrc, this._flashID, this._flashWidth, this._flashHeight,  "9.0.115", _V['scriptPath']+"/fs/expressInstall.swf", flashvars, params, attributes);		this._flash = $$O(this._flashID);
		var self = this;
		setTimeout(function(){self.LoadFailure();}, this._flashLoadTime);
	}
	this.setFlashStyle();
	$$D.css($$O(this._infoTextSpanID), 'display', 'none');
};
_p.setFlashStyle = function(){
	this._flashcontainer.style.position = "absolute";
	this._flashcontainer.style.top	  = this._titleHeight+"px";
	this._flashcontainer.style.left	 = "0px";
	this._flashcontainer.style.width	= this._flashWidth+"px";
	this._flashcontainer.style.height   = this._flashHeight+"px";
	if(this._flash){
		this._flash.style.position = "relative";
		this._flash.style.width  = this._flashWidth + "px";
		this._flash.style.height = this._flashHeight + "px";
		this._flash.style.left   = "0px";
		this._flash.style.top	= "0px";
	}
};
_p.restoreFlash = function(){
	if(this._flashFailedDiv){
	   this._flashcontainer.removeChild(this._flashFailedDiv);
	   delete this._flashFailedDiv;
	}
	this._flash = this._restoreFlash;
	this.resize(this._width, this._height);
	this._flash.focus();
};
_p.reloadFlash = function(){
	if(this._restoreFlash){
		delete this._restoreFlash;
	}
	this._flash = null;
	var _Ht = [];
	var flashWidth = this._width - 2 * this.borderWidth;
	var flashHeight = this._height - 2 * this.borderWidth;
	_Ht.push(	"<div id='" + this._infoTextSpanID + "' style='display:none;cursor:auto;width:"+flashWidth+"px;height:"+flashHeight+"px;line-height:" + flashHeight + "px;text-align:center;'></div>");
	_Ht.push(	"<div id='" + this._flashID + "' style=''></div>");
	this._flashcontainer. innerHTML = _Ht.join('');
	if(this._waitFlashAutoLoadTimeid) clearTimeout(this._waitFlashAutoLoadTimeid);
	this.createFlash();
	this.setFlashStyle();
};
_p.LoadFailure = function(){
	var _V = Ntalker.variable, _C = Ntalker.Config;
	if(this._isFlashLoadSuccess){
		return;
	}
	var self = this;
	this._restoreFlash = this._flash;
	var flashWidth = this._width - 2*this.borderWidth;
	var flashHeight = this._height - this.titleHeight;
	if(self._flash){
		$$D.css(this._flash, "display", "none");
		try{
			this._flash.parentNode.remove(this._flash);
		}catch(e){
			this._flash.style.width = 1 + 'px';
			this._flash.style.height = 1 + 'px';
		}
	}
	var closeButtonId = 'CloseIMWindowButton';
	var reLoadButtonId = 'reLoadFlashButton';
	$$D.css($$O(this._infoTextSpanID), 'backgroundImage', 'none');
	$$D.css($$O(this._infoTextSpanID), 'display', 'block');
	var _Ht = [];
	_Ht.push('<div>');
	_Ht.push(	'<div name="winlogo" style="float:left;width:70px;height:20px;background:url(' + _C['logo'] + ') center center no-repeat;"></div>');
	_Ht.push(	'<div name="wintitle" style="float:left;width:280px;height:20px;background:url(' + _C['publicDIR'] + 'titleText.gif) center center no-repeat;"></div>');
	_Ht.push(	'<div id="'+closeButtonId+'" name="btnclose" style="z-index:12;float:right;margin-right:8px;width:26px;height:20px;background:url('+_C['publicDIR'] + 'closewin.gif) center top no-repeat;cursor:pointer;"></div>');
	_Ht.push('</div>');
	_Ht.push('<div style="clear:both;height:' + (flashHeight-20) + 'px;line-height:' + (flashHeight-20) + 'px;">');
	_Ht.push(	'<a id="'+reLoadButtonId+'" href="javascript:void(0)">' + NtLang['loadFlashFailure'] + '</a>');
	_Ht.push('</div>');
	$$D.insert($$O(this._infoTextSpanID), _Ht.join(''));
	var self = this;
	var __clearClick  = function(e){$$E.fixEvent(e).stopPropagation();};
	var __closeWaitWin = function(e){self.close();};
	var __reloadFlash = function(){ self.reloadFlash();};
	if(this._FlashReloadCount < 2 && !this._isFlashLoadSuccess){
		this._waitFlashAutoLoadTimeid = setTimeout( __reloadFlash, this._waitFlashAutoLoad);
	}
	if( $$O(this._infoTextSpanID) ) $$O(this._infoTextSpanID).onclick = __clearClick;
	if( $$O(closeButtonId) ) $$O(closeButtonId).onclick = __closeWaitWin;
	if( $$O(reLoadButtonId) ) $$O(reLoadButtonId).onclick = __reloadFlash;
};
_p.onFlashLoadSuccess = function(){
	this._isFlashLoadSuccess = true;
};
_p.refreshFlashPos = function(){
	if(!this._flash || this._curWindMode=="min")
		return;
	var moveOffset = 0;
	if(this._isMoveLeft){
		moveOffset = 1;
		this._isMoveLeft = false;
	}
	else{
		moveOffset = 0;
		this._isMoveLeft = true;
	}
	this._flash.style.left = ($$B.StrictMode ? moveOffset : (this._borderWidth + moveOffset) )+"px";
};
_p.onFocus = function(){
	var _V = Ntalker.variable;
	$$D.css(this._self,'zIndex', this._focusZIndex);
	$$D.css(this._flashcontainer, 'zIndex', this._focusZIndex);
	$$D.css(this._flash, 'zIndex', this._focusZIndex);
	try{
		this._flash.focus();
	}catch(e){}
	if( this._chatType == 'nquan' ){
		showDiv(this._chatType + '_' + this._destuid);
	}	chatWindowManager.focusWindow(this._destuid, this._chatType);
};
_p.onBlur = function(){
	$$D.css(this._self,'zIndex', this._defaultZIndex);
	$$D.css(this._flashcontainer, 'zIndex', this._defaultZIndex);
	$$D.css(this._flash, 'zIndex', this._defaultZIndex);
	this._flash.style.visibility = "hidden";
	this._flash.style.visibility = "visible";
};
_p.onReceiveMessage = function(message){
	var titleText = sprintf(NtLang['receiveMessageTitle'], this._destnick, message);
	if(IMToolBar){
		var miniWindow = IMToolBar.get(this._destuid, this._chatType);
		miniWindow.onReceiveMiniMessage(message);
	}
	var impresenceflash = $$O('impresenceflash');
	if(impresenceflash && impresenceflash.playNotifySound){
		impresenceflash.playNotifySound();
	}
};
_p.onPresenceReceiveChatMsg = function(message){
	if(this._flash && this._flash.presenceReceiveChatMsg)
		this._flash.presenceReceiveChatMsg(message);
};
Ntalker.ChatWindowManager = function(){
	this._chatWnds = new IMHashtable();
	this._chatWndsArray = new Array();	this._windowWidth  = 0;
	this._windowHeight = 0;};
_p = Ntalker.ChatWindowManager.prototype;
_p.addChatWindow = function(destuid, destnick, chatid, message, logoUrl, OpenType, chatType, roomtype, userinfo, befrom){
	var _C = Ntalker.Config, _CP= Ntalker.Config.customparams, _V = Ntalker.variable;
	var chatRect = {left:0,top:0,right:0,bottom:0};
	var _autoFocus = true;
	var chatWindowKey = /^(nquan|room|group)$/.test(chatType) ? destuid + chatType : 'chat';
	this._windowWidth  = /^(nquan|room|group)$/.test(chatType) ? _C['groupWidth'] : _C['chatWidth'];
	this._windowHeight = /^(nquan|room|group)$/.test(chatType) ? _C['groupHeight'] : _C['chatHeight'];
	var chatWndsArray = chatWindowManager._chatWndsArray, 
		chatWndCount = chatWndsArray.length, 
		existMaxChatWnd = false;
	if( OpenType == -1 ){
		_autoFocus = false;
	}else if( OpenType == 0 ){
		_autoFocus = chatWndCount==0 ? true : false;
	}else {
		if( chatWndCount > 0 ){
			for(var i = 0; i < chatWndCount; i++ ){
				if( chatWndsArray[i]._curWindMode != 'hide' ){
					_autoFocus = true;
					break;
				}
			}
		}else{
			_autoFocus = true;
		}
	}
	var chatWindow = this.getChatWindow(destuid, chatType);
	if( chatWindow ){
		if( chatType == 'chat' && !IMToolBar.get(destuid, chatType) ){
			IMToolBar.add(destuid, destnick, logoUrl, _autoFocus, chatType, OpenType, userinfo);
		}
		if( _autoFocus ){
			debug('<b>addChatWindow(), focusWindow</b>');
			IMToolBar.focusTag(destuid, chatType);
			this.OnTBFocusWindow(destuid, chatType, destnick);
		}
		chatWindow.onPresenceReceiveChatMsg(message);
		return;
	}
	if( chatType == 'chat' ){
		var newChatWindow = new Ntalker.ntChatWindow(destuid, destnick, chatid, this._layout, chatType, roomtype, OpenType, userinfo, befrom);
	}else{
		var newChatWindow = new Ntalker.ntGroupWindow(destuid, destnick, chatid, this._layout, chatType, roomtype, OpenType, userinfo, befrom);
	}
	var l = this._chatWndsArray.length;
	for(var i=0; i<l; i++){
		this._chatWndsArray[i].hide();
	}
	var minWnd = IMToolBar.add(destuid, destnick, logoUrl, _autoFocus, chatType, OpenType);
	var miniTagElement = minWnd.tagElement;
	debug(miniTagElement);
	var mRt = minWnd.getPost();
	var tRt = $$D.clientRect(IMToolBar.contentElement);
	var x;
	if( IMToolBar.currentToolbarMode == 2 ){
		x = mRt.rx - this._windowWidth - tRt.left;
	}else{
		x = Math.min(mRt.x, tRt.w - this._windowWidth - _C['IMWidth'] - 10);
	}
	var chatRect = {left:x, top:0, bottom:0, right:0};
	newChatWindow.showWindow(chatRect, miniTagElement);
	this._chatWnds.add(chatWindowKey, newChatWindow);
	this._chatWndsArray.push(newChatWindow);	var type,i,desc; 
	switch(chatType){
		case "group":
		case "room":
			type=2;desc=NtLang['sd_GroupWindow'];break;
		case "nquan":
			type=15;
			desc=NtLang['sd_NQuanWindow'];
			break;
		default:type=0;desc=NtLang['sd_ChatWindow'];break;
	}
	$$C.load({tagName:'img', href:Ntalker.Config.services + '/func/statistic.php?', 
		params:{
			siteid: _V['siteid'],
			uid: _V['user_id'],
			destid: /^(room|group|nquan|traing)$/.test(this._chatType) ? 0 : this._destuid,
			groupid: /^(room|group|nquan|traing)$/.test(this._chatType) ? this._destuid : 0,
			type: type,
			desc: encodeURIComponent(desc),
			from: befrom,
			rnd: new Date().getTime()
		}, width:1,height:1
	});
};
_p.removeChatWindow = function(destuid, chatType){
	var chatWindow = this.getChatWindow(destuid, chatType);
	if (!chatWindow) return false;
	this._chatWnds.remove( (chatType=='chat' ? '' : destuid) + chatType);	var deleteWindowIndex = -1;
	for (i = 0; i < this._chatWndsArray.length; i++) {
		if (this._chatWndsArray[i]._destuid == destuid && this._chatWndsArray[i]._chatType==chatType){
			this._chatWndsArray.splice(i, 1);
			deleteWindowIndex = i;			break;
		}
	}};_p.focusWindow = function(destuid, chatType){
	var chatWindow = this.getChatWindow(destuid, chatType);
	var _V = Ntalker.variable;
	if(chatWindow._curWindMode == "default")
		return;
	for(var k in this._chatWnds._hash){
		chatWindow = this._chatWnds._hash[k];
		if(chatWindow._destuid!=destuid || chatWindow._chatType != chatType){
			chatWindow.onBlur();
		}	}
};
_p.closeAll = function(){
	for(var k in this._chatWnds._hash){
		chatWindow = this._chatWnds._hash[k];
		if(chatWindow&&chatWindow.close)
			chatWindow.close();
	}
};
_p.getChatWindow = function(destuid, chatType){
	chatType = /^(group|room|nquan|traing)$/.test(chatType) ? chatType : 'chat';
	return this._chatWnds.items((chatType=='chat' ? '' : destuid) + chatType);
};
_p.flashWindowTitle = function(destuid, chatType){
	var chatWindow = this.getChatWindow(destuid, chatType);
	if(chatWindow){
		titleText =  chatWindow ._isFlashTitle ? chatWindow ._flashTitleText : chatWindow ._titleText;
		chatWindow.changeTitle(titleText);
	}
};
_p.OnTBFocusWindow = function(destuid, chatType, destname, isCloseChat){
	var moveToX, l = this._chatWndsArray.length, _C = Ntalker.Config;
	isCloseChat = isCloseChat ? true : false;
	for(var i=0; i < l; i++){
		var chatWindow = this._chatWndsArray[i];
		if( chatWindow._chatType == chatType && chatType == 'chat' ){
			if(!destuid||destuid==0 || isCloseChat){
				chatWindow._curWindMode = 'default';
				chatWindow.MinMax();
				return;
			}
			if(chatWindow._curWindMode == 'hide'){
				chatWindow.MinMax(destuid, chatType);
			}
			try{
				var minTag = IMToolBar.get(destuid, chatType);
				minTag.onFocus();
				var mRt = minTag.getPost();
				var userInfo = minTag._userInfo;
				var minX = mRt ? mRt.x : 0;
				var minW = mRt ? mRt.w : 0;
			}catch(e){}
			var tRt = $$D.clientRect(IMToolBar.contentElement);
			if( /0|1/.test(IMToolBar.currentToolbarMode) ){
				moveToX = Math.min(minX + IMToolBar.AreaElement.scrollLeft, tRt.w - chatWindow._width - _C['IMWidth'] - 10);
				moveToX = Math.max(20, moveToX);
			}else{
				moveToX = Math.min(minX, minX + minW - chatWindow._width);
				if($$D.rect($$O('ntalkerbar-wrapper')).left<chatWindow._width){
			   		if(moveToX<0){
						moveToX = Math.max(moveToX,-1*$$D.rect($$O('ntalkerbar-wrapper')).left);
						if($$B.chrome){
							moveToX+=20;
						}
					}
				}  
			}			debug('OnTBFocusWindow.moveTo x=' + moveToX);			$$D.css(chatWindow._self, 'left', moveToX+'px');			var selectChatWindow = {id:destuid, name:destname, openType:1, userInfo:userInfo, current:true, deletePreviousWindow:isCloseChat};
			var tagWindowCount = IMToolBar.getTagCount('chat');
			if( tagWindowCount>0 ){
				chatWindow.switchChatWindow([selectChatWindow]);
			}
		}else{
			if(chatWindow._destuid==destuid && chatWindow._chatType==chatType){
				chatWindow._curWindMode = "hide";
				chatWindow.MinMax();
			}else{
				if(chatWindow._curWindMode == 'default'){
					chatWindow.MinMax();
				}
			}
		}
	}
};
var NtMenu = function (debug){ 
	this._debug = debug;
	this._Hash = new IMHashtable();
	this._span = null;
	this._Button = null;
	this._over  = {};
	this._out   = {};
	this._click = {};
	this._overItem = false;
	this._className = '';
	this._overClassName = '';
	this.init = function(span, Btn, mattr, over, out, click, visibleNoneCallFunction, visibleCallFunction, openedCallFunction){
		this._span = span;
		this._Button  = Btn;
		this._mAttr = mattr;
		this._over = over;
		this._out  = out;
		this._click= click;
		this.visibleNoneCallFunction = visibleNoneCallFunction;
		this.visibleCallFunction = visibleCallFunction;
		this.openedCallFunction = openedCallFunction;
		this._timer = null;
		this._Menu = null;
		this._MenuID = mattr['id'];
		this._MenuInited = false;
		this._MenuContentElement = null;
		var self = this;
		var __showMenu = function(e){self.show();};
		$$E.addEvent(this._Button, 'click', __showMenu);
	};
	this.add = function(k, obj){
		if( this._Hash.items(k) ){
			return false;
		}
		this._Hash.add(k, obj);
	};
	this.remove = function(k){
		this._Hash.remove(k);
	};
	this.get = function(k){
		return this._Hash.items(k);
	};
	this.length = function(){
		return this._Hash.count();
	};
	this.hidden = function(){
		if( this._debug ){
			return;
		}
		try{
			clearInterval(this._timer);
			this._Menu.parentNode.removeChild(this._Menu);
			this._MenuInited = false;
		}catch(e){}
	};
	this.show = function(){
		var self = this;
		var _B = this._Button,_PN = this._span, _U, 
		_mAttr = this._mAttr, _O1 = this._over, _O2 = this._out, _O3 = this._click;
		if(this._Hash.count()==0 && typeof self.visibleNoneCallFunction == 'function'){
			self.visibleNoneCallFunction.call(this);
			return;
		}
		if( this._MenuInited && typeof(self.openedCallFunction) == 'function' ){
			self.openedCallFunction.call(this);
			return;
		}
		var __menuHidden = function(){
			if(!self._overItem){
				self.hidden();
			}
		};
		var __menuOver = function(e){
			var Func = _O1.callback, event, target;
			self._overItem = true;
			event = $$E.fixEvent(e);
			target= searchTag(event.target, "li");
			$$D.replaceClass(target, _O2.className, _O1.className);
			if(typeof Func == 'function') Func.call(this, target);
		};
		var __menuOut = function(e){
			var Func = _O2.callback, event, target;
			self._overItem = false;
			event = $$E.fixEvent(e);
			target= searchTag(event.target, "li");
			$$D.replaceClass(target, _O1.className, _O2.className);
			if(typeof Func == 'function') Func.call(this, target);
		};
		var __menuClick = function(e){
			var Func = _O3.callback, Exec = _O3.exec, event, target, M = self._Menu;
			event = $$E.fixEvent(e);
			target= searchTag(event.target, "li");
			if(typeof Func == 'function'){
				Func.call(this, target);
			}
			if( Exec===false ){
				return;
			}
			try{
				self.remove(target.getAttribute('k'));
				M.parentNode.removeChild(M);
			}catch(e){}			clearInterval(self._timer);
		};
		function createChildNode(attribute, parentNode){
			var tagName = attribute.tagName ? attribute.tagName : 'div';
			var className = attribute.className ? attribute.className : '';
			var styleText = attribute.style ? attribute.style : '';
			var childNode = attribute.childNode;
			parentNode = $$D.create(tagName, {className:className, style:styleText}, parentNode);
			if( childNode ){
				return createChildNode(childNode, parentNode);
			}else{
				return parentNode;
			}
		}
		if( !$$O(this._MenuID)){
			var _Ht = ['<' + (_mAttr.tagName ? _mAttr.tagName : 'span')];
			for(var attr in _mAttr){
				if( !/^(tagName|childNode)$/.test(attr) ){
					_Ht.push(' ' + (attr.toLowerCase()=='classname' ? 'class' : attr) + '="' + _mAttr[attr]+'"');
				}
			}
			_Ht.push('>');
			_Ht.push('</' + (_mAttr.tagName ? _mAttr.tagName : 'span') + '>');
			this._Menu = this._MenuContentElement = $$D.insert(_PN, _Ht.join(''), 'beforeend');
			if( _mAttr.childNode ){
				this._MenuContentElement = createChildNode(_mAttr.childNode, this._MenuContentElement);
			}
			this._overItem = true;
			self._timer = setInterval(__menuHidden, 500);
		}
		this._MenuContentElement.innerHTML = '';
		_U = $$D.insert(this._MenuContentElement, '<ul class="NtMenuMessageBox"></ul>');
		for(var k in this._Hash._hash){
			var _V1 = this._Hash._hash[k], _Ht = ['<li k="' + k + '"'], type = 'item';
			for(var ck in _V1.custom){
				if (ck.toLowerCase() == 'type' )
					type = _V1.custom[ck];
				if(ck.toLowerCase()=='classname')
					_Ht.push(' class="' + _V1.custom[ck]+' '+_O2.className + '"');
				else
					_Ht.push(' ' + ck + '="' + _V1.custom[ck] + '"');
			}
			_Ht.push('><div><a href="javascript:void(0)">' + _V1.text + '</a></div></li>');
			_L = $$D.insert(_U, _Ht.join(''), 'beforeend');
			if ( type == 'item' ){
				$$E.addEvent(_L, 'mouseover', __menuOver);
				$$E.addEvent(_L, 'mouseout', __menuOut);
				$$E.addEvent(_L, 'click', __menuClick);
			}else if(type=='close'){
				 $$E.addEvent($$D.filter(($$D.filter(_L.childNodes)[0]).childNodes)[0], 'click', __menuClick);
			}
		}
		this._MenuInited = true;		if( typeof self.visibleCallFunction == 'function'){
			self.visibleCallFunction.call(this, _U);
		}
		$$A.each([_B,this._MenuContentElement], function(elem){
			$$E.addEvent(elem, 'mouseover', function(e){self._overItem = true;});
			$$E.addEvent(elem, 'mouseout', function(e){self._overItem = false;});
		});
	};
};
var ntTip = function (parent, content, k, callback){
	this._parent = parent;
	this._id = 'apptipid';
	this._element = null;
	this._content = content;
	this._key = k;	this._fn = callback;
	this._timer = null;
};
ntTip.prototype.init = function(content){
	var _C = Ntalker.Config, _V = Ntalker.variable;	debug('nttip init');
	this._content = content;	var html = '<span class="app_itemTip" style="height:54px;width:104px;cursor:pointer;display:none;position:absolute;top:0px;left:0px;background:url(' + _C['publicDIR'] + 'tb_bottom_tip.png) no-repeat 25px bottom;color:#FFFFFF; font-size:9pt;font-weight:100;display:none;z-index:2147483647;text-align:center;line-height:12px;">'
			+  '<div class="app_itemTip_close" style="height:15px;width:15px;right:8px; top: 5px;_filter:alpha(opacity:50);opacity:0.5;line-height:15px;cursor:pointer;position:absolute;">&nbsp;&nbsp;&nbsp;</div>'
			+  '<div class="app_tuan_content" Style="background:#ffff99;overflow:hidden;margin:0px;padding:1px;border:1px solid #ffcc00;line-height:1px; white-space: normal;">' + this._content + '</div></span>';	var el = $$D.insert(this._parent, html);
	this._element = el;	$$E.addEvent(el, 'mouseover',function(e){var event = $$E.fixEvent(e);event.stopPropagation(e);});
	$$E.addEvent(el, 'mouseout',function(e){var event = $$E.fixEvent(e);event.stopPropagation(e);});	var btnClose = $$D.filter(el.childNodes)[0], self = this;
	function overCloseTip(e){
		$$D.css(btnClose, 'backgroundColor', '#ccc');
	};
	function outCloseTip(e){
		$$D.css(btnClose, 'backgroundColor', '');
    };
	function clickCloseTip(e){
		var event = $$E.fixEvent(e).stopPropagation();
		self.hiden(self._key);
	};
	function clickOpenApp(e){
		var event = $$E.fixEvent(e).stopPropagation();
		if( self._fn ) self._fn(e);
		self.hiden(self._key);
	};
	$$E.addEvent(this._element, 'click', clickOpenApp);
	if( btnClose ){
		$$E.addEvent(btnClose, 'mouseover', overCloseTip);
		$$E.addEvent(btnClose, 'mouseout', outCloseTip);
		$$E.addEvent(btnClose, 'click', clickCloseTip);
	}	return el;
};
ntTip.prototype.show = function(){
	var _C = Ntalker.Config, _V = Ntalker.variable;
	if( NtUtil.getCookie('ntalkerhiddennewapplication') == '1' ){
		debug('Tip has shown that had, return.');
		return;
	}	var url = _C['services'] + "/func/statistic.php?siteid="+_V['siteid']+"&uid="+_V['user_id']+"&type=22&mode=1&from=show tip&rnd="+new Date().getTime();
	$$C.load({src: url});	var el = this._element;
	try{
		$$D.css(el, 'display', 'block');
		$$D.animate(el, {top:'-54px'}, 3000, 'easeOutElastic', function(){});
	}catch(e){
		;
	}		debug('Tip has shown that 5 seconds, set cookie.');
		NtUtil.onlyOne('ntalkerhiddennewapplication', "nd", 1);};
ntTip.prototype.hiden = function(k){
	var el = this._element;
	if( this._key != k || !el ) return;
	$$D.css(el,'display','none');
	clearTimeout(this._timer);
	debug('Hidden tip , set cookie.');
	NtUtil.onlyOne('ntalkerhiddennewapplication', "nd", 1);};
function ntBarNode(destuid, destname, headURL, isAutoFocus, chatType, OpenType, userInfo){
	this._focus = true;
	this._destuid = destuid;
	this._destnick = destname || '';
	this._chatType = chatType || 'chat';
	this._openType = OpenType;
	this._headURL = headURL || '';
	this._userInfo = userInfo || '';
	this._tagId = 'ntalkerbarMinTag' + this._destuid + this._chatType;
	this._spanId = 'ntTagSpanWindow' + (this._chatType=='chat' ? '' : this._destuid) + this._chatType;
	this.autoFocus = isAutoFocus;
	this.Element = null;
	this.tagElement = null;
	this._counter = 0;
	this.originTitle = '';
}
ntBarNode.prototype = {
	init: function(parent){
		var _Ht = [], elem, _C = Ntalker.Config;
		this.originTitle = $$S.cut(this._destnick, 5, true);
		var imgsrc = _C['publicDIR'] + '/'+this._chatType.toLowerCase()+'.' + ($$B.ie6?'gif':'png');
		if( !$$O(this._spanId) ){
			this.tagElement = $$D.insert($$O('ntalkerbar'), '<div class="ntSpanWindow" id="' + this._spanId + '"></div>');
		}else{
			this.tagElement = $$O(this._spanId);
		}
		_Ht.push( '<div class="win" id="' + this._tagId + '">' );
		_Ht.push(	 '<span class="ico"><img src="' + imgsrc + '" border="0" /></span>' );
		_Ht.push(	 '<span class="title">' );
		_Ht.push(	 this.originTitle);
		_Ht.push(	 '</span>');
		_Ht.push(	 '<span class="button" id="'+this._destuid+'" chattype="'+this._chatType+'"></span>' );
		_Ht.push( '</div>' );
		elem = this.Element = $$D.insert(parent, _Ht.join(''), 'BeforeEnd');
		if(this.autoFocus){
			this.onFocus();
		}else{
			this.onBlur();
		}
		var self = this;
		Ntalker.temp.current_tag = [self._destuid, self._chatType];
		var __clickMinWindow = function(e){
			var _self = self;
			Ntalker.temp.current_tag = [_self._destuid, _self._chatType];
			debug('<b>ntBarNode.init :: onClick('+_self._destuid+','+_self._destnick+', '+_self._chatType+')</b>');
			if( !_self._focus ){
				IMToolBar.focusTag(_self._destuid, _self._chatType);
			}else{
				IMToolBar.focusTag();
			}
		};
		var __overMinWindow  = function(e){
			current = e.currentTarget || window.event.srcElement;
			if( current.className.indexOf("win")==-1 ) current = current.parentNode;
			if( current.className.indexOf("win")!=-1 ) $$D.addClass(current, "hover");
		};
		var __outMinWindow = function(e){
			current = e.currentTarget || window.event.srcElement;
			if( current.className.indexOf("win")==-1 ) current = current.parentNode;
			if( current.className.indexOf("win")!=-1 ) $$D.removeClass(current, "hover", "");
		};
		var __clickClose = function(e){
			var _self = self;
			$$E.fixEvent(e).stopPropagation();
			fIM_CloseChatWindow(_self._destuid, _self._chatType);
		};
		var closeButton = $$D.filter(elem.childNodes)[2];
		$$E.addEvent(elem, 'click', __clickMinWindow);
		$$E.addEvent(elem, 'mouseover', __overMinWindow);
		$$E.addEvent(elem, 'mouseout',  __outMinWindow);
		$$E.addEvent(closeButton, 'click',  __clickClose);
		if( this._openType == 0 ){
			this.onReceiveMiniMessage();
		}
		return elem;
	},
	updateUserHead:function(src, intStatus){
		var image = $$selector("div#" + this._tagId + ">span.ico>img")[0];
		if( !image ){
			image = $$D.filter($$D.filter($$O(this._tagId).childNodes)[0].childNodes)[0];
		}
		image.src = src;
		image.onload = function(){
			if(this.width>this.height){
				_width = 20;
				_height= 20/this.width*this.height;
			}else{
				_height= 20;
				_width = 20/this.height*this.width;
			}
			this.width  = _width;
			this.height = _height;
		};
	},
	getPost: function(){
		var scrollLeft = $$O('nt_area').scrollLeft;
		var contentElementX = $$D.clientRect( IMToolBar.contentElement ).left;
		var mRt = $$D.clientRect(this.Element);
		var _x  = mRt.left-($$B.ie6 ? 2 : 0) - scrollLeft - contentElementX;
		var _rx = mRt.left+mRt.w+($$B.ie6 ? 2 : 0) - scrollLeft;
		return {x:_x, y:mRt.top, w:mRt.w, h:mRt.h,rx:_rx};
	},
	onFocus: function( ){
		var _V = Ntalker.variable;
		for(var k in IMToolBar.minWindows._hash){
			IMToolBar.minWindows._hash[k].onBlur();
		}
		this._focus = true;
		if( this._chatType=='chat' ){
			IMToolBar._currentTagId = this._tagId;
		}
		$$D.removeClass(this.Element, 'flash');
		$$D.replaceClass(this.Element, 'hover', "selected");		IMToolBar.leftMutex && IMToolBar.leftMutex('');		var tagRect = this.getPost();
		return tagRect;
	},
	onBlur: function( ){
		this._focus = false;
		$$D.removeClass(this.Element, 'flash');
		$$D.replaceClass(this.Element, "selected", '');
	},
	onReceiveMiniMessage: function(message){
		var titleText;
		titleText = message ? sprintf(NtLang['sayContent'], message) : this.originTitle;
		if ( this.timerID )
			return;
		if ( this._focus ) return;
		this.promptMsg = $$S.cut( titleText, 5 );
		this.flashWindowTitle();
	},
	flashWindowTitle: function(){
		var elem = this.Element;
		if(this._focus){
			clearInterval(this.timerID);
			this.timerID = null;
			this._counter = 0;
			return;
		}
		if(this._counter%2==1){
			$$D.replaceClass(elem, '', "flash");
		}else{
			$$D.replaceClass(elem, "flash", '');
		}
		var self = this, Timer = this._counter%2==1 ? 1000 : 500;
		this._counter = parseInt(this._counter) + 1;
		this.timerID = setTimeout(function(){
			var toolbarTag = IMToolBar.get(self._destuid, self._chatType);
			toolbarTag && toolbarTag.flashWindowTitle();
		}, Timer);
	}
};
function ntToolbar(){ 
	this._bindingScroll = false;
	this.element = null;
	this.minWidth = 700;
	this.inited = [];
	this._Hash = [];
	this._feedHeight=0;
	this._spanHeight=0;
	this._Button="";
	this._customMessageCount=0;
	this._fnum=0;
	this._inum=0;
	this._rfnum=0;
	this._rinum=0;	this.contentElement = null;
	this.AreaElement = null;
	this.resetCurTop = false;
	this.minWindows = new IMHashtable();	this._timer = [];	this._flashNum = [];	this._stopFlash = [];	this._flashClassName = [];	this.InitExpression = false;
	this.scroltimerID = null;
	this.resizetimerID = null;
	this.btnSwitchWidth = 0;	this.initToolbarMode = 0;
	this.currentToolbarMode = 1;	this.isSpread = false;
	this.styleElement = null;	 this.isExisitCustomButton = false;	this.backgroundDiv = null;	this._currentTagId = null;	this.jsonConfiguration = {
		acceptOriginalFeed: true, 		acceptCommentFeed: true,  		groupSetting: false,	   		buddyLoginTip: true,	  		acceptMsgFlag: "1",	   		audioOnFlag:"0"
	};
	this.newApplicationId = null;
	this.curApplicationId = null;
}
var _NtBar = ntToolbar.prototype;
_NtBar.init = function(){
	var _CP = Ntalker.Config.customparams;
	this.initToolbarMode = NtUtil.getCookie(Ntalker.tbModelKEY);
	if(_CP["intact"] == 1){
		this.isSpread = true;
	}
	if( this.initToolbarMode == '2' ){
		this.currentToolbarMode = 2;
	}else{
		this.currentToolbarMode = _CP["intact"];
	}
	this.initToolBar();
	this.setExpression(this.currentToolbarMode);
	this.initConfigurationMenu();
	this.initFriendButton();
	this.initGroupMessage();
	this.initMessageBox();
	if ( this.isSpread ){
		this.initSiteApplication();
		this.initHotFocus();
	}
	this.initShowToolBarButton();
	this.initScroll();
	this.closeMenuOrWindow();
	this.initCustomApplication();
	debug("ntToolbar.init::initCustomApplication");
};
_NtBar.closeMenuOrWindow = function(){
	var self = this;
	var __closeMenuOrWindow = function(e){
		var event = $$E.fixEvent(e);
		var targetElement = event.target;
		while(targetElement){
		if( /^(ntalkerbar-wrapper|ntalkerbar)$/.test(targetElement.id) ){
				return;
			}
			targetElement = targetElement.parentNode;
		}		self.leftMutex('', true);		self.closeMessagebox();		self.hiddenConfigurationMenu();
	};
	var Element = $$B.ie ? document : window;
	$$E.addEvent(Element, 'click', __closeMenuOrWindow);
};
_NtBar.add = function(destuid, destname, headURL, isAutoFocus, type, customModel, userInfo){
	var Tag, k = type + destuid, 
		parentNode = $$O('nt_wins'), 
		_V = Ntalker.variable, _C = Ntalker.Config,
		self = this;
	if ( this.get( k ) ) return;
	Tag = new ntBarNode(destuid, destname, headURL, isAutoFocus, type, customModel, userInfo);
	Tag.init(parentNode);
	this.minWindows.add(k, Tag);
	if( type == 'chat' ){
		this._currentTagId = Tag._tagId;
	}
	if( this.currentToolbarMode == 0 ){		this.setToolBarMode(1, true);
	}
	this.onToolBarTextChanage();	self.leftMutex('');
	if( /0|1/.test(self.currentToolbarMode) ){
		self.initScroll();
	}else{
		self.Mutex('');
	}
	return Tag;
};
_NtBar.getNext = function(destuid, type){
	var currentUid, currentNick, currentChatType, 
		isGetNext = false;
	for(var k in this.minWindows._hash){
		var minTag = this.minWindows._hash[k];
		if(minTag._destuid == destuid && minTag._chatType == type){
			isGetNext = true;
			if(currentUid){
				return [currentUid, currentNick, currentChatType];
			}
		}else{
			currentUid = minTag._destuid;
			currentNick = minTag._destnick;
			currentChatType = minTag._chatType;
			if(isGetNext){
				return [currentUid, currentNick, currentChatType];
			}
		}
	}
	return [0, '', 'chat'];
};
_NtBar.remove = function( destuid, type ){
	var _V = Ntalker.variable;	var nextParam = this.getNext(destuid, type);	var minTag = this.get(destuid, type);
	try{
		minTag.Element.parentNode.removeChild(minTag.Element);
	}catch(e){}
	this.minWindows.remove( type + destuid );
	var tagWindowCount = IMToolBar.minWindows.count();
	if( this.currentToolbarMode == 1 && !this.isSpread && tagWindowCount==0 ){
		this.setToolBarMode(0, true);
	}
	if( /0|1/.test(this.currentToolbarMode) ){
		this.onLeftScroll();
	}else{
		this.onToolBarTextChanage();
	}	var isCloseChat = true;
	chatWindowManager.OnTBFocusWindow(nextParam[0], nextParam[2], nextParam[1], isCloseChat);
};
_NtBar.get = function( destuid, type ){
	return this.minWindows.items( type + destuid );
};
_NtBar.focusTag = function( destuid, type, destname){
	for(var k in this.minWindows._hash){
		var minTag = this.minWindows._hash[k];
		if(minTag._destuid == destuid && minTag._chatType == type){
			chatWindowManager.OnTBFocusWindow(minTag._destuid, minTag._chatType, minTag._destnick);
		}else{
			minTag.onBlur();
		}
	}
	if( !destuid && !type ){
		chatWindowManager.OnTBFocusWindow();
	}
};
_NtBar.getTagCount = function(chatType){
	var existTagCount = 0, chatType = chatType || 'chat';
	for(var k in this.minWindows._hash){
		var minTag = this.minWindows._hash[k];
		if( minTag._chatType == chatType ){
			existTagCount++;
		}
	}
	return existTagCount;
};
_NtBar.setExpression = function(setToolBarModeValue, clearExpression){
	var _CP = Ntalker.Config.customparams,_R5, self = this, toolBarSpan = self.element;
	var _h2 = document.body.currentStyle,_a = "fixed";
	var _O = document.documentElement, _F1 = "url(about:blank)", _a3 = _O.runtimeStyle;
	var __onscroll = function(e){self.onScroll(e);};
	if( $$B.chrome && !self._bindingScroll ){
		$$E.addEvent(window, 'scroll', __onscroll);
		self._bindingScroll = true;
	}else if( $$B.ie6 || $$B.QuirksModel ){
		if( setToolBarModeValue == 2 && !_CP['enableScroll'] ){
			debug('ntToolbar.setExpression:: clearExpression, _bindingScroll='+self._bindingScroll);
			if (_O.currentStyle.backgroundImage == _F1){
				_a3.backgroundImage = "none";
				_a3.backgroundAttachment = "scroll";
			}
			toolBarSpan.style.setExpression("top", "null");
		}
		if( (setToolBarModeValue == 2 || _CP['enableScroll']) && !self._bindingScroll ){
			debug("ntToolbar.setExpression:: addEvent scroll");
			$$E.addEvent(window, 'scroll', __onscroll);
			self._bindingScroll = true;
			return;
		}else if( !_CP['enableScroll'] ){
			$$E.removeEvent(window, 'scroll', __onscroll);
			debug("ntToolbar.setExpression:: removeEvent scroll");
			debug("ntToolbar.setExpression:: InitExpression=" + this.InitExpression);
			if( !self.InitExpression ){
				if (_h2.backgroundImage == "none"){
					if ($$B.StrictMode) {
						if (_h2.backgroundImage == "none") {
							debug("ntToolbar.<b>setExpression</b>:: set background before");
							_a3.backgroundColor = _h2.backgroundColor.indexOf("#")==-1 ? _O.currentStyle.backgroundColor : _h2.backgroundColor;
							_a3.backgroundPositionX = _h2.backgroundPositionX;
							_a3.backgroundPositionY = _h2.backgroundPositionY;
							_a3.backgroundRepeat = _h2.backgroundRepeat;
							_a3.backgroundImage = _F1;
							_a3.backgroundAttachment = _a;
							debug("ntToolbar.<b>setExpression</b>:: set background complete");
						}
					} else {
						_a3.backgroundAttachment = _a;
						_a3.backgroundImage = _F1;
						debug("ntToolbar.<b>setExpression</b>:: background url(about:blank) fixed");
					}
				}else if( _h2.backgroundAttachment != "fixed" ){
					_a3.backgroundAttachment = _a;
					_a3.backgroundImage = _h2.backgroundImage;
					_a3.backgroundRepeat = _h2.backgroundRepeat;
					_a3.backgroundColor = _h2.backgroundColor.indexOf("#")==-1 ? _O.currentStyle.backgroundColor : _h2.backgroundColor;
					_a3.backgroundPositionX = _h2.backgroundPositionX;
					_a3.backgroundPositionY = _h2.backgroundPositionY;
					debug("ntToolbar.<b>setExpression</b>:: background "+_h2.backgroundImage+" fixed");
				}
				self.InitExpression = true;
			}
			if( $$B.StrictMode ){
			_R5 = "document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight";
			if (toolBarSpan.offsetParent == document.body) {
				_R5 += "-this.offsetParent.offsetTop-this.offsetParent.clientTop";
			}
		}
		else{
			_R5 = "document.body.scrollTop+document.body.clientHeight-this.offsetHeight";
		}
		toolBarSpan.style.setExpression("top", _R5);
		}
	}
};
_NtBar.initShowToolBarButton = function(){
	if( !$$O("btnSwitch") ){
		return;
	}
	var _CP = Ntalker.Config.customparams;
	var toolbarElems = $$D.filter($$O('spanSwitch').parentNode.childNodes);
	var tagWindowCount = IMToolBar.minWindows.count();
	var __controlToolBarMode = function(e){
		var tagWindowCount = IMToolBar.minWindows.count();
		if( IMToolBar.currentToolbarMode == 2 && tagWindowCount == 0 ){
			if( IMToolBar.isSpread ){
				IMToolBar.setToolBarMode(1);
			}else{
				IMToolBar.setToolBarMode(0);
			}
		}else if( IMToolBar.currentToolbarMode == 2 && tagWindowCount > 0 ){
			IMToolBar.setToolBarMode(1);
		}else{
			IMToolBar.setToolBarMode(2);
		}
	};
	var __buttonOver = function(e){
		$$D.addClass($$O('spanSwitch'), "hover");
	};
	var __buttonOut = function(e){
		$$D.removeClass($$O('spanSwitch'), "hover");
	};
	$$E.addEvent($$O("btnSwitch"), 'click', __controlToolBarMode);
	$$E.addEvent($$O("btnSwitch"), 'mouseover', __buttonOver);
	$$E.addEvent($$O("btnSwitch"), 'mouseout',  __buttonOut);
};
_NtBar.setToolBarMode = function(toolBarModeValue, noAnimation){
	var btnSwitch = $$O("btnSwitch"), 
		toolBarSpan = this.element, 
		toolBar = $$O("ntalkerbar"), 
		self = this, _V = Ntalker.variable, 
		_C = Ntalker.Config;
	debug('_NtBar.setToolBarMode( '+toolBarModeValue+' )');
	var toolbarElems = $$D.filter($$O('spanSwitch').parentNode.childNodes, 'span');
	toolBarModeValue = toolBarModeValue!='undefined' ? toolBarModeValue : this.currentToolbarMode;
	if( toolBarModeValue == 2 ){
		this.setExpression(toolBarModeValue, true);
		this.Mutex('');
		this.leftMutex('');
		this.focusTag();
		if( noAnimation ){
			toMinimizeToolbar();
		}else{
			$$D.animate(toolBar, {top:28}, 'fast', 'easeInOutQuint', function(){
				toMinimizeToolbar();
				$$D.animate(toolBar, {top:0}, 'fast', 'easeInOutQuint', function(){});
			});
		}
	}else if( toolBarModeValue == 0 ){
		if( noAnimation ){
			toSimplifyToolbar(toolBarModeValue);
			self.setExpression(toolBarModeValue);
		}else{
			this.Mutex('');
			$$D.animate(toolBar, {top:28}, 'fast', 'easeInOutQuint', function(){
				toSimplifyToolbar();
				self.setExpression(toolBarModeValue);
				self.onToolBarTextChanage();
				$$D.animate(toolBar, {top:0}, 'fast', 'easeInOutQuint', function(){});
			});
		}
	}else if( toolBarModeValue == 1 ){
		if( IMToolBar.currentToolbarMode != 0 ){
			this.focusTag();
		}
		if( noAnimation ){
			toMaximumToolbar();
			self.setExpression(toolBarModeValue);
		}else{
			this.Mutex('');
			$$D.animate(toolBar, {top:28}, 'fast', 'easeInOutQuint', function(){
				toMaximumToolbar();
				self.setExpression(toolBarModeValue);
				self.onToolBarTextChanage();
				$$D.animate(toolBar, {top:0}, 'fast', 'easeInOutQuint', function(){});
			});
		}
	}
	this.initScroll();
	function toMinimizeToolbar(){
		self.currentToolbarMode = toolBarModeValue;
		NtUtil.setCookie(Ntalker.tbModelKEY, toolBarModeValue, 1000*3600*24*7);
		$$D.replaceClass(btnSwitch, 'ntalkerbar-close', 'ntalkerbar-open');
		if( self.isExisitCustomButton ){
			$$D.css($$O('nt_system'), 'borderLeft', '1px dotted '+_C['bColor']);
		}else{
			$$D.css($$O('nt_system'), 'borderLeft', 'none');
		}
		var marginWidth = toolbarWidth = parseInt($$D.css($$O('ntalkerbar'), "marginLeft")) + parseInt($$D.css($$O('ntalkerbar'), "marginRight")) + parseInt($$D.css($$O('nt_content'), "borderLeftWidth")) + parseInt($$D.css($$O('nt_content'), "borderRightWidth"));
		$$A.each(toolbarElems, function(elem){
			if( /^(spanSwitch|spanSystem)$/.test(elem.id) ){
				$$D.css(elem, 'display', 'block');
				   self.btnSwitchWidth = $$D.clientRect(elem).w;
				   toolbarWidth += self.btnSwitchWidth;
			}else{
				$$D.css(elem, 'display', 'none');
			}
		});
		var tagWindowCount = IMToolBar.minWindows.count();
		var AreaWidth = parseInt(tagWindowCount * 130);
		$$D.css(self.AreaElement, 'width', (AreaWidth+1) + 'px');
		if( $$B.ie6 ){
			AreaWidth += 7;
		}else if( $$B.chrome || $$B.ie8 || $$B.ie7 || $$B.maxthon3 ){
			AreaWidth += 2;
		}
		toolbarWidth += AreaWidth;
		if( toolbarWidth > ($$D.windowRect().w - marginWidth + 130 - _C['chatWidth']) ){			self.setToolBarMode(1);
			return;
		}
		if( $$D.css(self.AreaElement, 'display') == 'none' ){
			$$D.css(self.AreaElement, 'display', 'block');
		}
		$$D.css(toolBarSpan, 'width', toolbarWidth + 'px');
		self.AreaElement.scrollLeft = 0;
	}
	function toMaximumToolbar(){
		$$D.css(toolBarSpan, 'width', '100%');
		self.currentToolbarMode = toolBarModeValue;
		NtUtil.setCookie(Ntalker.tbModelKEY, toolBarModeValue, 1000*3600*24*7);
		$$D.replaceClass(btnSwitch, 'ntalkerbar-open', 'ntalkerbar-close');
		$$D.css($$O('nt_system'),'borderLeft', '1px dotted '+_C['bColor']);
		var toolBarAreaWidth = $$D.windowRect().w - parseInt($$D.css($$O('ntalkerbar'), "marginLeft")) - parseInt($$D.css($$O('ntalkerbar'), "marginRight")) + parseInt($$D.css($$O('nt_content'), "borderLeftWidth")) - parseInt($$D.css($$O('nt_content'), "borderRightWidth")),
			Abnormal = false
		;
		$$A.each(toolbarElems, function(elem){
			$$D.css(elem, 'display', 'block');
			   toolBarAreaWidth -= parseInt($$D.clientRect(elem).w);
			   toolBarAreaWidth -= 1;
		});
		if( $$B.ie6 ){
			toolBarAreaWidth -= 6; 		}
		if( toolBarAreaWidth <= 0 ){
			if( Abnormal === true ){
				throw 'abnormal pattern taken by a wide';
			}
			Abnormal = true;
			toMaximumToolbar();
		}		$$D.css(self.AreaElement, 'width',  toolBarAreaWidth + 'px');
		$$D.css(self.AreaElement, 'visibility', 'visible');
		if( $$D.css(self.AreaElement, 'display') == 'none' ){
			$$D.css(self.AreaElement, 'display', 'block');
		}
	}	function toSimplifyToolbar(){
		var tagWindowCount = IMToolBar.minWindows.count();
		if( tagWindowCount > 0 ){
			self.setToolBarMode(1);
			return;
		}
		self.currentToolbarMode = toolBarModeValue;
		NtUtil.setCookie(Ntalker.tbModelKEY, toolBarModeValue, 1000*3600*24*7);
		$$D.replaceClass(btnSwitch, 'ntalkerbar-open', 'ntalkerbar-close');
		if( self.isExisitCustomButton || $$B.ie6 ){
			$$D.css($$O('nt_system'), 'borderLeft', 'none');
		}else{
			$$D.css($$O('nt_system'), 'borderLeft', '1px dotted '+_C['bColor']);
		}
		var toolbarWidth = parseInt($$D.css($$O('ntalkerbar'), "marginLeft")) + parseInt($$D.css($$O('ntalkerbar'), "marginRight")) + parseInt($$D.css($$O('nt_content'), "borderLeftWidth")) + parseInt($$D.css($$O('nt_content'), "borderRightWidth"));
		$$A.each(toolbarElems, function(elem){
			if( /^(spanSwitch|ntConfiguration|spanSystem|spanGroup|spanBuddylist)$/.test(elem.id) || elem.className.indexOf('customlink') > -1 || elem.className.indexOf('applicationItem') > -1 ){
				$$D.css(elem, 'display', 'block');
				toolbarWidth += $$D.clientRect(elem).w;
			}else {
				$$D.css(elem, 'display', 'none');
			}
		});
		var AreaWidth = 0;
		if( $$B.ie6 ){
			$$D.css(self.AreaElement, 'display', 'none');
			AreaWidth += 7;
		}
		$$D.css(self.AreaElement, 'width', '1px');
		toolbarWidth += AreaWidth;
		$$D.css(toolBarSpan, 'width', toolbarWidth+'px');
	}
};
_NtBar.initFriendButton = function(){ 
	var firendButton = $$O("nt_firend");
	var _V = Ntalker.variable, self = this;
	if( _V['user_sid'] == 'NtalkerGuestUserSessionID' ){
		return;
	}
	var __buttonOver = function(e){
		$$D.addClass($$O('spanBuddylist'), "hover");
	};
	var __buttonOut = function(e){
		$$D.removeClass($$O('spanBuddylist'), "hover");
	};
	var __buttonClick = function(e){
		self.onShowBuddylist(e, 0);
	};
	$$E.addEvent(firendButton, "click", __buttonClick);
	$$E.addEvent(firendButton, 'mouseover', __buttonOver);
	$$E.addEvent(firendButton, 'mouseout',  __buttonOut);
};
_NtBar.initGroupMessage = function(){ 
	var self = this, groupMenu;
	var _CP = Ntalker.Config.customparams;
	if( (!_CP['enablegroup']&&!_CP['enableroom']) || !$$O("nt_group") ){
		return;
	}
	var __viewGroupMessage = function(target){self.viewGroupMessage(target);};
	var __openGrouplist = function(e){self.onShowBuddylist(e, 2);};
	var __visibleCallFunction = function(){
		self.disableFlash('spanGroup');
		var allCount = 0;
		for(var k in self._groupMessageMenu._Hash._hash){
			allCount += self._groupMessageMenu.get(k).count;
		}
		self.Mutex('group', allCount);
		var contentRect = $$D.clientRect($$O('ntalkerbar-wrapper'));
		var _Right = Math.max(parseInt(contentRect.left + contentRect.w - $$D.clientRect($$O("spanGroup")).left - $$D.clientRect($$O("Nt-GROUP-MENU")).w), 20);
		$$D.css($$O("Nt-GROUP-MENU"), "right", _Right + 'px');
	};
	this._groupMessageMenu = groupMenu = new NtMenu(parseInt(NtUtil.getCookie("__debug") || 0));
	groupMenu.init(
		$$O('nt_group').parentNode, 
		$$O('nt_group'),
		{id:'Nt-GROUP-MENU',className:'ntalkerbar-menuright  messageMenu',style:''},
		{className:'nt-message-over icotype'},
		{className:'nt-message-out icotype'},
		{callback:__viewGroupMessage},
		__openGrouplist,
		__visibleCallFunction
	);
	var __buttonOver = function(e){
		$$D.addClass($$O('spanGroup'), "hover");
	};
	var __buttonOut = function(e){
		$$D.removeClass($$O('spanGroup'), "hover");
	};
	$$E.addEvent($$O("nt_group"), 'mouseover', __buttonOver);
	$$E.addEvent($$O("nt_group"), 'mouseout',  __buttonOut);
};
_NtBar.addGroupMessage = function(groupId, groupName, srcuid, srcnick, msg, chattype){
	var groupMenu = this._groupMessageMenu, _CP = Ntalker.Config.customparams;
	var allCount = itemCount = 0;
	var key = chattype + groupId;
	if( !groupMenu ){
		return;
	}
	if( groupMenu.get(key) ){		itemCount = groupMenu.get(key).count;		groupMenu.remove(key);
	}
	itemCount++;
	groupMenu.add(key, {
		text:$$S.cut(groupName,8) + '('+itemCount+')',
		groupid:groupId,
		groupname:groupName,
		srcuid:srcuid,
		srcnick:srcnick,
		msg:msg,
		chattype:chattype,
		custom:{
			groupid:groupId, 
			groupname:groupName,
			className:'nt-message-out icotype'
		},
		count:itemCount
	});
	for(var k in groupMenu._Hash._hash){
		allCount += groupMenu.get(k).count;
	}
	if(allCount>0){
		this.enableflash('spanGroup', '', 'flash');
	}else{
		this.disableFlash('spanGroup');
	}
	allCount = allCount>99 ? '99' : allCount;
	groupMenu._Button.innerHTML = sprintf(NtLang['groupButtonText'], String(allCount) );
};
_NtBar.removeGroupMessage = function(k){
	var groupMenu = this._groupMessageMenu, allCount = 0;
	if( !groupMenu ){
		return;
	}
	groupMenu.remove(k);	for(var k in groupMenu._Hash._hash){
		allCount += groupMenu.get(k).count;
	}
	allCount = allCount>99 ? '99' : allCount;
	groupMenu._Button.innerHTML = sprintf(NtLang['groupButtonText'] , String(allCount) );
};
_NtBar.viewGroupMessage = function(target){
	var groupMenu = this._groupMessageMenu, allCount, _groupObject, groupId, groupName;
	var k = target.getAttribute('k');
	if( !groupMenu ){
		return;
	}
	_groupObject = groupMenu.get(k);
	im_openWebchatWindow(_groupObject.groupid, _groupObject.groupname, null, 1, _groupObject.chattype, 0, 'groupMsgMenu');
	this.removeGroupMessage(k);
};
_NtBar.viewCurstomSystemMessage = function(url, e){
	var _ExtMsg = Ntalker.variable.ExMsg;
	var event = $$E.fixEvent(e);
	event.stopPropagation();
	var target = searchTag(event.target, "li");
	if(target.parentNode.childNodes.length<=1){
		setTimeout(function(){
			target.innerHTML="<div class='nt_box_null'>"+sprintf(NtLang['nullMessage'][0], NtLang['systemMessageBoxText'][1])+"</div>";
		},100);
	}else{
		target.parentNode.removeChild(target);
	}
	for(var i=0; i<_ExtMsg.length; i++){
		if(_ExtMsg[i].url==url)_ExtMsg[i].msgnumber = 0;
	}
	Ntalker.variable.ExMsg = _ExtMsg;
	this.countMessageBox("im",false,true);
	window.open(url);
};
_NtBar.initToolBar = function(){
	var _Ht = [], elem, first = true, initSimplifyToolbarWidth = 0, initMinimizeToolbarWidth = 0;
	var _CP = Ntalker.Config.customparams,
		_C = Ntalker.Config,
		_V = Ntalker.variable,
		_A = Ntalker.Config.application,
		_B = Ntalker.Config.customtoolbarButtons;	var toolbarElemStyle = _CP['showmode']=='hidden' ? 'visibility:hidden;' : 'visibility:visible;';
	var myAppButtonStyle = /1/.test(this.currentToolbarMode) ? 'display:block;' : 'display:none;';
	var hotFocusButtonStyle = /1/.test(this.currentToolbarMode) ? 'display:block;' : 'display:none;';
	var applicationButtonStyle = /1|0/.test(this.currentToolbarMode) ? 'display:block;' : 'display:none;';
	var customHyperlinkStyle = /0|1/.test(this.currentToolbarMode) ? 'display:block' : 'display:none';
	var scrollButtonStyle = /1/.test(this.currentToolbarMode) ? 'display:block' : 'display:none';
	var areaElementStyle = /1|2/.test(this.currentToolbarMode) ? 'visibility:visible;' : 'visibility:hidden;';
	var systemButtonStyle = /0|1|2/.test(this.currentToolbarMode) ? 'display:block' : 'display:none';
	var groupButtonStyle = /0|1/.test(this.currentToolbarMode) ? 'display:block' : 'display:none';
	var buddylistButtonStyle = /0|1/.test(this.currentToolbarMode) ? 'display:block' : 'display:none';
	var settingButtonStyle = /0|1/.test(this.currentToolbarMode) ? 'display:block' : 'display:none';
	var switchButtonClassName = /0|1/.test(this.currentToolbarMode) ? 'ntalkerbar-close' : 'ntalkerbar-open';
	var switchButtonText = /0|1/.test(this.currentToolbarMode) ? '' : '(0)';
	for(var k in Ntalker.Config.customtoolbarButtons){
		if( k ) this.isExisitCustomButton = true;
	}
	if( this.currentToolbarMode==1 )
		var systemSpanBorder = 'border-left:1px dotted '+_C['bColor'];
	else
		var systemSpanBorder = '';	_Ht.push('<div id="ntalkerbar" class="ntalkerbar">');
	_Ht.push(	'<div class="ntalkerbar-ui cc" id="nt_content">');
	if ( this.isSpread ){		_Ht.push('<span class="fl" id="siteApplication" style="'+myAppButtonStyle+'">');
		_Ht.push(	'<span id="nt_app" class="app-l nt_app">' + NtLang['myAppButtonText'] + '</span>');
		_Ht.push('</span>');		_Ht.push('<span class="fl" id="siteHotFocus" style="'+hotFocusButtonStyle+'">');
		_Ht.push(	'<span id="nt_hot" class="app-l nt_hot">' + NtLang['hotFocusButtonText'][0] + '</span>');
		_Ht.push('</span>');
	}	for(var k in _A ){
		if( typeof(_A[k]) == 'object' ){
			var customAppWidth = 34 + (NtLang['myAppButtonTextLength'] * $$S.len(_A[k]['name']));
			this.newApplicationId = _A[k]['id'] + '_button';
            _Ht.push('<span k="'+k+'" id="' + _A[k]['id'] + '_button" class="applicationItem fl" style="'+applicationButtonStyle+';">');
			_Ht.push(	'<span class="app_item" style="position:relative;width:'+(customAppWidth-1)+'px;_width:'+(customAppWidth-1)+'px;">');
			_Ht.push(		'<span class="app_itemImg" style="background:url(' + _A[k]['image'].src + ') no-repeat center center;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=noscale, src=' + _A[k]['image'].src + ');"></span>');
			_Ht.push(		'<span class="app_itemText">' + _A[k]['name'] + '</span>');
			_Ht.push(	'</span>');
			_Ht.push('</span>');
			initSimplifyToolbarWidth += customAppWidth;
		}
	}
	if( _CP['enableTraing'] ){
		_Ht.push('<span id="ntalkerCustomTempButton" class="applicationItem fl" style="'+applicationButtonStyle+'">');
		_Ht.push(	'<span class="app_item">');
		_Ht.push(		'<span class="app_itemImg" style="background:url(' + Ntalker['traing'].src + ') no-repeat center center;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=noscale, src=' + Ntalker['traing'].src + ');"></span>');
		_Ht.push(		'<span class="app_itemText">'+NtLang['customApplicationButtonText']+'</span>');
		_Ht.push(	'</span>');
		_Ht.push('</span>');
		initSimplifyToolbarWidth += 34 + (6 * $$S.len(NtLang['customApplicationButtonText']));
	}	for(var k in _B){
		if( typeof(_B[k])=="object" && _B[k]["float"]=="left" ){
			var firstHyperlinkBorder = "";
			_Ht.push('<span class="customlink fl" style="'+customHyperlinkStyle+'">');
			_Ht.push(	'<span class="customhyperlink" style="'+firstHyperlinkBorder+'">');
			_Ht.push(		'<a href="' + _B[k]['url'] + '" title="' + _B[k]['tip'] + '" target="_blank" style="' + _B[k]['style'] + '"></a>');
			_Ht.push(	'</span>');
			_Ht.push('</span>');
			first = false;
			initSimplifyToolbarWidth += 29;
		}
	}
	_Ht.push('<span class="fl" style="'+scrollButtonStyle+'">');
	_Ht.push(	'<span id="nt_forward" class="scroll_pre" title="' + NtLang['scrollButtonText'][0] + '"></span>');
	_Ht.push('</span>');
	_Ht.push('<span class="fr" id="spanSwitch" style="width:29px;">');
	_Ht.push(	'<span id="btnSwitch" class="'+switchButtonClassName+'"><span></span></span>');
	_Ht.push('</span>');
	initSimplifyToolbarWidth += 29;
	initMinimizeToolbarWidth += 29;
	if( _V['user_sid'] != 'NtalkerGuestUserSessionID' ){
		_Ht.push('<span class="fr" id="ntConfiguration" style="' + settingButtonStyle + '">');
		_Ht.push(	'<span id="nt_setting" class="app-l"></span>');
		_Ht.push('</span>');
		initSimplifyToolbarWidth += 33;
	}	if( _V['user_sid'] != 'NtalkerGuestUserSessionID' ){
		_Ht.push('<span class="fr" id="spanBuddylist" style="'+buddylistButtonStyle+'">');
		_Ht.push(	'<span id="nt_firend" class="app-r nt_firend">' + sprintf(NtLang['buddylistButtonText'][0], '0', '0') + '</span>');
		_Ht.push('</span>');
		initSimplifyToolbarWidth = initSimplifyToolbarWidth + 111 + NtLang['spanBuddylistlength'];
	}	if( _CP['enablegroup']||_CP['enableroom'] ){
		_Ht.push('<span class="fr" id="spanGroup" style="'+groupButtonStyle+'">');
		_Ht.push(	'<span id="nt_group" class="app-r nt_group">' + sprintf(NtLang['groupButtonText'], '0') + '</span>');
		_Ht.push('</span>');
		initSimplifyToolbarWidth = initSimplifyToolbarWidth + 83 +  NtLang['spanGroupslength'];
	}	_Ht.push('<span class="fr" id="spanSystem" style="'+systemButtonStyle+'">');
	_Ht.push(	'<span id="nt_system" class="app-r nt_system" style="'+systemSpanBorder+'">' + sprintf(NtLang['systemButtonText']+"(%1)", '0') + '</span>');
	_Ht.push('</span>');
	initSimplifyToolbarWidth = initSimplifyToolbarWidth + 83 + NtLang['spanNoticelength'];
	initMinimizeToolbarWidth = initMinimizeToolbarWidth + 83 + NtLang['spanNoticelength'];
	_Ht.push('<span class="fr" style="'+scrollButtonStyle+'">');
	_Ht.push(	'<span id="nt_back" class="scroll_next" title="' + NtLang['scrollButtonText'][1] + '"></span>');
	_Ht.push('</span>');	_Ht.push('<div class="nt_area" id="nt_area" style="'+areaElementStyle+'">');
	_Ht.push(	'<div class="nt_wins" id="nt_wins">');
	_Ht.push(	'</div>');
	_Ht.push('</div>');
	_Ht.push(	'</div>');
	_Ht.push(	'<div id="buddylistFlashSpan" class="ntalkerbar-menuright" style="border:none;width:' + _C['IMWidth'] + 'px;right:20px;' + ($$B.ie6 ? 'right:0px;' : '') + 'display:none;"></div>');
	!$$B.ie6 && _Ht.push(	'<div style="width:1px;height:1px;overflow:hidden;display:block;"><input type="text" id="NtFocusElement" /></div>');
	_Ht.push('</div>');
	if( this.currentToolbarMode==0 ){
		initSimplifyToolbarWidth += 42 + ($$B.ie6 ? 7 : ($$B.ie7 ? 2 :0));
		debug('initToolBar setToolbarWidth = '+ initSimplifyToolbarWidth);
		toolbarElemStyle += 'width:'+initSimplifyToolbarWidth+'px;';
	}else if( this.currentToolbarMode==2 ){
		initMinimizeToolbarWidth += 42 + ($$B.ie6 ? 7 : ($$B.ie7 ? 2 :0));
		debug('initToolBar setToolbarWidth = '+ initMinimizeToolbarWidth);
		toolbarElemStyle += 'width:'+initMinimizeToolbarWidth+'px;';
	}else{
		var scrollWidth = NtUtil.scrollWidth();
		var winRt = $$D.windowRect();
		if( winRt.w - scrollWidth < this.minWidth ){
			$$D.css($$O("ntalkerbar-wrapper"), 'width', this.minWidth + 'px');
			debug('initToolBar setToolbarWidth = '+ this.minWidth);
		}
	}
	toolbarElemStyle += 'height:32px;right:0;overflow:visible;z-index:2147483647;' + ($$B.ie6 ? 'position:absolute;bottom:0px;' : 'position:fixed;bottom:0px;');
	debug('initToolBar insert html before');
	var toolbarHtml = '<div id="ntalkerbar-wrapper" class="ntalkerbar-wrapper fixed" style="'+toolbarElemStyle+'">'+_Ht.join('')+'</div>';
	this.element = $$D.insert(document.body.firstChild, toolbarHtml, 'beforeBegin');
	debug('initToolBar insert html complete');
	if( this.currentToolbarMode==2 ){
		this.onScroll();
	}	this.contentElement = $$O('nt_content');
	Ntalker.variable.buddylistTag = $$O('buddylistFlashSpan');
	this.AreaElement = $$O('nt_area');
	$$D.css($$O('nt_area'), 'width', '1px');
	$$D.css($$O('nt_wins'), 'width', '2000px');
	var self = this;
	var __onresize = function(e){self.onResize(e);};
	$$E.addEvent(window, "resize", __onresize);
	var _onLeft  = function(e){self.onLeftScroll(e);};
	var _onRight = function(e){self.onRightScroll(e);};
	$$O('nt_forward') && $$E.addEvent($$O('nt_forward'), 'click', _onLeft);
	$$O('nt_back') && $$E.addEvent($$O('nt_back'), 'click',   _onRight);
	var btnCustom = $$O('ntalkerCustomTempButton');
	var __over = function(){
		$$D.addClass(btnCustom, 'hover');
	};
	var __out = function(){
		$$D.removeClass(btnCustom, 'hover');
	};
	var __onOpenNewTraingWindow = function(){
		self.onOpenNewTraingWindow();
	};
	btnCustom && $$E.addEvent(btnCustom, 'mouseover', __over);
	btnCustom && $$E.addEvent(btnCustom, 'mouseout', __out);
	btnCustom && $$E.addEvent(btnCustom, 'click', __onOpenNewTraingWindow);
};
_NtBar.onOpenNewTraingWindow = function(){
	var _Ht = [], 
		_V = Ntalker.variable,
		_C = Ntalker.Config,
		_CP= Ntalker.Config.customparams,
		destuid = '3000000',
		chatType= 'traing'
		flashId = "webchat_flash"+destuid+chatType;
	var width  = window.screen.width;
	var height = window.screen.height;
	var flashsrc = _V['scriptPath'] + "/fs/TraingMod.swf?version=" + Ntalker.version.traing_flash;
	var flashvars = [];
	flashvars.push("r="  + _V['scriptPath'] );
	flashvars.push("su=" + _C['services'] );
	flashvars.push("k="  + _C['skin'] );
	flashvars.push("t="  + encodeURIComponent(_V['siteid']) );
	flashvars.push("s="  + encodeURIComponent(_V['user_sid']) );
	flashvars.push("u="  + encodeURIComponent(_V['user_id']) );
	flashvars.push("n="  + encodeURIComponent(_V['user_name']) );
	flashvars.push("d="  + encodeURIComponent(destuid) );
	flashvars.push("dn=" + encodeURIComponent(NtLang['customApplicationButtonText']) );
	flashvars.push("m=0" );
	flashvars.push("localeChain=" + _CP['localeChain'] );
	flashvars.push("ot=1" );
	flashvars.push("ct=" + chatType );
	flashvars.push("lst="+ _CP['lstupdated'] );
	flashvars.push("v="+ Ntalker.version.traing_flash );
	_Ht.push('<html>');
	_Ht.push(	'<head>');
	_Ht.push(		'<title>'+NtLang['customApplicationButtonText']+'</title>');
	_Ht.push(		'<script language="javascript" type="text/javascript">');
	_Ht.push(		'function maximizeWindow() {');
	_Ht.push(		'	if(window.top != window) return;');
	_Ht.push(		'	try{');
	_Ht.push(		'		var offset = (navigator.userAgent.indexOf("Mac") != -1 || navigator.userAgent.indexOf("Gecko") != -1 || navigator.appName.indexOf("Netscape") != -1) ? 0 : 4;');
	_Ht.push(		'		window.moveTo(-offset, -offset);');
	_Ht.push(		'		window.resizeTo(screen.availWidth + (2 * offset), screen.availHeight + (2 * offset));');
	_Ht.push(		'	}catch(e){}');
	_Ht.push(		'}');
	_Ht.push(		'</script>');
	_Ht.push(	'</head>');
	_Ht.push(	'<body style="margin:0;padding:0;" onload="maximizeWindow();">');
	_Ht.push(		'<object width="100%" height="100%" id="'+flashId+'"');
	if( $$B.msie ){
		_Ht.push(' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" >');
		_Ht.push('<param name="movie" value="'+flashsrc+'">');
	}else{
		_Ht.push(' type="application/x-shockwave-flash" data="'+flashsrc+'">');
	}
	_Ht.push(		'<param name="menu" value="true">');
	_Ht.push(		'<param name="salign" value="LT">');
	_Ht.push(		'<param name="allowScriptAccess" value="always">');
	_Ht.push(		'<param name="wmode" value="Window">');
	_Ht.push(		'<param name="allowFullScreen" value="true">');
	_Ht.push(		'<param name="flashvars" value="'+flashvars.join('&')+'">');
	_Ht.push(		'</object>');
	_Ht.push(	'</body>');
	_Ht.push('</html>');
	var photoWallWindow = window.open('about:blank', "", "left=0, top=0, width="+width+",height="+height+",toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=no,resizable=no,channelmode=yes" );
	try{
		var windowContent = photoWallWindow.document || photoWallWindow.contentWindow.document;
	}catch(e){}
	function writeHtml(){
		windowContent.charset = "utf-8";
		windowContent.write(_Ht.join(''));
		windowContent.close();
		photoWallWindow.focus();
	}
	if( $$B.mozilla ){
		writeHtml();
	}else{
		setTimeout(writeHtml, 100);
	}
};_NtBar.onScroll = function(e){
	var _CP = Ntalker.Config.customparams;
	var openButton = $$O("ntalkerbar"), toolbarTop, toolBarSpan = IMToolBar.element;
	if( $$B.chrome && toolBarSpan ){
		clearTimeout(IMToolBar.scroltimerID);
		IMToolBar.scroltimerID = setTimeout(function(){
		var setNewZIndex = $$D.css(toolBarSpan, 'z-index') == '2147483647' ? '2147483646' : '2147483647';
			debug('ntToolbar.onScroll:: chrome setzIndex = ' + setNewZIndex);
			$$D.css(toolBarSpan, 'z-index', setNewZIndex);
		}, 400);
	}else if( $$B.ie6 && ( _CP['enableScroll'] || IMToolBar.currentToolbarMode==2 ) ){ 		var openedChat = chatWindowManager ? chatWindowManager._chatWndsArray.length : 0;
		var openedBuddy = im_myIMWindow && im_myIMWindow.isShow ? true : false;
		if( openedChat > 0 || openedBuddy ){
			if( $$B.StrictMode ){
				toolbarTop = document.documentElement.scrollTop + document.documentElement.clientHeight - toolBarSpan.offsetHeight;
				if (toolBarSpan.offsetParent == document.body) {
					toolbarTop = toolbarTop - toolBarSpan.offsetParent.offsetTop - toolBarSpan.offsetParent.clientTop;
				}
			}
			else{
				toolbarTop = document.body.scrollTop + document.body.clientHeight - toolBarSpan.offsetHeight;
			}
			$$D.css(toolBarSpan, "top", toolbarTop+'px');
			return;
		}
		clearTimeout(IMToolBar.scroltimerID);
		$$D.css($$O("ntalkerbar"), "visibility", "hidden");
		IMToolBar.scroltimerID = setTimeout(function(){
			if( $$B.StrictMode ){
				toolbarTop = document.documentElement.scrollTop + document.documentElement.clientHeight - toolBarSpan.offsetHeight;
				if (toolBarSpan.offsetParent == document.body) {
					toolbarTop = toolbarTop - toolBarSpan.offsetParent.offsetTop - toolBarSpan.offsetParent.clientTop;
				}
			}
			else{
				toolbarTop = document.body.scrollTop + document.body.clientHeight - toolBarSpan.offsetHeight;
			}
			$$D.css(toolBarSpan, "top", toolbarTop+'px');			debug('<i>onScroll visibility:visible;</i>');
			$$D.css($$O("ntalkerbar"), "visibility", "visible");
			$$D.animate($$O("ntalkerbar"), {opacity:100}, 1000, 'easeOutCubic',function(){
				$$O("ntalkerbar").style.filter="";
			});
		}, 800);
	}
};
_NtBar.onResize = function(e){
	var openedChat = chatWindowManager ? chatWindowManager._chatWndsArray.length : 0;
	var openedBuddy = im_myIMWindow && im_myIMWindow.isShow ? true : false;
	if( $$B.ie6 && openedChat <= 0 && !openedBuddy ){
		clearTimeout(IMToolBar.resizetimerID);		IMToolBar.resizetimerID = setTimeout(function(){
			debug('<b>IMToolBar.onResize:: Exec onToolBarTextChanage()</b>');
			if( Ntalker.temp.cssLoaded ) IMToolBar.onToolBarTextChanage();
			IMToolBar.initScroll();
			debug('IMToolBar.onResize:: Exec onScroll()');
			IMToolBar.onScroll();
		}, 400);
	}else{
		debug('<b>IMToolBar.onResize:: Exec onToolBarTextChanage()</b>');
		if( Ntalker.temp.cssLoaded ) IMToolBar.onToolBarTextChanage();
		IMToolBar.initScroll();
		debug('IMToolBar.onResize:: Exec onScroll()');
		IMToolBar.onScroll();
	}
	var appWindElem = $$O(IMToolBar.curApplicationId);
	debug('IMToolBar.resize::5, curApplicationId=' + IMToolBar.curApplicationId);
	if( appWindElem && $$B.ie6 ){
		var winRt = $$D.windowRect();
		var appWindRt = $$D.clientRect(appWindElem);
		var appWindRight = Math.round((winRt.w-appWindRt.w)/2);
		$$D.css(appWindElem, 'right', appWindRight + 'px');
		debug('IMToolBar.resize:: window.width='+winRt.w+', appRight='+appWindRight);
	}
};_NtBar.onToolBarTextChanage = function(){
	var _C = Ntalker.Config;
	var toolbarWidth, AreaWidth;
	var friendButton=$$O("nt_firend");
	if( this.currentToolbarMode == 1 ){		if(friendButton){
			$$D.css(friendButton,"width","auto");
			var tempWidth=parseInt($$D.clientRect(friendButton).w)-parseInt($$D.css(friendButton, "paddingLeft"))-parseInt($$D.css(friendButton, "paddingRight"));
			$$D.css(friendButton,"width",tempWidth+"px");
		}		var scrollWidth = NtUtil.scrollWidth();
		var winRt = $$D.windowRect();
		var width = $$D.clientRect($$O("ntalkerbar-wrapper")).w;
		if( winRt.w - scrollWidth < this.minWidth ){
			debug('ntToolbar.onToolBarTextChanage:: width='+width+', setToolbarWidth = '+this.minWidth);
			$$D.css($$O("ntalkerbar-wrapper"), 'width', this.minWidth + 'px');
			width = this.minWidth;
		}else{
			debug('ntToolbar.onToolBarTextChanage:: width='+width+', setToolbarWidth = 100%');
			$$D.css($$O("ntalkerbar-wrapper"), 'width', '100%');
			width = winRt.w - scrollWidth;
		}
		toolbarWidth = width - parseInt($$D.css($$O('ntalkerbar'), "marginLeft")) - parseInt($$D.css($$O('ntalkerbar'), "marginRight")) + parseInt($$D.css($$O('nt_content'), "borderLeftWidth")) - parseInt($$D.css($$O('nt_content'), "borderRightWidth"));
		$$A.each($$D.filter(this.contentElement.childNodes, 'span'), function(elem){
			if( $$D.css(elem, 'display') != 'none' ){
				toolbarWidth -= parseInt( $$D.clientRect(elem).w );
				toolbarWidth -= 1;
			}
		});
		AreaWidth = toolbarWidth - ($$B.ie6 ? 9 : 0);
	if( !isNaN(AreaWidth) && AreaWidth > 0 ){
		$$D.css(this.AreaElement, 'width', AreaWidth + 'px');
	}
	}else if( this.currentToolbarMode == 0 ){		if(friendButton){
			$$D.css(friendButton,"width","auto");
			var tempWidth=parseInt($$D.clientRect(friendButton).w)-parseInt($$D.css(friendButton, "paddingLeft"))-parseInt($$D.css(friendButton, "paddingRight"));
			$$D.css(friendButton,"width",tempWidth+"px");
		}		toolbarWidth = parseInt($$D.css($$O('ntalkerbar'), "marginLeft")) + parseInt($$D.css($$O('ntalkerbar'), "marginRight")) + parseInt($$D.css($$O('nt_content'), "borderLeftWidth")) + parseInt($$D.css($$O('nt_content'), "borderRightWidth"));
		$$A.each($$D.filter(this.contentElement.childNodes, 'span'), function(elem){
		   if( /^(spanSwitch|ntConfiguration|spanSystem|spanGroup|spanBuddylist)$/.test(elem.id) || elem.className.indexOf('customlink') > -1 || elem.className.indexOf('applicationItem') > -1 ){
				$$D.css(elem, 'display', 'block');
				toolbarWidth += $$D.clientRect(elem).w;
			}
		});
		if( $$B.ie6 ){
			$$D.css(this.AreaElement, 'width', '1px');
			toolbarWidth += 2;
		}
		toolbarWidth = toolbarWidth + ($$B.ie6 ? 5 : 0);
		debug('ntToolbar.onToolBarTextChanage:: setToolbarWidth='+toolbarWidth+'');
		!isNaN(toolbarWidth) && $$D.css(this.element, 'width', toolbarWidth + 'px');
	}else if( this.currentToolbarMode == 2 ){
		if($$D.css($$O('ntalkerbar'), "display")=="none") return;
		toolbarWidth = parseInt($$D.css($$O('ntalkerbar'), "marginLeft")) + parseInt($$D.css($$O('ntalkerbar'), "marginRight")) + parseInt($$D.css($$O('nt_content'), "borderLeftWidth")) + parseInt($$D.css($$O('nt_content'), "borderRightWidth"));
		$$A.each($$D.filter(this.contentElement.childNodes, 'span'), function(elem){
		   if( /^(spanSwitch|spanSystem)$/.test(elem.id) ){
				toolbarWidth += $$D.clientRect(elem).w;
			}
		});
		var tagWindowCount = IMToolBar.minWindows.count();
		AreaWidth = tagWindowCount * 130;
		$$D.css(this.AreaElement, 'width', (AreaWidth + 1) + 'px');
		if( $$B.ie6 ){
			AreaWidth += 6;
		}else if( $$B.chrome || $$B.ie8 || $$B.ie7 ){
			AreaWidth += 2;
		}
		toolbarWidth += AreaWidth;
		$$D.css(this.element, 'width', (isNaN(toolbarWidth) ? 160 : toolbarWidth) + 'px');
	}
};_NtBar.initScroll = function(){
	var _V = Ntalker.variable, _C = Ntalker.Config,
		ForwardElemt = $$O('nt_forward'), 
		BackElemt = $$O('nt_back'),
		AreaElement = this.AreaElement,
		WinsElemt = $$O('nt_wins'), WinsWidth = 0,
		AreaWidth = $$D.clientRect(AreaElement).w;
	if( AreaWidth==0 ){		return;
	}
	$$A.each($$D.filter(WinsElemt.childNodes ), function(win){		WinsWidth += parseInt( $$D.css(win, 'width') );
	});
	if( WinsWidth <= AreaWidth ){		$$D.replaceClass(ForwardElemt, 'scroll_pre', 'scroll_pre_disable');
		$$D.replaceClass(BackElemt, 'scroll_next', 'scroll_next_disable');
	}
	else{		if( AreaElement.scrollLeft > 0 ){
			$$D.replaceClass(ForwardElemt, 'scroll_pre_disable', 'scroll_pre');
		}
		else{
			$$D.replaceClass(ForwardElemt, 'scroll_pre', 'scroll_pre_disable');
		}		if( WinsWidth - AreaElement.scrollLeft > AreaWidth ){
			$$D.replaceClass(BackElemt, 'scroll_next_disable', 'scroll_next');
		}
		else{
			$$D.replaceClass(BackElemt, 'scroll_next', 'scroll_next_disable');
		}
	}
};
_NtBar.onLeftScroll = function(e){
	var self = this;
	$$D.animate(self.AreaElement, {scrollLeft:"-130"}, 'slow', 'easeInOutQuint', function(){ 
		self.initScroll();
	});
};
_NtBar.onRightScroll = function(e){
	var self = this;
	var _C = Ntalker.Config,
		ForwardElemt = $$O('nt_forward'), 
		BackElemt = $$O('nt_back'),
		AreaElement = this.AreaElement,
		WinsElemt = $$O('nt_wins'), WinsWidth = 0,
		AreaWidth = $$D.clientRect(AreaElement).w;
	if( AreaWidth==0 ){		return;
	}
	$$A.each($$D.filter(WinsElemt.childNodes ), function(win){		WinsWidth += parseInt( $$D.css(win, 'width') );
	});
	if( WinsWidth - AreaElement.scrollLeft <= AreaWidth ){
		return;
	}
	$$D.animate(self.AreaElement, {scrollLeft:"+130"}, 'slow', 'easeInOutQuint', function(){ 
		self.initScroll();
	});
};
_NtBar.onShowBuddylist = function(e, index){
	if( !im_myIMWindow ) return;
	index = index!=null ? index : 0;
	Ntalker.Config.IMtabIndex = index;
	im_myIMWindow.OnTBShowBuddylist(true);
	IMToolBar.closeMessagebox();
	IMToolBar.hiddenConfigurationMenu();
	IMToolBar.leftMutex('');
};
_NtBar.Mutex = function(type, _MCount){
	var groupMessageCount = _MCount ? _MCount : 0;
	type = type == 'undefined' ? '' : type;
	if( type.indexOf('buddylist') == -1 ){		if(im_myIMWindow) {
			im_myIMWindow.minimize();
		}
	}
	if( type.indexOf('group') == -1 ){		if(groupMessageCount>0 && im_myIMWindow) {
			im_myIMWindow.minimize();
		}
	}
	if( type.indexOf('system') == -1 ){
		this.closeMessagebox();
	}
	if( type.indexOf('setting') == -1 ){		this.hiddenConfigurationMenu();
	}
};
_NtBar.leftMutex = function(type, isClickPage){
	if( type != 'siteApplication' ){
		this.closeSiteApplication();
	}	if( type != 'siteHotFocus' ){
		this.closeHotFocus();
	}	if( type != 'applicationItem' && !(isClickPage === true) ){
		this.closeApplicationWindow();
	}
};
_NtBar.enableflash = function(key, className, FclassName, auto){
	var target = $$O(key), self = this;
	this._flashClassName[key] = [className, FclassName];
	if( this._timer[key] && !auto) return;
	if( (this._stopFlash[key]==true || this._flashNum[key] == 6)){
		this._stopFlash[key] = false;
		this._flashNum[key] = 0;
		return;
	}
	if(this._timer[key] == 500){
		this._timer[key] = 1000;
		$$D.replaceClass(target, className, FclassName);
	}else{
		this._timer[key] = 500;
		$$D.replaceClass(target, FclassName, className);
	}
	this._flashNum[key] = !$$S.isDefined(this._flashNum[key]) ? 1 : parseInt(this._flashNum[key]) + 1;
	setTimeout(function(){
		self.enableflash(key, className, FclassName, true);
	},  self._timer[key]);
};
_NtBar.disableFlash = function(key){
	try{
		var className = this._flashClassName[key][1] || '';
		var FclassName = this._flashClassName[key][0] || '';
	}catch(e){}
	$$D.replaceClass($$O(key), className, FclassName);
	this._stopFlash[key] = true;
	this._flashNum[key] = 0;
};_NtBar.initSiteApplication = function(){
	var self = this, _C = Ntalker.Config;
	if( !$$O('nt_app') ){
		return;
	}
	var __buttonOver = function(e){
		$$D.addClass($$O('siteApplication'), "hover");
	};
	var __buttonOut = function(e){
		$$D.removeClass($$O('siteApplication'), "hover");
	};
	$$E.addEvent($$O('nt_app'), 'mouseover', __buttonOver);
	$$E.addEvent($$O('nt_app'), 'mouseout',  __buttonOut);
	this.t_menu = new NtMenu(true);
	var __viewNoneMyAppMenu = function(e){
		self.loadSiteApplication();
		self.t_menu.show();
		self.inited['myapp'] = true;
	};
	var __visibleCallFunction = function(e){
		$$D.addClass($$O('siteApplication'), 'selected');
		self.leftMutex("siteApplication");		var menuElem = self.t_menu._Menu;
		var menuRect = $$D.clientRect(menuElem);
		$$D.css(menuElem, 'height', '1px');
		$$D.animate(menuElem, {height:(menuRect.h - 2)}, 'fast', 'easeInOutQuint', function(){});
	};
	var __openMyAppItem = function(o){
		if(o.attributes['k'].value=='app_close'){
			self.closeSiteApplication();
		}else{
			window.open(o.attributes["url"].nodeValue);
		}
	};
	var __openedCallFunction = function(){
		self.closeSiteApplication();
	};
	this.t_menu.init(
		$$O('ntalkerbar'), 
		$$O('nt_app'), 
		{
			id: 'siteApplicationMenu',
			className:'ntalkerbar-menuleft',
			style:'left:0px;width:120px;', 
			childNode:{
					tagName:'div', 
					className:'TopGradient', 
					childNode:{tagName:'div', className:'BottomGradient'}
			}
		},
		{className: 'nt-item-over'},
		{className: 'nt-item-out'},
		{callback:__openMyAppItem, exec: false},
		__viewNoneMyAppMenu,
		__visibleCallFunction,
		__openedCallFunction
	);
};
_NtBar.closeSiteApplication = function(){
	var self = this;
	var menuElem = $$O('siteApplicationMenu');
	if( !menuElem ){
		return;
	}
	var menuRect = $$D.clientRect(menuElem);
	$$D.animate(menuElem, {height:1}, 'fast', 'easeInOutQuint', function(){
		menuElem.parentNode.removeChild(menuElem);
		self.t_menu._MenuInited = false;
		$$D.removeClass($$O('siteApplication'), 'selected');
	});
	this.inited['myapp'] = false;
};
_NtBar.loadSiteApplication=function(){
	var _C  = Ntalker.Config;
	var t_menu = this.t_menu, self=this;
	var count=0; padding='';
	var array = Ntalker.variable.myApp;
	t_menu.add('app_close',{text:'&nbsp;&nbsp;',custom:{type:'close', className:"siteApplicationClose",style:''}});
	for(k in array){
		if( array[k].menuitems.length > 0){
			t_menu.add('app_line_' + k, {text:'',custom:{style:'border-top:1px #cccccc dotted;magin:1 1 0 0;font-size:0px;height:1px;line-height:1px;',type:'line',className:'nt-item-out'}});
			}
		for(v in array[k].menuitems){ 
			padding='6px';
			if(count>10) break;
			var icon = array[k].menuitems[v].icon ? array[k].menuitems[v].icon : _C['publicDIR'] + 'app_ico.gif';
				t_menu.add('app_' +k+ v, {
					  text : array[k].menuitems[v].title,
					custom:{
					style:'background-image:url(' + icon + ');background-repeat:no-repeat;overflow:hidden;background-position: 5px 50%;padding-left:'+padding+';',
						url : array[k].menuitems[v].url,
						className:'nt-item-out',
						type:'item'
						}
					}
				);
			if(array[k].groupname==NtLang['CONST_siteApplication'])count++;
		}
	}
};
_NtBar.initHotFocus = function(){
	var self = this, _C = Ntalker.Config;
	if( !$$O('nt_hot') ){
		return;
	}
	var __visibleActivity = function(e){
		$$E.fixEvent(e).stopPropagation();
		self.showHotFocus(e);
	};
	var __buttonOver = function(e){
		$$D.addClass($$O('siteHotFocus'), "hover");
	};
	var __buttonOut = function(e){
		$$D.removeClass($$O('siteHotFocus'), "hover");
	};
	$$E.addEvent($$O('nt_hot'), 'click', __visibleActivity);
	$$E.addEvent($$O('nt_hot'), 'mouseover', __buttonOver);
	$$E.addEvent($$O('nt_hot'), 'mouseout',  __buttonOut);
};
_NtBar.showHotFocus = function(e){
	this.leftMutex('siteHotFocus');
	if( this.inited['activity'] ){
		this.closeHotFocus();
		return;
	}
	var url, HotButton = $$O('nt_hot'), 
		self = this, _Ht = [],
		_C = Ntalker.Config,
		_V = Ntalker.variable;
	var left = $$D.clientRect(HotButton).left - $$D.clientRect(HotButton.parentNode.parentNode).left - 1;
	this.focusTag();
	_Ht.push('<span id="hotFocusMenu" class="ntalkerbar-menuleft" style="">');
	_Ht.push(	'<div class="TopGradient">');
	_Ht.push(		'<div class="BottomGradient">');
	_Ht.push(			'<div style="height:30px;">');
	_Ht.push(				'<span id="newactivity_tag" class="newactivity_tag newactivity_tag_select">' + NtLang['hotFocusButtonText'][1] + '</span>');
	_Ht.push(				'<span id="hotactivity_tag" class="hotactivity_tag">' + NtLang['hotFocusButtonText'][2] + '</span>');
	_Ht.push(				'<span id="activity_close" class="ntclose"></span>');
	_Ht.push(				'<br class="clearfloat" />');
	_Ht.push(			'</div>');
	_Ht.push(			'<div id="newactivity" class="nt-tagcontent" style="display:block;"><div style="padding:5px;">' + NtLang['hotFocusButtonText'][1] + NtLang['LoadingText'] + '...</div></div>');
	_Ht.push(			'<div id="hotactivity" class="nt-tagcontent" style="display:none;"><div style="padding:5px;">' + NtLang['hotFocusButtonText'][2] + NtLang['LoadingText'] + '...</div></div>');
	_Ht.push(		'</div>');
	_Ht.push(	'</div>');
	_Ht.push('</span>');
	var menuElem = $$D.insert($$O('ntalkerbar'), _Ht.join(''), 'beforeEnd');
	$$D.addClass($$O('siteHotFocus'), "selected");	__getHotFocusData();	function __getHotFocusData(){
		if( !_C['hotserver'] ){
			_C['waitRetuenServiceUrl'] = true;
		 	return;
		}
		url = _C['hotserver'] + '?query=siteactivity&siteid=' + _V['siteid'] + '&uid=' + _V['user_id'] + '&sid=' + _V['user_sid'] + '&maxnum=7&cachemode=true' ;
		$$C.load({src: url}, false, JsIM_setHotFocusData);
	};
	$$O('newactivity_tag').onclick = function(e){
		$$E.fixEvent(e).stopPropagation();
		$$D.replaceClass($$O('newactivity_tag'), '', 'newactivity_tag_select');
		$$D.css($$O('newactivity'), 'display', 'block');
		$$D.replaceClass($$O('hotactivity_tag'), 'hotactivity_tag_select', '');
		$$D.css($$O('hotactivity'), 'display', 'none');
	};
	$$O('hotactivity_tag').onclick = function(e){
		$$E.fixEvent(e).stopPropagation();
		$$D.replaceClass($$O('newactivity_tag'), 'newactivity_tag_select', '');
		$$D.css($$O('newactivity'), 'display', 'none');
		$$D.replaceClass($$O('hotactivity_tag'), '', 'hotactivity_tag_select');
		$$D.css($$O('hotactivity'), 'display', 'block');
	};
	var __closeHotFocus = function(){
		self.closeHotFocus();
	};
	$$E.addEvent($$O('activity_close'), 'click', __closeHotFocus);
	this.inited['activity'] = true;
	$$D.css(menuElem, 'display', 'block');
	var menuHeight = $$D.clientRect(menuElem).h - 2;
	$$D.css(menuElem, 'height', '1px');
	$$D.animate(menuElem, {height:menuHeight}, 'fast', 'easeInOutQuint', function(){});
};
_NtBar.closeHotFocus = function(){
	var menuElem = $$O('hotFocusMenu');
	if( !menuElem ){
		return;
	}
	$$D.animate(menuElem, {height:1}, 'fast', 'easeInOutQuint', function(){ 
		menuElem.parentNode.removeChild(menuElem);
		$$D.removeClass($$O('siteHotFocus'), "selected");
	});
	this.inited['activity'] = false;
};
_NtBar.initCustomApplication = function(){
	var self = this, 
		_V = Ntalker.variable,
		_A = Ntalker.Config.application;	var __openApplicationWindow = function(e){
		var event = $$E.fixEvent(e);
		event.stopPropagation();
		var targetElement = event.target;
		while(targetElement){
			if( /applicationItem/.test(targetElement.className) ){break;}
			targetElement = targetElement.parentNode;
		}
		return targetElement.getAttribute('k');
	};
	var __buttonClick = function(e){
		var k = __openApplicationWindow(e);
		self.openApplicationWindow(k, 'toolbar');
	};
	var __tipCallBack = function(e){
		var k = __openApplicationWindow(e);
		self.openApplicationWindow(k, 'tip');
	};
	var __buttonOver = function(e){
		var event = $$E.fixEvent(e);
        event.stopPropagation(e);
		var targetElement = event.target;
		while(targetElement){
			if( /applicationItem/.test(targetElement.className) ){break;}
			targetElement = targetElement.parentNode;
		}
		$$D.addClass(targetElement, "hover");
	};
	var __buttonOut = function(e){
		var event = $$E.fixEvent(e);
        event.stopPropagation(e);
		var targetElement = event.target;
		while(targetElement){
			if( /applicationItem/.test(targetElement.className) ){break;}
			targetElement = targetElement.parentNode;
		}
		$$D.removeClass(targetElement, "hover");
	};
	for(var k in _A ){
		if( $$O(_A[k]['id'] + '_button') ){
			$$E.addEvent($$O(_A[k]['id'] + '_button'), 'click', __buttonClick);
			$$E.addEvent($$O(_A[k]['id'] + '_button'), 'mouseover', __buttonOver);
			$$E.addEvent($$O(_A[k]['id'] + '_button'), 'mouseout',  __buttonOut);
		}
		if( _A[k]['tip']=='1' && !this.Tip ){			Ntalker.temp.Tip = new ntTip($$D.filter($$O(_A[k]['id'] + '_button').childNodes)[0], _A[k]['content'] || '', k);
			debug('new ntTip');			$$C.load({src: 'http://cpa.ntalker.com/ntalkerad.php?siteid='+Ntalker.variable.siteid+'&ref='+document.referrer}, false, function(){
				if( typeof(NTALKER_AD_SHOW)!=='undefined' ){
					debug('ntTip content load complete');
					Ntalker.temp.Tip.init(NTALKER_AD_SHOW);
					setTimeout(function(){
						debug('ntTip show');
						Ntalker.temp.Tip.show();
					}, 1000);
				}else{
					debug('NTALKER_AD_SHOW is undefined');
				}
			});
		}
	}
};
_NtBar.openApplicationWindow = function(k, from){
	if( !k ){
		return;
	}
	debug('ntToolbar.openApplicationWindow start');
	var appWidth,appHeight,iframeWidth,iframeHeight;
	var isAutoPosition = false,_A = Ntalker.Config.application,
		_V = Ntalker.variable, 
		_C = Ntalker.Config, self = this,
		_Ht = [],
		winRt = $$D.windowRect();
	var curId = this.curApplicationId = _A[k]['id'];
	var appWin = $$O(curId);
	var appLoadingID = curId + '_loading';
	var appIfrID = curId + '_iframe';
	var appBtnID = curId + '_button';
	var appCloseBtnID = curId + '_close';
	var appURL = _A[k]['url'] + (_A[k]['url'].indexOf('?')===-1 ? '?' : '&'  ) + 'siteid=' + _V['siteid'] + '&m=User&a=remoteLogin&uid=' + _V['user_id'] + '&username=' +encodeURIComponent(_V['user_name']) + '&sessionid=' + _V['user_sid'] + '&r=' + _V['scriptPath'] + '&imsid=' + Ntalker.variable.imsid;
	var appType = _A[k]['type'];	var openedApp = false;	if( _A[k]['mutex']=='1' ){
		for(var i in _A ){
			if( $$O(_A[k]['id']) ) openedApp = true;
		}
	}	if( Ntalker.temp.Tip ) Ntalker.temp.Tip.hiden(k);	if( !openedApp ){		var url = _C['services'] + "/func/statistic.php?siteid="+_V['siteid']+"&uid="+_V['user_id']+"&type=21&mode=1&from="+from+"&destid="+k+"&rnd="+new Date().getTime();
		$$C.load({tagName:'img', href:url});		_V['applicationOpened'] = true;		this.Mutex('');		this.leftMutex('');		this.focusTag();
		var winHeight = Math.max(document.body.scrollHeight || document.documentElement.scrollHeight, document.documentElement.clientHeight);
		if( !$$O('ntApplicationBackground') ){
			this.backgroundDiv = $$D.create('div', {id:"ntApplicationBackground", className:'ntalker_application_background', style:"z-index:99;position:absolute;left:0px;top:0px;background:#000000;opacity:0;filter:alpha(opacity:0);width:100%;height:"+winHeight+"px;"});
		}
		if( _A[k]['height']=='auto' || _A[k]['width']=='auto' ){
			appHeight = _A[k]['height']=='auto' ? parseInt(winRt.h*0.8) : parseInt(_A[k]['height']);
			appWidth = _A[k]['width']=='auto' ? parseInt(appHeight/3*4) : parseInt(_A[k]['width']);
			iframeHeight = appHeight - 24 - 11;
			iframeWidth = appWidth;
			isAutoPosition  = true;
		}else{
			iframeHeight = parseInt(_A[k]['height']);
			iframeWidth = parseInt(_A[k]['width']);
			appHeight = iframeHeight + 24;
			appWidth = iframeWidth;
		}
		appURL += (_A[k]['Parameters'] ? '&'+_A[k]['Parameters'] : '');
		appURL += '&height=' + iframeHeight;		var appWindRight = Math.round((winRt.w-appWidth)/2);
		debug('NtDiscuzTbar.openApplicationWindow::isAutoPosition='+isAutoPosition+',iframeHeight='+iframeHeight+', iframeWidth='+iframeWidth+', setLeft=' + appWindRight);
		var winBottom = _A[k]['align'] == 'bottom' ? 28 : (winRt.h - appHeight)/2;
		var appWinBackgroundStyle = !isAutoPosition ? 'background:transparent;' : 'background:#AAAAAA;';
		_Ht.push('<div id="' + curId + '" class="app_win" style="'+appWinBackgroundStyle+'position:fixed !important; _position:absolute;width:'+appWidth+'px;height:'+appHeight+'px;right:'+appWindRight+'px;bottom:'+winBottom+'px;">');
		if( isAutoPosition ){
		_Ht.push(	'<div class="app_win_header">');
		_Ht.push(		'<span class="app_itemImg"><img src="' + _A[k]['image'].src + '" border="0" /></span>');
		_Ht.push(		'<span class="app_itemText">' + _A[k]['name'] + '</span>');
		_Ht.push(		'<span id="'+appCloseBtnID+'" class="app_itemClose"></span>');
		_Ht.push('</div>');
		}else{
			_Ht.push('<div class="app_win_header" style="overflow:visible;">');
			_Ht.push('<span id="'+appCloseBtnID+'" class="app_itemClose" style=""></span>');
			_Ht.push('</div>');
		}		_Ht.push(	'<div id="span' + appIfrID + '" class="app_win_body">');
		_Ht.push(		'<div id="' + appLoadingID + '" style="background:url(' + _C['publicDIR'] + '/loading.gif) no-repeat ' + (iframeWidth - 32)/2 + 'px ' + (iframeHeight - 32)/2 + 'px; width:' + iframeWidth + 'px;height:' + iframeHeight + 'px;"></div>');
		if( appType == 'iframe' ){
			_Ht.push(	'<iframe id="' + appIfrID + '" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + appURL + '" frameborder="0" style="overflow: hidden;display:block;z-index:9999;" allowtransparency="true" scrolling="No"></iframe>');
		}else{
			appURL += "&from=" + from + "&activity_flash=" + Ntalker.version.activity_flash;
			_Ht.push(	'<div style="display:block;width:'+iframeWidth+'px;height:'+iframeHeight+'px;" id="' + appIfrID + '"></div>');
		}
		_Ht.push(	'</div>');
		if( isAutoPosition ){
			_Ht.push(	'<div class="app_win_footer">');
			_Ht.push(	 'Powered by Ntalker');
			_Ht.push(	'</div>');
		}
		_Ht.push('</div>');
		$$D.insert($$O('ntalkerbar'), _Ht.join(''), 'beforeEnd');		if( appType == 'flash' ){
			$$D.css($$O(appLoadingID),'display', 'none');
			var flashvars = {siteid: _V['siteid'], uid: _V['user_id'], username: encodeURIComponent(_V['user_name']), sessionid: _V['user_sid'] }, 
				params = {menu:"true", "salign":"LT", "allowScriptAccess":"always", "wmode":"Window", "allowFullScreen": true}, 
				attributes = {};
			ntalker_swfobject.embedSWF(_V['scriptPath'] + appURL, appIfrID, iframeWidth, iframeHeight, "9.0.115", _V['scriptPath']+"/fs/expressInstall.swf", flashvars, params, attributes);			$$D.css($$O(appIfrID), 'display', 'block');
		}else{			$$D.css($$O(appLoadingID),'display', 'none');
		}
		appWin = $$O(_A[k]['id']);		var __closeApplicationWindow = function(){
			self.closeApplicationWindow(k);
		};
		var __overApplicationCloseButton = function(){
			$$D.replaceClass($$O(appCloseBtnID), 'app_itemClose', 'app_itemClose_over');
		};
		var __outApplicationCloseButton = function(){
			$$D.replaceClass($$O(appCloseBtnID), 'app_itemClose_over', 'app_itemClose');
		};
		$$E.addEvent($$O(appCloseBtnID), 'click', __closeApplicationWindow);
		$$E.addEvent($$O(appCloseBtnID), 'mouseover', __overApplicationCloseButton);
		$$E.addEvent($$O(appCloseBtnID), 'mouseout', __outApplicationCloseButton);
	}else{
		_A[k]['mutex']=="1" && this.closeApplicationWindow(k);
		return;
	}	$$D.addClass($$O(appBtnID), 'selected');
	$$D.animate(this.backgroundDiv, {opacity:75}, 400, "swing", function(){});
	$$D.animate(appWin, {opacity:100}, 'fast', "easeOutQuint", function(){});
	debug('ntToolbar.openApplicationWindow::opend');
};
_NtBar.closeApplicationWindow = function(k){
	var _A = Ntalker.Config.application;
	if( !k ){
		for(var k in _A ){
			_A[k]['mutex']=="1" && this.closeApplicationWindow(k);
		}
		return;
	}
	var _A = Ntalker.Config.application,
		appBtnID = _A[k]['id'] + '_button',
		winElem = $$O(_A[k]['id']),
	applicationButton = $$O(appBtnID),
	appIfrID = _A[k]['id'] + '_iframe';
	if( winElem ){
		$$D.removeClass($$O(appBtnID), 'selected');			try{
				if( $$B.ie8 ) $$O(appIfrID).src = '';
				winElem && winElem.parentNode.removeChild(winElem);
				$$O('ntApplicationBackground').parentNode.removeChild($$O('ntApplicationBackground'));
				Ntalker.variable.applicationOpened = false;
			}catch(e){
				winElem && winElem.parentNode.removeChild(winElem);
				$$O('ntApplicationBackground') && $$O('ntApplicationBackground').parentNode.removeChild($$O('ntApplicationBackground'));
				try{
					var rootElements = $$D.filter(document.body.childNodes);
					for(i=0; i<rootElements.length; i++){
						if(rootElements[i].className == 'ntalker_application_background' && rootElements[i].id == 'ntApplicationBackground') 
							rootElements[i].parentNode.removeChild(rootElements[i]);
					}
				}catch(e){}
			}	}
};
_NtBar.updateUserNumber = function(onlineUser, totalUser){
	if( $$O('nt_firend') ){
		$$O('nt_firend').innerHTML = sprintf(NtLang['buddylistButtonText'][0], String(onlineUser), String(totalUser));
	}
	var strOnline = String(onlineUser) + '' + String(totalUser);
	if( strOnline.length>2 ){
		this.onToolBarTextChanage();
	}
};
_NtBar.initMessageBox=function(){
	var self = this, _C = Ntalker.Config;
	if( !$$O('nt_system') ){
		return;
	}
	var currentTag='divFeedContent',current_feed_Page=1,current_im_page=1;
	var __visibleActivity=function(currentTag,current_feed_Page,current_im_page){
		self.Mutex('system');
		self.leftMutex('');
		self.showMessageBox(currentTag,current_feed_Page,current_im_page);
	};
	var __hiddenActivity=function(e){
		if(IMToolBar&&IMToolBar.closeMessagebox){
			IMToolBar.closeMessagebox();
		}
	};
	var __buttonClick = function(){
		self.disableFlash('spanSystem');
		if(!$$O('feed_ul')&&!$$O('im_ul')){
			__visibleActivity.call(this);
			$$D.addClass($$O('spanSystem'), 'selected');
			$$D.css($$O('messageboxmenu'), 'height', '1px');
			var menuHeight = self._feedHeight <= 80 ? 119 : (self._feedHeight +38);
			menuHeight=(self._spanHeight||menuHeight);
			$$D.animate($$O('messageboxmenu'), {height:menuHeight}, 'fast', 'easeInOutQuint', function(){});
		}else{
			__hiddenActivity.call(this);
		}
	};
	var __buttonOver = function(e){
		$$D.addClass($$O('spanSystem'), "hover");
	};
	var __buttonOut = function(e){
		$$D.removeClass($$O('spanSystem'), "hover");
	};
	$$E.addEvent($$O('nt_system'), 'click', __buttonClick);
	$$E.addEvent($$O('nt_system'), 'mouseover', __buttonOver);
	$$E.addEvent($$O('nt_system'), 'mouseout',  __buttonOut);
	this.countMessageBox("im",false,true);
};
_NtBar.closeMessagebox = function(height){
	var self = this;
	var height=height;
	if( !$$O('messageboxmenu') ){
		return;
	}
	$$D.removeClass($$O('spanSystem'), 'selected');
	$$D.animate($$O('messageboxmenu'), {height:1}, 'fast', 'easeInOutQuint', function(){
		$$O('messageboxmenu').parentNode.removeChild($$O('messageboxmenu'));
		if(height){
			self._feedHeight=height;
		}else{
		self._feedHeight=0;
		}
	});
	this._Button="";
	this.countMessageBox('im',null,true);
};
_NtBar.contentMessageBox=function(currentTag,current_feed_Page,current_im_page,e){
	var _C = Ntalker.Config, _V = Ntalker.variable;
	var MessageBox=$$O('nt_system');
	this.countMessageBox();
	var self=this;
	var perPage=5;
	var _fnum=this._fnum;
	var _inum=this._inum;
	var _anum=this._fnum*1+this._inum*1+this._customMessageCount*1;
	var _feedPage=Math.ceil((_fnum*1)/(perPage*1));
	var _sysPage=Math.ceil((_inum*1)/(perPage*1));
	var _hash=this._Hash;
	var _feedHT=['<ul id="feed_ul">'],_sysHT=['<ul id="im_ul">'];
	var im_show,feed_show;
	var current_feed_Page=typeof(current_feed_Page)=="number"?current_feed_Page:1;
	var current_im_page=typeof(current_im_page)=="number"?current_im_page:1;
	this._current_feed_Page=current_feed_Page;
	this._current_im_page=current_im_page;
	this._currentTag=currentTag;
	var feed_page_content,im_page_content;
	var feed_nex_page,feed_pre_page,im_nex_page,im_pre_page;
	if(current_feed_Page>_feedPage)current_feed_Page=_feedPage;
	if(current_im_page>_sysPage)current_im_page=_sysPage;
	if(current_feed_Page<_feedPage)feed_nex_page=current_feed_Page*1+1;else feed_nex_page=current_feed_Page;
	if(current_feed_Page>1)feed_pre_page=current_feed_Page*1-1;else feed_pre_page=current_feed_Page;
	if(current_im_page<_sysPage)im_nex_page=current_im_page*1+1;else im_nex_page=current_im_page;
	if(current_im_page>1)im_pre_page=current_im_page*1-1;else im_pre_page=current_im_page;
	if(feed_nex_page==current_feed_Page){
		feed_page_content='<span class="nt_box_page"><span class="nt_box_pre" onClick="IMToolBar.contentMessageBox(\'ntFeedTag\','+feed_pre_page+','+current_im_page+',event)" >&nbsp;&nbsp;</span><span style="margin-left:4px;" class="nt_box_nexnone" >&nbsp;&nbsp;</span></span>';
	}else if(feed_pre_page==current_feed_Page){
		feed_page_content='<span class="nt_box_page"><span class="nt_box_prenone" >&nbsp;&nbsp;</span><span class="nt_box_nex" style="margin-left:4px;" onClick="IMToolBar.contentMessageBox(\'ntFeedTag\','+feed_nex_page+','+current_im_page+',event)">&nbsp;&nbsp;</span></span>';
	}else{
		feed_page_content='<span class="nt_box_page"><span class="nt_box_pre" onClick="IMToolBar.contentMessageBox(\'ntFeedTag\','+feed_pre_page+','+current_im_page+',event)">&nbsp;&nbsp;</span><span style="margin-left:4px;" class="nt_box_nex" onClick="IMToolBar.contentMessageBox(\'ntFeedTag\','+feed_nex_page+','+current_im_page+',event)">&nbsp;&nbsp;</span></span>';
	}
	if(im_nex_page==current_im_page){
		im_page_content='<span class="nt_box_page"><span class="nt_box_pre" onClick="IMToolBar.contentMessageBox(\'ntIMTag\','+current_feed_Page+','+im_pre_page+',event)">&nbsp;&nbsp;</span><span style="margin-left:4px;" class="nt_box_nexnone" >&nbsp;&nbsp;</span></span>';
	}else if(im_pre_page==current_im_page){
		im_page_content='<span class="nt_box_page"><span class="nt_box_prenone">&nbsp;&nbsp;</span><span style="margin-left:4px;" class="nt_box_nex" onClick="IMToolBar.contentMessageBox(\'ntIMTag\','+current_feed_Page+','+im_nex_page+',event)">&nbsp;&nbsp;</span></span>';
	}else{
		im_page_content='<span class="nt_box_page"><span class="nt_box_pre" onClick="IMToolBar.contentMessageBox(\'ntIMTag\','+current_feed_Page+','+im_pre_page+',event)">&nbsp;&nbsp;</span><span style="margin-left:4px;" class="nt_box_nex" onClick="IMToolBar.contentMessageBox(\'ntIMTag\','+current_feed_Page+','+im_nex_page+',event)">&nbsp;&nbsp;</span></span>';
	}
	var feed_flag=0,im_flag=0,lineClass="nt_box_line",have_feed=false;
	for(var k=0;k<_hash.length;k++){
		var _V1 = _hash[k];
		var unread="";
		if(_V1.msgtype=='feed'){
			if(feed_flag>=(current_feed_Page-1)*perPage&&feed_flag<(current_feed_Page*1-1)*perPage+perPage*1){
				if(currentTag=="ntFeedTag"){
					if(!_V1.isRead){
						this._rfnum++;unread='style=\"font-weight: bold;\"';
						var _V = Ntalker.variable;
						var desc="feedmsg";
						var siteurl=Ntalker.Config['services'] + "/func/statistic.php?siteid="+_V['siteid']+"&uid="+_V['user_id']+"&destid=0&groupid=0&type=18&mode=2&source=0&desc="+encodeURIComponent(desc)+"&from=sysMsgList&rnd="+new Date().getTime();
						$$C.load({tagName:'img', href:siteurl});
					}
					_V1.isRead=true;
				}
				_feedHT.push('<li style="cursor:pointer;" k="' + _V1.key + '" class="' + lineClass + ' nt_box_out" onClick=\'fIM_navigateToModuleView("'+_V1.id+'", "'+_V1.name+'","'+_V1.opentype+'" ,"'+_V1.activitytype+'", "'+_V1.activityid+'", "'+_V1.key+'", "feed_ul", "feedMsgList","'+_V1.chatid+'","'+_V1.msgtype+'",event)\'>');
				_feedHT.push(	'<div class="nt_box_ico"><img onerror=\'this.src="'+_C['imagesDIR'] + '/notify_userhead.png"\'  src="' + (_V1.iconurl ? _V1.iconurl : _C['imagesDIR'] + '/notify_userhead.png') + '" width=38 height=38 border=0 /></div>');
				_feedHT.push(	'<div class="nt_box_content_big" '+unread+'>');
				_feedHT.push(	_V1.content);
				_feedHT.push(	'</div>');
				_feedHT.push(	'<div class="nt_item_box_close" onClick="IMToolBar.removeMessageBox(\''+_V1.key+'\', \'feed_ul\', false, event)"></div>');
				_feedHT.push(	'<span class="clearfloat"></span>');
				_feedHT.push('<div class="nt_box_button" style="width:100%"></div>');
				_feedHT.push('</li>');
				feed_flag++;
			}else{
				feed_flag++;
			}
		}
		else{
			if(!_V1.msgtype) {continue;}
			if(im_flag>=(current_im_page-1)*perPage&&im_flag<(current_im_page*1-1)*perPage+perPage*1){
				if(currentTag=="ntIMTag"){
					if(!_V1.isRead){
						this._rinum++;unread='style=\"font-weight: bold;\"';
						if(_V1.msgtype=="notify"){
							var _V = Ntalker.variable;
							var desc="msgid_is_"+_V1.msgid;
							var siteurl=Ntalker.Config['services'] + "/func/statistic.php?siteid="+_V['siteid']+"&uid="+_V['user_id']+"&destid=0&groupid=0&type=17&mode=2&source=0&desc="+encodeURIComponent(desc)+"&from=sysMsgList&rnd="+new Date().getTime();
							$$C.load({tagName:'img', href:siteurl});
						}
					}
					 _V1.isRead=true;
				}
				if(_V1.id&&_V1.name&&_V1.opentype!="img"){
					_sysHT.push('<li style="cursor:pointer;" k="' + _V1.key + '" class="' + lineClass + ' nt_box_out" onClick=\'fIM_navigateToModuleView("'+_V1.id+'", "'+_V1.name+'","'+_V1.opentype+'","'+_V1.activitytype+'","'+_V1.activityid+'", "'+_V1.key+'", "im_ul", "sysMsgList","'+_V1.chatid+'","'+_V1.msgtype+'",event,"'+_V1.msgid+'")\'>');
				}else if(_V1.opentype=="img"){
					_sysHT.push('<li style="cursor:pointer;" k=\'' + _V1.key + '\' class=\'' + lineClass + ' nt_box_out\' onClick=\'javascript:window.open("'+(_V1.profileurl?_V1.profileurl:"")+'");IMToolBar.removeMessageBox("'+_V1.key+'","im_ul",false,event);\'>');
			}else{
					_sysHT.push('<li k="' + _V1.key + '" class="' + lineClass + ' nt_box_out" >');
				}
				_sysHT.push(	'<div class="nt_box_ico"><img onerror=\'this.src="'+_C['imagesDIR'] + '/notify_userhead.png"\'  src="' + (_V1.iconurl ? _V1.iconurl : _C['imagesDIR'] + '/notify_userhead.png') + '" width=38 height=38 border=0 /></div>');
				_sysHT.push(	'<div class="nt_box_content_big" ' +unread+'>');
				_sysHT.push(	_V1.content);
				_sysHT.push(	'</div>');
				if(_V1.chatid&&_V1.id&&_V1.msgtype=="request"&&_V1.opentype=="chat")
				{	 
					 _sysHT.push('<div class="nt_item_box_close" onClick="IMToolBar.removeMessageBox(\''+_V1.key+'\', \'im_ul\', false, event);fiM_RefuseRequest(\''+_V1.id+'\',\''+_V1.chatid+'\',\''+_V1.chatsid+'\')"></div>');
				}else{
					_sysHT.push('<div class="nt_item_box_close" onClick="IMToolBar.removeMessageBox(\''+_V1.key+'\', \'im_ul\', false, event)";></div>');
				}
				_sysHT.push(	'<span class="clearfloat"></span>');
				switch(_V1.msgtype){
				case 'notify':
					_sysHT.push('<div class="nt_box_button"></div>');
					break;
				case 'confirm':
					_sysHT.push('<div class="nt_box_button"><input type="button" class="nt_box_ignore" onclick="IMToolBar.removeMessageBox(\''+_V1.key+'\',\'im_ul\',false,event)"><input type="button" class="nt_box_approve" onclick="im_boxConfrim(\''+_V1.id+'\',1,\''+_V1.key+'\',\'im_ul\', event);fIM_navigateToModuleView(\''+_V1.id+'\',\''+_V1.name+'\',\''+_V1.opentype+'\' ,\''+_V1.activitytype+'\', \''+_V1.activityid+'\', \''+_V1.key+'\', \'feed_ul\', \'feedMsgList\',\''+_V1.chatid+'\',\''+_V1.msgtype+'\',event);"></div>');
						break;
				case 'request':
					_sysHT.push('<div class="nt_box_button"><input type="button" class="nt_box_ignore" onclick="fiM_RefuseRequest(\''+_V1.id+'\',\''+_V1.chatid+'\',\''+_V1.chatsid+'\');IMToolBar.removeMessageBox(\''+_V1.key+'\',\'im_ul\',false,event)"><input type="button" class="nt_box_approve" onclick="fIM_navigateToModuleView(\''+_V1.id+'\',\''+_V1.name+'\',\''+_V1.opentype+'\' ,\''+_V1.activitytype+'\', \''+_V1.activityid+'\', \''+_V1.key+'\', \'feed_ul\', \'feedMsgList\',\''+_V1.chatid+'\',\''+_V1.msgtype+'\',event);IMToolBar.removeMessageBox(\''+_V1.key+'\',\'im_ul\',false,event);"></div>');
					break;
				}
				_sysHT.push('</li>');
				im_flag++;
			}else{
					im_flag++;
			}
		}
	}
	for(var i=0;i<Ntalker.variable.ExMsg.length;i++){
		var _ExtMsg=Ntalker.variable.ExMsg[i];
		if(_ExtMsg.msgnumber>0){
			_sysHT.push('<LI class="nt_box_single nt_box_out" onclick="IMToolBar.viewCurstomSystemMessage(\'' + _ExtMsg.url + '\',event);" class="act nt-item-out" url="' + _ExtMsg.url + '"><DIV><a href="javascript:void(0);">' + _ExtMsg.name + ' (' + _ExtMsg.msgnumber + ')</a></DIV></LI>');	
		}
	}
	if(_fnum==0){
		_feedHT.push('<li class="nt_box_single nt_box_out"><div class="nt_box_null">' + sprintf(NtLang['nullMessage'][0], NtLang['systemMessageBoxText'][0]) + '</div></li>');
			_feedHT.push('</ul>');
	}else{
			_feedHT.push('</ul>');
		if(_feedPage>1)
		_feedHT.push(feed_page_content);
	}
	if( _anum - _fnum == 0){
		_sysHT.push('<li class="nt_box_single nt_box_out"><div class="nt_box_null">' + sprintf(NtLang['nullMessage'][0], NtLang['systemMessageBoxText'][1]) + '</div></li>');
			_sysHT.push('</ul>');
	}else{
			_sysHT.push('</ul>');
		if(_sysPage>1)
		_sysHT.push(im_page_content);
	}
	$$O('divFeedContent').innerHTML=_feedHT.join('');
	$$O('divIMContent').innerHTML=_sysHT.join('');
		if($$O('divFeedContent').scrollHeight!=0&&$$O('divFeedContent').scrollHeight>this._feedHeight) {
			this._feedHeight=$$O('divFeedContent').scrollHeight;
		}
		var feedHeight = ($$O('divFeedContent').scrollHeight>this._feedHeight)?($$O('divFeedContent').scrollHeight):(this._feedHeight);
		var imHeight   = $$O('divIMContent').scrollHeight ? ($$O('divIMContent').scrollHeight):(_inum>perPage?perPage*50+20*1:_inum*50+20*1);
		if( feedHeight > imHeight ){
			var paddingHeight = parseInt($$D.css($$O('divFeedContent'), 'paddingTop')) + parseInt($$D.css($$O('divFeedContent'), 'paddingBottom'));
			feedHeight=feedHeight-paddingHeight;
			if(this._feedHeight<feedHeight){
				this._feedHeight=feedHeight+paddingHeight;
			}
			var menuContentHeight = Math.max(80, feedHeight);
			var spanHeight=feedHeight>80 ? menuContentHeight+48 : menuContentHeight+39;
			if($$B.chrome){
				if(_feedPage>1){
					menuContentHeight-=15;
					spanHeight-=15;
					this._feedHeight-=15;
				}
			}
			this._spanHeight=spanHeight;
			if(currentTag=="ntFeedTag"){
				$$D.css($$O('divFeedContent'), 'height', menuContentHeight + 'px' );
			}else{
				$$D.css($$O('divIMContent'), 'height', menuContentHeight + 'px' );
			}
			if(!this._Button){
				this._Button=($$O("messageboxmenu")||"");
			}
			$$D.css(this._Button, 'height', spanHeight + 'px' );
		}else{
			var paddingHeight = parseInt($$D.css($$O('divIMContent'), 'paddingTop')) + parseInt($$D.css($$O('divIMContent'), 'paddingBottom'));
			imHeight=imHeight-paddingHeight;
			if(this._feedHeight<imHeight){
				this._feedHeight=imHeight+paddingHeight;
			}
			var menuContentHeight = Math.max(80, imHeight);
		   	var spanHeight=imHeight>80 ? menuContentHeight+48 : menuContentHeight+39;
		   	if($$B.chrome){
				if(_sysPage>1){
					menuContentHeight-=15;
					spanHeight-=15;
					this._feedHeight-=15;
				}
			}
			   this._spanHeight=spanHeight;
			if(currentTag=="ntFeedTag"){
				$$D.css($$O('divFeedContent'), 'height', menuContentHeight + 'px' );
			}else{
				$$D.css($$O('divIMContent'), 'height', menuContentHeight + 'px' );
		}
			if(!this._Button){
				this._Button=($$O("messageboxmenu")||"");
			}
			$$D.css(this._Button, 'height', spanHeight + 'px' );
	}
	var __mouseOver = function(e){
		e = $$E.fixEvent(e);
		target= searchTag(e.target, "li");
		$$D.replaceClass(target, 'nt_box_out', 'nt_box_over');
		for(var k in target.childNodes ){
			var itemCloseButton = target.childNodes[k];
			if( itemCloseButton && itemCloseButton.className == 'nt_item_box_close' ){
				$$D.css(itemCloseButton, 'background', 'url('+_C['imagesDIR']+'/nt_box_bj.gif) -20px -140px');
			}
		}
	};
	var __mouseOut = function(e){
		e = $$E.fixEvent(e);
		target= searchTag(e.target, "li");
		$$D.replaceClass(target,'nt_box_over','nt_box_out');
		for(var k in target.childNodes ){
			var itemCloseButton = target.childNodes[k];
			if( itemCloseButton && itemCloseButton.className == 'nt_item_box_close' ){
				$$D.css(itemCloseButton, 'background', 'none');
			}
		}
	};
	var __onClick=function(e){
		e = $$E.fixEvent(e);
		target= searchTag(e.target, "li");
		for(var k in target.childNodes ){
			var itemCloseButton = target.childNodes[k];
			if( itemCloseButton && itemCloseButton.className == 'nt_box_content_big' ){
				$$D.css(itemCloseButton, 'font-weight', 'normal');
			}
		}
	};
	for(k in $$O('feed_ul').childNodes){
		var elem = $$O('feed_ul').childNodes[k];
		if( elem.nodeName && elem.nodeName.toUpperCase()== "LI"){
			$$E.addEvent(elem, 'mouseover', __mouseOver);
			$$E.addEvent(elem, 'mouseout', __mouseOut);
			$$E.addEvent(elem, 'click', __onClick);
		}
	}
	for(k in $$O('im_ul').childNodes){
		var elem = $$O('im_ul').childNodes[k];
		if( elem.nodeName &&elem.nodeName.toUpperCase() == "LI"){
			$$E.addEvent(elem, 'mouseover', __mouseOver);
			$$E.addEvent(elem, 'mouseout', __mouseOut);
			$$E.addEvent(elem, 'click', __onClick);
		}
	}
	this.countMessageBox('im',null,true);
};
_NtBar.showMessageBox = function(currentTag,current_feed_Page,current_im_page){
	var _C = Ntalker.Config;
	var _CP = Ntalker.Config.customparams;
	var MessageBox = $$O('nt_system');
	var self=this;
	var _inum=this._inum;
	var _fnum=this._fnum;
	var _rfnum=this._rfnum;
	var _rinum=this._rinum;
	var _anum=this._fnum*1+this._inum*1+this._customMessageCount*1;
	var _Ht=[];
	var isShowFeed="";
	this.focusTag();
	if(!currentTag){
		var _urfnum=this._fnum-this._rfnum;
		var _urinum=this._inum-this._rinum;
		if(_urfnum>0&&_urinum==0){
			currentTag="ntFeedTag";
		}else{
			currentTag="ntIMTag";
	}
	}else{
		currentTag=currentTag;
	}
	if(_CP['quanflag']==0){
		currentTag="ntIMTag";
		isShowFeed="style=\"display:none\"";
	}
	if(currentTag=='ntIMTag'){im_show="block";feed_show="none";im_current="nt_box_currenttag";feed_current="nt_box_tag";}else{im_show="none";feed_show="block";feed_current="nt_box_currenttag";im_current="nt_box_tag";}
	var feed_str=(_fnum-_rfnum>0)?'<span style="color:red" id="feed_num" ><span style="color:black">(</span>'+(_fnum-_rfnum)+'<span style="color:black">)</span></span>':"";
	var im_str=((_inum-_rinum)*1+this._customMessageCount*1>0)?'<span style="color:red" id="im_num" ><span style="color:black">(</span>'+((_inum-_rinum)*1+this._customMessageCount*1)+'<span style="color:black">)</span></span>':"";
	var temp=$$D.clientRect("nt_content").left+$$D.clientRect("nt_content").w-$$D.clientRect("nt_system").left;
	if(temp>300){
		temp=temp-301;
	}else{
		temp=0;
	}
	_Ht.push('<span id="messageboxmenu" class="nt_box_menu" style="right:'+temp+'px;" >');
	_Ht.push('<div class="nt_box_top">');
	_Ht.push('<div class="nt_box_bottom">');
	_Ht.push('	<span id="ntFeedTag" '+isShowFeed+' class=" nt_box_feed '+feed_current+'">' + NtLang['systemMessageBoxText'][0] + feed_str + '</span>');
	_Ht.push('	<span id="ntIMTag" class=" nt_box_im '+im_current+'">' + NtLang['systemMessageBoxText'][1] + im_str + '</span>');
	_Ht.push('	<span class="nt_box_close" onClick="IMToolBar.closeMessagebox();">&nbsp;</span>');
	_Ht.push('<br class="clearfloat" />');
	_Ht.push('<div id="divFeedContent" style="display:'+feed_show+';" class="nt_box_feed_content">' + NtLang['systemMessageBoxText'][0] + NtLang['LoadingText'] + '</div>');
	_Ht.push('<div id="divIMContent" style="display:'+im_show+';" class="nt_box_im_content">' + NtLang['systemMessageBoxText'][1] + NtLang['LoadingText'] + '</div>');
	_Ht.push('</div></div>');
	_Ht.push('</span>');
	this._Button=($$D.insert($$O("ntalkerbar"), _Ht.join(''), 'beforeEnd')||$$O("messageboxmenu"));
	var _V = Ntalker.variable;
	var desc="messagebox";
	var siteurl=Ntalker.Config['services'] + "/func/statistic.php?siteid="+_V['siteid']+"&uid="+_V['user_id']+"&destid=0&groupid=0&type=19&mode=2&source=0&desc="+encodeURIComponent(desc)+"&from=sysMsgList&rnd="+new Date().getTime();
	$$C.load({tagName:'img', href:siteurl});
	this.contentMessageBox(currentTag,current_feed_Page,current_im_page);
	function changetag(type){
		if(type=="feed"){
			$$D.replaceClass($$O('ntFeedTag'),'nt_box_tag','nt_box_currenttag');
			$$D.css($$O('divFeedContent'),'display','block');
			$$D.replaceClass($$O('ntIMTag'),'nt_box_currenttag','nt_box_tag');
			$$D.css($$O('divIMContent'),'display','none');
		}else{
			$$D.replaceClass($$O('ntFeedTag'),'nt_box_currenttag','nt_box_tag');
			$$D.css($$O('divFeedContent'),'display','none');
			$$D.replaceClass($$O('ntIMTag'),'nt_box_tag','nt_box_currenttag');
			$$D.css($$O('divIMContent'),'display','block');
		}
		}
	$$O('ntFeedTag').onclick = function(e){
		$$E.fixEvent(e).stopPropagation();
		self._currentTag = "ntFeedTag";
		changetag('feed');
		self.contentMessageBox(self._currentTag,self._current_feed_Page,self._current_im_page);
	};
	$$O('ntIMTag').onclick = function(e){
		$$E.fixEvent(e).stopPropagation();
		self._currentTag="ntIMTag";
		changetag('im');
		self.contentMessageBox(self._currentTag,self._current_feed_Page,self._current_im_page);
	};
};
_NtBar.countMessageBox=function(type,isread,isnew){
	var _hash=this._Hash;
	var imMsgCount=0;
	var _inum=this._inum;
	var _fnum=this._fnum;
	this._customMessageCount=0;
	for(var i=0;i<Ntalker.variable.ExMsg.length;i++){
		var _ExtMsg=Ntalker.variable.ExMsg[i];
		if(_ExtMsg.msgnumber>0){
			this._customMessageCount=_ExtMsg.msgnumber*1+this._customMessageCount*1;
		}
	}
	if($$O('nt_system')&&isnew==true){
		var unum=(this._fnum-this._rfnum)*1+(this._inum-this._rinum)*1+this._customMessageCount*1;
		var _uinum=this._inum-this._rinum;
		if(_uinum>0){
			$$O('nt_system').innerHTML=NtLang['systemButtonText']+'<span class="nt_box_tip2">('+unum+')</span>';
			var allCount = this._Hash.length;
			if(allCount>0){
				this.enableflash('spanSystem', '', 'flash');
			}else{
				this.disableFlash('spanSystem');
			}
		}else if(unum>=0){
			$$O('nt_system').innerHTML=NtLang['systemButtonText']+'<span class="nt_box_tip2">('+unum+')</span>';
		}
	}
	if($$O('feed_num')&&_fnum-this._rfnum>0){
		$$O('feed_num').innerHTML="<span style='color:black'>(</span>"+(_fnum-this._rfnum)+'<span style="color:black">)</span>';
	}else if($$O('feed_num')){
		$$O('feed_num').innerHTML="";
	}
	if($$O('im_num')&&(_inum-this._rinum)*1+this._customMessageCount*1>0) {
		$$O('im_num').innerHTML="<span style='color:black'>(</span>"+((_inum-this._rinum)*1+this._customMessageCount*1)+'<span style="color:black">)</span>';
	}else if($$O('im_num')){
		$$O('im_num').innerHTML="";
	}
	if(type=="all") return this._customMessageCount*1+_hash.length*1;
};
_NtBar.addMessageBox=function(id,name,content,opentype,iconurl,msgtype,activitytype,activityid,activityname,activityicon,profileurl,chatid,isread,msgid,srcuid,msgtime,chatsid){
	var _hash=this._Hash;
	var _CP = Ntalker.Config.customparams;
	var rand=1, isupdate = false;
	var temp=0;
	var _fnum=this._fnum;
	var _inum=this._inum;
	var _tipTime=1800;
	if(_CP['quanflag']==0){
		if(msgtype=="feed"){
			return;
		}
	}
	function contains(_hash,msgtype,rand){
		for(var i=0;i<_hash.length;i++){if (_hash[i]&&_hash[i].key==msgtype+rand){ temp++; return true;}}
	}
	while(contains(_hash,msgtype,rand)){
		rand=Math.floor(Math.random()*99);
		if(temp>=99) break;
		if(msgtype=="feed"){
			if(_fnum>=50) break;
		}else{
			if(_inum>=50) break;
		}
	}
	for(var i=0;i<_hash.length;i++){
		var tmp=_hash[i];
		if(tmp&&tmp.id==id&&msgtype==tmp.msgtype){
			if(msgtype=="confirm"||msgtype=="request"){
				if(_hash[i].isRead){this._rinum--;isread=true;}
				this._inum--;
				_hash.splice(i,1);
				break;
			}else if(msgtype=="feed"){
				if((srcuid&&tmp.srcuid==srcuid)||tmp.activityid==activityid){
					if(_hash[i].isRead){
						this._rfnum--;
					}
					this._fnum--;
					if((Date.parse(new Date()))/1000-tmp.msgtime>_tipTime){
						isread=false;
						msgtime=Date.parse(new Date())/1000;
					}else{
						isread=tmp.isRead;
						msgtime=tmp.msgtime;
					}
					_hash.splice(i,1);
					break;
				}
				}
			}
		}
	if(_fnum>=50||_inum>=50){
		for(var i=_hash.length-1;i>=0;i--){
			var tmp=_hash[i];
		if(msgtype=="feed"&&_fnum>=50){
				if(tmp&&tmp.msgtype==msgtype){
				this._fnum--;
				if(tmp.isRead) this._rfnum--;
					_hash.splice(i,1);
				break;
			}
		}else{
				if(tmp&&tmp.msgtype==msgtype&&_inum>=50){
				this._inum--;
				if(tmp.isRead) this._rinum--;
					_hash.splice(i,1);
				break;
			}
		}
	}
	}
	if(!isupdate){
		_hash.unshift({
				key:msgtype+rand,
				id:id,
				name:name,
				content:content,
				opentype:opentype,
				iconurl:iconurl,
				msgtype:msgtype,
				activitytype:activitytype,
				activityid:activityid,
				activityname:activityname,
				activityicon:activityicon,
				profileurl:profileurl,
				chatid:chatid,
				isRead:isread,
				msgid:msgid,
				srcuid:srcuid,
				msgtime:msgtime,
				chatsid:chatsid
			}
		);
		if(msgtype=="feed"){ 
			this._fnum++;
			if(isread) this._rfnum++;
		}
		else{
			if(isread) this._rinum++;
			 this._inum++;
		}
	}
	if(!this._Button){
		this.countMessageBox('im',null,true);
	}
};
_NtBar.removeMessageBox=function(k,ulid,keepHt,e){
	$$E.fixEvent(e).stopPropagation();
	var _hash=this._Hash;
	for(var i=0;i<_hash.length;i++){
		if(_hash[i].key==k){
			if(_hash[i].msgtype=="feed"){ 
				if(_hash[i].isRead) this._rfnum--;
				this._fnum--;
			}
			else{ 
				if(_hash[i].isRead) this._rinum--;
				this._inum--; 
			}	
		_hash.splice(i,1);
		}
	}
	if(keepHt!=true){
	var span=$$O(ulid);
	for(i in span.childNodes){
		var child=span.childNodes[i];
			if(child&&child.nodeName=="LI"&&child.attributes['k']&&child.attributes['k'].nodeValue==k){
			span.removeChild(child);
			break;
		}
	}
	}
	this.countMessageBox('im',null,true);
	if(this._Button)
		this.contentMessageBox(this._currentTag,this._current_feed_Page,this._current_im_page);
};
_NtBar.saveMessageBox=function(){
	var _V = Ntalker.variable;
	if( !this._Hash ){
		return;
	}
	var _hash=this._Hash,feed=0,im=0,flag=[];
	for(var i=0; i<_hash.length;i++){
		var _V1=_hash[i];
		if(_V1.msgtype=="feed"){
			if( feed<20 ){
				flag.push(_V1);feed++;
			}
			}else {
			if( im<20 ){flag.push(_V1); im++;
			}
		}
	}
	if( flag.length == 0 ){
		cookieValue = null;
	}else{
		cookieValue = $$J.toJSONString(flag);
	}
	NtUtil.saveValue(_V['user_id'], Ntalker['ctKEY'], cookieValue);
};
_NtBar.loadMessageBox=function(){
	var _V = Ntalker.variable;
	NtUtil.loadValue(_V['user_id'], Ntalker['ctKEY']);
};
_NtBar.initConfigurationMenu = function(){
	var _V = Ntalker.variable;
	if( _V['user_sid'] == 'NtalkerGuestUserSessionID' || !$$O('nt_setting') ){
		return;
	}
	var self = this;
	var __buttonOver = function(e){
		$$D.addClass($$O('ntConfiguration'), "hover");
	};
	var __buttonOut = function(e){
		$$D.removeClass($$O('ntConfiguration'), "hover");
	};
	var __visibleConfigurationMenu = function(){
		self.visibleConfigurationMenu();
	};
	$$E.addEvent($$O('nt_setting'), 'mouseover', __buttonOver);
	$$E.addEvent($$O('nt_setting'), 'mouseout',  __buttonOut);
	$$E.addEvent($$O('nt_setting'), 'click',  __visibleConfigurationMenu);
};
_NtBar.visibleConfigurationMenu = function(){
	var _Ht = [], _CP = Ntalker.Config.customparams;
	if( $$O('configurationMenu') ){
		this.hiddenConfigurationMenu();
		return;
	}
	IMToolBar.Mutex('');	_Ht.push('<span id="configurationMenu" class="ntalkerbar-menuright" style="">');
	_Ht.push(	'<div class="TopGradient">');
	_Ht.push(		'<div class="BottomGradient">');
	_Ht.push(			'<div class="ntMenuTitle">');
	_Ht.push(				'<span class="ntConfigMenuText"></span>');
	_Ht.push(				'<span class="ntConfigMenuClose" id="ntConfigMenuClose"></span>');
	_Ht.push(			'</div>');
	_Ht.push(			'<div class="ntMenuLine"></div>');
	_Ht.push(			'<div class="ntMenuContent" id="ntConfigMenuList">');
	if( _CP['quanflag'] ){
		_Ht.push(			'<div class="ntMenuItemtTitle">' + NtLang['configurationMenuDynamicMessages'][0] + '</div>');
		_Ht.push(			'<div cusname="acceptOriginalFeed" cusgroupname="dynamicMessages" class="ntMenuItemtText dynamicMessages" custype="Checkbox">' + NtLang['configurationMenuDynamicMessages'][1] + '</div>');
		_Ht.push(			'<div cusname="acceptCommentFeed" cusgroupname="dynamicMessages" class="ntMenuItemtText dynamicMessages" custype="Checkbox">' + NtLang['configurationMenuDynamicMessages'][2] + '</div>');
		_Ht.push(			'<div class="ntMenuLine"></div>');
	}
	if( _CP['enablegroup'] || _CP['enableroom'] ){
		_Ht.push(			'<div class="ntMenuItemtTitle">' + NtLang['configurationMenuGroupSetting'][0] + '</div>');
		_Ht.push(			'<div cusgroupname="groupSetting" class="ntMenuItemtText groupSetting" custype="Radio" cusvalue="0">' + NtLang['configurationMenuGroupSetting'][1] + '</div>');
		_Ht.push(			'<div cusgroupname="groupSetting" class="ntMenuItemtText groupSetting" custype="Radio" cusvalue="1">' + NtLang['configurationMenuGroupSetting'][2] + '</div>');
		_Ht.push(			'<div class="ntMenuLine"></div>');
	}
	_Ht.push(				'<div class="ntMenuItemtTitle">' + NtLang['configurationMenuOtherSettings'][0] + '</div>');
	if( !(_CP['enableOnlineHint']===0) ){
		_Ht.push(			'<div cusname="buddyLoginTip" cusgroupname="otherSettings" class="ntMenuItemtText otherSettings" custype="Checkbox">' + NtLang['configurationMenuOtherSettings'][1] + '</div>');
	}
	_Ht.push(				'<div cusname="acceptMsgFlag" cusgroupname="otherSettings" class="ntMenuItemtText otherSettings" custype="Checkbox">' + NtLang['configurationMenuOtherSettings'][2] + '</div>');
	if( _CP['playsound'] ){
		_Ht.push(			'<div cusname="audioOnFlag" cusgroupname="otherSettings" class="ntMenuItemtText otherSettings" custype="Checkbox">' + NtLang['configurationMenuOtherSettings'][3] + '</div>');
	}
	_Ht.push(			'</div>');
	_Ht.push(		'</div>');
	_Ht.push(	'</div>');
	_Ht.push('</span>');
	var menuElem = $$D.insert($$O('ntalkerbar'), _Ht.join(''), 'beforeEnd');
	$$D.addClass($$O('ntConfiguration'), "selected");
	$$D.css(menuElem, 'display', 'block');
	var menuHeight = $$D.clientRect(menuElem).h - 2;
	$$D.css(menuElem, 'height', '1px');
	$$D.animate(menuElem, {height:menuHeight}, 'fast', 'easeInOutQuint', function(){});
	var impresenceflash = $$O('impresenceflash');
	if( impresenceflash && impresenceflash.getSetting ){
		impresenceflash.getSetting( );
	}
	var self = this;
	var __menuItemOver = function(e){
		var event = $$E.fixEvent(e);
		var current = event.target;
		$$D.addClass(current, "hover");
	};
	var __menuItemOut = function(e){
		var event = $$E.fixEvent(e);
		var current = event.target;
		$$D.removeClass(current, "hover");
	};
	var __menuItemClick = function(e){
		var event = $$E.fixEvent(e);
		var current = event.target;
		self.setConfiguration(current);
	};
	var __hiddenConfigurationMenu = function(e){
		self.hiddenConfigurationMenu();
	};
	$$E.addEvent($$O('ntConfigMenuClose'), 'click', __hiddenConfigurationMenu);
	var menuItems = $$D.filter($$O('ntConfigMenuList').childNodes);
	$$A.each(menuItems, function(elem){
		if( elem.className.indexOf("ntMenuItemtText") > -1 ){
			$$E.addEvent(elem, 'mouseover', __menuItemOver);
			$$E.addEvent(elem, 'mouseout',  __menuItemOut);
			$$E.addEvent(elem, 'click',  __menuItemClick);
		}
	});
};
_NtBar.hiddenConfigurationMenu = function(){
	$$D.removeClass($$O('ntConfiguration'), "selected");
	if( !$$O('configurationMenu') ){
		return;
	}
	$$D.animate($$O('configurationMenu'), {height:1}, 'fast', 'easeInOutQuint', function(){
		$$O('configurationMenu').parentNode.removeChild($$O('configurationMenu'));
	});
};
_NtBar.setConfiguration = function(clickElement){
	var custype, cusGroupName,groupItems, modifyIndex = 0;
	if( !clickElement ){
		return;
	}
		custype = clickElement.getAttribute('custype');
		cusGroupName = clickElement.getAttribute('cusgroupname');
	if( cusGroupName == 'dynamicMessages' ){
		modifyIndex = 0;
	}else if( cusGroupName == 'groupSetting' ){
		modifyIndex = 1;
	}else{
		modifyIndex = 2;
	}
	if( custype.toLowerCase() == 'radio' ){
		groupItems = $$D.filter($$O('ntConfigMenuList').childNodes, '.'+cusGroupName);
		$$A.each(groupItems, function(elem){
			if( clickElement == elem ){
				$$D.addClass(elem, 'selected_radio');
			}else{
				$$D.removeClass(elem, 'selected_radio');
			}
		});
	}else if( custype.toLowerCase() == 'checkbox' ){
		if( !$$D.indexOfClass(clickElement, 'selected_checkbox') ){
			$$D.addClass(clickElement, 'selected_checkbox');
		}else{
			$$D.removeClass(clickElement, 'selected_checkbox');
		}
	}else if( custype.toLowerCase() == 'checkbox' ){
		return;
	}
	this.saveConfiguration(modifyIndex);
};
_NtBar.loadConfiguration = function(strJson){
	var jsonConfiguration = {};
	jsonConfiguration = this.jsonConfiguration = $$J.parseJSON(strJson);
	if( !$$O('ntConfigMenuList') ){
		return;
	}
	var Items = $$D.filter($$O('ntConfigMenuList').childNodes, '.ntMenuItemtText');
	$$A.each(Items, function(elem){
		var custype = elem.getAttribute('custype');
		if( custype.toLowerCase() == 'radio' ){
			if( elem.getAttribute('cusvalue') == jsonConfiguration.groupSetting ){
				$$D.addClass(elem, 'selected_radio');
			}else{
				$$D.removeClass(elem, 'selected_radio');
			}
		}else if( custype.toLowerCase() == 'checkbox' ){
			if( jsonConfiguration[elem.getAttribute('cusname')] === true || jsonConfiguration[elem.getAttribute('cusname')] === elem.getAttribute('cusvalue') ){
				$$D.addClass(elem, 'selected_checkbox');
			}else{
				$$D.removeClass(elem, 'selected_checkbox');
			}
		}
	});
};
_NtBar.saveConfiguration = function(modifyIndex){
	var jsonConfiguration = {modifyIndex:modifyIndex};
	var Items = $$D.filter($$O('ntConfigMenuList').childNodes, '.ntMenuItemtText');
	$$A.each(Items, function(elem){
		var custype = elem.getAttribute('custype');
		if( custype.toLowerCase() == 'radio' && $$D.indexOfClass(elem, 'selected_radio') ){
			jsonConfiguration[elem.getAttribute('cusgroupname')] = elem.getAttribute('cusvalue');
		}else if( custype.toLowerCase() == 'checkbox' ){
			jsonConfiguration[elem.getAttribute('cusname')] = $$D.indexOfClass(elem, 'selected_checkbox');
		}
	});
	if( typeof(jsonConfiguration.acceptOriginalFeed)=='undefined' ) jsonConfiguration.acceptOriginalFeed = true;
	if( typeof(jsonConfiguration.acceptCommentFeed)=='undefined' )  jsonConfiguration.acceptCommentFeed = true;
	this.jsonConfiguration = jsonConfiguration;
	var strJson = $$J.toJSONString(jsonConfiguration);
	var impresenceflash = $$O('impresenceflash');
	if( impresenceflash && impresenceflash.setSetting ){
		impresenceflash.setSetting( strJson );
	}
};
function im_boxConfrim(id, confirmStr, key, ulid, e){
	$$E.fixEvent(e).stopPropagation();
	var impresence = $$O('impresenceflash');
	if(impresence && impresence.addFriendConfirmResult){
	   impresence.addFriendConfirmResult(id, confirmStr);
	}
	if(IMToolBar&&IMToolBar.removeMessageBox){
		IMToolBar.removeMessageBox(key,ulid,false, e);
	}
}
function fIM_navigateToModuleView(id, name,opentype, activitytype,activityid, key, ulid, befrom,chatid,msgtype,e,msgid){
	$$E.fixEvent(e).stopPropagation();
	if(chatWindowManager && /chat|group|room|nquan/.test(opentype) ){
		var quan=chatWindowManager.getChatWindow(id, opentype);
		if(quan&&quan._isFlashLoadSuccess&&opentype=="nquan"){
			chatWindowManager.OnTBFocusWindow(id,opentype);
			if(quan._flash.navigateToModuleView)
			quan._flash.navigateToModuleView(activityid,activitytype);
		}else{
			Ntalker.variable.activityid=activityid;
			Ntalker.variable.activitytype=activitytype;
			im_openWebchatWindow(id, name, chatid, 1, opentype, 0, befrom);
			Ntalker.variable.activityid=Ntalker.variable.activitytype="";
		}
	}else if(opentype == 'application'){		IMToolBar.openApplicationWindow(id, 'sysMsgList');
	}
	if(msgid){
		var _V = Ntalker.variable;
		var desc="msgid_is_"+msgid;
		var siteurl=Ntalker.Config['services'] + "/func/statistic.php?siteid="+_V['siteid']+"&uid="+_V['user_id']+"&destid=0&groupid=0&type=20&mode=1&source=0&desc="+desc+"&from=sysMsgList&rnd="+new Date().getTime();
		$$C.load({tagName:'img', href: siteurl});
	}
	if(IMToolBar&&IMToolBar.currentToolbarMode==2){
		IMToolBar.closeMessagebox();
	}
}
function fiM_RefuseRequest(destuid,chatid,chatsid){
	var impresenceflash = $$O('impresenceflash');
	if(impresenceflash&&impresenceflash.hangupAVChat){
		impresenceflash.hangupAVChat(destuid,chatid,chatsid);
	}
}
function fIM_onPresenceReceiveSysMessage(msgtype,strMsg){
	var _M = strMsg, _Index = _M.indexOf('ntalker://'), _JSON;
	var _V = Ntalker.variable;
	if( _Index == -1 ){
		debug('Not ntalker protocol standard news');
	}else{
		try{
			_Message = _M.substring(0, _Index);
			if(_M.substr(_Index+10).length>0){
				_JSON = $$J.parseJSON(_M.substr(_Index+10));
			}else{
				var str='{"id":"","name":"","iconurl":"","opentype":"","activitytype":"","activityid":"","activityname":"","activityicon":"","profileurl":"","chatid":"","srcuid":"","msgtime":""}';
				_JSON = $$J.parseJSON(str);
			}
			_Message = _Message ? _Message : _JSON.name;
			if(typeof(msgtype)!="string")msgtype=_JSON.msgtype;
			switch(msgtype)
			{
				case "nquan":
					IMToolBar.addSystemMessage(_JSON.id, _JSON.name, _Message, 0, _JSON.iconurl, '', 'alert', '','','nquan');
					break;
				case "group":
					break;
				case "notify":
				case "feed":
				case "application":
					if(msgtype!="feed"){						var desc="msgid_is_"+ ( _JSON.msgid ? _JSON.msgid : _JSON.id);
						var siteurl=Ntalker.Config['services'] + "/func/statistic.php?siteid="+_V['siteid']+"&uid="+_V['user_id']+"&destid=0&groupid="+(_JSON.id?_JSON.id:"")+"&type=13&mode=2&source=0&desc="+desc+"&from=sysMsgList&rnd="+new Date().getTime();
						$$C.load({tagName:'img', href: siteurl});
					}
					IMToolBar.addMessageBox(_JSON.id?_JSON.id:"",_JSON.name?_JSON.name:"",_Message?_Message:"",_JSON.opentype?_JSON.opentype:"", _JSON.iconurl?_JSON.iconurl:"",msgtype?msgtype:"",_JSON.activitytype?_JSON.activitytype:"",_JSON.activityid?_JSON.activityid:"",_JSON.activityname?_JSON.activityname:"",_JSON.activityicon?_JSON.activityicon:"",_JSON.profileurl?_JSON.profileurl:"",_JSON.chatid?_JSON.chatid:"",_JSON.isRead?_JSON.isRead:false,_JSON.msgid?_JSON.msgid:'',_JSON.srcuid?_JSON.srcuid:"",_JSON.msgtime?_JSON.msgtime:(Date.parse(new Date())/1000),_JSON.chatsid?_JSON.chatsid:"" );
					break;
			}
		}catch(e){}
	}
}
function startGetMyIMStatus(imStatusUrl){
	var _V = Ntalker.variable;
	if(imStatusUrl && _V['user_id']){
		$$C.load({src:imStatusUrl+"?query=onlinenum&sitid="+_V['siteid']+"&uid="+_V['user_id']+"&imsid="+_V['imsid']});
	}
}
Ntalker.PromptWindow = function(){
	this.isfocus = false;
	this.isprompting = false;
	this.timerID = null;
	this.promptMsg = null;
	this.promptMsg2 = null;
	this.originTitle = document.title;
	this.counter = 0;
	this.autostop = true; 
};
var _proWindow = Ntalker.PromptWindow.prototype;
_proWindow.init = function(){
	var self = this;
	function _handleFocus(e){
		self.handleFocus(e);
	}
	function _handleBlur(e){
		self.handleBlur(e);
	}
	if($$B.ie){
		document.attachEvent("onfocusin", _handleFocus);
		document.attachEvent("onfocusout", _handleBlur);
	}
	$$E.addEvent(window, 'focus', _handleFocus);
	$$E.addEvent(window, 'blur', _handleBlur);
};
_proWindow.dispose = function(){
};
_proWindow.handleFocus = function(e){
	this.isfocus = true;
	var presenceFlash = $$O("impresenceflash");
	if(presenceFlash && presenceFlash.setPageFocus){
		try{
			presenceFlash.setPageFocus(true);
		}catch(e){}
	}
	if(this.autostop)
		this.stopPrompt();
};
_proWindow.handleBlur = function(e){
	var newvar = 1;
	this.isfocus = false;
	var presenceFlash = $$O("impresenceflash");
	if(presenceFlash && presenceFlash.setPageFocus){
		try{
			presenceFlash.setPageFocus(false);
		}catch(e){}
	}
};
_proWindow.startPrompt = function(destnick, proMsg, autostop){
	if(this.isprompting || this.isfocus)
		return;
	if(proMsg && proMsg.length>0){
		this.promptMsg = sprintf(NtLang['promptTitle'], proMsg, "", this.originTitle);
		this.promptMsg2 = "";
		for(var i=0,l=Math.ceil($$S.len(proMsg)/2); i<l; i++){
		  this.promptMsg2+=NtLang.zhBlank;
		}
		this.promptMsg2 = sprintf(NtLang['promptTitle'], this.promptMsg2, "", this.originTitle);
	}
	var impresenceflash = document.getElementById('impresenceflash');
	if(impresenceflash && impresenceflash.playNotifySound){
		impresenceflash.playNotifySound();
	}
	if(autostop!=null)
		this.autostop = autostop;
	var self = this;
	var _changeWindowTitle = function(){ self.changeWindowTitle(); };
	this.timerID = setInterval(_changeWindowTitle, 800);
	this.isprompting = true;
};
_proWindow.changeWindowTitle = function(){
	this.counter++;
	if(this.counter%2==0)
	   document.title = this.promptMsg2;
	else
	   document.title = this.promptMsg;
	try{
		if(top!=self){
			if(this.counter%2==0)
				top.document.title = this.promptMsg2;
			else
				top.document.title = this.promptMsg;
		}
	}catch(e){}
};
_proWindow.stopPrompt = function(){
	if(!this.isprompting)
		return;
	window.clearInterval(this.timerID);
	this.timerID = null;
	this.counter = 0;
	document.title = this.originTitle;
	this.isprompting = false;
	try{
		if(top!=self) top.document.title = this.originTitle;
	}catch(e){}
};
(function(){
	if(typeof(promptwindow)=="undefined" || !promptwindow){
		promptwindow = new Ntalker.PromptWindow();
		promptwindow.init();
	}
	var path, scripts = window.document.getElementsByTagName("script"),src,mts;
	for(var i = 0; i<scripts.length; i++ ){
		src = scripts[i].getAttribute("src");
		mts = /(.*?)\/+imfunction(_utf8)?(_(.*?))?\.js/gi.exec(src);
		if( mts && mts[1] ){ path = mts[1];break;}
	}
	if( !path ) path = 'http://download.ntalker.com/res';
	Ntalker.variable.scriptPath = path;
	Ntalker.Config.publicDIR = path+"/images/";
	Ntalker.temp.ready = true;
})();
function fIM_OpenPostThreadWindow(str){
	var url="http://www.ntalker.com/postthread/?"+str;
	var width  = window.screen.width;
	var height = window.screen.height;
	var _Ht = [];
	_Ht.push('<html>');
	_Ht.push(	'<head>');
	_Ht.push(		'<title>\u53d1\u5e16</title>');
	_Ht.push(		'<script language="javascript" type="text/javascript">');
	_Ht.push(		'function maximizeWindow() {');
	_Ht.push(		'	if(window.top != window) return;');
	_Ht.push(		'	try{');
	_Ht.push(		'		var offset = (navigator.userAgent.indexOf("Mac") != -1 || navigator.userAgent.indexOf("Gecko") != -1 || navigator.appName.indexOf("Netscape") != -1) ? 0 : 4;');
	_Ht.push(		'		window.moveTo(-offset, -offset);');
	_Ht.push(		'		window.resizeTo(screen.availWidth + (2 * offset), screen.availHeight + (2 * offset));');
	_Ht.push(		'	}catch(e){}');
	_Ht.push(		'}');
	_Ht.push(		'</script>');
	_Ht.push(	'</head>');
	_Ht.push(	'<body style="margin:0;padding:0;" onload="maximizeWindow();">');
	_Ht.push(		'<iframe src="'+url+'" width="100%" height="100%">');
	_Ht.push(		'</iframe>');
	_Ht.push(	'</body>');
	_Ht.push('</html>');
	if(str.indexOf("bbs_tiexue")!=-1){
		window.open(url, "", "left=0, top=0, width="+width+",height="+height+",toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no" );
		return;
	}
	var photoWallWindow = window.open('about:blank', "", "left=0, top=0, width="+width+",height="+height+",toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=no,resizable=no" );
	try{
	var windowContent = photoWallWindow.document || photoWallWindow.contentWindow.document;
	}catch(e){}
	function writeHtml(){
	windowContent.charset = "utf-8";
	windowContent.write(_Ht.join(''));
	windowContent.close();
	photoWallWindow.focus();
}
	if( $$B.mozilla ){
		writeHtml();
	}else{
		setTimeout(writeHtml(), 100);
	}
}
function fIM_openPhotoWallWindow(fileServer, siteId, roomId, selectFileName, viewSource){
	var flashvars, selectURL, swfUrl;
	var width, height, _Ht = [];;
	if( !fileServer ){
		return;
	}
	if( viewSource == 'nquan' && selectFileName ){
		siteId = selectFileName.split("_")[0] || siteId;
	}
	flashvars = 'feed=' + fileServer + '/imageupload.php%3Faction=rss%26siteid='+siteId+'%26roomid='+roomId+'%26rnd='+(new Date).getTime();
	flashvars += '&style=light&numRows=3&showItemEmbed=false&showReflections=false&showNavArrows=true&showSearch=false&showDescription=false&showEmbed=false&backgroundColor=#000000';
	selectURL = fileServer + '/imageupload.php?action=index&siteid='+siteId+'&roomid='+roomId+'&indexfile=' + selectFileName;
	swfUrl = Ntalker.variable.scriptPath;
	swfUrl += '/fs/cooliris.swf';
	width  = window.screen.width;
	height = window.screen.height;
	_Ht.push('<html>');
	_Ht.push(	'<head>');
	_Ht.push(		'<title>' + NtLang['viewPhotoTitle'] + '</title>');
	_Ht.push(		'<script language="javascript" type="text/javascript">');
	_Ht.push(		'function maximizeWindow() {');
	_Ht.push(		'	if(window.top != window) return;');
	_Ht.push(		'	try{');
	_Ht.push(		'		var offset = (navigator.userAgent.indexOf("Mac") != -1 || navigator.userAgent.indexOf("Gecko") != -1 || navigator.appName.indexOf("Netscape") != -1) ? 0 : 4;');
	_Ht.push(		'		window.moveTo(-offset, -offset);');
	_Ht.push(		'		window.resizeTo(screen.availWidth + (2 * offset), screen.availHeight + (2 * offset));');
	_Ht.push(		'	}catch(e){}');
	_Ht.push(		'}');
	_Ht.push(		'</script>');
	_Ht.push(	'</head>');
	_Ht.push(	'<body style="margin:0;padding:0;" onload="maximizeWindow();">');
	_Ht.push(		'<object id="photoWall" width="100%" height="100%" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">');
	_Ht.push(		'<param name="movie" value="'+swfUrl+'" />');
	_Ht.push(		'<param name="allowFullScreen" value="true" />');
	_Ht.push(		'<param name="allowScriptAccess" value="always" />');
	_Ht.push(		'<param name="flashvars" value="'+flashvars+'" />');
	_Ht.push(		'<embed id="photoWall" src="'+swfUrl+'" flashvars="'+flashvars+'" width="100%" height="100%" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always"></embed>');
	_Ht.push(		'</object>');
	_Ht.push(		'<script type="text/javascript">');
	_Ht.push(			'setTimeout(function(){document.getElementById("photoWall").style.display = "block";}, 100);');
	_Ht.push(		'</script>');
	if( selectFileName ){
		_Ht.push(	'<script type="text/javascript" src="' + selectURL + '"></script>');
	}
	_Ht.push(	'</body>');
	_Ht.push('</html>');
	var photoWallWindow = window.open('about:blank', "", "left=0, top=0, width="+width+",height="+height+",toolbar=no,directories=no,menubar=no,status=no,location=no,scrollbars=no,resizable=no" );
	try{
		var windowContent = photoWallWindow.document || photoWallWindow.contentWindow.document;
	}catch(e){}
	function writeHtml(){
		windowContent.charset = "utf-8";
		windowContent.write(_Ht.join(''));
		windowContent.close();
		photoWallWindow.focus();
	}
	if( $$B.mozilla ){
		writeHtml();
	}else{
		setTimeout(writeHtml(), 100);
	}
}
function fIM_OpenChatWindow(destuid, destname, myuid, myname, mysid, siteid, userparam, userinfo, type){
	if( im_openWebchatInPage ){
		var chatType = /^(group|room|nquan|chat)$/.test(type) ? type : 'chat';
		im_openWebchatInPage(destuid, destname, null, 1, chatType, 0, userinfo, 'buddyList');
		return true;
	}
}
function fIM_OpenIMWindow(source){
	if(im_myIMWindow){
		im_myIMWindow.showWindow();
	}
	return;
}
function fIM_OnGroupOpenChatWindow(destuid, destname, myuid, myname, mysid, siteid, userparam, chattype){
	if( im_openWebchatInPage ){
		im_openWebchatInPage(destuid, destname, null, 1, 'chat');
	}
}
function fIM_OnGroupListOpenGroupWindow(groupid, groupname, myuid, myname, mysid, siteid, userparam, chattype, befrom){
	chattype = /^(nquan|room|group)$/.test(chattype) ? chattype : 'group';
	im_openWebchatWindow(groupid, groupname, null, 1, chattype);
}var __debug__scrolltimerID = null;
var __debug__enable__level = NtUtil.getCookie("__debug") || 0;
function debug(info){
	if( !__debug__enable__level || __debug__enable__level == "0" || ( __debug__enable__level != 1 && info.indexOf(__debug__enable__level)==-1 ) ){
		return;
	}
	var execCommandTimer = Math.floor(new Date().getTime()) - parseInt(NtExecCommandTimer);
	if( !$$O('debugSpan') ){
		var _Ht = [];
		_Ht.push('<div id="debugDiv" style="background:#000000;position:absolute;left:0px;top:0px;height:320px;width:420px;z-index:99999;">');
		_Ht.push('<div id="debug_head" style="text-align:right;color:#fff;height:20px;background:#ccc;" >');
		_Ht.push('<span style="cursor:pointer;display:block;background:#eee;float:right;height:20px;width:20px;margin-left:10px;text-align:center;" id="btnClose">x</span>');
		_Ht.push('<span style="cursor:pointer;display:block;background:#eee;float:right;height:20px;width:40px;margin-left:10px;text-align:center;" id="btnClear">clear</span>');
		_Ht.push('<span style="cursor:pointer;display:block;background:#eee;float:right;height:20px;width:20px;margin-left:10px;text-align:center;" id="btnRight">&gt;</span>');
		_Ht.push('<span style="cursor:pointer;display:block;background:#eee;float:right;height:20px;width:20px;margin-left:10px;text-align:center;" id="btnLeft">&lt;</span>');
		_Ht.push('</div>');
		_Ht.push(	'<div id="debugSpan" style="color:#00FF00;height:300px;width:420px;overflow-y:scroll;text-align:left;opacity:0.7;filter:alpha(opacity=70);"></div>');
		_Ht.push('</div>');
		$$D.insert(document.body, _Ht.join("\n"));
		function __debugScroll(){
			clearTimeout(__debug__scrolltimerID);
			__debug__scrolltimerID = setTimeout(function(){
				var debugDivTop = document.documentElement.scrollTop || document.body.scrollTop;
				if ($$O('debugDiv').offsetParent == document.body && $$B.StrictMode) {
					debugDivTop = debugDivTop - $$O('debugDiv').offsetParent.offsetTop - $$O('debugDiv').offsetParent.clientTop;
				}
				$$D.animate($$O('debugDiv'), {top:debugDivTop}, 'fast', 'easeInOutElastic');
			},400);
		}
		$$E.addEvent(window, 'scroll', __debugScroll);
		$$E.addEvent($$O('btnLeft'), 'click', function(e){
			$$D.css($$O('debugDiv'), "right", 'auto');
			$$D.css($$O('debugDiv'), "left", '0px');
		});
		$$E.addEvent($$O('btnRight'), 'click', function(e){
			$$D.css($$O('debugDiv'), "left", 'auto');
			$$D.css($$O('debugDiv'), "right", '0px');
		});
		$$E.addEvent($$O('btnClear'), 'click', function(e){
			$$O('debugSpan').innerHTML = '';
		});
		$$E.addEvent($$O('btnClose'), 'click', function(e){
			$$E.removeEvent(window, 'scroll', __debugScroll);
			__debug__enable__level = 0;
			NtUtil.setCookie("__debug", 0);
			$$O('debugDiv').parentNode.removeChild($$O('debugDiv'));
		});
	}
	$$O('debugSpan').innerHTML += info + ' - ' + execCommandTimer + "<br />";
	$$O('debugSpan').scrollTop=$$O('debugSpan').scrollHeight;
	NtExecCommandTimer =  Math.floor(new Date().getTime());
}
function createIFrame(frameID, webChatID)
{
	Ntalker.Config.iframes[frameID] = frameID;
	var parentID = $$O(webChatID) || document.getElementsByTagName("body")[0];
	if( $$O(frameID) )
		return false;
	var newDiv = document.createElement("DIV");
	newDiv.id = frameID;
	newDiv.style.position = 'absolute';
	newDiv.style.backgroundColor = '#FFFFFF';
	newDiv.style.border = '0px';
	newDiv.style.overflow = 'auto';
	newDiv.style.display = 'none';
	if(parentID) parentID.appendChild(newDiv);
	window.onerror = function(){return true;};
	return true;
}
function moveIFrame(frameID, iframeID, x, y, w, h, objectID)
{
	try{
		var frameRef = document.getElementById(frameID); 
		var swfObject = document.getElementById(objectID); 
		frameRef.style.left = x + swfObject.offsetLeft + 'px';  
		frameRef.style.top = y + swfObject.offsetTop + 'px'; 
		frameRef.style.width = w + 'px'; 
		frameRef.style.height = h + 'px'; 
		var iFrameRef = document.getElementById(iframeID); 
		iFrameRef.width = w;
		iFrameRef.height = h;
		var loadRef = document.getElementById(iframeID + "Loading");
		if( loadRef ){
			loadRef.style.width = w + 'px';
			loadRef.style.height = h + 'px';
			loadRef.style.backgroundPosition = (w-32)/2 + 'px ' + (h-32)/2 + 'px';
		}
	}catch(e){}
}
function hideIFrame(frameID, iframeID)
{
	var iframeRef = document.getElementById(iframeID);
	var iframeDoc;
	if (iframeRef.contentWindow) {
		iframeDoc = iframeRef.contentWindow.document;
	} else if (iframeRef.contentDocument) {
		iframeDoc = iframeRef.contentDocument;
	} else if (iframeRef.document) {
		iframeDoc = iframeRef.document;
	}
	if (iframeDoc) {
		iframeDoc.body.style.display = 'none';
	}
	if ($$O(frameID)) {
		$$O(frameID).style.display = 'none';
	}
}
function showIFrame(frameID, iframeID)
{
	var iframeRef = document.getElementById(iframeID);
	if ($$O(frameID)) {
		$$O(frameID).style.display='block';
	}
	var iframeDoc;
	if (iframeRef.contentWindow) {
		iframeDoc = iframeRef.contentWindow.document;
	} else if (iframeRef.contentDocument) {
		iframeDoc = iframeRef.contentDocument;
	} else if (iframeRef.document) {
		iframeDoc = iframeRef.document;
	}
	if (iframeDoc) {
		iframeDoc.body.style.display='block';
	}
}
function hideDiv(frameID)
{
	if ($$O(frameID)) {
		$$O(frameID).style.display='none';
	}
}
function showDiv(frameID)
{
	if ($$O(frameID)) {
		$$O(frameID).style.display = 'block';
	}
}
function loadIFrame(frameID, iframeID, url, embedID, frameType){
	var frame= $$O(frameID);
	var _C = Ntalker.Config;
	var loadId = iframeID + "Loading";
	if ( !frame ) return;
	var math = /\w+\.(swf|aspx|asp|jsp|php|htm|html|shtml)/ig.exec(url);
	var src, _Ht = [], iframe;
	if( $$B.ie6&&frameType=='video' ){
		src = 'about:blank';
		_Ht.push("<iframe id='" + iframeID + "' src='"+src+"' name='"+iframeID+"' onLoad='"+embedID+"."+frameID+"_load();' frameborder='0' scrolling='no'></iframe>");
		iframe = $$D.insert(frame, _Ht.join(''));
		var iFrameContent = iframe.contentWindow.document;
		iFrameContent.designMode = 'On';
		iFrameContent.contentEditable = true;
		iFrameContent.open();
		var _ht = [];
		_ht.push('<html>');
		_ht.push(	'<head>');
		_ht.push(	'</head>');
		_ht.push(	'<body marginwidth="0" marginheight="0">');
		_ht.push(		'<embed height="100%" width="100%" name="plugin" src="' + url + '" type="application/x-shockwave-flash">');
		_ht.push(	'</body>');
		_ht.push('</html>');
		iFrameContent.write(_ht.join(''));
		iFrameContent.close();
		iFrameContent.designMode = 'Off';
		iFrameContent.contentEditable = false;
	}else if( frameType=='video' ){
		src = url;
		_Ht.push("<iframe id='" + iframeID + "' src='"+src+"' name='"+iframeID+"' onLoad='"+embedID+"."+frameID+"_load();' frameborder='0' scrolling='no'></iframe>");
		iframe = $$D.insert(frame, _Ht.join(''));
	}else{
		src = url;
		_Ht.push('<div id="' + loadId + '" style="display:none;background:url(' + _C['publicDIR'] + '/loading.gif) no-repeat center #FAFAFA;"></div>');
		_Ht.push("<iframe id='" + iframeID + "' style='display:block;' src='"+src+"' name='"+iframeID+"' onLoad='"+embedID+"."+frameID+"_load();' frameborder='0' scrolling='no'></iframe>");
		iframe = $$D.insert(frame, _Ht.join(''));
	}
}
function reloadIFrame(frameID, iframeID, url, embedID){
	var frame= $$O(frameID);
	var loadId = iframeID + "Loading";
	if ( !frame ) 
		return;
	var math = /\w+\.(swf|aspx|asp|jsp|php|htm|html|shtml)/ig.exec(url);
	if( $$B.ie6&&math&&math[1]=='swf' ){
		return;
	}
	$$O(iframeID).src = url;
	$$D.css($$O(iframeID), 'display', 'none');
	$$D.css($$O(loadId),   'display', 'block');
	$$C.ready($$O(iframeID), function(){
		$$D.css($$O(loadId),   'display', 'none');
		$$D.css($$O(iframeID), 'display', 'block');
	});
}
function loadDivContent(frameID, iframeID, content)
{
	if ($$O(frameID)) {
		$$O(frameID).innerHTML = "<div id='"+iframeID+"' frameborder='0'>"+content+"</div>";
	}
}
function callIFrameFunction(iframeID, functionName, args)
{
	var iframeRef=document.getElementById(iframeID);
	var iframeDoc;
	if (iframeRef.contentDocument) {
		iframeDoc = iframeRef.contentDocument;
	} else if (iframeRef.contentWindow) {
		iframeDoc = iframeRef.contentWindow.document;
	} else if (iframeRef.document) {
		iframeDoc = iframeRef.document;
	}
	if (iframeDoc.wrappedJSObject != undefined) {
		iframeDoc = iframeDoc.wrappedJSObject;
	}
	return iframeDoc[functionName](args);
}
function removeIFrame(frameID)
{
	var iFrameDiv = document.getElementById(frameID);
	if ( $$B.ie6 ){
		iframe = $$O('iframe_' + frameID);
		var iFrameContent = iframe.contentWindow.document;
		iFrameContent.designMode = 'On';
		iFrameContent.contentEditable = true;
		iFrameContent.open();
		iFrameContent.write('');
		iFrameContent.close();
		iFrameContent.designMode = 'Off';
		iFrameContent.contentEditable = false;
		iFrameDiv.parentNode.removeChild(iFrameDiv);
	}
	else{
		iFrameDiv.parentNode.removeChild(iFrameDiv);
	}
}
function bringIFrameToFront(frameID)
{
	var frameRef=document.getElementById(frameID);
	if (oldFrame!=frameRef) {
		if (oldFrame) {
			oldFrame.style.zIndex="99";
		}
		frameRef.style.zIndex="100";
		oldFrame = frameRef;
	}
}
function askForEmbedObjectId(randomString)
{
	var embeds = document.getElementsByTagName('embed');
	for (var i = 0; i < embeds.length; i++) {
		try {
			var isTheGoodOne = embeds[i].checkObjectId(embeds[i].getAttribute('id'),randomString);
			if(isTheGoodOne) {
				return embeds[i].getAttribute('id');
			}
		}catch(e){}
	}
	var objects = document.getElementsByTagName('object');
	for(i = 0; i < objects.length; i++) {
		try{
			var isTheGoodOne = objects[i].checkObjectId(objects[i].getAttribute('id'),randomString);
			if(isTheGoodOne) {
				return objects[i].getAttribute('id');
			}
		} catch(e) {}
	}
	return null;
}
function getBrowserMeasuredWidth(objectID)
{
	return document.getElementById(objectID).offsetWidth;
}
function setupResizeEventListener(frameId)
{
	if(!frameId) return;
	var resizeTimeout = []; 
	$$E.addEvent(window, "resize", function(e, frameId){
		window.clearTimeout(resizeTimeout[frameId]);
		resizeTimeout[frameId] = window.setTimeout(function(){
			 eval("document.getElementById('" + Ntalker.Config.iframes[frameId] + "')." + frameId + "_resize();");
		 }, 10);
	});
}
function printIFrame(iframeID)
{
	try
	{
		if (navigator.appName.indexOf('Microsoft') != -1)
		{
			document[iframeID].focus();
			document[iframeID].print();
		}
		else
		{
			for (var i=0; i < window.frames.length; i++)
			{
				if (window.frames[i].name == iframeID)
				{
					window.frames[i].focus();
					window.frames[i].print();
				}
			}
		}
	}
	catch(e){}
}
function historyBack(iframeID)
{
	frames[iframeID].history.go(-1);
}
function historyForward(iframeID)
{
	frames[iframeID].history.go(1);
}var ntalker_swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in ntalker_swfobject){ntalker_swfobject[X]=null}ntalker_swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
var im_flashVersion = ntalker_swfobject.getFlashPlayerVersion().major;
var im_installFlashActionX = im_flashVersion<9 ? true : false;

