	var ua=navigator.userAgent;
	var platform=navigator.platform;
	
	var is64IE=false;
	if(platform.indexOf("Win64")>-1){
		is64IE=true;
	}else{
		is64IE=false;
	}
/******************************************************
// 	 *功能描述:把密码输入控件写入页面中，maxLen,minLen为输入密码的长度
// 	 *参数说明：
//		id: 控件id
//		basePath:路径
//		fieldName:数据域
//		maxLen:最大长度
//		minLen:最小长度
//		pwidth:显示宽度
//		pheight:显示高度
//		uniqueID:密文
//      tabindex:tab index
//      rule：密码规则
//		
***************************************************** */ 
	function writePwdActivxObject(id,fieldName,basePath,maxLen,minLen,pheight,pwidth,uniqueID,tabindex,rule)
	{ 
		if(ua.indexOf("WOW64")>-1){
			document.write('<object classid="CLSID:E83313B3-B1B9-4DB8-9E3B-AD6037DE0679" id="'+id+'"'+' codebase='+basePath+'ocx/x6432.cab#version=1,0,0,1  width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
		}else{
			if(is64IE){
				document.write('<object classid="CLSID:FC6E1BC7-61BD-4031-A90E-AA934EA77553" id="'+id+'"'+' codebase='+basePath+'ocx/x64.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}else{
				document.write('<object classid="CLSID:E83313B3-B1B9-4DB8-9E3B-AD6037DE0679" id="'+id+'"'+' codebase='+basePath+'ocx/x32.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}
		}
		document.write('<param  name="EditName" value="'+fieldName+'">');
		document.write('<param  name="MaxLength" value="'+maxLen+'">');
		document.write('<param  name="MinLength" value="'+minLen+'">');
		if(rule != null) {
			document.write('<param  name="Rule" value="'+rule+'">');
		}else {
			document.write('<param  name="Rule" value="10111">');
		}
		document.write('<param  name="UniqueID" value="' + uniqueID + '">');
		document.write('</object>');
	}
	
	function writePwdForCardActivxObject(id,fieldName,basePath,maxLen,minLen,pheight,pwidth,uniqueID,tabindex)
	{ 
		if(ua.indexOf("WOW64")>-1){
			document.write('<object classid="CLSID:E83313B3-B1B9-4DB8-9E3B-AD6037DE0679" id="'+id+'"'+' codebase='+basePath+'ocx/x6432.cab#version=1,0,0,1  width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
		}else{
			if(is64IE){
				document.write('<object classid="CLSID:FC6E1BC7-61BD-4031-A90E-AA934EA77553" id="'+id+'"'+' codebase='+basePath+'ocx/x64.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}else{
				document.write('<object classid="CLSID:E83313B3-B1B9-4DB8-9E3B-AD6037DE0679" id="'+id+'"'+' codebase='+basePath+'ocx/x32.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}
		}
		document.write('<param  name="EditName" value="'+fieldName+'">');
		document.write('<param  name="MaxLength" value="'+maxLen+'">');
		document.write('<param  name="MinLength" value="'+minLen+'">');
		document.write('<param  name="Rule" value="00001">');
		document.write('<param  name="UniqueID" value="' + uniqueID + '">');
		document.write('</object>');		
	}
	
	function writeAliasActivxObject(id,fieldName,basePath,maxLen,minLen,pheight,pwidth,uniqueID,tabindex)
	{ 
		if(ua.indexOf("WOW64")>-1){
			document.write('<object classid="CLSID:C00E3FF3-1F6A-423D-B5E0-17C198EF65E4" id="'+id+'"'+' codebase='+basePath+'ocx/x6432.cab#version=1,0,0,1  width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
		}else{
			if(is64IE){
				document.write('<object classid="CLSID:C2C81750-6310-4be7-B9E2-7B1C61D9E2C4" id="'+id+'"'+' codebase='+basePath+'ocx/x64.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}else{
				document.write('<object classid="CLSID:C00E3FF3-1F6A-423D-B5E0-17C198EF65E4" id="'+id+'"'+' codebase='+basePath+'ocx/x32.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}
		}
		document.write('<param  name="EditName" value="'+fieldName+'">');
		document.write('<param  name="MaxLength" value="'+maxLen+'">');
		document.write('<param  name="MinLength" value="'+minLen+'">');
		document.write('<param  name="Rule" value="11111">');
		document.write('<param  name="EditType" value="1">');
		document.write('<param  name="UniqueID" value="' + uniqueID + '">');
		document.write('</object>');
	}
	
	function writeCardActivxObject(id,fieldName,basePath,maxLen,minLen,pheight,pwidth,uniqueID,tabindex)
	{ 
		if(ua.indexOf("WOW64")>-1){
			document.write('<object classid="CLSID:C00E3FF3-1F6A-423D-B5E0-17C198EF65E4" id="'+id+'"'+' codebase='+basePath+'ocx/x6432.cab#version=1,0,0,1  width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
		}else{
			if(is64IE){
				document.write('<object classid="CLSID:C2C81750-6310-4be7-B9E2-7B1C61D9E2C4" id="'+id+'"'+' codebase='+basePath+'ocx/x64.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}else{
				document.write('<object classid="CLSID:C00E3FF3-1F6A-423D-B5E0-17C198EF65E4" id="'+id+'"'+' codebase='+basePath+'ocx/x32.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}
		}
		document.write('<param  name="EditName" value="'+fieldName+'">');
		document.write('<param  name="MaxLength" value="'+maxLen+'">');
		document.write('<param  name="MinLength" value="'+minLen+'">');
		document.write('<param  name="Rule" value="00001">');
		document.write('<param  name="EditType" value="1">');
		document.write('<param  name="UniqueID" value="' + uniqueID + '">');
		document.write('</object>');
	}
	
	function writeVIDActivxObject(id,fieldName,basePath,maxLen,minLen,pheight,pwidth,uniqueID,tabindex)
	{ 
		if(ua.indexOf("WOW64")>-1){
			document.write('<object classid="CLSID:C00E3FF3-1F6A-423D-B5E0-17C198EF65E4" id="'+id+'"'+' codebase='+basePath+'ocx/x6432.cab#version=1,0,0,1  width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
		}else{
			if(is64IE){
				document.write('<object classid="CLSID:C2C81750-6310-4be7-B9E2-7B1C61D9E2C4" id="'+id+'"'+' codebase='+basePath+'ocx/x64.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}else{
				document.write('<object classid="CLSID:C00E3FF3-1F6A-423D-B5E0-17C198EF65E4" id="'+id+'"'+' codebase='+basePath+'ocx/x32.cab#version=1,0,0,1 width='+pwidth+' height='+pheight+' tabindex="'+tabindex+'">');
			}
		}
		document.write('<param  name="EditName" value="'+fieldName+'">');
		document.write('<param  name="MaxLength" value="'+maxLen+'">');
		document.write('<param  name="MinLength" value="'+minLen+'">');
		document.write('<param  name="Rule" value="00111">');
		document.write('<param  name="EditType" value="2">');
		document.write('<param  name="UniqueID" value="' + uniqueID + '">');
		document.write('</object>');
	}

	
	function writeCommitActivxObject(basePath)
	{ 
		if(ua.indexOf("WOW64")>-1){
			document.write('<object classid="CLSID:C391E12A-EAF1-45F1-8425-6E513C0D553C" id="safeSubmit1"  codebase='+basePath+'ocx/x6432.cab#version=1,0,0,1  width=0 height=0>');
		}else{
			if(is64IE){
				document.write('<object classid="CLSID:EC8A3953-D2E9-404c-825A-AACCBC30B99E" id="safeSubmit1"  codebase='+basePath+'ocx/x64.cab#version=1,0,0,1 width=0 height=0>');
			}else{
				document.write('<object classid="CLSID:C391E12A-EAF1-45F1-8425-6E513C0D553C" id="safeSubmit1"  codebase='+basePath+'ocx/x32.cab#version=1,0,0,1 width=0 height=0>');		
			}
		}
		document.write('</object>');		
	}	
	
	function ie_error_message_cn(errcode){
		if(errcode==1){
			alert("错误1：非交通银行网上银行的网页地址，请查证核实");
		}
		else if(errcode==2){
			alert("错误2：网页处于被调试状态，请重新打开再试");
		}
		else if(errcode==3){
			alert("错误3：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==4){
			alert("错误4：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==5){
			alert("错误5：安全控件启动异常，请关闭浏览器并使用管理员重新安装");
		}
		else if(errcode==6){
			alert("错误6：安全控件启动异常，请关闭浏览器并使用管理员重新安装");
		}
		else if(errcode==7){
			alert("错误7：安全控件启动异常，请关闭浏览器并使用管理员重新安装");
		}
		else if(errcode==8){
			alert("错误8：输入的字符长度不正确，请重新输入");
		}
		else if(errcode==9){
			alert("错误9：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==10){
			alert("错误10：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==11){
			alert("错误11：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else{
			alert("其它：安全控件运行异常，请关闭浏览器并重新安装");
		}
	}
	
	function ie_error_message_mo(errcode){
		if(errcode==1){
			alert("错误1：非交通银行网上银行的网页地址，请查证核实");
		}
		else if(errcode==2){
			alert("错误2：网页处于被调试状态，请重新打开再试");
		}
		else if(errcode==3){
			alert("错误3：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==4){
			alert("错误4：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==5){
			alert("错误5：安全控件启动异常，请关闭浏览器并使用管理员重新安装");
		}
		else if(errcode==6){
			alert("错误6：安全控件启动异常，请关闭浏览器并使用管理员重新安装");
		}
		else if(errcode==7){
			alert("错误7：安全控件启动异常，请关闭浏览器并使用管理员重新安装");
		}
		else if(errcode==8){
			alert("错误8：输入的字符长度不正确，请重新输入");
		}
		else if(errcode==9){
			alert("错误9：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==10){
			alert("错误10：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else if(errcode==11){
			alert("错误11：安全控件运行异常，请关闭浏览器并重新安装");
		}
		else{
			alert("其它：安全控件运行异常，请关闭浏览器并重新安装");
		}
	}
	
	function ie_error_message_uk(errcode){
		if(errcode==1){
			alert("Error 1：Not URL of BOCOM online banking, please have a check");
		}
		else if(errcode==2){
			alert("Error 2: The web pages are under debugging, please try again.");
		}
		else if(errcode==3){
			alert("Error 3: Security control is malfunctioning; please close the explorer and reinstall it.");
		}
		else if(errcode==4){
			alert("Error 4: Security control is malfunctioning; please close the explorer and reinstall it.");
		}
		else if(errcode==5){
			alert("Error 5: Security control cannot start normally; please close the explorer and use administrator to reinstall it.");
		}
		else if(errcode==6){
			alert("Error 6: Security control cannot start normally; please close the explorer and use administrator to reinstall it.");
		}
		else if(errcode==7){
			alert("Error 7: Security control cannot start normally; please close the explorer and use administrator to reinstall it.");
		}
		else if(errcode==8){
			alert("Error 8: Length of characters entered is incorrect; please try again.");
		}
		else if(errcode==9){
			alert("Error 9: Security control is malfunctioning; please close the explorer and reinstall it.");
		}
		else if(errcode==10){
			alert("Error 10: Security control is malfunctioning; please close the explorer and reinstall it.");
		}
		else if(errcode==11){
			alert("Error 11: Security control is malfunctioning; please close the explorer and reinstall it.");
		}
		else{
			alert("Others：Security control is malfunctioning; please close the explorer and reinstall it.");
		}
	}
//*功能描述:初始化IE控件
//*Author: Mazg
//*参数说明：
//objectId: 控件id		
	function initIEActivxObject(objectId,language) {
		var cryptObject = document.getElementById(objectId);	
		 if(!cryptObject.IsAvailable()){
			var errcode = cryptObject.GetErrorCode();
			if(language=="zh_CN")
	    	{
	    		ie_error_message_cn(errcode);
	    	}
	    	else if(language=="zh_MO"){
	    		ie_error_message_mo(errcode);
	    	}
	    	else if(language=="en_UK"){
	    		ie_error_message_uk(errcode);
	    	}else {
	    		ie_error_message_mo(errcode);
	    	}
		 }
	}
/******************************************************
// 	 *功能描述:提交密码
//   *Author: Mazg
// 	 *参数说明：
//		objectId: 控件id
//		submitFormId:提交的formID
//		
***************************************************** */ 	
  function submitPwdByIE(objectId,submitFormId,language) {
		var cryptObject = document.getElementById(objectId);
	  	//密码控件 
		//if(!cryptObject.isValid()){
			  //  alert("密码不合法，登录密码应含有数字和字符且不小于6位");		
			  // return;
	        // }
		if(!cryptObject.commit(safeSubmit1)){
			var errcode = cryptObject.GetErrorCode();
			if(language=="zh_CN")
	    	{
	    		ie_error_message_cn(errcode);
	    	}
	    	else if(language=="zh_MO"){
	    		ie_error_message_mo(errcode);
	    	}
	    	else if(language=="en_UK"){
	    		ie_error_message_uk(errcode);
	    	}else {
	    		ie_error_message_mo(errcode);
	    	}
		  	return;
		}
		// SubmitControl提交
		if(!safeSubmit1.submit(document.getElementById(submitFormId))){
			var errcode = safeSubmit1.GetErrorCode();
			if(language=="zh_CN")
	    	{
				ie_error_message_cn(errcode);
	    	}
	    	else if(language=="zh_MO"){
	    		ie_error_message_mo(errcode);
	    	}
	    	else if(language=="en_UK"){
	    		ie_error_message_uk(errcode);
	    	}else {
	    		ie_error_message_mo(errcode);
	    	}
		}
	}
  
/******************************************************
//	 *功能描述:提交密码（多密码）
// *Author: Mazg
//	 *参数说明：
//		objectIdSet: 控件id集合
//		submitFormId:提交的formID
//		
***************************************************** */ 	
	function submitPwdsByIE(objectIdSet,submitFormId,language) {
		for(var i=0; i<objectIdSet.length; i++) {
			var cryptObject  = document.getElementById(objectIdSet[i]);
			//密码控件 
			//if(!cryptObject.isValid()){
				  //  alert("密码不合法，登录密码应含有数字和字符且不小于6位");		
				  // return;
		        // }
			if(!cryptObject.commit(safeSubmit1)){
				var errcode = cryptObject.GetErrorCode();
				if(language=="zh_CN")
		    	{
					ie_error_message_cn(errcode);
		    	}
		    	else if(language=="zh_MO"){
		    		ie_error_message_mo(errcode);
		    	}
		    	else if(language=="en_UK"){
		    		ie_error_message_uk(errcode);
		    	}else {
		    		ie_error_message_mo(errcode);
		    	}
			  	return;
			}
		}
		// SubmitControl提交
		if(!safeSubmit1.submit(document.getElementById(submitFormId))){
			var errcode = safeSubmit1.GetErrorCode();
			if(language=="zh_CN")
	    	{
				ie_error_message_cn(errcode);
	    	}
	    	else if(language=="zh_MO"){
	    		ie_error_message_mo(errcode);
	    	}
	    	else if(language=="en_UK"){
	    		ie_error_message_uk(errcode);
	    	}else {
	    		ie_error_message_mo(errcode);
	    	}
		}
	}
