document.domain = 'imqq.com';
if (typeof(QQI) == "undefined" || !QQI) {
	var QQI = {};
}
QQI = {
	qqi_changeEvent : function(o1,e1,o2,e2,index){
		var e11 = document.getElementById(o1).getElementsByTagName(e1);
		var e12 = document.getElementById(o2).getElementsByTagName(e2);
		var len = e11.length;
		for(var i=0; i<len; i++){
			QQI.removeClassName(e11[i],'on');
			QQI.addClassName(e12[i],'dis');
		}
		QQI.addClassName(e11[index],'on');
		QQI.removeClassName(e12[index],'dis');
	},
	qqi_overEvent : function(o1,e1,index){
		var e11 = document.getElementById(o1).getElementsByTagName(e1);
		QQI.addClassName(e11[index],'over');
	},
	qqi_outEvent : function(o1,e1,index){
		var e11 = document.getElementById(o1).getElementsByTagName(e1);
		QQI.removeClassName(e11[index],'over');
	},
	hoveCitys : function(){
		QQI.removeClassName(QQI.getById("citys_menu"),'dis');
	},
	outCitys : function(){
		QQI.addClassName(QQI.getById("citys_menu"),'dis');
	},
	hoveCitysMenu : function(){
		QQI.removeClassName(QQI.getById("citys_menu"),'dis');
	},
	outCitysMenu : function(){
		QQI.addClassName(QQI.getById("citys_menu"),'dis');
	},
	
	//dom、event、css
	get : function(e) {
		if (e && ((e.tagName || e.item) || e.nodeType == 9)) {
			return e;
		}
		return this.getById(e);
	},
	
	getById : function(id) {
		return document.getElementById(id);
	},
	
	getClassRegEx : function(className) {
		var re = RL.css.classNameCache[className];
		if (!re) {
			re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
			RL.css.classNameCache[className] = re;
		}
		return re;
	},
	
	styleSheets : {},
	
	hasClassName : function(elem, cname) {
		return (elem && cname) ? new RegExp('\\b' + cname + '\\b').test(elem.className) : false;
	},
	
	addClassName : function(elem, cname) {
		if (elem && cname) {
			if (elem.className) {
				if (QQI.hasClassName(elem, cname)) {
					return false;
				} else {
					elem.className += ' ' + cname;
					return true;
				}
			} else {
				elem.className = cname;
				return true;
			}
		} else {
			return false;
		}
	},
	
	removeClassName : function(elem, cname) {
		if (elem && cname && elem.className) {
			var old = elem.className;
			elem.className = (elem.className.replace(new RegExp('\\b' + cname + '\\b'), ''));
			return elem.className != old;
		} else {
			return false;
		}
	},
	
	extendType : /(click|mousedown|mouseover|mouseout|mouseup|mousemove|scroll|contextmenu|resize)/i,
	_eventListDictionary : {},
	_fnSeqUID : 0,
	_objSeqUID : 0,
	getEvent : function(evt) {
		var evt = evt || window.event;
		if (!evt) {
			var c = this.getEvent.caller,
				cnt = 1;
			while (c) {
				evt = c.arguments[0];
				if (evt && Event == evt.constructor) {
					break;
				}else if(cnt > 32){
					break;
				}
				c = c.caller;
				cnt++;
			}
		}
		return evt;
	},
	
	addEvent : function(obj, eventType, fn, argArray) {
		var cfn = fn,
			res = false, l;
		if (!obj) {
			return res;
		}
		if (!obj.eventsListUID) {
			obj.eventsListUID = "e" + (++QQI._objSeqUID);
			QQI._eventListDictionary[obj.eventsListUID] = {};
		}
		l = QQI._eventListDictionary[obj.eventsListUID];
		if (!fn.__elUID) {
			fn.__elUID = "e" + (++QQI._fnSeqUID) + obj.eventsListUID;
		}
		if (!l[eventType]) {
			l[eventType] = {};
		}
		if(typeof(l[eventType][fn.__elUID])=='function'){
			return false;
		}
		if (QQI.extendType.test(eventType)) {
			var argArray = argArray || [];
			cfn = function(e) {
				return fn.apply(null, ([QQI.getEvent(e)]).concat(argArray));
			};
		}
		if (obj.addEventListener) {
			obj.addEventListener(eventType, cfn, false);
			res = true;
		} else if (obj.attachEvent) {
			res = obj.attachEvent("on" + eventType, cfn);
		} else {
			res = false;
		}
		if (res) {
			l[eventType][fn.__elUID] = cfn;
		}
		return res;
	},
	
	bind : function(obj, method) {
		var args = Array.prototype.slice.call(arguments, 2);
		return function() {
			var _obj = obj || this;
			var _args = args.concat(Array.prototype.slice.call(arguments, 0));
			if (typeof(method) == "string") {
				if (_obj[method]) {
					return _obj[method].apply(_obj, _args);
				}
			} else {
				return method.apply(_obj, _args);
			}
		}
	},
	
	getSize : function(el) {
		var _w = el.offsetWidth;
		var _h = el.offsetHeight;
		return [_w, _h];
	},

	getXY : function(el, doc) {
		var _t = 0, _l = 0,
			_doc = doc || document;
		if (el) {
			if (_doc.documentElement.getBoundingClientRect && el.getBoundingClientRect) {
				var box = el.getBoundingClientRect(),
					oDoc = el.ownerDocument,
					_fix = QQI.browser.ie ? 2 : 0;

				_t = box.top - _fix + QQI.getScrollTop(oDoc);
				_l = box.left - _fix + QQI.getScrollLeft(oDoc);
			} else {
				while (el.offsetParent) {
					_t += el.offsetTop;
					_l += el.offsetLeft;
					el = el.offsetParent;
				}
			}
		}
		return [_l, _t];
	},
	
	getScrollTop : function(doc) {
		var _doc = doc || document;
		return Math.max(_doc.documentElement.scrollTop, _doc.body.scrollTop);
	},
	
	getScrollLeft : function(doc) {
		var _doc = doc || document;
		return Math.max(_doc.documentElement.scrollLeft, _doc.body.scrollLeft);
	},

	setXY : function(el, x, y) {
		el = this.get(el);
		var _ml = parseInt(this.getStyle(el, "marginLeft")) || 0;
		var _mt = parseInt(this.getStyle(el, "marginTop")) || 0;
		this.setStyle(el, "left", parseInt(x) - _ml + "px");
		this.setStyle(el, "top", parseInt(y) - _mt + "px");
	},
	
	getClientWidth : function(doc) {

		var _doc = doc || document;
		return _doc.compatMode == "CSS1Compat" ? _doc.documentElement.clientWidth : _doc.body.clientWidth;
	},
	
	getClientHeight : function(doc) {
		var _doc = doc || document;
		return _doc.compatMode == "CSS1Compat" ? _doc.documentElement.clientHeight : _doc.body.clientHeight;
	},
	
	createElementIn : function(tagName, el, insertFirst, attributes) {
		var tagName = tagName || "div";
		var el = this.get(el) || document.body;
		var _doc = el.ownerDocument;
		var _e = _doc.createElement(tagName);
		if (attributes) {
			for (var k in attributes) {
				if (/class/.test(k)) {
					_e.className = attributes[k];
				} else if (/style/.test(k)) {
					_e.style.cssText = attributes[k];
				} else {
					_e[k] = attributes[k];
				}
			}
		}
		if (insertFirst) {
			el.insertBefore(_e, el.firstChild);
		} else {
			el.appendChild(_e);
		}
		return _e;
	},
	
	removeElement : function(el) {
		if (typeof(el) == "string") {
			el = QQI.getById(el);
		}
		if (!el) {
			return;
		}
		if (el.removeNode) {
			el.removeNode(true);
		} else {
			if (el.childNodes.length > 0) {
				for (var ii = el.childNodes.length - 1; ii >= 0; ii--) {
					QQI.removeElement(el.childNodes[ii]);
				}
			}
			if (el.parentNode) {
				el.parentNode.removeChild(el);
			}
		}
		el = null;
		return null;
	},
	
	getStyle : function(el, property) {
		el = this.get(el);
		var w3cMode = document.defaultView && document.defaultView.getComputedStyle;
		var computed = !w3cMode ? null : document.defaultView.getComputedStyle(el, '');
		var value = "";
		switch (property) {
			case "float" :
				property = w3cMode ? "cssFloat" : "styleFloat";
				break;
			case "opacity" :
				if (!w3cMode) {
					var val = 100;
					try {
						val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
					} catch (e) {
						try {
							val = el.filters('alpha').opacity;
						} catch (e) {}
					}
					return val / 100;
				}
				break;
			case "backgroundPositionX" :
				if (w3cMode) {
					property = "backgroundPosition";
					return ((computed || el.style)[property]).split(" ")[0];
				}
				break;
			case "backgroundPositionY" :
				if (w3cMode) {
					property = "backgroundPosition";
					return ((computed || el.style)[property]).split(" ")[1];
				}
				break;
		}
		if (w3cMode) {
			return (computed || el.style)[property];
		} else {
			return (el.currentStyle[property] || el.style[property]);
		}
	},
	
	setStyle : function(el, property, value) {
		el = this.get(el);
		if (!el || el.nodeType == 9) {
			return false;
		}
		var w3cMode = document.defaultView && document.defaultView.getComputedStyle;
		switch (property) {
			case "float" :
				property = w3cMode ? "cssFloat" : "styleFloat";
			case "opacity" :
				if (!w3cMode) {
					if (value >= 1) {
						el.style.filter = "";
						return;
					}
					el.style.filter = 'alpha(opacity=' + (value * 100) + ')';
					return true;
				} else {
					el.style[property] = value;
					return true;
				}
				break;
			case "backgroundPositionX" :
				if (w3cMode) {
					var _y = RL.dom.getStyle(el, "backgroundPositionY");
					el.style["backgroundPosition"] = value + " " + (_y || "top");
				} else {
					el.style[property] = value;
				}
				break;
			case "backgroundPositionY" :
				if (w3cMode) {
					var _x = RL.dom.getStyle(el, "backgroundPositionX");
					el.style["backgroundPosition"] = (_x || "left") + " " + value;
				} else {
					el.style[property] = value;
				}
				break;
			default :
				if (typeof el.style[property] == "undefined") {
					return false
				}
				el.style[property] = value;
				return true;
		}
	},
	
	getValue : function(tagName,obj){
		var value = '';
		var tags = obj.getElementsByTagName(tagName);
		//if(tags == 'undefined'){return;}
		if(tags && tags[0].childNodes[0]){
			value = tags[0].childNodes[0].nodeValue;
		}
		return value;
	},
	
	getSafeHTML : function(s)
	{
		var html = "";
		var safeNode = document.createElement("TEXTAREA");
		if(safeNode){
			safeNode.innerHTML = s;
			html = safeNode.innerHTML;
			safeNode.innerHTML = "";
		}
		return html;
	},
	
	SendAJAXRequest : function(sURL, sMethod, fFunc, sContent, param, bNoRand){
		var ajaxobj=new QQI.AJAXRequest;
		var sTmp = "&t="+Math.random().toString();
		if(bNoRand == true){sTmp='';}
		var tContent = sContent+sTmp;
		ajaxobj.method=sMethod;
		ajaxobj.callback=fFunc;
		ajaxobj.callbackparam=param;
		if(sMethod == "POST" ){ajaxobj.url=sURL;ajaxobj.content=tContent;}
		else{ajaxobj.url=sURL+sContent+sTmp;}
		ajaxobj.send();
	},
	
	AJAXRequest : function()
	{
		var xmlObj = false;
		var CBfunc,ObjSelf;
		ObjSelf=this;
		try{
			xmlObj=new XMLHttpRequest; 
		}
		catch(e){
			try{
				xmlObj=new ActiveXObject("MSXML2.XMLHTTP"); 
			}
			catch(e2){
				try{
					xmlObj=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e3){
					xmlObj=false;
				}
			}
		}
		if (!xmlObj) return false;
		this.method="POST";
		this.url;
		this.async=true;
		this.content="";
		this.callback=function(cbobj){return;}
		this.send=function()
		{
			if(!this.method||!this.url||!this.async) return false;
			xmlObj.open (this.method, this.url, this.async);
			if(this.method=="POST") xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//if(this.method=="POST") xmlObj.setRequestHeader("Content-length",sContent.length);
			xmlObj.onreadystatechange=function(){
				if(xmlObj.readyState==4){
					if(xmlObj.status>=200 && xmlObj.status<300){
						ObjSelf.callback(xmlObj, ObjSelf.callbackparam);
					}
					else{ 
						ObjSelf.callback(null, ObjSelf.callbackparam);
					}
					ObjSelf.callbackparam = null;
				}
			}
			if(this.method=="POST"){ xmlObj.send(this.content);}
			else { xmlObj.send(null);}		
		}
	}
}

//预设全局空函数
QQI.emptyFn = function(){};
//dialog组件
QQI.dialog = {
	items : [],
	maskzInden : 0,
	create : function(title, content, config) {
		//变量初始化
		var width=300,height=400,tween=false,noborder=false;
		//根据传入参数判断兼容性
		if((config != null)&&(typeof(config) == "object")){
			width = config.width || 300;
			height = config.height || 400;
		}else{
			width=arguments[2] || 300;
			height=arguments[3] || 400;
		}
		var _i = this.items;
		_i.push(new QQI.DialogHandler(_i.length));
		var _dialog = _i[_i.length - 1];
		_dialog.init(width, height);
		_dialog.fillTitle(title || "无标题");
		_dialog.fillContent(content || "");
		return _dialog;
	}
}
QQI.DialogHandler = function(id) {
	this._id = id;
	this._isIE6 = (QQI.browser.ie && !window.XMLHttpRequest);
	this.id = "dialog_" + id;
	this.mainId = "dialog_main_" + id;
	this.headId = "dialog_head_" + id;
	this.titleId = "dialog_title_" + id;
	this.closeId = "dialog_button_" + id;
	this.contentId = "dialog_content_" + id;
	this.frameId = "dialog_frame_" + id;
	this.zIndex = 6000 + this._id;
	this.onBeforeUnload = function() {
		return true;
	};
	this.onUnload = QQI.emptyFn;
	this.isFocus = false;
	var _t = [
				'<div id="',
				this.mainId,
				'" class="',
				"layer_global_box",
				'">',
				'<div id=',
				this.headId,
				' class="',
				"layer_global_title",
				'">',
				'<h3 id="',
				this.titleId,
				'"></h3>',
				'<span id="',
				this.closeId,
				'">Close</span>',
				'</div>',
				'<div id="',
				this.contentId,
				'" class="',
				"layer_global_cont",
				'"></div>',
				'</div>'];
	if (this._isIE6 && false) {
		_t.push('<iframe id="' + this.frameId + '" frameBorder="no" style="filter:alpha(opacity=0);border:0px;position:absolute;width:100%;height:100%;top:0px;left:0px;z-index:-1;"></iframe>');
	}

	this.temlate = _t.join("");
};
QQI.DialogHandler.prototype.init = function(width, height) {
	//创建最外层div容器
	this.dialog = document.createElement("div");
	this.dialog.id = this.id;
	_selfID = this.id;
	var _l = (QQI.getClientWidth() - width) / 2 + QQI.getScrollLeft();
	var _t = Math.max((QQI.getClientHeight() - height) / 2 + QQI.getScrollTop(), 0);
	with (this.dialog) {
		if(QQI.browser.ie && !window.XMLHttpRequest){
			//IE6
			style.position = "absolute";
		}
		else{
			style.position = "fixed";
		}
		style.left = _l + "px";
		style.top = _t - 80 + "px";
		style.zIndex = this.zIndex;
		innerHTML = this.temlate;
	}
	document.body.appendChild(this.dialog);
	this.dialogClose = QQI.get(this.closeId);
	var o = this;
	//焦点事件
	QQI.addEvent(this.dialog, "mousedown", QQI.bind(o, o.focus));
	//关闭事件
	QQI.addEvent(this.dialogClose, "click", function() {
		var t = QQI.dialog.items[o._id];
		if (t) {
			t.unload();
		}
	})
	this.focus();
	this.setSize(width, height);//设置大小
	if(QQI.browser.ie && !window.XMLHttpRequest){
		QQI.addEvent(window,'scroll',function(){
			QQI.get(_selfID).style.top = Math.max((QQI.getClientHeight() - height) / 2 + QQI.getScrollTop() - 80, 0) + 'px';									   
		});
	}
	if (QQI.maskLayout) {
		var _z = this.zIndex;
		QQI.dialog.maskzInden = QQI.maskLayout.create(_z - 1);
	}
};
//激活窗体
QQI.DialogHandler.prototype.focus = function() {
	if (this.isFocus) {
		return;
	}
	this.dialog.style.zIndex = this.zIndex + 3000;

	if (QQI.dialog.lastFocus) {
		QQI.dialog.lastFocus.blur();
	};
	this.isFocus = true;
	QQI.dialog.lastFocus = this;
};
//窗体失去焦点
QQI.DialogHandler.prototype.blur = function() {
	this.isFocus = false;
	this.dialog.style.zIndex = this.zIndex;
};
//获得对话框的zindex
QQI.DialogHandler.prototype.getZIndex = function() {
	return this.dialog.style.zIndex;
};
//填充对话框标题
QQI.DialogHandler.prototype.fillTitle = function(title) {
	var _t = QQI.get(this.titleId);
	_t.innerHTML = title;
};
//填充对话框内容
QQI.DialogHandler.prototype.fillContent = function(html) {
	var _c = QQI.get(this.contentId);
	_c.innerHTML = html;
};
//显示对话框
QQI.DialogHandler.prototype.setSize = function(width, height) {
	//同步dialog外层div的长宽
	var _m = QQI.get(this.id);
	_m.style.width=width+"px";
	//当为div时
	var _c = QQI.get(this.contentId);
	_c.style[(QQI.browser.ie && !window.XMLHttpRequest) ? "height" : "minHeight"] = height + "px";
	//遮挡器设定大小
	if (this._isIE6 && false) {
		var _s = QQI.getSize(QQI.get(this.id)),//同步内部iframe与外层容器div的大小
			_f = QQI.get(this.frameId);
		QQI.setSize(_f, _s[0], _s[1]);
	}
};
//卸载对话框
QQI.DialogHandler.prototype.unload = function() {
	if (!this.onBeforeUnload()) {
		return;
	};
	var o = this;
	QQI.maskLayout.remove(this.zIndex - 1);
	this._unload();
};
QQI.DialogHandler.prototype._unload = function() {
	this.onUnload();
	if(QQI.browser.ie && !window.XMLHttpRequest){
		this.dialog.innerHTML = ""; // 避免ie6出现focus链条断掉的问题。
	}
	QQI.removeElement(this.dialog);
	QQI.maskLayout.remove(QQI.dialog.maskzInden);
	delete QQI.dialog.items[this._id];
};
//蒙版层
QQI.maskLayout = {
	count : 0,
	items : {},
	create : function(zindex, _doc) {
		this.count++;
		zindex = zindex || 5000;
		_doc = _doc || document;
		var _m = QQI.createElementIn("div", _doc.body, false, {
					className : "qz_mask_layout"
				}),
				_h;
		_h = (QQI.browser.ie && !window.XMLHttpRequest)
				? Math.max(_doc.documentElement.scrollHeight,
						_doc.body.scrollHeight)
				: QQI.getClientHeight(_doc);

		_m.style.zIndex = zindex;
		_m.style.height = _h + "px";
		_m.unselectable = "on";
		this.items[this.count] = _m;
		return this.count;
	},
	
	remove : function(countId) {
		QQI.removeElement(this.items[countId]);
		delete this.items[countId];
	}
};

QQI.browser={
	ie:/msie/.test(window.navigator.userAgent.toLowerCase()),
	moz:/gecko/.test(window.navigator.userAgent.toLowerCase()),
	opera:/opera/.test(window.navigator.userAgent.toLowerCase()),
	safari:/safari/.test(window.navigator.userAgent.toLowerCase())
};

//业务
var _lastID = 0;
function showGroupDetail(id){
	var _xy = QQI.getXY(QQI.getById(id));
	if(!QQI.getById("g_dateil_box")){
		var _div_box = document.createElement('div');
		_div_box.className = 'g_dateil_box';
		_div_box.id = 'g_dateil_box';
		var _div1 = document.createElement('div');
		_div1.className = 'g_dateil';
		_div1.id = 'g_dateil';
		var _div2 = document.createElement('div');
		_div2.className = 'g_b';
		var _c = QQI.getById(id+"d").innerHTML;
		var _text = document.createTextNode(_c);
		_div1.appendChild(_text);
		_div_box.appendChild(_div1);
		_div_box.appendChild(_div2);
		document.body.appendChild(_div_box);
		
		_div_box.onmouseover = function(){
			QQI.removeClassName(this,'dis');
		}
		_div_box.onmouseout = function(){
			QQI.addClassName(this,'dis');
		}
		QQI.setXY(QQI.getById("g_dateil_box"),_xy[0]-9,_xy[1]+40);
	}
	else{
		var _c = QQI.getById(id+"d").innerHTML;
		var _div1 = QQI.getById("g_dateil");
		_div1.innerHTML = _c;
		QQI.setXY(QQI.getById("g_dateil_box"),_xy[0]-9,_xy[1]+40);
	}
	
	QQI.removeClassName(QQI.getById("g_dateil_box"),'dis');
}

function hideGroupDetail(id){
	QQI.addClassName(QQI.getById("g_dateil_box"),'dis');
}

function cpGroupId(id){
	var _copyID = id.substring(id.indexOf('_')+1,id.length);
	copyToClipboard(_copyID);
	if(_lastID!=0){
		QQI.getById(_lastID).getElementsByTagName("p")[1].innerHTML = '<a href="#" onclick="cpGroupId(\''+_lastID+'\');return false;">copy ID</a> to join';
	}
	_lastID = id;
	QQI.getById(id).getElementsByTagName("p")[1].innerHTML = '<span class="tips" onmouseover="showGroupTips(\''+id+'\')" onmouseout="hideGroupTips(\''+id+'\')">Copied</span>';
}

function cpGroupIdOngroupCat(id){
	copyToClipboard(id);
	if(_lastID!=0){
		QQI.getById(_lastID).innerHTML = '<a href="#" onclick="cpGroupIdOngroupCat(\''+_lastID+'\');return false;">copy ID</a> to join';
	}
	_lastID = id;
	QQI.getById(id).innerHTML = '<span class="tips" onmouseover="showGroupTips('+id+',1,14)" onmouseout="hideGroupTips(\''+id+'\')">Copied</span>'
}

function showGroupTips(id,x,y){
	var _x = x || 62;
	var _y = y || 37;
	var _xy = QQI.getXY(QQI.getById(id));
	if(!QQI.getById("g_tips")){
		var _p1 = document.createElement('p');
		_p1.className = 's1';
		var _text1 = document.createTextNode("Please Search this group in QQ International, and then join it.");
        _p1.appendChild(_text1);
		var _p2 = document.createElement('p');
		var _a1 = document.createElement('a');
		_a1.target = '_blank';
		_a1.href = 'http://download.imqq.com/help/02_06.shtml?p=2&c=6';
		var _text2 = document.createTextNode('How to Join?');
		_a1.appendChild(_text2);
		var _a2 = document.createElement('a');
		_a2.target = '_blank';
		_a2.href = 'http://download.imqq.com/download.shtml';
		var _text3 = document.createTextNode('Download QQ International');
		_a2.appendChild(_text3);
        _p2.appendChild(_a1);
		_br = document.createElement('br');
		_p2.appendChild(_br);
		_p2.appendChild(_a2);
		var _div = document.createElement('div');
		_div.className = 'g_tips';
		_div.appendChild(_p1);
		_div.appendChild(_p2);
		var _div2 = document.createElement('div');
		_div2.className = 'g_tips_box dis';
		_div2.id = 'g_tips';
		_div2.appendChild(_div);
		document.body.appendChild(_div2);
		_div2.onmouseover = function(){
			QQI.removeClassName(this,'dis');
		}
		_div2.onmouseout = function(){
			QQI.addClassName(this,'dis');
		}
		QQI.setXY(QQI.getById("g_tips"),_xy[0]-_x,_xy[1]+_y);
	}
	else{
		QQI.setXY(QQI.getById("g_tips"),_xy[0]-_x,_xy[1]+_y);
	}
	QQI.removeClassName(QQI.getById("g_tips"),'dis');
}

function hideGroupTips(id){
	QQI.addClassName(QQI.getById("g_tips"),'dis');
}

function copyToClipboard(txt){
	var _hasFlash = flashChecker();
	if(_hasFlash.f){
		if(QQI.browser.ie){		
			clipboardData.setData("Text",txt);	
		}
		else{			
			copyWithFlash(txt);	
		}
	}
	else{
		copyWithoutFlash(txt);
	}
}

function flashChecker()
{
	var hasFlash=0;//是否安装了flash
	var flashVersion=0;//flash版本
	if(document.all){
		var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); 
		if(swf){
			hasFlash=1;
			VSwf=swf.GetVariable("$version");
			flashVersion=parseInt(VSwf.split(" ")[1].split(",")[0]); 
		}
	}
	else{
		if(navigator.plugins && navigator.plugins.length > 0){
			var swf=navigator.plugins["Shockwave Flash"];
			if (swf){
				hasFlash=1;
				var words = swf.description.split(" ");
				for (var i = 0; i < words.length; ++i)
				{
					 if (isNaN(parseInt(words[i]))){
					 	continue;
					 }
					 flashVersion = parseInt(words[i]);
				}
			}
		}
	}
	return {f:hasFlash,v:flashVersion};
}

function copyWithFlash(text2copy) {    
	var flashcopier = 'flashcopier';
	if(!document.getElementById(flashcopier)) {
		var divholder = document.createElement('div');
		divholder.id = flashcopier;
		document.body.appendChild(divholder);
	}
	document.getElementById(flashcopier).innerHTML = '';
	var divinfo = '<embed src="http://static.imqq.com/images/clipboard.swf" FlashVars="clipboard='+text2copy+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	document.getElementById(flashcopier).innerHTML = divinfo;			
}

function copyWithoutFlash(txt) {    
     if(window.clipboardData) {    
             window.clipboardData.clearData();    
             window.clipboardData.setData("Text", txt);    
     } else if(navigator.userAgent.indexOf("Opera") != -1) {    
          window.location = txt;    
     } else if (window.netscape) {    
          try {    
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
          } catch (e) {    
               alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");    
          }    
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);    
          if (!clip)    
               return;    
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);    
          if (!trans)    
               return;    
          trans.addDataFlavor('text/unicode');    
          var str = new Object();    
          var len = new Object();    
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);    
          var copytext = txt;    
          str.data = copytext;    
          trans.setTransferData("text/unicode",str,copytext.length*2);    
          var clipid = Components.interfaces.nsIClipboard;    
          if (!clip)    
               return false;    
          clip.setData(trans,null,clipid.kGlobalClipboard);     
     }    
}

QQI.setMask = function(){
	var maskEl = QQI.get('qqi_uni_mask');
	var isIE6 = !window.XMLHttpRequest;
	if (!maskEl) {
		maskEl = document.createElement('div');
		maskEl['id'] = 'qqi_uni_mask';
		document.body.appendChild(maskEl);
		if(isIE6) {
			window.onresize = QQI.setMask;
		}
	}
	if(isIE6) {
		var newHeight = document.documentElement.clientHeight > document.documentElement.scrollHeight ? document.documentElement.clientHeight : document.documentElement.scrollHeight;
		maskEl.style.height = newHeight + 'px';
	}
}

// API for User Action

if (typeof(QQI.User) == "undefined" || !QQI.User) {
	QQI.User = {};
}

QQI.User.init = function() {
	var signinEl = QQI.get('qqi_signin');
	if(!signinEl) {
		signinEl = document.createElement('div');
		signinEl['id'] = 'qqi_signin';
		signinEl.innerHTML = '<div id="qqi_signin_wrap"><div id="qqi_signin_header"><div id="qqi_signin_topbt"><a href="#" onclick="QQI.User.close(); return false;">Close</a></div><h2>Sign in</h2></div><div id="qqi_signin_content"></div><div id="qqi_signin_footer"><ul><li><a href="http://ptlogin2.qq.com/ptui_forgetpwd?ptlang=1033">Reset password</a></li><li><a href="http://en.emailreg.qq.com/cgi-bin/signup/step1?regtype=1">Don\'t have a QQid?</a></li><li><a href="https://account.qq.com/cgi-bin/en/reset_index_en?ptlang=1033&ADUIN=0&ADSESSION=0&ADTAG=CLIENT.QQ.2413_ForgetPsw.0">Forget password?</a></li></ul></div></div>';
		document.body.appendChild(signinEl);
	}
}

QQI.User.signin = function() {
	QQI.User.close();
	var url = 'http://ui.ptlogin2.imqq.com/cgi-bin/login?appid=3000401&s_url=' + encodeURIComponent('http://www.imqq.com/checklogin') + '&f_url=loginerroralert&hide_title_bar=1&target=self&lang=1033&css=http://static.imqq.com/css/qqi_signin.css?v=1.0';
	var html = '<iframe onload="if(qqi_signin_iframe.document) { QQI.User.setSize(420, qqi_signin_iframe.document.documentElement.scrollHeight); }" name="qqi_signin_iframe" id="qqi_signin_iframe" marginWidth="0" src="' + url + '" frameborder="0" scrolling="no" width="100%"></iframe>';
	QQI.setMask();
	var signinEl = QQI.get('qqi_signin');
	if(!signinEl) {
		QQI.User.init();
	}
	QQI.get('qqi_signin_content').innerHTML = html;
	QQI.setStyle(QQI.get('qqi_signin'), 'top', QQI.getScrollTop() + 100 + 'px');
	QQI.setStyle(QQI.get('qqi_uni_mask'), 'display', 'block');
	QQI.setStyle(QQI.get('qqi_signin'), 'display', 'block');
}

QQI.User.close = function(){
	QQI.setStyle(QQI.get('qqi_uni_mask'), 'display', 'none');
	QQI.setStyle(QQI.get('qqi_signin'), 'display', 'none');
}

QQI.User.setSize = function(width, height) {
	var ifrEl = QQI.get("qqi_signin_iframe");
	var popupEl = QQI.get("qqi_signin");
	QQI.setStyle(popupEl, 'width', width + 'px');
	QQI.setStyle(ifrEl, 'width', width + 'px');
	QQI.setStyle(ifrEl, 'height', height + 'px');
}

// API for Join Group Action

if (typeof(QQI.Group) == "undefined" || !QQI.Group) {
	QQI.Group = {};
}

QQI.Group.result = function(str, type) {
	//QQI.get('qqi_join_result').innerHTML = '<p class="t' + type + '">' + str + '</p>';
	QQI.Group.close();
	var alertEl = QQI.get('qqi_join_alert');
	if(!alertEl) {
		QQI.Group.init();
	}
	
	if(type == 1) {
		QQI.get('qqi_join_alert').className = 'join_success';
		QQI.get('qqi_join_result').innerHTML = '<h3>Applied!</h3><p>Once accepted, you can access your groups in the Group Section of your QQ International.</p>';
	} else if(type == 4) {
		QQI.get('qqi_join_alert').className = 'join_failed';
		QQI.get('qqi_join_result').innerHTML = '<h3>Warning!</h3><p>' + str + '</p>';
	}
	
	QQI.setStyle(QQI.get('qqi_join_alert'), 'top', QQI.getScrollTop() + 200 + 'px');
	QQI.setStyle(QQI.get('qqi_uni_mask'), 'display', 'block');
	QQI.setStyle(QQI.get('qqi_join_alert'), 'display', 'block');
	setTimeout(QQI.Group.close, 3500);
}

QQI.Group.init = function() {
	var alertEl = QQI.get('qqi_join_alert');
	var joinEl = QQI.get('qqi_join_group');
	if(!joinEl) {
		joinEl = document.createElement('div');
		joinEl['id'] = 'qqi_join_group';
		joinEl.innerHTML = '<div id="qqi_join_group_wrap"><div id="qqi_join_group_header"><div id="qqi_join_group_topbt"><a href="#" onclick="QQI.Group.close(); return false;">Close</a></div><h2>Join a Group</h2></div><div id="qqi_join_group_content"></div><div id="qqi_signin_footer"><ul><li><a href="http://ptlogin2.qq.com/ptui_forgetpwd?ptlang=1033">Reset password</a></li><li><a href="http://en.emailreg.qq.com/cgi-bin/signup/step1?regtype=1">Don\'t have a QQid?</a></li><li><a href="https://account.qq.com/cgi-bin/en/reset_index_en?ptlang=1033&ADUIN=0&ADSESSION=0&ADTAG=CLIENT.QQ.2413_ForgetPsw.0">Forget password?</a></li></ul></div></div>';
		document.body.appendChild(joinEl);
	}
	if(!alertEl) {
		alertEl = document.createElement('div');
		alertEl['id'] = 'qqi_join_alert';
		alertEl.innerHTML = '<div id="qqi_join_result"><h3>Applied!</h3><p>Once accepted, you can access your groups in the Group Section of your QQ International.</p></div>';
		document.body.appendChild(alertEl);
	}
}

QQI.Group.join = function(gid){
	QQI.Group.close();
	var html = '<iframe onload="if(qqi_join_group_iframe.document) { QQI.Group.setSize(420, qqi_join_group_iframe.document.documentElement.scrollHeight); }" name="qqi_join_group_iframe" id="qqi_join_group_iframe" marginWidth="0" src="http://group.imqq.com/join/' + gid + '/" frameborder="0" scrolling="no" width="100%" height="0"></iframe>';
	QQI.setMask();
	var joinEl = QQI.get('qqi_join_group');
	if(!joinEl) {
		QQI.Group.init();
	}
	QQI.get('qqi_join_group_content').innerHTML = html;
	QQI.setStyle(QQI.get('qqi_join_group'), 'top', QQI.getScrollTop() + 100 + 'px');
	QQI.setStyle(QQI.get('qqi_uni_mask'), 'display', 'block');
	QQI.setStyle(QQI.get('qqi_join_group'), 'display', 'block');
}

QQI.Group.close = function(){
	QQI.setStyle(QQI.get('qqi_uni_mask'), 'display', 'none');
	QQI.setStyle(QQI.get('qqi_join_alert'), 'display', 'none');
	QQI.setStyle(QQI.get('qqi_join_group'), 'display', 'none');
}

QQI.Group.setSize = function(width, height) {
	var ifrEl = QQI.get("qqi_join_group_iframe");
	var popupEl = QQI.get("qqi_join_group");
	QQI.setStyle(popupEl, 'width', width + 'px');
	QQI.setStyle(ifrEl, 'width', width + 'px');
	QQI.setStyle(ifrEl, 'height', height + 'px');
}


