<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"><!----20120110 ting---->
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzConn" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.organize.SzCompany" %>
<%@ page import="net.sz600.organize.SzCompanyInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%
    //判断是否正在还原数据库
    if (SzConn.getRestore()) {
            out.println("管理员正在还原系统数据库，稍后再重新登陆！");
       return; //这里必须要加return，否则以下的程序仍然会执行。
    }

    String COMPANY = SzConvert.toSpaceStr(request.getParameter("COMPANY")); //分公司信息
    //取得公司的图片
    SzCompany szCompany = new SzCompany();
    SzCompanyInfo companyInfo = (SzCompanyInfo)szCompany.getInfoByKey(SzConvert.toInt(SzCompany.decryptCOMPANY(COMPANY)));
		String sTitle = "";
		int companyPepedom = 0;
		if (companyInfo != null) {
			sTitle = companyInfo.getGSMC();
			companyPepedom = companyInfo.getGSQZ();
		}
		if (sTitle.equals("")) {
			sTitle = "数飞协同网络办公系统";
		}
	
		String c = SzConvert.toSpaceStr(request.getParameter("c")); //助手参数
    if (c.equals("swc")) {
    	session.setAttribute("SzHelp", "swc");	
    } else {
    	session.setAttribute("SzHelp", "");
    }
    session.setAttribute("SzDLID", "");
    session.setAttribute("SzDLZH", "");
    session.setAttribute("SzLoginInfo", null);
    
    //System.out.println("index============" + session.getAttribute("SzHelp"));

    String sIp = SzConvert.toSpaceStr( request.getRemoteHost() );
    //out.println("=" + sIp);

    //cookie
    Cookie[] cks =request.getCookies();
    String temp_cookie = null;
    String loginName = SzConvert.toSpaceStr(request.getParameter("LoginName")); // 
    String loginPassword = SzConvert.toSpaceStr(request.getParameter("LoginPassword"));

    if(cks!=null && loginName.equals("")) {
	    for(int   i=0;i<cks.length;i++)   {
              temp_cookie = cks[i].getName();
              //查找用户名
              if(temp_cookie.equals("SzLoginCookie")) {
            	  //SzConvert.strWriteData(cks[i].getValue());
                  loginName =  java.net.URLDecoder.decode(cks[i].getValue(),"GBK"); 
              }
        }
   }  
   if (loginName.equals("")) {
      loginName = "admin";
   }  
    
    //将在线SzOnlineCookie设置为空，保证助手知道还没有登陆。
    Cookie szOnlineCookie = new Cookie("SzOnlineCookie", "");
    szOnlineCookie.setMaxAge(0);
    szOnlineCookie.setPath("/");       
    response.addCookie(szOnlineCookie);	     
    //System.out.println(szCompany.getLoginPicture2(COMPANY));

    //System.out.println(net.sz600.check.SzHasp.getInstance().hasDog());

    String sServer_SESSION  = request.getServerName();
    String sPort_SESSION    = Integer.toString( request.getServerPort() );
    String sContext_SESSION = request.getContextPath();
%>
<html>
<head>
<%@ include file="/share/oa_app_title.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />

<meta name="keywords" content="数飞OA 2012" />
<meta name="description" content="数飞OA 2012" />
<style type="text/css">
input{ padding:4px 0 0 4px;}/*----20120111 ting------------------------------*/
input:hover{
   
    width:118x;
    height:20px;
    border:0px solid #7F9DB9;
	background-image:url(images/2011/destop/name2.gif);
	background-repeat:no-repeat;
    vertical-align:middle;
	padding-left:4px;
}/*----20120111 ting----*/
<!--
a{
  text-decoration:none;
  color:#000000;
 }/*-------------------20120107 ting------------------------------------- */

.font1 {
	font-family: "宋体";
	font-size: 12px;
	color: #FFFFFF;
}
.font2 {
	font-family: "宋体";
	font-weight: bold;
	font-size:13px;
	line-height:25%;
}
.style1 {
	font-family: "宋体";
	font-size:12px;
	text-align:center;
        line-height:30px;  /*---------------------20120107 ting----------------------------------------- */
}

.style1 img{ margin:-1px 0px -6px 0px;}/*-------------------20120107 ting------------------------------------- */
.txtClass1 {
    width:118px;
    height:20px;
    border:0px solid #7F9DB9;
	background-image:url(images/2011/destop/name.gif);
	background-repeat:no-repeat;
    vertical-align:middle;
	padding-left:4px;
}/*----------------------------------------20120111 ting------------------------------------------------*/
.txtClass1-2 {
    width:80px;
    height:20px;
    border:0px solid #7F9DB9;
        vertical-align:middle;
	padding-left:4px;
}
.img{vertical-align:middle; background-image:url(images/2011/destop/enter_button.gif); width:58px; height:24px; border:0px;}
.img:hover{vertical-align:middle; background-image:url(images/2011/destop/enter_button2.gif); background-repeat:no-repeat; border:0px; width:58px; height:24px;}
.fonthome4{
	font-family: "宋体";
	color:#000000;
	font-size:13px;
	
	line-height:25px;
	padding-left:10px;
	padding-right:10px;
	padding-top:10px;
	padding-bottom:10px;
}
.fonthome3 {
	font-family: "宋体";
	font-size: 14px;
	font-weight: bold;
	color: #4b4f53;
	padding-left:8px;
}
-->
</style>
<script language="javascript">
  function OpenDiv(v) {
  	var vCount = 5;
  	var vIndex = parseInt(v);
  	
  	var obj = null;
  	for (var i=0; i<vCount; i++) {
  		obj = document.getElementById("div" + i);
  		if (obj != null) {
  			obj.style.display = "none";
  		}
  	}  
  	obj = document.getElementById("div" + vIndex);
  	obj.style.display = "block";
  }
  function CloseDiv(v) {
  	var obj = null;  
  	obj = document.getElementById("div" + v);
  	obj.style.display = "none";
  }

  function SwapImg(objId, img) {
    document.getElementById(objId).src=img;
  }

  //2012-01-12增加
  function addBookmark() {
    try {
      title = "数飞OA";
      url = "http://<%=sServer_SESSION%>:<%=sPort_SESSION%>/<%=sContext_SESSION%>";
      window.external.AddFavorite(url, title);
    } catch(e) {
	alert("sorry,您电脑的浏览器不支持!");
    }
  }

  //可以成功
  function toDesktop(){
    try { 
      sName = "访问数飞OA";
      sUrl = "http://<%=sServer_SESSION%>:<%=sPort_SESSION%>/<%=sContext_SESSION%>";
      var WshShell = new ActiveXObject("WScript.Shell"); 
      var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop") + "\\" + sName + ".url"); 
      oUrlLink.TargetPath = sUrl; 
      oUrlLink.Save(); 
      alert("创建快捷方式成功");
    } catch(e) {   
	alert(e + "当前IE安全级别不允许操作！");   
    }
  } 
 
  //下载登陆助手
  function downloadSwc() {
    if (confirm("登陆助手可最小化到托盘，可开机自动访问OA，确定要下载？")) {
	return true;
    }
    return false;
  }

</script>


</script>
</head>


<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#004a75">
<table width="100%"  border="0" cellpadding="0" cellspacing="0" align="center"  background="images/2011/destop/top_background.gif" >
  <tr >
    <td width="6%" height="85">&nbsp;</td>
    <% if (!net.sz600.check.SzHasp.getInstance().hasDog()) {%>
    <td align="left"><a href="http://www.soarwell.com/" target="_blank" onfocus="javascript:blur();"><img src="images/2011/destop/logo.gif" id="logo" width="300" border="0" OnMouseOver="javascript:SwapImg('logo','images/2011/destop/logo_02.gif');" OnMouseOut="javascript:SwapImg('logo','images/2011/destop/logo.gif');"></a><% out.println(SzProperties.printSystemValidInfo()); %></td>
    <% } else {%>
    <td align="left"><a href="http://www.soarwell.com/" target="_blank" onfocus="javascript:blur();"><img src="images/customer/logo.gif" id="logo" width="300" border="0" OnMouseOver="javascript:SwapImg('logo','images/customer/logo_02.gif');" OnMouseOut="javascript:SwapImg('logo','images/customer/logo.gif');"></a><% out.println(SzProperties.printSystemValidInfo()); %></td>
    <% } %>

    <td width="1"></td>

  </tr>
</table>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" align="center"  >
<form name="formUpdate"  method="post">
  <input type="hidden" name="skinType" value="1">
  <input type="hidden" name="COMPANY" value="<%=COMPANY%>">
  <input type="hidden" name="navigator" value="MSIE">  
  <tr>
    <td colspan="3" height="100">
 
    </td>
  </tr>
  <tr bgcolor="#004a75" height="40">
    <td align="right" colspan=2"><span class="font1">登陆帐号：</span>  
      <input type="text" name="txtLoginName" value="<%=loginName %>" class="txtClass1" OnMouseOver="javascript:this.select();">
    </td>
    <td width="3%">&nbsp;</td>
  </tr>
  <tr bgcolor="#004a75" height="40">
    <td valign="top" align="right" colspan=2"><span class="font1">登陆密码：</span>  
      <input type="password" name="txtLoginPassword"  value=""  class="txtClass1"  OnMouseOver="javascript:this.select();">
    </td>
    <td width="3%">&nbsp;</td>
  </tr>
  <% if (SzProperties.needVerificationCode(request.getRemoteHost())) { %>
  <tr bgcolor="#004a75" height="40">
    <td valign="top" align="right" colspan=2"><span class="font1">验证码：</span>  
      <input type="password" name="txtLoginPassword"  value=""  class="txtClass1"  OnMouseOver="javascript:this.select();">
      <input type="text" name="txtVerificationCode"  value=""  class="txtClass1"  OnMouseOver="javascript:this.select();">
      <img alt="看不清楚，换一张"  src="organize/verificationImage.jsp" id="imgVerificationCode" class="txtClass1-2" onclick="javascript:VerificationCode();" style="width:70px;height: 25px"/>
    </td>
    <td width="3%">&nbsp;</td>
  </tr>
  <% } %>	
  <tr bgcolor="#004a75" height="40">
    <td valign="top" align="right" colspan=2">
    	
				<input name="btnSave"  type="button" id="btnSave" class="img" style="cursor:hand;"  width="58" height="24"border="0"    OnClick="javascript:FormSave(formUpdate, 'loginCheckAPP.jsp');">
        <span style="width:800px;">&nbsp;</span>
    </td>
    <td width="3%">&nbsp;</td>
  </tr>
  </form>
</table>

</div>
</body>
</html>
<script language="javascript">
  function myFunction() {
    //document.getElementById("btnSave").click();
    FormSave(formUpdate, 'loginCheckAPP.jsp');
  }
  //2013-06-07增加
  function VerificationCode() {
    var oVerificationCode = document.getElementById("imgVerificationCode");
    if (oVerificationCode != null) {
      //oVerificationCode.src= "organize/verificationImage.jsp";
      oVerificationCode.setAttribute("src","organize/verificationImage.jsp?"+ Math.random());
    }
  }
  
  function SelectSkinType(vType) {
  	if (vType == "1") {
	  document.location.href="index.jsp?COMPANY=<%=COMPANY%>";	
  	} else if (vType == "2") {
	  document.location.href="index2.jsp?COMPANY=<%=COMPANY%>"; 	
  	} else if (vType == "3") {
      document.location.href="3index.jsp?COMPANY=<%=COMPANY%>";
  	}
  }
  
  function FormSave(formName, url) {
    //检查是否可以保存
    if (formName.txtLoginName.value == "") {
      formName.txtLoginName.focus();
      alert("登陆名称不能为空");
      return false;
    }
    //提交
    formName.action = url;
    formName.submit();
  }

  function FormReset() {
    formUpdate.txtLoginName.value = "";
    formUpdate.txtLoginPassword.value = "";
    formUpdate.txtLoginName.focus();
  }

  function keyDown(e) {
    //修改2011-11-03：支持safari,ff
    var et = e || window.event;
    if (et.keyCode) {
	if (et.keyCode == 13) {
     		 FormSave(formUpdate, 'loginCheckAPP.jsp');
	}
    } else  if (et.which  == 13) {
      		//回车就是提交，调用保存
      		//document.formUpdate.btnSave.click();
      		
     		 FormSave(formUpdate, 'loginCheckAPP.jsp');
    }
  }
  document.onkeydown = keyDown;
  //如果已经有了用户名，则光标在密码处。否则在用户处
  if (formUpdate.txtLoginName.value == "") {
  	formUpdate.txtLoginName.focus();
  } else {
  	formUpdate.txtLoginPassword.focus();
  }
  
  var vScreenWidth = screen.width;


  var oDiv = document.getElementById("divImg04");
  if (oDiv != null) {
     if (vScreenWidth >1024) {
  	oDiv.style.left = vScreenWidth - 420;
     } else {
  	oDiv.style.left = vScreenWidth - 180;
     }
  }

  //2014-06增加浏览器类型
  var sNavigator = "MSIE";


  if(navigator.userAgent.indexOf("MSIE")>0) {   
      sNavigator = "MSIE";  
  } else if(navigator.userAgent.indexOf("Chrome")>0) { 
      sNavigator = "CHROME";  
  } else if(navigator.userAgent.indexOf("Firefox")>0) {   
      sNavigator = "FIREFOX"; 
  } else if(navigator.userAgent.indexOf("MQQBrowser")>0) {   
      sNavigator = "MQQBROWSER";   
  } else if(navigator.userAgent.indexOf("AppleWebKit")>0) {   
      sNavigator = "APPLEWEBKIT";           
  } else {
      sNavigator = "OTHER"; 
  }
  formUpdate.navigator.value = sNavigator;
  //var codeName=navigator.appCodeName;
  //alert(codeName);

</script>


