// (1) 增加的js代码
document.domain="qq.com";

// 关闭
function ptlogin2_onClose()
{
	//弹出Iframe方式的范例
	login_wnd = document.getElementById("login_div");	
	login_wnd.style.display="none";
	document.getElementById("mybg").style.display = "none";
	document.body.style.overflow = '';
}

// 调整尺寸
function ptlogin2_onResize(width, height)
{	
	login_wnd = document.getElementById("login_div");
	if (login_wnd)
	{
		login_wnd.style.width = width + "px";
		login_wnd.style.height = height + "px";
		login_wnd.style.visibility = "hidden"
		login_wnd.style.visibility = "visible"
	}
}

// 显示
function openLogin(backUrl)
{
	var url="http://ui.ptlogin2.qq.com/cgi-bin/login?appid=12000101&s_url="+backUrl;
	login_wnd = document.getElementById("login_div");
	if (login_wnd != null)
	{
		login_wnd.style.visible = "hidden"	//先隐藏，这样用户就看不到页面的尺寸变化的效果
		login_wnd.style.display = "block"	  //设为block， 否则页面不会真正载入

	  var login_frame = document.getElementById('login_frame');
    //login_frame.location.href = url;
		login_frame.src = url;
	}

	//var myAlert = document.getElementById("login_div");
	//alert(login_wnd);
	//var reg = document.getElementById(infoId); 
	 login_wnd.style.display = "block";
	 login_wnd.style.position = "absolute";
	 login_wnd.style.top = "30%";
	 login_wnd.style.left = "50%";
	 login_wnd.style.marginTop = "-75px";
	 login_wnd.style.marginLeft = "-150px";
	 
	 mybg = document.getElementById("mybg");
	 if (mybg == null)
	 {
	 	 mybg = document.createElement("div");
	 	 mybg.setAttribute("id","mybg");
     mybg.style.background = "#000";
     mybg.style.width = "100%";
     mybg.style.height = "100%";
     mybg.style.position = "absolute";
     mybg.style.top = "0";
     mybg.style.left = "0";
     mybg.style.zIndex = "500";
     mybg.style.opacity = "0.3";
     mybg.style.filter = "Alpha(opacity=30)";
     document.body.appendChild(mybg);
	 }
	 else
	 {
	 	 document.getElementById("mybg").style.display = "block";
	 }
	 	 
	 document.body.style.overflow = "hidden";
}

// 生成主页上方欢迎文字及登陆入口
function showLoginTitle()
{
	var sUin 		= GetCookie("uin");
	sUin = szTrim(sUin==null?"":sUin);
	
	if ( sUin.length > 0 )
	{	
		var i = 1;
		for (i = 1; i < sUin.length && sUin.charAt(i) == "0"; i++);
		sUin = sUin.substr(i, sUin.length);
		document.getElementById("loginTitle").innerHTML = "欢迎您（" + sUin + "），[<a href='javascript:doLogout()' style='text-decoration:underline;'>退出</a>]";
	}
	else
	{
		document.getElementById("loginTitle").innerHTML = "欢迎您来到腾讯客服中心,[<a href=javascript-openLogin('http-3A/service.qq.com')/index.html" style='text-decoration:underline;'>登录</a>]";
	}
}

// 登出
function doLogout()
{
	var sURL = window.location.href;
	
	// 注意根据url不同，需要登出后跳转到不同的页面
	if ( sURL.indexOf("AskForFillDatum") != -1 )
		sURL = get_url_domain(sURL) + "/V200D100/mine_index.shtml";
	else if ( sURL.indexOf("ViewQuestion" ) != -1 )
		sURL = get_url_domain(sURL) + "/V200D100/mine_index.shtml";
	else if ( sURL.indexOf("ViewQuestionList" ) != -1)	 
		sURL = get_url_domain(sURL) + "/V200D100/mine_index.shtml";
	else if ( sURL.indexOf("myservice") != -1 )
		sURL = get_url_domain(sURL) + "/V200D100/mine_index.shtml";
	else if ( sURL.indexOf("askQuestion") != -1 )                   // 提单预搜索页面
		sURL = get_url_domain(sURL) + "/index.html";
	else if ( sURL.indexOf("communion") != -1 )                     // 提单页面
		sURL = get_url_domain(sURL) + "/index.html";
	else if ( sURL.indexOf("questionList") != -1 )                  // 单据列表页面
		sURL = get_url_domain(sURL) + "/index.html";
	else if ( sURL.indexOf("questionDetail") != -1 )                // 单据详情
		sURL = get_url_domain(sURL) + "/index.html";		
	else if ( sURL.indexOf("ShowQuestionIndex") != -1 )             // gcs提单页面
		sURL = get_url_domain(sURL) + "/index.html";
	else
		//sURL = get_url_domain(sURL) + "/index.html";
		sURL = sURL;	
	window.location.href = "/cgi-bin/Logout?url=" + sURL ;
}
	

