

//在弹窗显示QQ登录
function popupQQLogin(_id , _url , _type){
	var WWidth=600;
	var WHeight=500;
	var WLeft=Math.ceil((window.screen.width-WWidth)/2);
	var WTop=Math.ceil((window.screen.height-WHeight)/2);

	var _String = "";
	
	if (typeof _id != "undefined"){
		_String = "?community_id=" + _id;
	}

	if ((typeof _url != "undefined") && _url != "") {
		_url = _url.replace("http://","");
		if (_String == ""){
			_String = "?redirect_url=" + escape(_url);
		}
		else{
			_String = _String + "&redirect_url=" + escape(_url);
		}
	}

	var _root = popupQQLogin_getPath();
	var _qqlogin_url = _root + "qqlogin/login.asp" + _String;


	if (_type == "self"){
		window.location.href = _qqlogin_url ;
	}
	else{
		var features=
		'width='+WWidth+'px,'+
		'height='+WHeight+'px,'+
		'left='+WLeft+'px,'+
		'top='+WTop+'px,'+
		'menubar=0, scrollbars=1, resizable=1, status=1, titlebar=0, toolbar=0, location=1 '; 
		
		//window.open(_qqlogin_url ,"QQLogin",features);
		
		
	this.r = document.documentElement;
	this.f = document.createElement("FORM");
	this.f.target = "_blank";
	this.f.method = "post";
	this.r.insertBefore(this.f, this.r.childNodes[0]);
	
		
	this.f.action = _qqlogin_url;
	this.f.submit();
	
	this.f.parentNode.removeChild(this.f); 


	
	}
} 



function popupQQLogin_getPath(){
	var _syspath = window.location.href ,
			_returnPath = "" ,
			_myPositionEnd = "" ,
			_myPositionBegin = "" ;
	
	if (typeof document.getElementsByTagName("base")[0] != "undefined"){
		if (typeof document.getElementsByTagName("base")[0].href != "undefined"){
			_syspath = document.getElementsByTagName("base")[0].href;
		}
	}
	
	_syspath = _syspath.toLowerCase();      //把路径名称转换成小写
	_myPositionEnd = _syspath.lastIndexOf("/");  // 获取文件路径中的最后一个"/"
	_myPositionBegin = _syspath.lastIndexOf("script/");  // 获取文件路径中的"script/"
		

	if (_myPositionBegin > 0){
		_syspath = _syspath.substring(0,parseInt(_myPositionBegin)+7); // 使用substring函数 截取"/"之前的字符串，就得到当前目录的路径 
		
		_syspath = _syspath.replace("file:///","");   //这里要把file:///替换为空，否则会报错
		_syspath = _syspath.replace(new RegExp("%20","gm")," ");   // 如果文件名中含有空格，则要还原空格，替换所有的 %20 为 " "

	}
	
	return _syspath;
}
