<!DOCTYPE html>
<!-- #include file="../common/checkru.asp" -->
<%
man = "add"
%>
<!-- #include file="../common/sub_inc.asp" -->
<!-- #include file="../common/commfun.asp" -->
<!-- #include file="../common/ip_purview.asp" -->
<%
Session("LingFengNet_LFM_save_ok") = "LFW_LFMessS_Plus"
IF LingFengNet_MS_add_upload_1 <> 0 Then
	Response.Write LingFengNet_MS_language_upload_1
	Response.End()
End IF	
%>
<html lang="zh-cn">
<head>
<%  
  Call htmlmeta() 
%>
<link rel="stylesheet" href="../style/css/<%= LingFengNet_MS_web_css %>.css" type="text/css">
<link rel="shortcut icon" href="../pic/favicon.ico" type="image/x-icon">
<link rel="bookmark" href="../pic/favicon.ico" type="image/x-icon">
<style>
.fileInput {
	width: 550px;
	height: 35px;
	line-height: 35px;
	background: url(../pic/upFileBtn.png) no-repeat;
	overflow: hidden;
	position: relative;
}
.upfile {
	position: absolute;
	top: -80px;
}
.upFileBtn {
	width: 102px;
	height: 35px;
	opacity: 0;
	filter: alpha(opacity=0);
	cursor: pointer;
}
.tip {
	margin:6px;
}
</style>
</head>
<body class="bgc" style="background-image:url(../pic/upload_bg.png);">
<form class="top_m"  name="form1" method="post" action="upload<%= Get_Suffix() %>" enctype="multipart/form-data">
  <div class="fileInput left">
    <input type="file" name="upfile" id="upfile" class="upfile" />
    <input class="upFileBtn" type="button" value="uploadmes" onclick="document.getElementById('upfile').click()" />
    <input type="submit" name="upFileSub" id="upFileSub" value="<%= LingFengNet_MS_language_upload_8 %>" class="buttonface" style="height:33px;">
    &ensp;<%= LingFengNet_MS_language_upload_9 %></div>
  <div class="tip" id="upfileResult"><%= LingFengNet_MS_language_upload_10 & toxs_chr(LingFengNet_MS_add_upload_3) %></div>
</form>
<script>
try{onLoadFont();}catch(e){}
var upfile = document.getElementById("upfile");
//i = 0
upfile.onchange = function(){	
	//i++;
	//console.log (i);
	//console.log (upfile.value);
	checkFile(upfile,upfile.value);
}
var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
function checkFile(fileName,strValue){
	var fileSize = 0;
	var fileExt = "<%= LingFengNet_MS_add_upload_3 %>";
	var filepath = strValue;
	var filemaxsize = <%= LingFengNet_MS_add_upload_2 %>;
	if(filepath){
		var index = filepath.lastIndexOf(".");
		var ext = filepath.substr(index+1);
		var flag = fileExt.indexOf(ext);
		if(flag >= 0){
			document.getElementById("upfileResult").innerHTML=filepath+"<%= LingFengNet_MS_language_upload_12 %>"; 
			upFileSubOK(1);
		}else if(flag < 0){
			document.getElementById("upfileResult").innerHTML="<span class=redfont><%= LingFengNet_MS_language_upload_13 & toxs_chr(LingFengNet_MS_add_upload_3) %></span>";
			upFileSubOK(0);
			return false;
		}else{	
			document.getElementById("upfileResult").innerHTML="<%= LingFengNet_MS_language_upload_10 & toxs_chr(LingFengNet_MS_add_upload_3) %>"; 
			upFileSubOK(0);
			return false;
		}
	}else{	
		document.getElementById("upfileResult").innerHTML="<%= LingFengNet_MS_language_upload_10 & toxs_chr(LingFengNet_MS_add_upload_3) %>"; 			
		upFileSubOK(0);
		return false;
	}
	
	if(isIE && !filepath){
		var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
		if(!fileSystem.FileExists(filePath)) {
			document.getElementById("upfileResult").innerHTML="<%= LingFengNet_MS_language_upload_10 & toxs_chr(LingFengNet_MS_add_upload_3) %>";
			upFileSubOK(0);
			return false;
		}
		var file = fileSystem.GetFile(filePath);
		fileSize = file.Size;
	}else{
		fileSize = fileName.files[0].size;
	}

	var size = fileSize / 1024;
	if(size > filemaxsize){
		document.getElementById("upfileResult").innerHTML="<span class=redfont><%= LingFengNet_MS_language_upload_15 %>" + filemaxsize + " KB£¡<%= LingFengNet_MS_language_upload_16 %></span>"; 
		upFileSubOK(0);
		return false;
	}else if((size <= 0)||(size == null)){
		document.getElementById("upfileResult").innerHTML="<%= LingFengNet_MS_language_upload_10 & toxs_chr(LingFengNet_MS_add_upload_3) %>";
		upFileSubOK(0);
		return false;
	}
}

function upFileSubOK(howToDo){
	howToDo == 0 ? (document.getElementById("upFileSub").className="buttonface_gray",document.getElementById("upFileSub").disabled="disabled",document.getElementById("upFileSub").value="<%= LingFengNet_MS_language_upload_14 %>") : (document.getElementById("upFileSub").className="buttonface",document.getElementById("upFileSub").disabled="",document.getElementById("upFileSub").value="<%= LingFengNet_MS_language_upload_8 %>");
}
</script>
</body>
</html>