var password1;

window.onload=function (){	
	password1=null;	
	initCalc();		
}

var CapsLockValue=0;
var checkSoftKey;
var pIsPWD=false;
var ps;
var ifUseYinshe='1';
var jiami=0;
var keyjiami=0;
var hidekeyboard=true;
var ifjiami = false; //设置键盘输入时是否需要加密，如果需要加密，则设为true,否则设为false

var a=new Array([16]);
a[0]='S';
a[1]='0';
a[2]='0';
a[3]='0';
a[4]='0';
a[5]='0';
a[6]='0';
a[7]='0';
a[8]='2';
a[9]='7';
a[10]='4';
a[11]='6';
a[12]='1';
a[13]='3';
a[14]='2';
a[15]='5';
var b=new Array([190]);
b[0]='G';
b[1]=' ';
b[2]='R';
b[3]='M';
b[4]='W';
b[5]='N';
b[6]='u';
b[7]='B';
b[8]='v';
b[9]='V';
b[10]='=';
b[11]='C';
b[12]=',';
b[13]='X';
b[14]='M';
b[15]='Z';
b[16]='%';
b[17]='L';
b[18]='_';
b[19]='K';
b[20]='c';
b[21]='J';
b[22]='s';
b[23]='H';
b[24]='k';
b[25]='G';
b[26]='@';
b[27]='F';
b[28]='+';
b[29]='D';
b[30]='~';
b[31]='S';
b[32]='$';
b[33]='A';
b[34]='&';
b[35]='P';
b[36]='y';
b[37]='O';
b[38]='[';
b[39]='I';
b[40]='-';
b[41]='U';
b[42]='p';
b[43]='Y';
b[44]='V';
b[45]='T';
b[46]='*';
b[47]='R';
b[48]='K';
b[49]='E';
b[50]='U';
b[51]='W';
b[52]='w';
b[53]='Q';
b[54]=']';
b[55]='/';
b[56]='<';
b[57]='.';
b[58]='n';
b[59]=',';
b[60]='d';
b[61]='?';
b[62]='B';
b[63]='>';
b[64]='`';
b[65]='<';
b[66]='b';
b[67]='m';
b[68]='o';
b[69]='n';
b[70]='P';
b[71]='b';
b[72]='{';
b[73]='v';
b[74]='L';
b[75]='c';
b[76]='l';
b[77]='x';
b[78]='r';
b[79]='z';
b[80]='T';
b[81]='\'';
b[82]='?';
b[83]=';';
b[84]='8';
b[85]='"';
b[86]='h';
b[87]=':';
b[88]='Z';
b[89]='l';
b[90]='i';
b[91]='k';
b[92]='f';
b[93]='j';
b[94]='x';
b[95]='h';
b[96]='1';
b[97]='g';
b[98]='5';
b[99]='f';
b[100]='E';
b[101]='d';
b[102]='g';
b[103]='s';
b[104]='J';
b[105]='a';
b[106]='t';
b[107]=']';
b[108]='!';
b[109]='[';
b[110]='N';
b[111]='}';
b[112]='m';
b[113]='{';
b[114]='|';
b[115]='p';
b[116]='A';
b[117]='o';
b[118]='6';
b[119]='i';
b[120]='(';
b[121]='u';
b[122]=':';
b[123]='y';
b[124]='}';
b[125]='t';
b[126]='^';
b[127]='r';
b[128]='a';
b[129]='e';
b[130]='Y';
b[131]='w';
b[132]='7';
b[133]='q';
b[134]='/';
b[135]='\\';
b[136]='>';
b[137]='=';
b[138]='O';
b[139]='-';
b[140]='Q';
b[141]='0';
b[142]='2';
b[143]='9';
b[144]=' ';
b[145]='8';
b[146]='X';
b[147]='7';
b[148]='S';
b[149]='6';
b[150]='z';
b[151]='5';
b[152]='0';
b[153]='4';
b[154]='e';
b[155]='3';
b[156]='H';
b[157]='2';
b[158]='3';
b[159]='1';
b[160]='D';
b[161]='`';
b[162]='I';
b[163]='|';
b[164]='#';
b[165]='+';
b[166]=';';
b[167]='_';
b[168]='q';
b[169]=')';
b[170]='\'';
b[171]='(';
b[172]='4';
b[173]='*';
b[174]='\\';
b[175]='&';
b[176]='C';
b[177]='^';
b[178]='F';
b[179]='%';
b[180]='"';
b[181]='$';
b[182]='9';
b[183]='#';
b[184]='.';
b[185]='@';
b[186]='j';
b[187]='!';
b[188]=')';
b[189]='~';

function setVariables(){
	
	tablewidth=630;	
	tableheight=20;	
	if(navigator.appName=="Netscape"){
		
		horz=".left";		
		vert=".top";		
		docStyle="document.";		
		styleDoc="";		
		innerW="window.innerWidth";		
		innerH="window.innerHeight";		
		offsetX="window.pageXOffset";		
		offsetY="window.pageYOffset";		
		
	}
	else {
		
		horz=".pixelLeft";		
		vert=".pixelTop";		
		docStyle="";		
		styleDoc=".style";		
		innerW="document.body.clientWidth";		
		innerH="document.body.clientHeight";		
		offsetX="document.body.scrollLeft";		
		offsetY="document.body.scrollTop";		
		
	}
	
}
function checkLocation(){
	
	if(checkSoftKey){
		
		objectXY="softkeyboard";		
		var availableX=eval(innerW);		
		var availableY=eval(innerH);		
		var currentX=eval(offsetX);		
		var currentY=eval(offsetY);		
		x=availableX-tablewidth+currentX;		
		y=currentY;		
		evalMove();		
		
	}
	setTimeout("checkLocation()",0);	
	
}
function evalMove(){
	
	eval(docStyle+objectXY+styleDoc+vert+"="+y);	
	
}
self.onError=null;
currentX=currentY=0;

whichIt=null;

lastScrollX=0;
lastScrollY=0;
NS=(document.layers)?1:0;
IE=(document.all)?1:0;
function heartBeat(){
	
	if(IE){
		diffY=document.body.scrollTop;
		diffX=document.body.scrollLeft;
		
	}
	if(NS){
		diffY=self.pageYOffset;
		diffX=self.pageXOffset;
		
	}
	if(diffY!=lastScrollY){
		
		percent=.1*(diffY-lastScrollY);		
		if(percent>0)percent=Math.ceil(percent);		
		else percent=Math.floor(percent);		
		if(IE)document.all.softkeyboard.style.pixelTop+=percent;		
		if(NS)document.softkeyboard.top+=percent;
		
		lastScrollY=lastScrollY+percent;
		
	}
	if(diffX!=lastScrollX){
		
		percent=.1*(diffX-lastScrollX);		
		if(percent>0)percent=Math.ceil(percent);		
		else percent=Math.floor(percent);		
		if(IE)document.all.softkeyboard.style.pixelLeft+=percent;		
		if(NS)document.softkeyboard.left+=percent;		
		lastScrollX=lastScrollX+percent;
		
	}
}
function checkFocus(x,y){
	
	stalkerx=document.softkeyboard.pageX;	
	stalkery=document.softkeyboard.pageY;	
	stalkerwidth=document.softkeyboard.clip.width;	
	stalkerheight=document.softkeyboard.clip.height;	
	if((x>stalkerx&&x<(stalkerx+stalkerwidth))&&(y>stalkery&&y<(stalkery+stalkerheight)))return true;	
	else return false;
	
}
function grabIt(e){
	
	checkSoftKey=false;	
	if(IE){
		
		whichIt=event.srcElement;		
		while(whichIt.id!=null&&whichIt.id.indexOf("softkeyboard")==-1){
			
			whichIt=whichIt.parentElement;			
			if(whichIt==null){
				return true;
				
			}
		}
		if(whichIt.style!=null){
			
			whichIt.style.pixelLeft=whichIt.offsetLeft;			
			whichIt.style.pixelTop=whichIt.offsetTop;			
			
		}
		currentX=(event.clientX+document.body.scrollLeft);		
		currentY=(event.clientY+document.body.scrollTop);
		
		
	}else {
		
		window.captureEvents(Event.MOUSEMOVE);		
		if(checkFocus(e.pageX,e.pageY)){
			
			whichIt=document.softkeyboard;			
			StalkerTouchedX=e.pageX-document.softkeyboard.pageX;			
			StalkerTouchedY=e.pageY-document.softkeyboard.pageY;
			
		}
	}
	return true;
	
}
function moveIt(e){
	
	//不移动窗口
	return true;
	
	if(whichIt==null){
		return false;
		
	}
	if(IE){
		
		if(whichIt.style!=null){
			
			newX=(event.clientX+document.body.scrollLeft);			
			newY=(event.clientY+document.body.scrollTop);			
			distanceX=(newX-currentX);
			distanceY=(newY-currentY);			
			currentX=newX;
			currentY=newY;			
			whichIt.style.pixelLeft+=distanceX;			
			whichIt.style.pixelTop+=distanceY;			
			if(whichIt.style.pixelTop<document.body.scrollTop)whichIt.style.pixelTop=document.body.scrollTop;			
			if(whichIt.style.pixelLeft<document.body.scrollLeft)whichIt.style.pixelLeft=document.body.scrollLeft;			
			if(whichIt.style.pixelLeft>document.body.offsetWidth-document.body.scrollLeft-whichIt.style.pixelWidth-20)whichIt.style.pixelLeft=document.body.offsetWidth-whichIt.style.pixelWidth-20;			
			if(whichIt.style.pixelTop>document.body.offsetHeight+document.body.scrollTop-whichIt.style.pixelHeight-5)whichIt.style.pixelTop=document.body.offsetHeight+document.body.scrollTop-whichIt.style.pixelHeight-5;			
			event.returnValue=false;			
			
		}
		
	}else {
		
		whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);		
		if(whichIt.left<0+self.pageXOffset)whichIt.left=0+self.pageXOffset;		
		if(whichIt.top<0+self.pageYOffset)whichIt.top=0+self.pageYOffset;		
		if((whichIt.left+whichIt.clip.width)>=(window.innerWidth+self.pageXOffset-17))whichIt.left=((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;		
		if((whichIt.top+whichIt.clip.height)>=(window.innerHeight+self.pageYOffset-17))whichIt.top=((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;		
		return false;
		
	}
	return false;
	
}
function dropIt(){
	whichIt=null;	
	if(NS)window.releaseEvents(Event.MOUSEMOVE);	
	return true;
	
}
if(NS){
	window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);	
	window.onmousedown=grabIt;	
	window.onmousemove=moveIt;	
	window.onmouseup=dropIt;
	
}
if(IE){
	
	document.onmousedown=grabIt;	
	document.onmousemove=moveIt;	
	document.onmouseup=dropIt;
	
}
var style1="<style>";
style1+=".softkeyboard_btn_letter {BORDER-RIGHT: 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: 1px solid; PADDING-LEFT: 2px;FONT-SIZE: 14px; BORDER-LEFT: 1px solid; CURSOR: hand;PADDING-TOP: 1px; BORDER-BOTTOM: 1px solid; width:25px; height:20px;}";
style1+=".softkeyboard_btn_num {vertical-align:middle;width:25px;BORDER-RIGHT:1px solid; PADDING-RIGHT: 1px; BORDER-TOP: 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; BORDER-LEFT: 1px solid; CURSOR: hand; PADDING-TOP: 1px; BORDER-BOTTOM: 1px solid;height:20px;}";
style1+=".softkeyboard_table_title {FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#B2DEF7, EndColorStr=#7AB7DA); height:26px;padding-top: 3px;}";
style1+=".softkeyboard_btn_input {BORDER-RIGHT: #2C59AA 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #2C59AA 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#C3DAF5); BORDER-LEFT: #2C59AA 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #2C59AA 1px solid}";
style1+="</style>";

document.write(style1);

document.write("<DIV class = 'softkeyboard_div' align=center id=\"softkeyboard\" name=\"softkeyboard\" style=\"position:absolute; left:0px; top:0px; width:400px; z-index:180;display:none\"><table id=\"CalcTable\" width=\"\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"\"><FORM id=Calc name=Calc action=\"\" method=post autocomplete=\"off\"><tr><td class=\"softkeyboard_table_title\" title=\"为了保安全,建议使用密码输入器输入密码!\" align=\"right\" valign=\"middle\" bgcolor=\"\" style=\"cursor: default;height:30\"><INPUT type=hidden value=\"\" name=password><INPUT type=hidden value=ok name=action2>&nbsp<font style=\"font-weight:bold; font-size:13px; color:#075BC3\">网 龙 公 司&nbsp;&nbsp;密码输入器</font>&nbsp&nbsp&nbsp&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;<INPUT id=useKey class=\"softkeyboard_btn_input\" type=button value=\"使用键盘输入\" bgtype=\"1\" onclick=\"password1.readOnly=0;password1.focus();closekeyboard();password1.value='';\"><span style=\"width:2px;\"></span></td></tr><tr align=\"center\"><td align=\"center\" bgcolor=\"#FFFFFF\"><table align=\"center\" width=\"%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n<tr align=\"left\" valign=\"middle\"> \n<td> <input type=button value=\" ~ \"></td>\n<td> <input type=button value=\" ! \"></td>\n<td> <input type=button value=\" @ \"></td>\n<td> <input type=button value=\" # \"></td>\n<td> <input type=button value=\" $ \"></td>\n<td><input type=button value=\" % \"></td>\n<td><input type=button value=\" ^ \"></td>\n<td> <input type=button value=\" & \"></td>\n<td><input type=button value=\" * \"></td>\n<td><input type=button value=\" ( \"></td>\n<td><input type=button value=\" ) \"></td>\n<td><input type=button value=\" _ \"></td>\n<td> <input type=button value=\" + \"></td>\n<td><input type=button value=\" | \"></td>\n<td colspan=\"1\" rowspan=\"2\"> <input name=\"button10\" type=button value=\" 退格\" onclick=\"setpassvalue();\"  onDblClick=\"setpassvalue();\" style=\"width:100px;height:40px\"> \n</td>\n</tr>\n<tr align=\"left\" valign=\"middle\"> \n<td><input type=button value=\" ` \"></td>\n<td><input type=button bgtype=\"2\" name=\"button_number1\" value=\" 1 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number2\" value=\" 2 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number3\" value=\" 3 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number4\" value=\" 4 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number5\" value=\" 5 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number6\" value=\" 6 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number7\" value=\" 7 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number8\" value=\" 8 \"></td>\n<td> <input type=button bgtype=\"2\" name=\"button_number9\" value=\" 9 \"></td>\n<td> <input bgtype=\"2\"  name=\"button_number0\" type=button value=\" 0 \"></td>\n<td> <input type=button  value=\" - \"></td>\n<td> <input type=button value=\" = \"></td>\n<td> <input type=button value=\" \\ \"></td>\n<td> </td>\n</tr>\n<tr align=\"left\" valign=\"middle\"> \n<td> <input type=button name=\"button_line3_0\" value=\" q \"></td>\n<td> <input type=button name=\"button_line3_1\" value=\" w \"></td>\n<td> <input type=button name=\"button_line3_2\" value=\" e \"></td>\n<td> <input type=button name=\"button_line3_3\" value=\" r \"></td>\n<td> <input type=button name=\"button_line3_4\" value=\" t \"></td>\n<td> <input type=button name=\"button_line3_5\" value=\" y \"></td>\n<td> <input type=button name=\"button_line3_6\" value=\" u \"></td>\n<td> <input type=button name=\"button_line3_7\" value=\" i \"></td>\n<td> <input type=button name=\"button_line3_8\" value=\" o \"></td>\n<td> <input  type=button name=\"button_line3_9\" value=\" p \"></td>\n<td> <Input name=\"button9\" type=button value=\" { \"></td>\n<td> <input type=button value=\" } \"></td>\n<td> <input type=button value=\" [ \"></td>\n<td> <input type=button value=\" ] \"></td>\n<td><input name=\"button9\" type=button onClick=\"capsLockText();setCapsLock();\"  onDblClick=\"capsLockText();setCapsLock();\" value=\"切换大/小写\" style=\"width:100px;\"></td>\n</tr>\n<tr align=\"left\" valign=\"middle\"> \n<td> <input type=button name=\"button_line4_0\" value=\" a \"></td>\n<td> <input type=button name=\"button_line4_1\" value=\" s \"></td>\n<td> <input type=button name=\"button_line4_2\" value=\" d \"></td>\n<td> <input type=button name=\"button_line4_3\" value=\" f \"></td>\n<td> <input type=button name=\"button_line4_4\" value=\" g \"></td>\n<td> <input type=button name=\"button_line4_5\" value=\" h \"></td>\n<td> <input type=button name=\"button_line4_6\" value=\" j \"></td>\n<td> <input name=\"button_line4_7\" type=button value=\" k \"></td>\n<td> <input name=\"button_line4_8\" type=button value=\" l \"></td>\n<td> <input name=\"button5\" type=button value=\" : \"></td>\n<td> <input name=\"button7\" type=button value=\" &quot; \"></td>\n<td> <input type=button value=\" ; \"></td>\n<td> <input type=button value=\" ' \"></td>\n<td rowspan=\"2\" colspan=\"2\"> <input name=\"button12\" type=button onclick=\"OverInput();\" value=\"   确定  \" style=\"width:126px;height:42px;\"></td>\n</tr>\n<tr align=\"left\" valign=\"middle\"> \n<td><input name=\"button_line5_0\"  type=button value=\" z \"></td>\n<td> <input type=button name=\"button_line5_1\" value=\" x \"></td>\n<td> <input type=button  name=\"button_line5_2\" value=\" c \"></td>\n<td> <input type=button  name=\"button_line5_3\" value=\" v \"></td>\n<td> <input type=button  name=\"button_line5_4\" value=\" b \"></td>\n<td> <input type=button  name=\"button_line5_5\" value=\" n \"></td>\n<td> <input type=button  name=\"button_line5_6\" value=\" m \"></td>\n<td> <input type=button value=\" &lt; \"></td>\n<td> <input type=button value=\" &gt; \"></td>\n<td> <input type=button value=\" ? \"></td>\n<td> <input type=button value=\" , \"></td>\n <td> <input type=button value=\" . \"></td>\n <td> <input type=button value=\" / \"></td>\n</tr>\n</table></td></FORM></tr></table></DIV>");

function addValue(newValue)
{
	
	if(CapsLockValue==0)
	{
		
		var str=Calc.password.value;		
		if(str.length<password1.maxLength)
		{
			
			Calc.password.value+=newValue;			
			
		}
		if(str.length<=password1.maxLength)
		{
			
			password1.value=Calc.password.value;			
			pspassword1();			
			
		}
		
	}
	else 

	{
		
		var str=Calc.password.value;		
		if(str.length<password1.maxLength)
		{
			
			//Calc.password.value += newValue.toUpperCase();
			Calc.password.value+=newValue;			
			
		}
		if(str.length<=password1.maxLength)
		{
			
			password1.value=Calc.password.value;			
			pspassword1();			
			
		}
		
	}
	
}

function setpassvalue()
{
	
	var longnum=Calc.password.value.length;	
	var num
	num=Calc.password.value.substr(0,longnum-1);	
	Calc.password.value=num;	
	var str=Calc.password.value;	
	password1.value=Calc.password.value;	
	pspassword1();	
	
}

function OverInput()
{
	if (Calc.password.value != "")
	{
		var str=Calc.password.value;	
		password1.value=Calc.password.value;	
	}
	removeJiamiName();	
	pspassword1();	
	closekeyboard();	
	Calc.password.value="";	
	password1.readOnly=0;	
	
}

function closekeyboard(theForm)
{
	softkeyboard.style.display="none";	
	if(null!=unhideSelect){
		
		unhideSelect();		
		
	}
	
}

function showkeyboard()
{
	
	if (softkeyboard.style.display == "none")
	{
		randomNumberButton();	
		var th=password1;	
		var ttop=th.offsetTop;	
		var thei=th.clientHeight;	
		var tleft=th.offsetLeft;	
		var ttyp=th.type;	
		while(th=th.offsetParent){
			ttop+=th.offsetTop;
			tleft+=th.offsetLeft;
			
		}
			softkeyboard.style.top=204;	
		softkeyboard.style.left=71;	
		
		//softkeyboard.style.top= ttop+thei+16;	
		//softkeyboard.style.left=tleft-100;	
		softkeyboard.style.display="block";	
		password1.readOnly=0;	
		password1.blur();	
		document.all.useKey.focus();	
		if(null!=hideSelect){
			
			hideSelect();		
			
		}
	}
	else
	{
		closekeyboard();
	
	}
	
}

function setCapsLock()
{
	
	if(CapsLockValue==0)
	{
		
		CapsLockValue=1
		
	}
	else 
	{
		
		CapsLockValue=0
		
	}
	
}
function setCalcborder()
{
	
	CalcTable.style.border="1px solid #B5ADF1"
	
}
function setHead()
{
	
	CalcTable.cells[0].style.backgroundColor="#B5ADF1"
	
}
function setCalcButtonBg()
{
	
	for(var i=0;i<Calc.elements.length;i++)
	{
		
		if(Calc.elements[i].type=="button"&&Calc.elements[i].bgtype!="1")
		{
			
			if(Calc.elements[i].bgtype=="2"){
				
				Calc.elements[i].className="softkeyboard_btn_num";				
				
			}else {
				
				Calc.elements[i].className="softkeyboard_btn_letter";				
				
			}
			var str1=Calc.elements[i].value;			
			str1=str1.trim();			
			if(str1.length==1)
			{
				
				
			}
			var thisButtonValue=Calc.elements[i].value;			
			thisButtonValue=thisButtonValue.trim();			
			if(thisButtonValue.length==1)
			{
				
				Calc.elements[i].onclick=
				function ()
				{
					
					var thisButtonValue=this.value;					
					thisButtonValue=thisButtonValue.trim();	
					//alert("按键加密前:"+thisButtonValue);
					thisButtonValue=jiamiMimaKey(thisButtonValue,ifjiami);
					//alert("加密后："+thisButtonValue);
					addValue(thisButtonValue);					
					
				}
				Calc.elements[i].ondblclick=
				function ()
				{
					
					var thisButtonValue=this.value;					
					thisButtonValue=thisButtonValue.trim();
					//alert("按键加密前:"+thisButtonValue);
					thisButtonValue=jiamiMimaKey(thisButtonValue,ifjiami);
					//alert("加密后："+thisButtonValue);
					addValue(thisButtonValue);					
					
				}
				
			}
			
		}
		
	}
	
}
function initCalc(){
	setCalcborder();	
	setHead();	
	setCalcButtonBg();	
}

String.prototype.trim=function (){
	return this.replace(/(^\s*)|(\s*$)/g,"");	
}
var capsLockFlag;
capsLockFlag=true;
function capsLockText()
{
	
	if(capsLockFlag)
	{
		
		for(var i=0;i<Calc.elements.length;i++)
		{
			
			var char=Calc.elements[i].value;			
			var char=char.trim()
			if(Calc.elements[i].type=="button"&&char>="a"&&char<="z"&&char.length==1)
			{
				
				Calc.elements[i].value=" "+String.fromCharCode(char.charCodeAt(0)-32)+" "
				
			}
			
		}
		
	}
	else 
	{
		
		for(var i=0;i<Calc.elements.length;i++)
		{
			
			var char=Calc.elements[i].value;			
			var char=char.trim()
			if(Calc.elements[i].type=="button"&&char>="A"&&char<="Z"&&char.length==1)
			{
				
				Calc.elements[i].value=" "+String.fromCharCode(char.charCodeAt(0)+32)+" "
				
			}
			
		}
		
	}
	capsLockFlag=!capsLockFlag;	
	
}

function randomNumberButton(){
	
	var a=new Array(10);
	
	a[0]=0;
	a[1]=1;
	a[2]=2;
	a[3]=3;
	a[4]=4;
	a[5]=5;
	a[6]=6;
	a[7]=7;
	a[8]=8;
	a[9]=9;	
	var randomNum;	
	var times=10;	
	for(var i=0;i<10;i++){
		
		randomNum=parseInt(Math.random()*10);		
		var tmp=a[0];		
		a[0]=a[randomNum];		
		a[randomNum]=tmp;		
		
	}
	Calc.button_number0.value=" "+a[0]+" ";	
	Calc.button_number1.value=" "+a[1]+" ";	
	Calc.button_number2.value=" "+a[2]+" ";	
	Calc.button_number3.value=" "+a[3]+" ";	
	Calc.button_number4.value=" "+a[4]+" ";	
	Calc.button_number5.value=" "+a[5]+" ";	
	Calc.button_number6.value=" "+a[6]+" ";	
	Calc.button_number7.value=" "+a[7]+" ";	
	Calc.button_number8.value=" "+a[8]+" ";	
	Calc.button_number9.value=" "+a[9]+" ";	
	
	
	a[0]="q";
	a[1]="w";
	a[2]="e";
	a[3]="r";
	a[4]="t";
	a[5]="y";
	a[6]="u";
	a[7]="i";
	a[8]="o";
	a[9]="p";	
	
	for(var i=0;i<10;i++){
		
		randomNum=parseInt(Math.random()*10);		
		var tmp=a[0];		
		a[0]=a[randomNum];		
		a[randomNum]=tmp;		
		
	}
	
	Calc.button_line3_0.value=" "+a[0]+" ";	
	Calc.button_line3_1.value=" "+a[1]+" ";	
	Calc.button_line3_2.value=" "+a[2]+" ";	
	Calc.button_line3_3.value=" "+a[3]+" ";	
	Calc.button_line3_4.value=" "+a[4]+" ";	
	Calc.button_line3_5.value=" "+a[5]+" ";	
	Calc.button_line3_6.value=" "+a[6]+" ";	
	Calc.button_line3_7.value=" "+a[7]+" ";	
	Calc.button_line3_8.value=" "+a[8]+" ";	
	Calc.button_line3_9.value=" "+a[9]+" ";	
	
	
	a[0]="a";
	a[1]="s";
	a[2]="d";
	a[3]="f";
	a[4]="g";
	a[5]="h";
	a[6]="j";
	a[7]="k";
	a[8]="l";

	
	for(var i=0;i<9;i++){
		
		randomNum=parseInt(Math.random()*10);		
		var tmp=a[0];		
		a[0]=a[randomNum];		
		a[randomNum]=tmp;		
		
	}
	
	Calc.button_line4_0.value=" "+a[0]+" ";	
	Calc.button_line4_1.value=" "+a[1]+" ";	
	Calc.button_line4_2.value=" "+a[2]+" ";	
	Calc.button_line4_3.value=" "+a[3]+" ";	
	Calc.button_line4_4.value=" "+a[4]+" ";	
	Calc.button_line4_5.value=" "+a[5]+" ";	
	Calc.button_line4_6.value=" "+a[6]+" ";	
	Calc.button_line4_7.value=" "+a[7]+" ";	
	Calc.button_line4_8.value=" "+a[8]+" ";	
	
	a[0]="z";
	a[1]="x";
	a[2]="c";
	a[3]="v";
	a[4]="b";
	a[5]="n";
	a[6]="m";
	

	
	for(var i=0;i<7;i++){
		
		randomNum=parseInt(Math.random()*10);		
		var tmp=a[0];		
		a[0]=a[randomNum];		
		a[randomNum]=tmp;		
		
	}
	
	Calc.button_line5_0.value=" "+a[0]+" ";	
	Calc.button_line5_1.value=" "+a[1]+" ";	
	Calc.button_line5_2.value=" "+a[2]+" ";	
	Calc.button_line5_3.value=" "+a[3]+" ";	
	Calc.button_line5_4.value=" "+a[4]+" ";	
	Calc.button_line5_5.value=" "+a[5]+" ";	
	Calc.button_line5_6.value=" "+a[6]+" ";	
	

	
}

function hideSelect(){
	
	var i=0;	
	while(i<document.getElementsByTagName("select").length){
		
		document.getElementsByTagName("select")[i].style.visibility="hidden";		
		i=i+1;		
		
	}
	
}

function unhideSelect(){
	
	var i=0;	
	while(i<document.getElementsByTagName("select").length){
		
		document.getElementsByTagName("select")[i].style.visibility="visible";		
		i=i+1;		
		
	}
	
}

//此函数是用来加密输入的，即键盘输入的是加密后的字符
//newValue : 原值
//ifjiami :  是否需要加密
function jiamiMimaKey(newValue,ifjiami){	
	if(typeof(b)=="undefined"||typeof(ifUseYinshe)=="undefined"||ifUseYinshe==0){
		return newValue;		
	}
	//alert(!ifjiami);  //del by xuqb
	if(!ifjiami) return newValue;
	var everyone='';	
	var afterPass='';	
	for(var i=0;i<newValue.length;i++){		
		everyone=newValue.charAt(i);
		for(var j=0;j<((b.length)/2);j++){			
			if(everyone==b[2*j]){				
				afterPass=afterPass+b[2*j+1];				
				break;
			}
		}
	}
	newValue=afterPass;	
	if(typeof(jiami)!="undefined"){
		jiami=1;
	}
	return afterPass;
}

//此函数据作用是对密码框的的文字进行加密,输入参数为输入框的ID或name
function jiamiMima(inputboxname){
	//alert(document.jhform.LOGPASS.value);
	var inputboxobj = document.getElementById(inputboxname);
	//var inputboxobj = document.getElementById("LOGPASS");
	alert(inputboxobj.value);
	if(inputboxobj.value.length<6){
		alert('密码长度必须大于等于6位!');
		return false
	};
		
	var newValue=inputboxobj.value;	
	var specialChar=0;
	//alert("keyjiami:"+(keyjiami==0));
	//alert("jiami:"+(jiami==0));
	//alert("ifUseYinshe:"+(ifUseYinshe==1));
	//alert(keyjiami==0&&jiami==0&&ifUseYinshe==1);
	//这里判断的作用是，如果键输入已加密就不再需要加密，或按用户预设情况看是否需要加密ifUseYinshe=0时不需要加密
	if(keyjiami==0&&jiami==0&&ifUseYinshe==1){
		var everyone='';
		var afterPass='';		
		for(var i=0;i<newValue.length;i++){
			if(specialChar==1){
				break;		
			}
			everyone=newValue.charAt(i);			
			for(var j=0;j<((b.length)/2);j++){
				if(everyone==b[2*j]){
					afterPass=afterPass+b[2*j+1];					
					break;		
				}
				if(j==(b.length)/2-1){
					if(everyone!=b[2*j]){
						specialChar=1;						
						break;	
					}
				}
			}
		}
		if(specialChar==0){
			inputboxobj.value=afterPass;
		}else {
			var ret="";			
			afterPass='';			
			for(i=0;i<newValue.length;i++){
				var c=newValue.substr(i,1);				
				var ts=escape(c);				
				if(ts.substring(0,2)=="%u"){
					ret=ret+ts.replace("%u","(^?)");
				}else {
					ret=ret+c;
				}
			}
			inputboxobj.value=ret;			
			for(var n=0;n<ret.length;n++){
				everyone=ret.charAt(n);				
				for(var w=0;w<((b.length)/2);w++){
					if(everyone==b[2*w]){
						afterPass=afterPass+b[2*w+1];						
						break;	
					}
				}
			}
			inputboxobj.value=afterPass;
		}
		keyjiami=1;
	}
	//下面两行是冷月宫主用来测试用的
    //alert("logpassword:"+inputboxobj.value);	
	//alert("CCB_PWD_MAP_GIGEST:"+document.jhform.CCB_PWD_MAP_GIGEST.value);
	return false;
}

function removeJiamiName(){
	
	var jiamiObjectname=password1.name;
	
	var jiamiObjectnameBefore=jiamiObjectname+',';	
	var jiamiObjectnameAll=','+jiamiObjectname+',';	
	if(typeof(keyjiamiName)!="undefined"){
		
		if(keyjiamiName.indexOf(jiamiObjectnameBefore)==0){			
			keyjiamiName=keyjiamiName.substring(jiamiObjectnameBefore.length);			
		}else if(keyjiamiName.indexOf(jiamiObjectnameAll)!=-1){			
			keyjiamiName.replace(jiamiObjectnameBefore,',');			
		}		
	}	
}

function pspassword1(){	
	var passwd=password1.value;	
	var PWD=document.getElementsByName("PWD");	
	if(PWD!=null&&ps!=null&&pIsPWD){
		//add by lvwj modify date:20070226
		ps.update(getStartPassword(passwd));	
	}
}