/*
	公共的变量
*/
	/** 全球通 */
	var _GOTONE = 1;
	/** 神州行 */
	var _EASYOWN = 2;
	/** 动感地带 */
	var _MZONE = 3;
	/** 大众卡 */
	var _EASYOWN_DZ = 5;
	/**是否是办理类*/
	var _isTransactBiz = false;
	/**用户手机号码*/
	var _userMobileNumber = "";
	
	//b2m随机验证码
	var s_rsms_code="";
	
	//办理B2M业务的业务编码
	var b2m_bizCode="";

	 var clearTime=600;//指定首页登录后cookie过期时间
	 
	 var sms_bizCode ="Others";//用于统计短信下发的业务编码 by wangshaoying 2011-12-15
    
/**
	功能：业务办理失败后的调用的方法
	m_id：消息提示的id
	f_id：业务表单的id
	b_id：功能按钮的id
	c_id：推荐信息的id
	msg：消息提示
*/
function show_fail(m_id,f_id,b_id,c_id,msg){
	var _show_faile_t = function(){
		document.getElementById(f_id).style.display = "none";
		document.getElementById('biz_op_139').style.display = "none";
		//隐藏b2m随机短信
		//hide_b2m_sms();
		re_write_biz_div(b_id,'button');
		document.getElementById(b_id).style.display = "";
		show_message(m_id,msg,false);
		var branchCode = '';
		query_common_navigation(c_id,branchCode);
	};
	setTimeout(_show_faile_t,300);
	return true;
}
/**
	功能：业务办理成功后的调用的方法
	m_id：消息提示的id
	f_id：业务表单的id
	b_id：功能按钮的id
	c_id：推荐信息的id
	msg：消息提示
*/
function show_success(m_id,f_id,b_id,c_id,msg){
	
	document.getElementById(f_id).style.display = "none";
	re_write_biz_div(b_id,'button');
	document.getElementById(b_id).style.display = "";
	document.getElementById('biz_op_139').style.display = "none";
	//隐藏b2m随机短信
	hide_b2m_sms();
	show_message(m_id,msg,true);
	var branchCode = '';
	query_common_navigation(c_id,branchCode);
	//proccessQuestion(getLoginMobile());   需求变列去掉
}
/*
	功能：展示业务办理层
	t_id：业务标题id
	c_id：业务办理层的id
	b_id：功能按钮id
	t：业务标题（中文）
	c：业务办理层的内容（html代码窜）
	b：功能按钮（html代码窜）
*/
function show_operation(t_id,c_id,b_id,t,c,b){
	var tdiv = document.getElementById(t_id);
	var cdiv = document.getElementById(c_id);
	var bdiv = document.getElementById(b_id);
	
	tdiv.innerHTML = t;
	cdiv.innerHTML = c;
	bdiv.innerHTML = b;
}
/*
	功能：弹出框效果函数
	t_id：弹出div层的标题id
	c_id：弹出div层的内容id
	b_id：弹出div层的按钮id
	title：弹出div层的标题（html代码窜,包括关闭按钮）
	content：弹出div层的内容（html代码窜）
	button：弹出div层的按钮（html代码窜）
*/
function open_window(t_id,c_id,b_id,title,content,button){
	document.getElementById(t_id).innerHTML = title;
	document.getElementById(c_id).innerHTML = content;
	document.getElementById(b_id).innerHTML = button
	
	showorhide('pop_open_window','pop_op');
}//end function
/*
	功能：展示业务办理的提示信息
	d_div：展示提示信息的id。
	msg：提示信息
	b_s：是否成功
	
*/
function show_message(d_id,msg,b_s){
	var div = document.getElementById(d_id);
	var c = "";
	var i = "";
	var t = ""
	if(b_s){
		i = '/v2008/images/public/icon_right.gif';
		t = 'green';
	}else{
		i = '/v2008/images/public/icon_wrong.gif';
		t = 'red_02';
		try{
			//b2m随机短信显示
			query_is_b2m_biz(b2m_bizCode,'b2m');
			display_b2m_sms();
		}catch(b2me){}
	}
	c += "<table>";
	c += "<tr>";
	c += "<td class='bFtd_02' valign='top'><img src='"+i+"' /></td><td> <b class='"+t+"'>"+msg+"</b> </td>";
	c += "</tr>";
	c += "</table>";
	
	div.innerHTML = c;
}
/*
	功能：营业厅业务类型查询
	t_id：业务类型div的id
	f_id：相关功能div的id
	r_id：温馨提醒div的id
	o_id：业务操作div的id
	c_id：具体内容div的id
	is_a：是否异步
	brand：品牌
	is_index：是否是营业厅首页
	is_login：是否需要登录
*/
var _a_biz_type;	//业务类型数组 
var _o_biz_id = null;//业务操作div的id
var _s_biz_suf = 'biz_type_';//业务类型标签id前缀
var _b_is_login = true;	//是否需要登录

function query_bizType(t_id,f_id,r_id,o_id,c_id,is_a,is_index,brand,bizCode,is_login){
	
	sms_bizCode = bizCode ;// 初始化 ，by wangshaoying 2011-12-15
	//暂时隐藏
	//document.getElementById("tabMenu").style.display = "none";
   
	if (arguments.length == 10) {
		_b_is_login = is_login;
	}
	
	//将流程隐藏掉
	var o_f = document.getElementById('biz_op_flow');
	if(o_f != null){
		o_f.style.display = "none";
	}
	//获得用户选择的品牌
	var brand = GetCookie('BizBrand');
	if(brand == null ){brand = _GOTONE;}
	
	var url = "/services/biztype?bizCode="+bizCode+"&bizBrand="+brand;
	var isSuccess = false;
	var handleSuccess = function(response){
			//after_response();
			isSuccess = response.result;
			_a_biz_type = response.bizType;
			//alert(_a_biz_type.length);
			show_bizType(t_id,c_id,_a_biz_type,is_index,0);
			//alert(!is_index); 
			//b2m随机短信显示
			b2m_bizCode=bizCode;
			query_is_b2m_biz(bizCode,'b2m');
			display_b2m_sms();
		query_bizInfo(t_id,f_id,r_id,o_id,c_id,is_a,is_index,brand,bizCode,response);
		//proccessQuestion(getLoginMobile());  需求变更去掉
	};
	var handleFail = function(response){
		alert("网厅基本信息加载失败，请重试。");
		//location.reload();
	};
	//请求参数
	var handlePostData = {};
	
	before_request(0,'正在加载网厅基本信息，请稍候。');
	//请求
	common_send_ajax(url,handlePostData,is_a,handleSuccess,handleFail);
	return isSuccess;
}//end function
/*
	功能：展示业务类型标签
	t_id：业务类型div的id
	c_id：具体内容div的id
	a_type：业务类型数组
	is_index：是否是营业厅首页
	p：起始的业务类型
*/
function show_bizType(t_id,c_id,a_type,is_index,p){
	var tdiv = document.getElementById(t_id);
	var size = a_type.length;
	var content = "";
	
	for(var i=0;i<size;i++){
		var t = a_type[i];
		var n = t.name;
		var c = "";
		var a = "";
		if(i == p){
			c = 'on';
		}
		var id = _s_biz_suf+i;
		if(is_index){a = "onclick=\"check_bizType('"+_o_biz_id+"','"+c_id+"',"+i+",'"+id+"')\"";}
		else
		{	
			if(i != p)
				a = "onclick=\"check_bizType('"+_o_biz_id+"','"+c_id+"',"+i+",'"+id+"')\"";
			else
				a = "onclick=\"check_bizOperation('"+c_id+"','"+_o_biz_id+"','"+id+"')\"";
		}
		content += "<li id='"+id+"' class='"+c+"' "+a+"> <span>"+n+"</span> </li>";
	}//end for
	//alert('展示业务类型: '+content);
	tdiv.innerHTML = content;
	
}//end function

/*
	功能：展示业务类型的功能
	c_id：具体内容div的id
	t_d：业务类型的描述
	a_f：功能的型数组
*/
function show_bizContent(c_id,t_d,t){
	//alert('展示相关业务的功能a_f = '+a_f);
	var cdiv = document.getElementById(c_id);
	
	var f = t.functions;	//功能列表
	var i = t.image;
	var n = t.name;
	
	var content = "";
	var url = '/v2008/images/service/public/pic_80x60.gif';
	if(i!=null && i != ''){
		url = i;
	}
	
	content += "<div class='info clearfix'>"; 
	content += "<span class='fl'>";
	content += "<img src='"+url+"' alt='"+name+"' width='80' height='60'  />";
	content += "</span>";
	content += "<div class='fr_p'>";
	content += t_d;
	content += "</div>";
	content += "</div>";
	content += "<ul class='relatedBusiness clearfix'>";
	if(f.length >0){
		for(var i=0;i<f.length;i++){
			var f1 = f[i];
			var n = f1.name;
			var u = f1.url;
			content += "<li>·<a href='"+u+"'>"+n+"</a></li>";	
		}
	}
	content += "</ul>";
	
	cdiv.innerHTML = content;
}//end function
/*
	功能：查询某个业务类型
	o_id: 业务操作的div的id
	c_id：具体内容div的id
	p：某个业务类型在业务类型数组中的索引
	id：某个具体业务类型的id
*/
function check_bizType(o_id,c_id,p,id){
	//alert('切换标签 '+id+" p = "+p);
	var t = _a_biz_type[p];	
	var t_d = t.describtion;//业务类型描述
	for(var i=0;i<_a_biz_type.length;i++){
		var d = _s_biz_suf+i;
		document.getElementById(d).className = '';
	}
	document.getElementById(id).className = 'on';
	show_bizContent(c_id,t_d,t);
	
	document.getElementById(c_id).className = 'tabBoxs_content_02';
	if(o_id != 'null')
	document.getElementById(o_id).className = 'tabBoxs_content hide';
	
}//end function
/*
	功能：展示业务操作框
*/
function check_bizOperation(c_id,o_id,id){
	//alert('展示业务操作框');
	for(var i=0;i<_a_biz_type.length;i++){
		var d = _s_biz_suf+i;
		document.getElementById(d).className = '';
	}
	document.getElementById(id).className = 'on';
	document.getElementById(o_id).className = 'tabBoxs_content';
	document.getElementById(c_id).className = 'tabBoxs_content_02 hide';
}
/*
	功能：查询某个具体业务的信息
	t_id：业务类型div的id
	f_id：相关功能div的id
	r_id：温馨提醒div的id
	o_id：业务操作div的id
	c_id：其他业务类型div的id
	is_index：是否是首页
	brand：品牌
	bizCode：业务编码
	is_a：是否异步
	
*/
function query_bizInfo(t_id,f_id,r_id,o_id,c_id,is_a,is_index,brand,bizCode,response){
	_o_biz_id = o_id;
		
	var info = response.bizInfo;
	var state = response.userState;
	
	var size = _a_biz_type.length;
	//1.得到该业务所属类型的type值
	var type = info.type;
	//2.得到在数组中的索引
	var p = 0;
	for(var i=0;i<size;i++){
		var t = _a_biz_type[i];
		var tt = t.type;
		if(tt == type){
			p = i;
		}
	}
	//3.相关类型显示高亮
	show_bizType(t_id,c_id,_a_biz_type,is_index,p);
	
	for(var i=0;i<_a_biz_type.length;i++){
		var d = _s_biz_suf+i;
		document.getElementById(d).className = '';
	}
	var id = _s_biz_suf+p;
	if(size > 0)
	document.getElementById(id).className = 'on'
	//4.展示相关功能
	var f = info.functions;
	show_bizFunction(f_id,f);
	//5.展示温馨提醒
	var r = info.reminds;
	show_bizRemind(r_id,r);
	
	//如果用户没有登录并且该业务是需要登录的就去查询该业务的信息
		if(!state && _b_is_login){
			//alert("查询该业务的信息");
			query_bizIntro(info);
		}else{
			//alert("显示操作界面");
			//如果登录就显示操作界面
			document.getElementById('biz_op_expand1').style.display = "none";
			document.getElementById('biz_op_forms').style.display = "";
			document.getElementById('biz_op_message').style.display = "";
			document.getElementById('biz_op_commond').style.display = "";
			document.getElementById('biz_op_button').style.display = "";
			
			//query_is_transact_biz(bizCode,'email');	//查询业务类型，显示邮箱
	}
}//end function

/*
	功能：当用户还没登陆时就去查询业务信息
	bc：业务编码
*/
function query_bizIntro(info){
	document.getElementById('biz_op_forms').style.display = "none";
	document.getElementById('biz_op_message').style.display = "none";
	document.getElementById('biz_op_commond').style.display = "none";
	document.getElementById('biz_op_button').style.display = "none";
	
	var div = document.getElementById('biz_op_expand1');
	var desc = info.describtion;
	var image= info.image;
	var name = info.name;
	
	var content = "";
	var url = "/v2008/images/service/public/pic_80x60.gif";
	if(image != null && image != ''){
		url = image;
	}
	content += "<div class='info clearfix'>"; 
	content += "<span class='fl'>";
	content += "<img src='"+url+"' alt='"+name+"' width='80' height='60'  /><br/>";
	content += "</span>";
	content += "<div class=\"fr_p\">";
	content += desc;
	content += "尊敬的用户如想办理该业务请先点击<a  href=\"javascript:void(0)\" onclick=\"showorhide('pop_filter_login','pop_login')\">登录</a>。谢谢。";
	//content += " <button  class=\"btn_blue_75\" onclick=\"showorhide('pop_filter_login','pop_login')\">登录</button>";
	content += "</div>";
	content += "</div>";
	
	div.innerHTML = content;
}

/*
	功能：展示某个业务的相关功能
	f_id：相关功能div的id
	f：相关功能数组
*/
function show_bizFunction(f_id,f){
	var fdiv = document.getElementById(f_id);
	
	var content = "";
	content += "<h2>相关业务功能</h2>";
	content += "<ul class='relatedBusiness clearfix'>";
	if(f.length >0 ){
		for(var i=0;i<f.length;i++){
			var t = f[i];
			var n = t.name;
			var u = t.url;
			//20081225在连接前暂时加/v08/
			content += "<li>·<a href='"+u+"' target='_blank'>"+n+"</a></li>";
		}
	}
	else{
		content += "暂无相关业务"
	}
	content += "</ul>";
	fdiv.innerHTML = content;
}//end function 
/*
	功能：展示某个业务的温馨提醒
	r_id：温馨提醒div的id
	r：温馨提醒数组
*/
function show_bizRemind(r_id,r){
	var rdiv = document.getElementById(r_id);
	var content = ""
	
	content += "<h2>温馨提醒</h2>";
	content += "<div class='reminder'>";
	if(r.length >0 ){
		content += r[0].name;
	}
	else{content += "暂无温馨提醒。"}
	content += "</div>";
	rdiv.innerHTML = content;
}//end function
/*
	功能：查询用户积分
*/
function query_common_uesr_integral(u_id){
	var url = "/services/function?action=QueryIntegral";
	var handleSuccess = function(response){
		if(response.result){
			//将积分设置Cookie中。
			var cookieValue = response.UserMobile +"|"+response.UserIntegral;
			SetCookie('LoginMember',cookieValue,false,'/');
			
			var c = "您的积分：<i>"+response.UserIntegral+"</i>分";
			document.getElementById(u_id).innerHTML = c;
		}
	};
	var handleFail = function(response){};
	//请求参数
	var handlePostData = {};
	//请求
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}//end function
/*
	功能：查询导航信息。
*/
function query_common_navigation(c_id,branchCode){
	var content = "";
	content += "<table class='navigation'>";
	content += "<tr >";
	content += "<td class='bFtd_02' ><a href='/' title='转去网站首页'>1、转去网站首页；</a></td>";
	content += "<td class='bFtd_02'><a href='/service/' title='转去网厅首页'>2、转去网厅首页；</a></td>";
	content += "</tr>";
	
	content += "<tr >";
	content += "<td class='bFtd_02'><a href='/shop/' title='转去移动商城'>3、转去移动商城；</a></td>";
	content += "<td class='bFtd_02'><a href='/e100/index.jsp' title='转去e100个人专区'>4、转去e100个人专区；</a></td>";
	content += "</tr>";
	
	content += "<tr >";
	if(branchCode == ''){
		content += "<td class='bFtd_02'><a href='/whatsnew/' title='转去最新优惠'>5、转去最新优惠；</a></td>";
	}else{//http://gd.10086.cn/whatsnew/discount/index.jsp?branchCode=GZ
		content += "<td class='bFtd_02'><a href='/whatsnew/discount/index.jsp?branchCode="+branchCode+"' title='转去最新优惠'>5、转去最新优惠；</a></td>";
	}
	content += "<td class='bFtd_02'><a href='/10086/' title='转去客户服务'>6、转去客户服务；</a></td>";
	content += "</tr>";
	content += "</table>";
	document.getElementById(c_id).innerHTML = content;
	

	return content;
}//end function
/*
	功能：签订协议
	p_id :协议签订框的id;
*/
function signed_biz_agreement(p_id,s_id){
	var url = "/services/function?action=SignedAgreement";
	var handleSuccess = function(response){
		if(response.result){
			var title = "<h4>信息提示<span onclick=\"showorhide('pop_open_window','pop_op')\" title='点击关闭'>关闭</span></h4>";
			var content = '<center>'+response.message+'</center>';
			var button = "<button onclick=\"showorhide('pop_open_window','pop_op')\>确定</button>";
			open_window('pop_op_title','pop_op_content','pop_op_button',title,content,button);
			
			document.getElementById(p_id).disabled= "none";
			document.getElementById(s_id).innerHTML= "尊敬的用户您已<a href=\"/service/agreement.shtml\" target=\"_blank\">阅读</a>并接受业务办理协议";
		}
	};
	var handleFail = function(response){};
	//请求参数
	var handlePostData = {};
	//请求
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}//end function
/*
	功能：弹出用户退出网站二次确认
*/
function show_logout_gmcc(){
	//<span onclick=\"showorhide('pop_open_window','pop_op')\" title='点击关闭'>关闭</span>
	var title = "<h4>信息提示</h4>";
	var content = "<center id='_user_logout_msg'>尊敬的客户，您确认要退出网上服务厅吗？</center>";
	var button = "<button onclick=\"user_logout_gmcc();\">确定</button>";
		button += "<button onclick=\"showorhide('pop_open_window','pop_op')\">取消</button>";
		
	open_window('pop_op_title','pop_op_content','pop_op_button',title,content,button);
}
/*
	功能：用户退出网站
*/
function user_logout_gmcc(){
	document.getElementById("_user_logout_msg").innerHTML = "<span class=loading>正在退出中，请稍候。</span>";
	handle_biz_button("pop_op_button",true);
	
	var url = "/services/function?action=Logout";
	//退出成功
	var handleSuccess = function(response){
		var isNg = response.isNg;
		if(isNg==true){
			var backUrl = response.backUrl;
			window.location = backUrl;
			return false;
		}
		showorhide('pop_open_window','pop_op');
		var title = "<h4>信息提示<span onclick=\"showorhide('pop_open_window','pop_op');location.reload()\" title='点击关闭'>关闭</span></h4>";
		var content = '<center><h2>您已经成功退出网上服务厅，请选择：</h2><br/><span id=\"_gmcc_n_info\"></span></center>';
		var button = "<button onclick=\"showorhide('pop_open_window','pop_op');location.reload()\">关闭</button>";
		open_window('pop_op_title','pop_op_content','pop_op_button',title,content,button);
		//alert('response.branchCode = '+response.branchCode);
		query_common_navigation('_gmcc_n_info',response.branchCode);
		
		//删除Cookie
		//DelCookie('LoginMember','/');
		//LoginMember添加已退出标识
		SetCookie('LoginMember',GetCookie('LoginMember')+'|logout',false,'/');
		//alert("delete BizBrand");
		DelCookie('BizBrand','/');
		//删除139ssoCookie
		//DelCookie('139_sso_cookie','/');
	};
	//退出失败
	var handleFail = function(response){
		showorhide('pop_open_window','pop_op');
		
		var title = "<h4>信息提示<span onclick=\"showorhide('pop_open_window','pop_op');\" title='点击关闭'>关闭</span></h4>";
		var content = '<center>退出失败</center>';
		var button = "<button onclick=\"showorhide('pop_open_window','pop_op')\">关闭</button>";
		open_window('pop_op_title','pop_op_content','pop_op_button',title,content,button);
		
	};
	//请求参数
	var handlePostData = {};
	//请求
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}//end function
/*
	功能：查询某个业务是否是办理类业务
	t：回调方法类型
		email: 显示邮箱
*/
function query_is_transact_biz(bizCode,t){
	var url = "/services/function?action=IsTransactBiz&BizCode="+bizCode;
	var handleSuccess = function(response){
		var b_r = response.result;
		_userMobileNumber = response.UserMobile;
		
		if(t == 'email'){//显示邮箱
			if(b_r){
				show_biz_email('biz_op_139')
			}	
		}
		
		_isTransactBiz = b_r;
	};
	var handleFail = function(response){};
	//请求参数
	var handlePostData = {};
	//请求
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}//end function
/*
	功能：展示邮箱
*/
function show_biz_email(e_id){
	var c = "<table width=\"80%\"><tr><td class=\"blue_01\" align='center'>";
	c += "<input type=\"checkbox\" id='_is_check_email' name='_is_check_email'/> ";
    c += "<span class=\"red_01\">您是否将记录保存到邮箱：</span>";
	if(_userMobileNumber==undefined)_userMobileNumber="";
    c += "<input type=\"text\" class=\"text_01\" id='_biz_prefix_email' value='"+_userMobileNumber+"'/> ";
    c += "<select id='_biz_postfix_email'>";
    c += "<option value='@139.com' selected='selected'>@139.com</option>";
    c += "<option value='@sina.com' >@sina.com</option>";
    c += "<option value='@yahoo.com.cn'>@yahoo.com.cn</option>";
    c += "<option value='0'>其他</option>";
    c += "</select>";
    c += "</td></tr></table>";
             
	document.getElementById(e_id).innerHTML = c;
}
/*
	功能：进度提示信息
	n_t：
		 1，正在查询中，请稍候。
		 2，正在办理中，请稍候。
		 3，正在修改中，请稍候。
		 4，正在取消中，请稍候。
		 5，正在删除中，请稍候。
*/
function before_request(n_t,s_m){
    //隐藏b2m随机短信输入框
    hide_b2m_sms();

	var msg = "数据加载中，请稍候。";
	
	if(arguments.length == 1){
		switch (n_t) {
	        case 1:
	            msg = "正在查询中，请稍候。";
	            break;  
	        case 2:
	            msg = "正在办理中，请稍候。";
	            break;
	        case 3:
	            msg = "正在修改中，请稍候。";
	            break;
	        case 4:
	            msg = "正在取消中，请稍候。";
	            break;
	        case 5:
	           msg = "正在删除中，请稍候。";
	           break;
	    }
    }
    else if(arguments.length == 2){
    	msg = s_m;
    }
    //alert(msg);
	document.getElementById("biz_op_message").innerHTML = "<center><span class=loading>"+msg+"</span></center>";
	var d = document.getElementById("biz_op_button");
	if(d != null){
		var bs = d.getElementsByTagName("button");
		for(var i=0;i<bs.length;i++){
			bs[i].disabled = "disabled";
		}
	}
}

function after_response(){
	//显示b2m随机短信输入框
    display_b2m_sms();
	var m = document.getElementById("biz_op_message");
		m.innerHTML = "";
	var d = document.getElementById("biz_op_button");
	if(d != null){
		var bs = d.getElementsByTagName("button");
		for(var i=0;i<bs.length;i++){
			bs[i].disabled = "";
		}
	}
}
/*
	处理功能按钮
*/
function handle_biz_button(d_id,b_ish){
	var table = document.getElementById(d_id);
	if(table != null){
		var t = "";
		if(b_ish){
			t = "disabled";
		}
		var b = table.getElementsByTagName("button");
		for(var i=0;i<b.length;i++){
			b[i].disabled = t;
		}
	}
}
/*
	功能：重写div中的内容
	d_id：div的id
	t：重写内容
*/
function re_write_biz_div(d_id,t){
	var div = document.getElementById(d_id);
	var c = "";
	
	if(t == "button"){//重写button
		var msg = "重新查询";
		var click = "onclick = \"location.reload()\"";
		if(_isTransactBiz)//是办理类
			msg = "重新办理";
		c += "<table class=\"tfootBtn\">";
        c += "<tr>";
        c += "<td>";
        c += "<button class=\"btn_blue_75\" onmouseover=\"shover(this,'btn_blue_75_02')\" onmouseout=\"shover(this,'btn_blue_75')\" "+click+">"+msg+"</button>";
        c += "<button class=\"btn_online\" onmouseover=\"shover(this,'btn_online_02')\" onmouseout=\"shover(this,'btn_online')\" onclick=\"poponlineWindow()\">网上客服</button>";
        c += "</td>";
        c += "</tr>";
    	c += "</table>";
	}
	div.innerHTML = c;
}
/*

	检查邮箱，成功返回邮箱地址，不成功则返回"",如果用户没有选择则返回“none”
	c_id（checkbox的id）,t_id（text的id）,s_id（select的id）
*/
function check_biz_email(c_id,t_id,s_id){
	var e = "";
	var o_cb = document.getElementsByName(c_id);
    if(o_cb != null){
    	if(o_cb[0].checked){
    		var s_e = document.getElementById(t_id).value;
    		var n_t = document.getElementById(s_id).value;
    		
    		if(n_t == '0'){
    			e = s_e;
    		}
    		else{
    			e = s_e + n_t;
    		}
    		//139邮箱的验证
    		if(n_t == '@139.com'){
    			var is = new SunRise.Validate();
    			if(!is.isMobile(s_e)){return "";}
    		}
    		//验证邮箱：
    		var is = new SunRise.Validate();
    		if(is.isEmail(e)){
    			return e;
    		}
    		else{
    			return "";
    		}
    		
    	}
    	else{
    		return "none";
    	}
    } 
}//end function
/*=======================20081218 添加/service/public.js=======================*/
//网厅公共JS
/* 选项卡函数
 * 参数说明：
 * tabBoxId,选项卡大容器Id
 * tabMenuId,选项卡菜单Id 【必须为ul元素】
 * tc_className，选项卡内容容器className 【必须为div元素】  
 */
function tabFunc(tabBoxId,tabMenuId,tc_className)
{
	//var o =  SunRise.Dom.get(tabBoxId);	
	
	
	var D = SunRise.Dom;
	var tabBoxs = D.getElementsByClassName(tc_className,"div",D.get(tabBoxId));
	var lis = D.get(tabMenuId).getElementsByTagName("li");
	for(var i=0,j=lis.length;i<j;i++)
	{
		
		//E.addListener(lis[i],'click',tab(i));
		lis[i].onclick = tab(i);
		
	}	
	
	function tab(i)
	{
		return function()
			{
				for(var k=0,t=lis.length;k<t;k++)
				{
					lis[k].className = k == i?"on":"";
					//tabBoxs[k].className = k == i?(SunRise.Dom.removeClass(tabBoxs[k],"hide")):(SunRise.Dom.addClass(tabBoxs[k],"hide"));
					tabBoxs[k].className = k == i?tabBoxs[k].className.replace(/ hide/g,""):(tabBoxs[k].className+" hide");
				}
			}
	}
}



function autoFixMenu(o)//修复IE6.0下，不能遮住下拉框的问题
	{
		var D = SunRise.Dom;
		var $ = D.get;
		
		if(!o.getElementsByTagName("iframe")[0])return;
		
		//try{
		
		var _iframe= o.getElementsByTagName("iframe")[0];		
		var ul = o.getElementsByTagName("ul")[0];
		var ulOffset = Offset(ul);					
		
		D.setStyle(_iframe,'width',ulOffset.width);
		D.setStyle(_iframe,'height',ulOffset.height);
		
		D.setStyle(_iframe,'left',D.getStyle(ul,'left'));
		D.setStyle(_iframe,'top',D.getStyle(ul,'top'));
		
		D.setStyle(_iframe,'display','block');
		D.setStyle(_iframe,'zIndex','5');
		D.setStyle(ul,'zIndex','10');	
		
		//}
	//	catch(e){}
		
	}
	

	
function createIframe(o)
	{
		try
		{
			var oiframe = document.createElement("iframe");
			oiframe.className="iframefilter";
			//oiframe.style.display = "none";
			oiframe.style.left = -9000+"em";
			oiframe.style.top = -9000+"em";
			o.appendChild(oiframe);
			
		}
		catch(e){}
		
	}

//侧边栏菜单脚本(id固定)===========================
function funcleftMenu()
	{
		if(!document.getElementById("leftMenu"))return;
		var lis_temp =document.getElementById("leftMenu").childNodes;
		//alert(lis.nodeType)
		var lis=[];
		for(var i =0,j=lis_temp.length;i<j;i++)
		{
			if(lis_temp[i].nodeType!=3)
			{
				lis.push(lis_temp[i]);
			}
		}
		
		function _onclick(o)
		{
			if(typeof(old_o)=="object")
			{
				if(old_o!=o)
				{
					old_o.className=old_o.className.replace(/on/g,"");	
					old_o.getElementsByTagName("a")[0].title = "请点击打开";
				}
			}
			
			if(typeof(old_o2)=="object")
			{
				
					old_o2.className=old_o2.className.replace(/on/g,"");		
					//alert(old_o2)				
				
			}
			
			old_o=o;
			if(o.className.indexOf("on")!=-1)
			{
				o.getElementsByTagName("a")[0].title = "请点击打开";
				o.className=o.className.replace(/on/g,"");
			}
			else
			{
				
				o.className="on "+o.className;	
				o.getElementsByTagName("a")[0].title = "请点击关闭";
			}
		
		cancleEventUp(getEvent());
		/*
			if(document.all) 
				{
					window.event.cancelBubble=true;
				}
			else 
				{
					oevent.stopPropagation();
				}
		*/
		}
		
		
		function _onmouseover(o)
		{			
			if(typeof(old_o2)=="object")
			{
				if(old_o2!=o)
				{
					old_o2.className=old_o2.className.replace(/on/g,"");	
						
					//alert('?')				
				}
			}
			old_o2=o;
			o.className="on "+o.className;	
			if(o.getElementsByTagName("ul")[0])
			{
				var offul =o.getElementsByTagName("ul")[0];
				var _top = Offset(offul).height/2-13;
				offul.style.top= - _top +"px";
			}
			
			if(o.getElementsByTagName("iframe")[0])
			{
				//var _iframe = o.getElementsByTagName("iframe")[0];
				autoFixMenu(o);
			}
		}
		
		
		for(var i = 0,j=lis.length;i<j;i++)
			{			
				if(lis[i].getElementsByTagName("ul").length>0)
					{
						
						lis[i].className="hastree";	
						lis[i].getElementsByTagName("a")[0].title = "请点击打开";
						lis[i].getElementsByTagName("a")[0].href = "javascript:;";
						lis[i].onclick =(function (tag){
							return function()
							{								
								_onclick(tag);
							}
							
						})(lis[i]) ;
						
					var ulis = lis[i].getElementsByTagName("ul")[0].getElementsByTagName("li");	
						for(var k1=0,k2=ulis.length;k1<k2;k1++)
						{
							if(ulis[k1].getElementsByTagName("ul").length>0)
							{
								ulis[k1].className="hastree";									
								ulis[k1].getElementsByTagName("a")[0].href = "javascript:;";		
								if(SunRise.ua.ie=="6")
									{
										createIframe(ulis[k1]);
										
									}						
							}
							ulis[k1].onmouseover =(function (tag){
									return function()
									{								
										_onmouseover(tag);
									}
									
								})(ulis[k1]) ;
							
						}
						
					}
			
		
		
	}

document.onclick = function()
{
	if(typeof(old_o2)=="object")
	{
		old_o2.className=old_o2.className.replace(/on/g,"");	
	}
	if(typeof(old_o)=="object")
	{
		old_o.className=old_o.className.replace(/on/g,"");	
	}
	
	
}
}



/*信息提示函数
 * 转入的参数格式必须为json格式
 * 参数格式{url:str_url,text:str_text,tget:str_tget,func:str_func} url为链接，text为文本,tget为窗口打开的方式,func为onclick方法名
 * 参数长度不限
 * 调用示例：tips({url:'/service/gotone/',text:'停机开机'},{url:'/service/gotone/',text:'解除黑名单'},{url:'/service/gotone/',text:'备卡激活'},{url:'/service/gotone/',text:'补卡SIM卡(广州)'})
 */
var tips_box; //存储信息提示对象的全局变量
function tips(){
	if( arguments.length==0||!document.body) return;//如果无参数和没有得到body 则返回
	
	tips_box = tips_box||document.createElement("div");	
	tips_box.className = "tips_box";
		
	var con_01 = "<div class=\"tips_con\"><ul>";
	var con_02 = "";
	var con_03 = "</ul></div><div class=\"tips_b\"></div>";
	for( var i=0,j=arguments.length;i<j;i++)
		{
			con_02 += "<li><a href=\"" + arguments[i].url +"\""+" "+"target=\""+arguments[i].tget+"\""+" onclick=\""+arguments[i].func+"\""+">·"+ arguments[i].text + "</a></li>";
			
		}		
		
	var con = con_01 + con_02 +con_03;	
	
	tips_box.innerHTML = con;
	var ev = getEl()
	var offset = Offset(ev);
	var T = offset.top + 20;
	var L = offset.left + 20
	tips_box.style.top = T +"px";
	tips_box.style.left = L +"px";	
	
	try
	{
		document.body.appendChild(tips_box);
	}
	catch(e){};
	function settipsTimeout()
	{
		tipstt = setTimeout(function(){
			
			if(tips_box)
			{
				try
					{
						document.body.removeChild(tips_box);
					}
				catch(e){};
			}
			
			
			
		},1000);
	}
	ev.onmouseout = settipsTimeout;
	
	
	try
			{
				if(tipstt)
				{
					clearTimeout(tipstt);
					
				}
			}
			catch(e){};
	
	tips_box.onmouseover = function()
		{
			try
			{
				if(tipstt)
				{
					clearTimeout(tipstt);
					
				}
			}
			catch(e){};
			
			tips_box.onmouseout = settipsTimeout;
			
		};
}//end function
/*=======================20081218 添加CommonAjax.js=======================*/
/*
	功能：向服务端发送请求
	url: 请求url
	handlePostData：发送的json对象
	isAsynchronism：是否异步
	handleSuccess：回调的方法
	handleFail：调用失败的回调方法
*/
var n_unlogin = 30;//还未登录
var n_err_loginty=32;//登陆方式错误
var n_must_protocol=33;//必须签定电子协议
var n_TIME_OUT=45*1000;//超时时间
var n_e100_unsetinfo=98;//没有设置个人信息的处理：提示，确认提示则转到个人信息提示页面
var n_e100_isshow = true;
function reset_timeout_MilliSeconds( MilliSeconds ){ n_TIME_OUT=MilliSeconds; };//重置超时时间
function common_send_ajax(url, handlePostData,isAsynchronism,handleSuccess, handleFail, handleTimeout){ 
	
	if(url=="/ServicesServlet/LOGIN"){
		//alert(handlePostData.toJSONString());
		var info=handlePostData._loginInfo;
		info=info.parseJSON();
		var b=info.isSso;
		if(b){
			var f = document.createElement("form"); 
			f.action = "http://" + window.location.host + url; 
			//f.action = url;
			//f._request_json = encodeURIComponent(handlePostData.toJSONString());
			f.method = "POST"; 
			document.getElementById("pop_op_content").appendChild(f); 
			var i = document.createElement("input");
			i.type = "hidden";
			i.name = "_request_json"; 
			//alert(handlePostData.toJSONString());
			i.value = encodeURIComponent(handlePostData.toJSONString());
			f.appendChild(i);
			f.submit(); 
			return;
		}
	}
	
	//统一门户快捷业务插码
  /**
   if(new RegExp(/^\/ServicesServlet\//).test(url)){				       
		var  s_cut_bizcode=url.substr(17);
		var  s_operation=handlePostData.operation;
		//统一门户快捷业务插码部署需求 需要采集日志的 业务编码串 注意首尾的","
		var w_shortcuts_bizcodes=",INTE_GRAL_CURR_YEAR,ACCOUNTS_BALANCE_SEARCH,MZONE_MVALUE_BALANCE,GPRS,NEW_SMS_PACKAGE,STOP_OPEN_MOBILE,UPDATE_PASSWORD,";	      
		  //alert("操作"+url+":"+s_operation+":"+s_cut_bizcode);
		if(w_shortcuts_bizcodes.indexOf(","+s_cut_bizcode+",")!=-1){
			if(s_operation=='initiate'||s_operation=='modify' || s_operation=='cancel'){
			  //alert("---开始进行办理,取消或修改--");
				_grtag.dcsMultiTrack('WT.si_x','20'); 
			}			          
		}
	}
	*/
	//end
	var sending = false;
    var handleResult = function(o){
		//alert(o.status);
        if (o.readyState == 4) { 
		//alert(o.status);
            if (o.status == 200) {
				if(sending){
					sending = false;
				}else{
					return;
				}
				//alert(o.responseText);
                var response = o.responseText.parseJSON();
				//alert(response);
               	var code = response.resultCode;
               
				if(response.result){ 				    
				    //webtrends
                 	if(new RegExp(/^\/ServicesServlet\//).test(url)){				       
				        var  s_cut_bizcode=url.substr(17);
				        var  s_operation=handlePostData.operation;
				       //统一门户快捷业务插码部署需求 需要采集日志的 业务编码串 注意首尾的","
				        var w_shortcuts_bizcodes=",INTE_GRAL_CURR_YEAR,ACCOUNTS_BALANCE_SEARCH,MZONE_MVALUE_BALANCE,GPRS,NEW_SMS_PACKAGE,STOP_OPEN_MOBILE,UPDATE_PASSWORD,BAY_FEE,MONTER_SPBOOK_REL,PUK,PACKAGEMANAGEMENT,CALLAWAKE,SVC_VOICEMAIL,SVC_CALLDISPLAY,SVC_CALLWAIT,SVC_CALLFORWARD,SVC_CALLLIMITIED,ONE_TOMORE_CARD_HK,ONE_TOMORE_CARD_MA,BUSI_LONG_DISTANCE,InternatRoam,QueryServeFunc,BILL_SEARCH,REALTIME_LIST_SEARCH,CHINESESECRETARY,AllBUSININESS_GOTONE_SEC,CommunicateAssistant,";
				          //alert("成功"+url+":"+s_operation+":"+s_cut_bizcode);
				        if(w_shortcuts_bizcodes.indexOf(","+s_cut_bizcode+",")!=-1){
				            if(s_operation=='initiate'||s_operation=='modify'||s_operation=='modified' || s_operation=='cancel'|| s_operation=='query'){
				               //alert("---办理,取消或修改成功--");
				              try{
								  if( typeof(_grtag) != "undefined" )
									  _grtag.dcsMultiTrack('WT.si_x','99');
							  }catch(e){}
				            }			          
					    }
				    }
					handleSuccess(response);
					//加载关联业务
					load_relating_biz(handlePostData,response);
					//处理营销活动引导信息
					handleAwardGuideInfo(response);
				}else{
                    if(code == n_unlogin){//还未登录，弹出登录框
                    	showorhide('pop_filter_login','pop_login');
						var _loginType = document.getElementById("_loginType");
						_loginType.value = response.lessLoginType;
						document.getElementById("_login_backurl").value = "";
						document.getElementById("_login_target").style.display = "none";
						_s_l_m_p(_loginType,'service_pwd','check_code','message_code');
                    }else if(code == n_err_loginty){
						if(response.updateLoginType == 1){
							showorhide('pop_message_rnsms','pop_msg_rnsms');
						}else{
							showorhide('pop_message_pwd','pop_msg_pwd');
						}
					}else if(code == n_must_protocol){
						showorhide('pop_agreement_biz','pop_agr_biz');
					}else if(code==n_e100_unsetinfo){
					    if(n_e100_isshow){
					        n_e100_isshow=false; 	  
							window.location = '/e100/UserInfoManage/index.vm?_burl='+window.location.pathname;  
						}
					}else{
							//统一门户快捷业务插码			       
							var  s_cut_bizcode=url.substr(17);
							var  s_operation=handlePostData.operation;
							//统一门户快捷业务插码部署需求 需要采集日志的 业务编码串 注意首尾的","
                                                         var w_shortcuts_bizcodes=",INTE_GRAL_CURR_YEAR,ACCOUNTS_BALANCE_SEARCH,MZONE_MVALUE_BALANCE,GPRS,NEW_SMS_PACKAGE,STOP_OPEN_MOBILE,UPDATE_PASSWORD,BAY_FEE,MONTER_SPBOOK_REL,PUK,PACKAGEMANAGEMENT,CALLAWAKE,SVC_VOICEMAIL,SVC_CALLDISPLAY,SVC_CALLWAIT,SVC_CALLFORWARD,SVC_CALLLIMITIED,ONE_TOMORE_CARD_HK,ONE_TOMORE_CARD_MA,BUSI_LONG_DISTANCE,InternatRoam,QueryServeFunc,BILL_SEARCH,REALTIME_LIST_SEARCH,CHINESESECRETARY,AllBUSININESS_GOTONE_SEC,CommunicateAssistant,";
                                                       //var w_shortcuts_bizcodes=",INTE_GRAL_CURR_YEAR,ACCOUNTS_BALANCE_SEARCH,MZONE_MVALUE_BALANCE,GPRS,NEW_SMS_PACKAGE,STOP_OPEN_MOBILE,UPDATE_PASSWORD,";
							  //alert("失败------"+url+":"+s_operation+":"+s_cut_bizcode);
							if(w_shortcuts_bizcodes.indexOf(","+s_cut_bizcode+",")!=-1){
								if(s_operation=='initiate'||s_operation=='modify' || s_operation=='cancel'|| s_operation=='query'){
								  //alert("---办理,取消或修改失败--");
									_grtag.dcsMultiTrack('WT.si_x','-99'); 
								}			          
							}
						 //end
						handleFail(response);
					}
				}
            }
            else {//调用失败统一处理  
            	if(sending){
					sending = false;
				}else{
					return;
				}
				if (handleFail) {
					handleFail();
				}else{
					//alert('系统异常，请稍后再试');
					var m = document.getElementById('biz_op_message');
					if(m != null){
						m.innerHTML = "<center><b class='red_02'>系统异常，请稍后再试</b></center>";
					}
				}
            }
        }
    };
	
	//请求超时处理
	var timeout = function(){
		if(sending){
			sending = false;
			if(handleTimeout){
				handleTimeout();
			}else{
				showorhide('pop_timeout_msg','pop_timeout_req');
			}
		}
	}
	//传B2M随机码
	get_bbc_RndSms();
	handlePostData._bbc_rsmsRND=s_rsms_code;
	
	//加入channel信息
	//alert($("_which_channel").value);
	handlePostData._which_channel=$("_which_channel")==null?"":$("_which_channel").value;
	//alert(handlePostData.toJSONString());
    var callback = {
        success: handleResult,
        postData: "_request_json="+encodeURIComponent(handlePostData.toJSONString())
    };
    
    //办理关联时，传递源业务编码及源业务子编码
    var operation = handlePostData.operation;
	if(operation == 'query' || operation == 'initiate' || operation == 'modify' || operation == 'cancel'){
		var relating_biz_div = document.getElementById("relating_biz_div");
		if(relating_biz_div != null){
			callback.postData = callback.postData + "&src_biz_info=" +relating_biz_div.innerHTML;
		}
	}
	
    var ajax = new SunRise.Ajax({
        URL: url,
        isAsynchronism: isAsynchronism,
        method: 'POST'
    });
    ajax.send(callback);
	sending = true;
	window.setTimeout( function() {timeout();} , n_TIME_OUT );
}

function update_login_type(n){
	var p = 0;
	var t = "";
	var _lem = null;
	var d = null;
	var o = "";
	if(n == 1 ){
		t = "随机短信密码";
		_lem = document.getElementById("_up_smsrnd_login_type");
		p = document.getElementById("_update_smsrnd").value;
		d = document.getElementById("pop_msg_rnsms");
		o = "checksms";
	}else{
		t = "服务密码";
		_lem = document.getElementById("_up_pwd_login_type");
		p = document.getElementById("_pwd_update_logintype").value;
		d = document.getElementById("pop_msg_pwd");
		o = "checkpwd";
	}
	
	var v1 = new SunRise.Validate();
	var v = function(p){
        if (p == "") {
            _lem.innerHTML ="<img src=\"/v2008/images/public/icon_wrong.gif\" /> <b class=\" red_02\"> "+ t+"不能为空</b>";
            return false;
        }
        if (!v1.isNumber(p)) {
            _lem.innerHTML ="<img src=\"/v2008/images/public/icon_wrong.gif\" /> <b class=\" red_02\"> "+ t+"必须为数字</b>";
            return false;
        }
        return true;
    }
	
	if(!v(p)){
		return;
	}
	
	var url = "/ServicesServlet/UPDATE_LOGIN_TYPE";
	
	if(d != null){
		_lem.innerHTML = "正在验证中，请稍候......";
		var bs = d.getElementsByTagName("button");
		for(var i=0;i<bs.length;i++){
			bs[i].disabled = "disabled";
		}
	}
	
	var handlePostData = {
		sms_bizcode:sms_bizCode,//修改添加业务编码 by wangshaoying 2011-12-15
        operation: o,
		isProtocol:true,
		checkstr:p
    };
	
	var handleSuccess = function(o){
		location.reload();
    };
	
	var handleFail = function(o){
		var m = null;
		if(o.type == 1){
			m = document.getElementById("_up_smsrnd_login_type");
		}else{
			m = document.getElementById("_up_pwd_login_type");
		}
		m.innerHTML ="<img src=\"/v2008/images/public/icon_wrong.gif\" /> <b class=\" red_02\"> "+ o.message +"</b>";
		if(d != null){
			var bs = d.getElementsByTagName("button");
			for(var i=0;i<bs.length;i++){
				bs[i].disabled = "";
			}
		}
    };
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}

//showCommonError
function _show_common_error(m){
	var t = "<h4>信息提示<span onclick=\"showorhide('pop_open_window','pop_op')\" title='点击关闭'>关闭</span></h4>";
	var c = m;
	var b = "<button type='submit' onclick=\"showorhide('pop_open_window','pop_op')\" id='submit_button'>确定</button>";
	open_window('pop_op_title','pop_op_content','pop_op_button',t,c,b);
}
// popForm

//重写window.onscroll事件
function addScrollEvent(func){
    var oldonscroll = window.onscroll;
    if (typeof window.onscroll != 'function') {
        window.onscroll = func;
    }
    else {
        window.onscroll = function(){
            oldonscroll();
            func();
        }
    }
}

var _obj02 = "";
function autoCenter(o1,o){
	
	o1.style.height = document.documentElement.scrollHeight + "px";
    o.style.left = (document.documentElement.scrollLeft + (document.documentElement.clientWidth - o.offsetWidth) / 2) + "px";//左右居中		
    o.style.top = (document.documentElement.scrollTop + (document.documentElement.clientHeight - o.offsetHeight) / 2 - 10) + "px";
    //o.style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-o.offsetHeight)/2)+"px";

    //上下居中	
}

var objFilters = [];
/*
*
*   判断在数组中是否含有给定的一个变量值
*   参数说明：
*   needle：需要查询的值
*   haystack：被查询的数组
*   在haystack中查询needle是否存在，如果找到返回true，否则返回false。
*   此函数只能对字符和数字有效
*
*/
function in_array(needle,haystack) 
{
    // 得到needle的类型
    var type = typeof needle;

    if(type == "object" ) 
    {
        for(var i in haystack) 
        {
            if(haystack[i] == needle) 
            {
                return true;
            }
        }
    }
    return false;
	
}

/*功能说明：显示和隐藏某个层
 *参数说明： _id01为要显示/隐藏的id
 *           _id02为要左右居中的id
 **/
var showorhide = function(_id01, _id02){
	
	if((_id01 ==""||typeof _id01 !="string")&&(_id02 ==""||typeof _id02 !="string")) return;
	_obj01 = $(_id01);	
	_obj02 = $(_id02);
	if(!_obj01||!_obj02)return;
    
    if(_id01!="pop_filter_login")	
		{
			if(objFilters.length<1)
				{
					objFilters.push(_obj01);
				}
			else
				{
					if(!in_array(_obj01,objFilters))
					{
						objFilters.push(_obj01);				
					}
				}
		}
	else
		{
			for( var i=0,j=objFilters.length;i<j;i++)
				{
					if(objFilters[i].className.indexOf("hide")==-1)
					{
						objFilters[i].className+=" hide";	
					}
				}
		}	
	
    
    var _obj = _obj01;
    if (_obj.className.indexOf("hide") != -1) {
        _obj.className = (_obj.className).replace("hide", "");
        _obj.style.height = document.documentElement.scrollHeight + "px";
        autoCenter(_obj,_obj02);
        function center(){
            autoCenter(_obj,_obj02);
        }
        addScrollEvent(center);
    }
    else 
        if (_obj.className.indexOf("hide") == -1) {
            _obj.className += " hide";
        }
    
};




function check_login(u){
	var handleSuccess = function(o){
	        if (o.readyState == 4) {
				if (o.status == 200) {
					var response = o.responseText.parseJSON();
					if (response.resultCode == 100) {
						document.getElementById('_login_backurl').value = response.targetUrl;
						showorhide('pop_filter_login','pop_login');
					}else{
						window.location=response.targetUrl;
					}
				}
			}
	}
	var handlePostData = {
        operation: "check"
    };
	
	var callback = {
        success: handleSuccess,
        postData: handlePostData.toJSONString()
    };
	
 	var ajax = new SunRise.Ajax({
        URL: "/login/checkLogin.jsp?targetUrl="+u,
        isAsynchronism: true,
        method: 'POST'
    });
    ajax.send(callback);
}

function _show_loginform(s,h){
    document.getElementById(h).style.display = "none";
    document.getElementById(s).style.display = "";
}



function s_l_m_g(o){
    var _value = o.value;
    var mobileNo = document.getElementById("mobileNo");
    var service_pwd2 = document.getElementById("service_pwd2");
    var userName = document.getElementById("userName");
    var userPsw = document.getElementById("userPsw");
    switch (_value) {
    
        case "0":
            mobileNo.style.display = "";
            service_pwd2.style.display = "";
            userName.style.display = "none";
            userPsw.style.display = "none";
            break;
            
        case "1":
            
            mobileNo.style.display = "none";
            service_pwd2.style.display = "none";
            userName.style.display = "";
            userPsw.style.display = "";
            break;
    }
}

function s_agr_onclick(){
	var c = document.getElementById("s_biz_agreement");
	var b = document.getElementById("s_agr_but");
	if(c.checked){
		b.disabled = "";
	}else{
		b.disabled = "disabled";
	}
}

function s_agr_submit(){
	var url = "/services/function?action=SignedAgreement"; 
	var handleSuccess = function(response){ 
		if(response.result){		 
			var _s_agreement = document.getElementById('_s_agreement');
			var _s_agreement_info = document.getElementById('_s_agreement_info');
			if(_s_agreement){
				_s_agreement.disabled= "none"; 
			    _s_agreement.checked= "checked";
			}
			if(_s_agreement_info){
				_s_agreement_info.innerHTML= "尊敬的用户您已<a href=\"/service/agreement.shtml\" target=\"_blank\">阅读</a>并接受业务办理协议";
			}
			location.reload();
		}
	};
	var handleFail = function(response){};
	//请求参数
	var handlePostData = {};
	//请求
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}//end function

function h_login_info(d){
	var i = document.getElementById(d);
	var l = GetCookie("LoginMember");
	var c = "";
	var s = l==null ? "":l.split("|");
	if(l==null || s[s.length-1]=='logout'){   //modify by huangjianhuan
		c += "<h1>中国移动广东公司欢迎您！</h1>";
		c += "<button onmouseover=\"shover(this,'b2')\" onmouseout=\"shover(this,'')\" onclick=\"showorhide('pop_filter_login','pop_login');\">登录</button>";
	}else{
		//var s = l.split("|");
		c += "<i>"+s[0]+"</i>";
		c += "<h1>中国移动广东公司欢迎您！</h1>";
		c += "<span id=\"_common_usr_integral\">";
		if(s[1] != -1){
			c += "您的积分：<i>"+s[1]+"</i>分";
		}
		c += "</span>";
		c += "<button onmouseover=\"shover(this,'b2')\" onmouseout=\"shover(this,'')\" onclick=\"show_logout_gmcc()\">退出</button>";
	}
	i.innerHTML = c;
}


function h_login_info_homepage(d){
var i = document.getElementById(d);
var l = GetCookie("LoginMember");
var c = "";
var s = l==null ? "":l.split("|");
if(l==null || s[s.length-1]=='logout'){   //modify by huangjianhuan
return false;
}else{
//var s = l.split("|");
c += "<i>"+s[0]+"</i>";
c += "<h1>中国移动广东公司欢迎您！</h1>";
c += "<span id=\"_common_usr_integral\">";
if(s[1] != -1){
c += "您的积分：<i>"+s[1]+"</i>分";
}
c += "</span>";
c += "<button onmouseover=\"shover(this,'b2')\" onmouseout=\"shover(this,'')\" onclick=\"show_logout_gmcc()\">退出</button>";
i.innerHTML = c;
}
}


//=========================cookie 操作=============================
//设置Cookie
function SetCookie(name, value, expires, path, domain, secure) 
{ 
  var today = new Date();
  today.setTime(today.getTime()); 
  if(expires) { expires *= 8640000; } 
  var expires_date = new Date(today.getTime() + (expires));    
  document.cookie = name + "=" + escape(value) + (expires ? ";expires=" + expires_date.toGMTString() : "")    + (path ?";path=" + path : "")    + (domain ? ";domain=" + domain : "")    + (secure ? ";secure" : "");
}
 
//获取Cookie
function GetCookie(name) 
{  
 var cookies = document.cookie.split(';');  
 var cookie = ''; 
 for(var i=0; i<cookies.length; i++)
  {   
   cookie = cookies[i].split('='); 
   if(cookie[0].replace(/^\s+|\s+$/g, '') == name)
    { 
     return (cookie.length <= 1) ? "" : unescape(cookie[1].replace(/^\s+|\s+$/g, '')); 
    }
  }
 return null;
}
 
//删除Cookie
function DelCookie(name, path, domain) 
{  
	document.cookie = name + "=" + (path ? ";path=" + path : "") + (domain ? ";domain=" + domain : "") + ";expires=Thu,01-Jan-1970 00:00:01 GMT";
}

function cookieEnabled()
{
  return (navigator.cookieEnabled)? true : false;
}
//============================cookie 操作结束=================

/*===================================20081218 添加：json.js===========================*/
if (!this.JSON) {

// Create a JSON object only if one does not already exist. We create the
// object in a closure to avoid global variables.

    JSON = function () {

        function f(n) {
            // Format integers to have at least two digits.
            return n < 10 ? '0' + n : n;
        }

        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';
        };

        var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
            escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
            gap,
            indent,
            meta = {    // table of character substitutions
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
                '\f': '\\f',
                '\r': '\\r',
                '"' : '\\"',
                '\\': '\\\\'
            },
            rep;


        function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

            escapeable.lastIndex = 0;
            return escapeable.test(string) ?
                '"' + string.replace(escapeable, function (a) {
                    var c = meta[a];
                    if (typeof c === 'string') {
                        return c;
                    }
                    return '\\u' + ('0000' +
                            (+(a.charCodeAt(0))).toString(16)).slice(-4);
                }) + '"' :
                '"' + string + '"';
        }


        function str(key, holder) {

// Produce a string from holder[key].

            var i,          // The loop counter.
                k,          // The member key.
                v,          // The member value.
                length,
                mind = gap,
                partial,
                value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

            if (value && typeof value === 'object' &&
                    typeof value.toJSON === 'function') {
                value = value.toJSON(key);
            }

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

            if (typeof rep === 'function') {
                value = rep.call(holder, key, value);
            }

// What happens next depends on the value's type.

            switch (typeof value) {
            case 'string':
                return quote(value);

            case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

                return isFinite(value) ? String(value) : 'null';

            case 'boolean':
            case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

                return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

            case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

                if (!value) {
                    return 'null';
                }

// Make an array to hold the partial results of stringifying this object value.

                gap += indent;
                partial = [];

// If the object has a dontEnum length property, we'll treat it as an array.

                if (typeof value.length === 'number' &&
                        !(value.propertyIsEnumerable('length'))) {

// The object is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

                    length = value.length;
                    for (i = 0; i < length; i += 1) {
                        partial[i] = str(i, value) || 'null';
                    }

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

                    v = partial.length === 0 ? '[]' :
                        gap ? '[\n' + gap +
                                partial.join(',\n' + gap) + '\n' +
                                    mind + ']' :
                              '[' + partial.join(',') + ']';
                    gap = mind;
                    return v;
                }

// If the replacer is an array, use it to select the members to be stringified.

                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, rep);
                            if (v) {
                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                            }
                        }
                    }
                } else {

// Otherwise, iterate through all of the keys in the object.

                    for (k in value) {
                        if (Object.hasOwnProperty.call(value, k)) {
                            v = str(k, value, rep);
                            if (v) {
                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                            }
                        }
                    }
                }

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

                v = partial.length === 0 ? '{}' :
                    gap ? '{\n' + gap +
                            partial.join(',\n' + gap) + '\n' +
                            mind + '}' :
                          '{' + partial.join(',') + '}';
                gap = mind;
                return v;
            }
        }


// Return the JSON object containing the stringify and parse methods.

        return {
            stringify: function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

                var i;
                gap = '';
                indent = '';

// If the space parameter is a number, make an indent string containing that
// many spaces.

                if (typeof space === 'number') {
                    for (i = 0; i < space; i += 1) {
                        indent += ' ';
                    }

// If the space parameter is a string, it will be used as the indent string.

                } else if (typeof space === 'string') {
                    indent = space;
                }

// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.

                rep = replacer;
                if (replacer && typeof replacer !== 'function' &&
                        (typeof replacer !== 'object' ||
                         typeof replacer.length !== 'number')) {
                    throw new Error('JSON.stringify');
                }

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

                return str('', {'': value});
            },


            parse: function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

                var j;

                function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

                    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);
                }


// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.

                cx.lastIndex = 0;
                if (cx.test(text)) {
                    text = text.replace(cx, function (a) {
                        return '\\u' + ('0000' +
                                (+(a.charCodeAt(0))).toString(16)).slice(-4);
                    });
                }

// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.

// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

                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, ''))) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

                    j = eval('(' + text + ')');

// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

                    return typeof reviver === 'function' ?
                        walk({'': j}, '') : j;
                }

// If the text is not JSON parseable, then a SyntaxError is thrown.

                throw new SyntaxError('JSON.parse');
            }
        };
    }();
}


// Augment the basic prototypes if they have not already been augmented.
// These forms are obsolete. It is recommended that JSON.stringify and
// JSON.parse be used instead.

if (!Object.prototype.toJSONString) {
    Object.prototype.toJSONString = function (filter) {
        return JSON.stringify(this, filter);
    };
    Object.prototype.parseJSON = function (filter) {
        return JSON.parse(this, filter);
    };
}

/**
	功能：查询某个业务是否b2m业务，并且是否第一次登陆办理b2m
	t：回调方法类型
	b2m: 显示下发短信输入框
*/
function query_is_b2m_biz(bizCode,t){
	var url = "/services/function?action=IsB2MBiz&BizCode="+bizCode;
	var handleSuccess = function(response){
		var b_r = response.result;
		_userMobileNumber = response.UserMobile;
		
		if(t == 'b2m'){//显示随机短信输入框
			if(b_r){
				show_biz_b2m('biz_op_expand2')//div ID，用扩展标签1
			}else{
				hide_b2m_sms('biz_op_expand2');
			}	
		}
	};
	var handleFail = function(response){};
	//请求参数
	var handlePostData = {};
	//请求
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}

/**
  功能：显示b2m办理业务输入的随机短信码框
*/
function show_biz_b2m(b2m_id){
	var c = "<table width='80%'>";
	c += "<tr>";
	c += "<td class='blue_01' align='center'><span class='blue_01'>随机短信密码：</span>";
	c += "<input type='text' class='text_01' maxlength='6' id='_bbc_rsmsRND' onfocus=\"shover(this,'text_01_02')\" onblur=\"shover(this,'text_01')\" />";
	c += "<button class='btn_blue'  onmouseover=\"shover(this,'btn_blue_02')\" onmouseout=\"shover(this,'btn_blue')\" onClick=\"sendSMSRnd('B2MSMS','/services/SMSRndSend')\" >获取随机短信密码</button></td>";
	c += "</tr>";
	c += "</table>";
             
	document.getElementById(b2m_id).innerHTML = c;
}

/**
  功能：隐藏b2m办理业务输入的随机短信码框
*/
function hide_biz_b2m(b2m_id){
	var c = "";
	document.getElementById(b2m_id).innerHTML = c;
}

/**
 功能：隐藏b2m随机短信输入框
*/
function hide_b2m_sms(){
	document.getElementById("biz_op_expand2").style.display='none';
}

/**
 功能：显示b2m随机短信输入框
*/
function display_b2m_sms(){
	document.getElementById("biz_op_expand2").style.display = "";
}

/**
 功能：检查b2m随机短信是否正确
*/
function is_bbc_RndSms(){
		try{
			s_rsms_code = document.getElementById('_bbc_rsmsRND').value;
			var v = new SunRise.Validate();
			if (s_rsms_code == "") {
		     	return '1';
		    }
		    if (!v.isNumber(s_rsms_code)) {
		        return '2';
		    }
		    return '0';
	    }catch(e){
	    	//不存在_bbc_rsmsRND导致出错
	    	s_rsms_code='';
	    	return '0';
	    }
}
 
 /**
 功能：获取B2M输入框的随机短信码
*/
function get_bbc_RndSms(){
		try{
			s_rsms_code = document.getElementById('_bbc_rsmsRND').value;
	    }catch(e){
	    	//不存在_bbc_rsmsRND导致出错
	    	s_rsms_code='';
	    	return '0';
	    }
}

/**
 功能：b2m随机短信检查提示
*/
function check_b2m_sms(){
	if(b2m_bizCode=='MMSSJB'){
		return true;
	}
    var s_sms=is_bbc_RndSms();
    if(s_sms=='1'){
    	show_message('biz_op_message',"尊敬的客户：随机验证码不能为空，请重新输入！",false);
    	return false;
    }else if(s_sms=='2'){
    	show_message('biz_op_message',"尊敬的客户：随机验证码只能为数字，请重新输入！",false);
    	return false;
    }else{
    	return true;
    }
} 

//updateLoginType.jsp
function _p_update_login_type(n){
	var p = 0;
	var t = "";
	var u=document.getElementById('_p_backUrl').value; 
	var _lem = document.getElementById("_p_message");  
	var o = "";
	if(n == 1 ){
		t = "随机短信密码"; 
		p = document.getElementById("_p_update_smsrnd").value; 
		o = "checksms";
	}else{
		t = "服务密码"; 
		p = document.getElementById("_p_pwd_update_logintype").value; 
		o = "checkpwd";
	}
	
	var v1 = new SunRise.Validate();
	var v = function(p){
        if (p == "") {
            _lem.innerHTML ="<img src=\"/v2008/images/public/icon_wrong.gif\" /> <b class=\" red_02\"> "+ t+"不能为空</b>";
            return false;
        }
        if (!v1.isNumber(p)) {
            _lem.innerHTML ="<img src=\"/v2008/images/public/icon_wrong.gif\" /> <b class=\" red_02\"> "+ t+"必须为数字</b>";
            return false;
        }
        return true;
    }
	
	if(!v(p)){
		return;
	}
	
	var url = "/ServicesServlet/UPDATE_LOGIN_TYPE";
	var d=document.getElementById('_p_table');
	if(d != null){
		_lem.innerHTML = "正在验证中，请稍候......";
		var bs = d.getElementsByTagName("button");
		for(var i=0;i<bs.length;i++){
			bs[i].disabled = "disabled";
		}
	}
	
	var handlePostData = {
		
        operation: o, 
		checkstr:p
    };
	
	var handleSuccess = function(o){ 
		 top.location.href=u;
    };
	
	var handleFail = function(o){ 
	    _lem.innerHTML = "<img src=\"/v2008/images/public/icon_wrong.gif\" /> <b class=\" red_02\"> "+ o.message +"</b>"; 
		if(d != null){
			var bs = d.getElementsByTagName("button");
			for(var i=0;i<bs.length;i++){
				bs[i].disabled = "";
			}
		}
    };	 
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail); 
}
//左侧登陆框 动感地带查询M值 
function _lg_qy_mvalue() { 	 

	//封装请求参数
	var m_pst= {
		operation : 'query',
		opmessage : {optype:'queryAddupBalance'}.toJSONString()
	};
	 
	//请求成功后的处理方法
	var m_s = function(response){   
		var _R_INBA = response._R_INBA;
		if(parseInt(_R_INBA)==0) 
			$('_lg_qy_mvalue_id').innerHTML='0';
		else 
		    $('_lg_qy_mvalue_id').innerHTML=_R_INBA; 
	}; 
	//失败处理函数
	var m_f = function(response) {  
		 $('_lg_qy_mvalue_id').innerHTML='查询失败';
	} 
	$('_lg_qy_mvalue_id').innerHTML='loading'; 
	common_send_ajax('/ServicesServlet/MZONE_MVALUE_BALANCE', m_pst, true, m_s, m_f); 	 
} 
//左侧登陆框 帐户余额查询 
function _lg_qy_balance() {  
	//封装请求参数
	var m_pst= {
		operation : 'query',
		opmessage : {optype:'queryAddupBalance'}.toJSONString()
	};
	 
	//请求成功后的处理方法
	var m_s = function(response){   
		  var o_balance=response.balance;  
		  if(o_balance.brand==3){//说明是动感地带
		     $('_lg_qy_balance_id').innerHTML=o_balance.totalMoney; 
		  }else {//全球通或者是神州行  
			 if(o_balance.brand==1){  
			    $('_lg_qy_balance_id').innerHTML=o_balance.relcout;
			 } else{  
			    $('_lg_qy_balance_id').innerHTML=o_balance.branchCode=='ST'?o_balance.reltim:o_balance.total; 
		     }	 
		} 
	}; 
	//失败处理函数  
	var m_f = function(response) {  
		 $('_lg_qy_balance_id').innerHTML='查询失败'; 
	} 
    $('_lg_qy_balance_id').innerHTML='loading';  
	common_send_ajax('/ServicesServlet/ACCOUNTS_BALANCE_SEARCH', m_pst, true, m_s, m_f); 	 
	 
} 
//左侧登陆框 积分查询
function _lg_qy_integral(i) {  
    if(i!='-1'){//没查询过
         $('_lg_qy_integral_id').innerHTML=i;
         return false;
    }else{
		//封装请求参数
		var m_pst= {
			operation : 'query',
			suboperation:'queryAddupBalance'
			//,subpostData:{b_year3:'', b_month3:'', e_year3:'', e_month3:''}.toJSONString()  
		};
		 
		//请求成功后的处理方法
		var m_s = function(response){    
	       $('_lg_qy_integral_id').innerHTML=response.integralbalance;  
		}; 
		//失败处理函数  
		var m_f = function(response) {  
			 $('_lg_qy_integral_id').innerHTML='查询失败'; 
		} 
	    $('_lg_qy_integral_id').innerHTML='loading';  
		common_send_ajax('/ServicesServlet/INTE_GRAL_CURR_YEAR', m_pst, true, m_s, m_f); 	
	} 	 
} 

//网厅关联业务推荐,利用扩展标签expand1实现
function load_relating_biz(handlePostData,response){
	var operation = handlePostData.operation;
	if(operation == 'initiate' || operation == 'modify' || operation == 'cancel'){
		_show_relating_biz(response);
	}
}

//处理营销活动引导信息
function handleAwardGuideInfo(response) {
	var awardGuides = response.awardGuides;
	var divObj = document.getElementById("biz_op_interphase");
	if(awardGuides!=undefined && awardGuides != null && awardGuides.length > 0){
		var _divObj = document.getElementById("awardGuides");
		var contents = "";
		for(var i=0; i<awardGuides.length; i++){
			contents  += "<div id='awardGuide_"+i+"'>"+awardGuides[i]+"</div>";
		}

		if(_divObj != null){//以前有
			_divObj.innerHTML = contents;
		}else{
			divObj.innerHTML = "<div id='awardGuides'>"+contents+"</div>" + divObj.innerHTML;
		}
	}
}

//显示源业务的关联业务
function _show_relating_biz(response){
	var relating_bizs = response.relating_biz;
	if(typeof relating_bizs == 'undefined')	return;
	var length = relating_bizs.length;
	if(length > 0){
		var relating_biz = null;
		var tmpHtml = '';
		var nopic = '/v2008/images/public/nopic.gif';
		for(var i=0;i<relating_bizs.length;i++){
			var relating_biz = relating_bizs[i];
			var srcBizCode = relating_biz.srcBizCode;
			var srcBizChildCode = relating_biz.srcBizChildCode;
			var bizName = relating_biz.bizName;
			var bizIntro = relating_biz.bizIntro;
			var bizTariff = relating_biz.bizTariff;
			var imageUrl = relating_biz.imageUrl == '' ? nopic : relating_biz.imageUrl;
			var transUrl = relating_biz.transUrl;
			var introUrl = relating_biz.introUrl;
			
			tmpHtml = tmpHtml + '<li><span class="pic"><a href="#"><img src="' + imageUrl + '" /></a></span>'
				+ '<p><strong>' + bizName + '</strong>'          
				+ '<span class="txt">' + bizIntro + '</span>' + bizTariff
				+ '<span class="btnLine">'
				+ '<form action="'+transUrl+'" name="trans_form'+i+'" method="post" id="trans_form'+i+'">'
				+ "<a href=\"javascript:$('trans_form"+i+"').submit();\" class='btn_blue'>办理</a>"
				+ '<input type="hidden" name="src" value="'+srcBizCode+'~'+srcBizChildCode+'"/>'
				+ '</form>'
				+ '<a href="' + introUrl + '" class="btn_blue">详情</a></span>'
				+ '</p></li>';
		}
		$('expand1').innerHTML = '<h2>办理了本业务的用户还办理了以下业务：</h2>' + '<ul class="relevance">' + tmpHtml + '</ul>';
	}
}

/*营销活动等页面登陆时弹出登录框用*/
function LoginGo(url){
	if(url != undefined && url != null && url != ''){
		$('_login_backurl').value = url;
	}
	showorhide('pop_filter_login','pop_login');
}


/*****************************************************************************************************/
//以下是集团满意度问卷调查新添加的JS
var flushKey = "FLUSH_";
var questionKey = "QUESTION_";
var flushSecond = 30;//30秒
var questionDay = 30;//30天
/**
 * 处理集团问卷调查
 */
function proccessQuestion(loginMobile){
	if (loginMobile != null && loginMobile.length == 11) {//说明已登录了
		var questionMobile = GetCookie(questionKey);
		var needRequest = true;
		if (questionMobile != null && questionMobile.length == 11 && questionMobile == loginMobile) {//说明用户提交过
			needRequest = false;
		}
		//发送ajax请求
		if(needRequest){
			checkHasSubmitQuestion(loginMobile);
		}
	}
}


/**
 * 设置cookie的值
 * @param {Object} name
 * @param {Object} value
 * @param {Object} expires 时间单位为秒
 * @param {Object} path
 * @param {Object} domain
 * @param {Object} secure
 */
function SetCookieSecond(name, value, expires, path, domain, secure) { 
	  var today = new Date();
	  today.setTime(today.getTime()); 
	  if(expires) { expires *= 24*3600; } 
	  var y=today.getFullYear();
	var m=today.getMonth();
	var d=today.getDate();
	
	
	  //var expires_date = new Date(today.getTime() + (expires));   
	  var expires_date=new Date(y,m,d,23,59,59);
	  document.cookie = name + "=" + escape(value) +  ";expires=" + expires_date.toGMTString()+ (path ?";path=" + path : "")    + (domain ? ";domain=" + domain : "")    + (secure ? ";secure" : "");
}


/**
 * 获得当前登录的手机号
		null:则未登录
 */
function getLoginMobile(){
	var l = GetCookie("LoginMember");
	if(l==null){
		return null;
	}else{
		var s = l.split("|");
		return s[0];
	}
}

var IS_150=1;
function checkHasSubmitQuestion(loginMobile){
//	alert("checkHasSubmitQuestion="+loginMobile);
	
	//封装请求参数
	var handlePostData = {
		operation : 'mobilers',
		mobile : loginMobile
	};
	
	//请求后的处理方法
	var handleSuccess = function(response){
		var flag = response.flag;
		//flag true:已经存在 flae：未做过调查
		if(flag){
			SetCookie(questionKey, loginMobile, questionDay, '/');//写cookie，失效30天
		}else{
			IS_150=response.IS_150;			
			openQuestionDiv(loginMobile);

		}
	};
	var handleFail = function(response){
		
		if(response.resultCode!=100){
			alertMessage2(response.message);	
		}	
	};
	var url = '/ServicesServlet/QUEST_RESULT';
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}

////////////////////////////
//问卷满意度发送短信的，临时东东，建议国庆后删除
function processRequestTEMP() {
  // only if req shows "loaded"
  if (http_request.readyState == 4) {
	// only if "OK"
	if (http_request.status == 200) {
	  	//alert(http_request.responseText).Trim();
	  	var temp = http_request.responseText.Trim();
	  	//alert(temp);
	  if(temp=="OK"){
			alert("动态密码已发送到您的手机（10分钟内有效）请注意查收，如未收到请稍后重试！");
	  }else if(temp=="LIMITED"){
			alert("每10分钟只能发送三条短信随机码，请稍后再试！");
	  }else if(temp=="LIMITEDHOUR_10"){
            alert("每小时最多只能发送10条短信随机码，请稍后再试！");
      }else if(temp=="LIMITEDDATE_50"){	
            alert("每天最多只能发送50条短信随机码，请明天再试！");
	  }else if(temp=="WRONG_MOBILE"){
			alert("手机号码错误，请使用广东移动号码登录！");
	  }else{
			alert("发送失败，请重试！");
	  }
	} else {
	  	alert("发送失败，请重试！");
	}
  }
} 


function sendSMSPwdTEMP(targetUrl,m_id) {
  var id = "_logonName";
  if(m_id){
  	id = m_id;
  }
  var mobile = document.getElementById(id).value;
  //alert("length = "+mobile.length);
  if( mobile.length < 11 )
  {	alert( "请输入您的手机号码" );
	document.getElementById(id).focus();	
	return false;
  }
  var moReg = /^1\d{10}$/;
  if( mobile.search(moReg)==-1)
  {
   	 alert("手机号码错误，请输入正确的手机号码！");  
	 document.getElementById(id).focus();		
     return false;
  }
  var url = targetUrl+"?_logonName="+mobile + "&_r=" + Math.random();
  send_requestTEMP(url);
}

function send_requestTEMP(url) {//初始化、指定处理函数、发送请求的函数
  	http_request = false;
  	//开始初始化XMLHttpRequest对象
  	if(window.XMLHttpRequest) { //Mozilla 浏览器
   		http_request = new XMLHttpRequest();
   		if (http_request.overrideMimeType) {//设置MiME类别
    		http_request.overrideMimeType('text/xml');
   		}
  	}else if (window.ActiveXObject) { // IE浏览器
   		try {
    		http_request = new ActiveXObject("Msxml2.XMLHTTP");
   		} catch (e) {
    		try {
     			http_request = new ActiveXObject("Microsoft.XMLHTTP");
    		} catch (e) {}
   		}
  	}
  	
  	if (!http_request) { // 异常，创建对象实例失败
   		window.alert("不能创建XMLHttpRequest对象实例.");
   		return false;
  	}
  	http_request.onreadystatechange = processRequestTEMP;
  	// 确定发送请求的方式和URL以及是否同步执行下段代码
  	
  	http_request.open("post", url, true);
  	http_request.send(null);	
 }
/////////////////

/**
 * 弹出问卷div
 */
function openQuestionDiv(loginMobile){
	//window.open("/branches/questresult.jsp", "_blank", "height=250,width=400,toolbar=no, menubar=noscrollbars=no, resizable=no,location=no,status=no");
	var s="";
	var m="<br/>";
	if(IS_150==1){
		m="<br/><br/>";
		s="诚邀请对广东移动门户网站作出<span style='color:#FF0000'>真实的评价</span>，成功参与调查并正确填写<span style='color:#FF0000'>动态密码</span>的用户将<span style='color:#FF0000'>获赠2元话费</span>。";
	}else{
		s="诚邀请对广东移动门户网站作出真实的评价。";
	}
	var content = "<div class=\"login_contentform hide\" id=\"aa\"><div class=\"filter\">";
	content+="<iframe></iframe></div><div class=\"pop\" id=\"bb\">";
	content+="<h4>门户网站在线满意度调查<span onclick=\"showorhide('aa','bb')\" title=\"点击关闭\">关闭</span></h4>";
	content+="<div class=\"box\">";
	content+="<div class=\"manyi\"><p class=\"blue_12b\" style=\"color:#2d9509;\">"+s+"</p>"+m;
	content+="<p class=\"blue_12b\">1、总体而言,您觉得广东移动门户网站的整体质量是?</p>";
	content+="<table class=\"tab_dc\">";
	content+="<tr><td><input type=\"radio\" name=\"answerone\" id=\"answerone\" value=\"0\" />&nbsp;非常好</td>";
	content+="<td><input type=\"radio\" name=\"answerone\" id=\"answerone2\" value=\"1\" />&nbsp;很好</td>";
	content+="<td><input type=\"radio\" name=\"answerone\" id=\"answerone3\" value=\"2\" />&nbsp;好</td>";
	content+="<td><input type=\"radio\" name=\"answerone\" id=\"answerone4\" value=\"3\" />&nbsp;一般</td>";
	content+="<td><input type=\"radio\" name=\"answerone\" id=\"answerone5\" value=\"4\" />&nbsp;差</td>";
	content+="<td><input type=\"radio\" name=\"answerone\" id=\"answerone6\" value=\"5\" />&nbsp;不知道</td></tr>";
	content+="</table><p class=\"blue_12b\">2、那么,如果要用1到10分来评价,你会打几分呢?</p>";
	content+="<table class=\"tab_dc\">";
	content+="<tr><td><input type=\"radio\" name=\"answertwo\" id=\"answertwo\" value=\"0\" />&nbsp;10分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo2\" value=\"1\" />&nbsp;9分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo3\" value=\"2\" />&nbsp;8分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo4\" value=\"3\" />&nbsp;7分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo5\" value=\"4\" />&nbsp;6分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo6\" value=\"5\" />&nbsp;5分</td></tr>";
	content+="<tr><td><input type=\"radio\" name=\"answertwo\" id=\"answertwo7\" value=\"6\" />&nbsp;4分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo8\" value=\"7\" />&nbsp;3分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo9\" value=\"8\" />&nbsp;2分</td>";
	content+="<td><input type=\"radio\" name=\"answertwo\" id=\"answertwo10\" value=\"9\" />&nbsp;1分</td>";
	content+="<td colspan=\"2\"><input type=\"radio\" name=\"answertwo\" id=\"answertwo11\" value=\"10\" />&nbsp;不知道</td></tr>";
	//content+="<tr><td colspan=\"6\"><p class=\"blue_12b\">10分满意代表您真的满意</p></td></tr>";
	if(IS_150==1){
		content+="<tr><td colspan=\"6\">动态密码：<input type=\"text\" class=\"verifycode\" maxlength=\"6\" id=\"wenjuan_text\"/><input type='hidden' value='"+loginMobile+"' id='hidden_inputValue'/>&nbsp;&nbsp;<button type=\"button\" class=\"rndLink\"  onclick=\"sendSMSPwdTEMP('/branches/award/sendSMSRND.jsp','hidden_inputValue')\" title=\"点击获取动态密码\">点击获取</button><p id=\"in_html\"></p></td></tr>";
	}
	content+="</table>";
	content+="<p class=\"btn_list\"> <span id=\"pop_op_button1\" class=\"btn\">";
	content+="<button id=\"c1\" onclick=\"getQuestResultValue();\">确定</button>";
	content+="</span> </p></div> </div></div></div>";

	try{
	var objDiv = document.createElement("div");

	document.body.appendChild(objDiv);
	objDiv.innerHTML = content;
	showorhide('aa','bb');

	}catch(e){}
}
/**
 * 关闭问卷div
 */
function closeQuestionDiv(){
	//window.close();
}
/**
 * 提交满意度问卷答案
 * @param {Object} answer1 问题1答案
 * @param {Object} answer2 问题2答案
 */
function submitQuestion(mobile,answer1,answer2,dtPwd){
	var url = "/ServicesServlet/QUEST_RESULT";
	var handlePostData = {
		operation : 'insert',
		mobile : mobile,
        answerone: answer1, 
		answertwo: answer2,
		dtPwd:typeof(dtPwd)=='defined'?"":dtPwd
    };
	var handleSuccess = function(response){
		alertMessageQuest2(response.message);	
		SetCookie(questionKey, getLoginMobile(), questionDay, '/');//写成功提交cookie，失效30天
		closeQuestionDiv();//关闭调查问卷Div
    };
	
	var handleFail = function(response){
		if(response.resultCode==104||response.resultCode==105){
		document.getElementById("in_html").innerHTML=response.message;
		showorhide('aa','bb');
		return;
		}
     	 alertMessageQuest2(response.message);	
	}
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail);
}

function getQuestResultValue(){
	  var loginMobile = getLoginMobile();
	  var temp1 = document.getElementsByName("answerone");
	  var temp2 = document.getElementsByName("answertwo");
	  var answerone = -1;
	  var answertwo = -1;
	  for(var i=0;i<temp1.length;i++){
		 if(temp1[i].checked)
			  answerone = temp1[i].value;
	  }
	   for(var i=0;i<temp2.length;i++){
		 if(temp2[i].checked)
			  answertwo = temp2[i].value;
	  }
	if(IS_150==1){
	  var svalue=document.getElementById("wenjuan_text").value;
	  if(svalue==""){
		document.getElementById("in_html").innerHTML="<font color='red'>动态密码不能为空</font>";
		return;
	  }
	  if(svalue.length!=6){
		document.getElementById("in_html").innerHTML="<font color='red'>动态密码必须为6位数字</font>";
		return;

	  }
	   var v = new SunRise.Validate();
	  if(!v.isNumber(svalue)){
		document.getElementById("in_html").innerHTML="<font color='red'>动态密码必须为6位数字</font>";
		return;
	  }
	  document.getElementById("in_html").innerHTML="";
	}
	  if(answerone==-1||answertwo==-1){
		  showorhide('aa','bb');
		  alertMessageQuest("问卷选项不能为空！");
	  }else{
		submitQuestion(loginMobile,answerone,answertwo,svalue);
		showorhide('aa','bb');
	  }
}

//弹出信息提示框
function alertMessage(msg,f){
	var c="<h4>信息提示</h4>";
	var b="<center id='_user_logout_msg'>";
	b+=msg+"</center>";
	var a="<button onclick=\"showorhide('pop_open_window','pop_op')\">确定</button>";
	open_window("pop_op_title","pop_op_content","pop_op_button",c,b,a)
}

function alertMessage2(msg,f){
	var c="<h4>信息提示</h4>";
	var b="<center id='_user_logout_msg' style=\"font-size:14px;line-height:24px\">";
	b+=msg+"</center>";
	var a="<button onclick=\"showorhide('pop_open_window','pop_op')\">确定</button>";
	open_window("pop_op_title","pop_op_content","pop_op_button",c,b,a)
}
	//弹出信息提示框(满意度专用)
function alertMessageQuest2(msg){
	var c="<h4>信息提示</h4>";
	var b="<p id='_user_logout_msg' style=\"font-size:14px;line-height:24px\">";
	b+=msg+"</p>";
	var a="<button onclick=\"showorhide('pop_open_window','pop_op');\">确定</button>";
	open_window("pop_op_title","pop_op_content","pop_op_button",c,b,a)
}
//弹出信息提示框(满意度专用)
function alertMessageQuest(msg){
	var c="<h4>信息提示</h4>";
	var b="<center id='_user_logout_msg' style=\"font-size:14px;line-height:24px\">";
	b+=msg+"</center>";
	var a="<button onclick=\"showorhide('pop_open_window','pop_op');showorhide('aa','bb');\">确定</button>";
	open_window("pop_op_title","pop_op_content","pop_op_button",c,b,a)
}
/*****************************************************************************************************/

//////////////////////////////////////////////////////2011-8-22
/*
 * t : 登陆方式ID
 * n : 手机号码ID
 * p : 服务密码ID
 * sr : 随机短信密码
 * ir : 图形校验码
 * lb : 登陆后的跳转地址
 * m : 信息提示ID
 * b : 提交按扭ID
 * reb : 密码重置按扭
 * a : 电子协议ID
 */


function on_web_login(t,n,p,sr,ir,lb,m,b,reb,a,img_div,isSso){
	//登录时清除139_sso_cookie
	//DelCookie('139_sso_cookie','/');
	
    web_login(t,n,p,sr,ir,lb,m,b,reb,a,img_div,isSso);
    return false;
}

function on_web_login_homepage(n,p,ir,f,lt,sr,ir2,img_div,isSso){
	var isfromonlineservice = false;
	if(typeof(onlineLogin)=="undefined"||!onlineLogin){
	}else{
		isfromonlineservice = true;
	}
	
	//登录时清除139_sso_cookie
	//DelCookie('139_sso_cookie','/');
	//alert(409);
		var mobileip=GetCookie("mobileip");
	if(mobileip==null||typeof(mobileip)=='undefined')
		mobileip=0;
	mobileip=1;
	var login_info = {
        _loginType: document.getElementById(lt).value,
        _logonName: document.getElementById(n).value,
        _password: document.getElementById(p).value,
        _smsRND: document.getElementById(sr).value,
        _imageCode: document.getElementById(ir).value,
		mobileip:mobileip,
		isSso:isSso,
		_channel:0,
		//_login_backurl:'/common/redirect.jsp'
		_login_backurl:'/personal/index.jsp'
    };
	var d = document.getElementById(f);
	if(d != null){
		var bs = d.getElementsByTagName("button");
		for(var i=0;i<bs.length;i++){
			bs[i].disabled = "disabled";
		}
		var input = d.getElementsByTagName("input");
		for(var i=0;i<input.length;i++){
			input[i].disabled = "disabled";
		}
	}
	var showM = function(m){
	    var title = "<h4>温馨提示</h4>";
		var content = '<center>'+m+'</center>';
		var button = "<button onclick=\"showorhide('pop_open_window','pop_op')\">确定</button>";
		open_window('pop_op_title','pop_op_content','pop_op_button',title,content,button); 
		
		if(d != null){
			var bs = d.getElementsByTagName("button");
			for(var i=0;i<bs.length;i++){
				bs[i].disabled = "";
			}
			var input = d.getElementsByTagName("input");
			for(var i=0;i<input.length;i++){
				input[i].disabled = "";
			}
		}
	}
	var v = new SunRise.Validate();
    if (login_info._logonName == "") {
        showM("请输入手机号码");
        return false;
    }
    
    if (!v.isMobile(login_info._logonName)) {
		showM("请输正确的手机号码");
        return false;
    }
	
	
	if(login_info._loginType == 1){
		if (login_info._smsRND == "") {
            showM("动态密码不能为空");
            return false;
        }
        if (!v.isNumber(login_info._smsRND)) {
            showM("动态密码必须为6位数字");
            return false;
        }
		if(login_info._smsRND.length!=6){
			showM("动态密码必须为6位数字");
		}
		login_info._imageCode = document.getElementById(ir2).value;
	}else{
	    if (login_info._password == "") {
	        showM("服务密码不能为空");
	        return false;
	    }
	    if (!v.isNumber(login_info._password)) {
	        showM("服务密码必须为数字，全球通和动感地带的服务密码为6位数字，神州行服务密码为8位数字，请核对后再输入。");
	        return false;
	    }
		if(login_info._password.length!=6&&login_info._password.length!=8){
				        showM("服务密码必须为数字，全球通和动感地带的服务密码为6位数字，神州行服务密码为8位数字，请核对后再输入。");
	        return false;
		}
	}
	if(mobileip==1||isSso==true){
		if(login_info._loginType != 0){
			if (login_info._imageCode == "" || login_info._imageCode.length != 4 ) {
				showM("请输入正确的认证码");
				return false;
			}
		}
	}
	  
    var url = "/ServicesServlet/LOGIN";
 
    var handlePostData = {
        operation: "login",
		isProtocol:false,
		_dl100Mobile:'',
		_isfrompop:isfromonlineservice,
        _loginInfo: login_info.toJSONString()
    };
	
	var handleSuccess = function(response){
		try{
			var cookieValue = login_info._logonName + "|-1";
			SetCookie('LoginMember',cookieValue,false,'/');
			//DelCookie('mobileip','/');
		}catch(e){
			alert(e);
		}
		if(response._login_backurl != ""){
			window.location = response._login_backurl;
		}else{
			location.reload();
		}
		
		
	};
	var handleFail = function(response){		
	    //showM(response.message);
		if(d != null){
		var bs = d.getElementsByTagName("button");
		for(var i=0;i<bs.length;i++){
			bs[i].disabled = false;
		}
		
		var input = d.getElementsByTagName("input");
		for(var i=0;i<input.length;i++){
			input[i].disabled = false;
		}
		if(typeof(response.resultCode)!='undefined'){
			var retcode=response.resultCode;
			if(retcode==135||retcode==136||retcode==137||retcode==138){
				alert(response.message);
				return;
			}

		}
	}
		document.getElementById("my_loginName").value=login_info._logonName;
		if(isShow("pop_filter_login")){
			showorhide('pop_filter_login','pop_login');
		}
		var ms=document.getElementById("myTishi");
		if(ms){
				ms.innerHTML=response.message;
		}
		if(!isShow("loginBox2"))
			showorhide('loginBox2','loginBox2_op');
		var cookieValue=response.mobileip;
		//alert(cookieValue);
		//如果得到短信登陆的方式值
		if(typeof(response.sms_login_time)!='undefined'){
			var sms_login_time=response.sms_login_time;
			SetCookieSecond("sms_login_time",sms_login_time,180,'/');
		}
			SetCookieSecond("mobileip",cookieValue,1000,'/');
			isDisplay(img_div);
			isDisplay("index_imgCode");
			isDisplay("my_Login_ImgDiv");
			isDisplay("s_check_code");
			isDisplay("s_check_Img_head");
			isDisplay("s_check_Img_head2");
			isDisplay("check_code");
		if(login_info._loginType != 0){
			//getVerify('verifyIMG_0','0');
		    //hiddenVerify();
		}
	}
	var handleTimeout = function(){
	    showM("请求超时，请重新登陆！");
		if(login_info._loginType != 0){
			getVerify('verifyIMG_0','0');
		   	hiddenVerify();
		}
	}
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail,handleTimeout); 
	return false;
}

var myStatus="";
var myMessage="";


function web_login(t,n,p,sr,ir,lb,m,b,reb,a,img_div,isSso){
    
	var isfromonlineservice = false;
	if(typeof(onlineLogin)=="undefined"||!onlineLogin){
	}else{
		isfromonlineservice = true;
	}
	var mobileip=GetCookie("mobileip");
	if(mobileip==null||mobileip=='undefined')
		mobileip=0;
	if(isSso)mobileip=1;
	mobileip=1;
    var login_info = {
        _loginType: document.getElementById(t).value,
        _logonName: document.getElementById(n).value,
        _password: document.getElementById(p).value,
        _smsRND: document.getElementById(sr).value,
        _imageCode: document.getElementById(ir).value,
		mobileip:mobileip,
		isSso:isSso,
		_channel:document.getElementById(lb).value.indexOf("/e100/")!=-1?8:0,
		_login_backurl:document.getElementById(lb).value==""?window.location.href:document.getElementById(lb).value
    }; 
		
	var sms_login_time=GetCookie("sms_login_time");
	if(login_info._loginType==1||login_info._loginType==1==3){
		if(sms_login_time==0){		
			
		}else if(sms_login_time==1){
			alert("尊敬的客户：您输入的动态密码已失效，请重新点击获取动态密码后再试！");
			return;
		}
	}
	var _lem = document.getElementById(m);
    //alert(login_info.toJSONString());
    var v = new SunRise.Validate();
    if (login_info._logonName == "") {
        _lem.innerHTML = "请输入手机号码";
        return false;
    }
    
    if (!v.isMobile(login_info._logonName)) {
        _lem.innerHTML = "请输正确的手机号码";
        return false;
    } 
    
    var vPwd = function(n){
        if (n == "") {
            _lem.innerHTML = "服务密码不能为空";
            return false;
        }
        if (!v.isNumber(n)) {
            _lem.innerHTML = "服务密码必须为数字";
            return false;
        }
		if(n.length!=6&&n.length!=8){
			_lem.innerHTML = "服务密码必须为数字，全球通和动感地带的服务密码为6位数字，神州行服务密码为8位数字，请核对后再输入。"
			return false;
		}
        return true;
    }
    
	  var vRndSms = function(n){
        if (n == "") {
            _lem.innerHTML = "动态密码不能为空";
            return false;
        }
        if (!v.isNumber(n)) {
            _lem.innerHTML = "动态密码必须为数字";
            return false;
        }
		if(n.length!=6){
			_lem.innerHTML = "动态密码必须为6位数字";	
			return false;
		}
        return true;
     }

    if (login_info._loginType == 2) {
        if (!vPwd(login_info._password)) {
            return;
        }
    }
    //Login By Mobile
    else if(login_info._loginType == 0){
    	
    }
    else if (login_info._loginType == 1) {
       if (!vRndSms(login_info._smsRND)) {
           return;
       }
    }
    else if (login_info._loginType == 3) { 
       if (!vPwd(login_info._password)) {
             return;
       }else if (!vRndSms(login_info._smsRND)) {
         return;
       }
    }
    else {
       _lem.innerHTML = "请以正确的方式登陆";
       return;
    }
  //Login By Mobile not check Image Code

  if(login_info._loginType != 0&&mobileip==1||isSso==true){
    if (login_info._imageCode == "" || login_info._imageCode.length != 4 || login_info._imageCode == '点击输入') {
		_lem.innerHTML = "请输入正确的图形校验码";
        return;
    }
  }
 /*
  valBrandMember(login_info._logonName,login_info._password);
 
	if(myStatus!=0){
		alert(myMessage);
		return;
	}

*/
    var _sb = document.getElementById(b);
    var _fp = document.getElementById(reb); 
	//alert(reb);
    _sb.disabled = true;
    _fp.disabled = true;
    _lem.innerHTML = "正在登陆中，请稍候......";
    
    var url = "/ServicesServlet/LOGIN";
    var handlePostData = {
        operation: "login",
		isProtocol:document.getElementById(a).checked,
		_dl100Mobile:'',
		_isfrompop:isfromonlineservice,
        _loginInfo: login_info.toJSONString()
    };
    
    var handleSuccess = function(response){
		//alert("success");
		try{
			var cookieValue = login_info._logonName + "|-1";
			SetCookie('LoginMember',cookieValue,false,'/');
			//DelCookie('mobileip','/');
		}catch(e){
			alert(e);
		}
//		alert("window location:"+window.location.href);
		if(response._login_backurl != ""){
		    //alert( response._login_backurl);
			window.location = response._login_backurl;
		}else{
			location.reload();
		}
    };
	
	var handleFail = function(response){
		//alert(222);
        _sb.disabled = false;
        _fp.disabled = false;
        _lem.innerHTML = "";
		if(typeof(response.resultCode)!='undefined'){
			var retcode=response.resultCode;
			if(retcode==135||retcode==136||retcode==137||retcode==138){
				alert(response.message);
				return;
			}

		}
		document.getElementById("my_loginName").value=login_info._logonName;
		if(isShow("pop_filter_login")){
			showorhide('pop_filter_login','pop_login');
		}
		var ms=document.getElementById("myTishi");
		if(ms){
				ms.innerHTML=response.message;
			}
		if(!isShow("loginBox2"))
			showorhide('loginBox2','loginBox2_op');
		var cookieValue=response.mobileip;
		//alert(cookieValue);
		//如果得到短信登陆的方式值
		if(typeof(response.sms_login_time)!='undefined'){
			var sms_login_time=response.sms_login_time;
			SetCookieSecond("sms_login_time",sms_login_time,0,'/');
		}
			SetCookieSecond("mobileip",cookieValue,clearTime,'/');
			isDisplay(img_div);
			isDisplay("index_imgCode");
			isDisplay("my_Login_ImgDiv");
			isDisplay("s_check_code");
			isDisplay("s_check_Img_head");
			isDisplay("s_check_Img_head2");
			isDisplay("check_code");
		if(login_info._loginType != 0&&cookieValue==1){
			//alert(8);
			//getVerify('verifyIMG_0','0');
			//alert(888);
		}
		if(cookieValue==1){
			//alert(9);
  			//hiddenVerify();
			//alert(978);
		}
	}
	
	var handleTimeout = function(){
        _sb.disabled = false;
        _fp.disabled = false;
        _lem.innerHTML = "请求超时，请重新登陆！";
//		h_d.style.display = "";
//		h_c.style.display = "";
		if(login_info._loginType != 0)
			getVerify('verifyIMG_0','0');
  		hiddenVerify();
	}
	
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail,handleTimeout);
}

function _s_l_m_p(o,p,c,m){
    var _value = o.value;
    var service_pwd = document.getElementById(p);
    var check_code = document.getElementById(c);
    var mesage_code = document.getElementById(m);
	var mobileip=GetCookie("mobileip");	
    switch (_value) {
    
        case "0":
            service_pwd.style.display = "none";
            mesage_code.style.display = "none";
            check_code.style.display = "none";
            break;  
        case "1":
            service_pwd.style.display = "none";
            mesage_code.style.display = "";
			if(mobileip==1)
				 check_code.style.display = "";
			else
				check_code.style.display = "none";
            break;
        case "2":
            service_pwd.style.display = "";
            mesage_code.style.display = "none";
            if(mobileip==1)
				 check_code.style.display = "";
			else
				check_code.style.display = "none";
            break;
        case "3":
            service_pwd.style.display = "";
            mesage_code.style.display = "";
            if(mobileip==1)
				 check_code.style.display = "";
			else
				check_code.style.display = "none";
            break;
    }
}


/**

随便逛逛用到的登录
**/
function new_web_login(t,n,p,sr,ir,lb,m,b){
    var isfromonlineservice = false;
	if(typeof(onlineLogin)=="undefined"||!onlineLogin){
	}else{
		isfromonlineservice = true;
	}
    var login_info = {
        _loginType: document.getElementById(t).value,
        _logonName: document.getElementById(n).value,
        _password: document.getElementById(p).value,
        _smsRND: document.getElementById(sr).value,
        _imageCode: document.getElementById(ir).value,
		mobileip:0,
		_channel:document.getElementById(lb).value.indexOf("/e100/")!=-1?8:0,
		_login_backurl:document.getElementById(lb).value==""?window.location.href:document.getElementById(lb).value
    };   
	var _lem = document.getElementById(m);
    
    var v = new SunRise.Validate();
    if (login_info._logonName == "") {
        _lem.innerHTML = "请输入手机号码";
        return false;
    }
    
    if (!v.isMobile(login_info._logonName)) {
        _lem.innerHTML = "请输正确的手机号码";
        return false;
    } 
    
    var vPwd = function(n){
        if (n == "") {
            _lem.innerHTML = "服务密码不能为空";
            return false;
        }
        if (!v.isNumber(n)) {
            _lem.innerHTML = "服务密码必须为数字";
            return false;
        }
		
        return true;
    }
    
	  var vRndSms = function(n){
        if (n == "") {
            _lem.innerHTML = "随机短信码不能为空";
            return false;
        }
        if (!v.isNumber(n)) {
            _lem.innerHTML = "随机短信码必须为数字";
            return false;
        }
        return true;
     }

    if (login_info._loginType == 2) {
        if (!vPwd(login_info._password)) {
            return;
        }
    }
    //Login By Mobile
    else if(login_info._loginType == 0){
    	
    }
    else if (login_info._loginType == 1) {
       if (!vRndSms(login_info._smsRND)) {
           return;
       }
    }
    else if (login_info._loginType == 3) { 
       if (!vPwd(login_info._password)) {
             return;
       }else if (!vRndSms(login_info._smsRND)) {
         return;
       }
    }
    else {
       _lem.innerHTML = "请以正确的方式登陆";
       return;
    }
  //Login By Mobile not check Image Code
  if(login_info._loginType != 0){
    if (login_info._imageCode == "" || login_info._imageCode.length != 4 || login_info._imageCode == '点击输入') {
		_lem.innerHTML = "请输入正确的图形校验码";
        return;
    }
  }
    var _sb = document.getElementById(b);
    _sb.disabled = true;
    _lem.innerHTML = "正在登陆中，请稍候......";
    
    var url = "/ServicesServlet/LOGIN";
    var handlePostData = {
        operation: "login",
		isProtocol:"false",
		_dl100Mobile:'',
		_isfrompop:isfromonlineservice,
        _loginInfo: login_info.toJSONString()
    };
    
    var handleSuccess = function(response){
		try{
			var cookieValue = login_info._logonName + "|-1";
			SetCookie('LoginMember',cookieValue,false,'/');
		}catch(e){
			alert(e);
		}
		if(response._login_backurl != ""){
		    //alert( response._login_backurl);
			window.location = response._login_backurl;
		}else{
			location.reload();
		}
		
		
    };
	
	var handleFail = function(response){
        _sb.disabled = false;
      //  _fp.disabled = false;
        _lem.innerHTML = response.message;
		if(login_info._loginType != 0)
			getVerify('verifyIMG_0','0');
  		hiddenVerify();
	}
	
	var handleTimeout = function(){
        _lem.innerHTML = "请求超时，请重新登陆！";
		if(login_info._loginType != 0)
			getVerify('verifyIMG_0','0');
  		hiddenVerify();
	}
	common_send_ajax(url,handlePostData,true,handleSuccess,handleFail,handleTimeout);
}

//***************************************************
function isDisplay(ids){	
	//var mobileip=GetCookie("mobileip");
	SetCookieSecond("mobileip",1,clearTime,'/');
	var mobileip=1;
	//alert("得到Cookie的值是>>>>>>>>>>>>>>>>>>>>>>>>>>>"+mobileip);
	var obj=document.getElementById(ids);
	if(typeof(obj)!='undefined'&&obj!=null){
		if(mobileip==1){
			obj.style.display="";
			//obj.className="";
		}else{
			obj.style.display="none";
			//obj.className="hide";
		}
	}
	
}
function getLoginName(loginid){
	var loginMobile=GetCookie("LoginMember");	
	var mob=document.getElementById(loginid);
	if(typeof(mob)!='undefined'&&mob!=null){
		if(typeof(loginMobile)!='undefined'&&loginMobile!=null){			
				//loginMobile=loginMobile.substring(0,11);
				//alert(loginMobile.length);
				//mob.value=loginMobile;
		}
	}
}
//点击随便逛逛
function  ramble(t,n,p,sr,ir,lb,m,b,reb,a){
		document.getElementById(t).value="0";
	 new_web_login(t,n,p,sr,ir,lb,m,b);
}
function isShow(_id01){
   var _obj = document.getElementById(_id01);
   //alert("obj is=="+_obj);
   if(_obj==null)return false;
   //alert(_obj.className);
    return (_obj.className.indexOf("hide")== -1);

}

/**
当输入完后验证登陆信息
t：1，验证手机号码，2：验证服务密码，3：验证短信验证码，4：验证图形验证码
**/

function valLogin(t,id,nid){
	// alert(9890);
	var obj=document.getElementById(id);
	var o=document.getElementById(nid);
	var v = new SunRise.Validate();
	 //验证手机号码
	// o.style.display="";
	//alert(obj.value.length);
	var m=0;
	var a=11;
	if(t==1&&obj.value.length>0){
		if(obj.value==""){
			o.innerHTML="请输入手机号码";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		}
		if (!v.isMobile(obj.value)) {
			o.innerHTML = "请输入正确的手机号码";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		} 
	}else{
		o.style.display="none";
	}
	//验证服务密码
	if(t==2&&obj.value.length>0){
		if(obj.value==""){
			o.innerHTML="请输入服务密码";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		}
		if (!v.isNumber(obj.value)) {
			o.innerHTML = "服务密码必须是数字";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		} 
		if (obj.value.length!=6&&obj.value.length!=8) {
			o.innerHTML = "服务密码必须是6位或者8位数字";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		} 
		//o.style.display="none";
	}else{
		o.style.display="none";
	}
	//验证短信码
	if(t==3&&obj.value.length>0){
		if(obj.value==""){
			o.innerHTML="请输入动态密码";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		}
		if (!v.isNumber(obj.value)) {
			o.innerHTML = "动态密码必须是数字";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		} 
		if (obj.value.length!=6) {
			o.innerHTML = "动态密码必须是6位数字";
			m=o.innerHTML.length*a;
			o.style.width=m+"px";
			o.style.display="";
			return false;
		} 
		
	}else{
		o.style.display="none";
	}
	//验证图形验证码
	if(t==4){
		//alert(456);
		if(obj.value==""||obj.value.length != 4||obj.value=='点击输入') {
			o.innerHTML="请输入图形验证码";
			
			return false;
		}		 
		o.style.display="none";
	}
}
function sendSMSLoginPWD(url,mobile){
	sendSMSPwd(url,mobile);
	DelCookie("sms_login_time","/");
}

