var DefaultEnableExtensions="gif,jpg,jpeg,bmp,png";
function CheckUpload(id,enableExtensions){
if(CheckExtension(id,enableExtensions)){
document.getElementById("upload").disabled=false;
}
else{
document.getElementById("upload").disabled=true;   
}
}

function CheckExtension(id,enableExtensions){
if(document.getElementById(id)==null){
return true;
}
if(document.getElementById(id).value==""){
return true;
}
if(enableExtensions==""){
return true;
}
var str=document.getElementById(id).value.toLowerCase();   
var extension=str.split(".");
extension=extension[extension.length-1];
if(!enableExtensions){
enableExtensions=DefaultEnableExtensions
}
var extensions=enableExtensions.split(",");
for(var i=0;i<=extensions.length-1;i++){
if("."+extension==extensions[i]){
break
}
if(i==extensions.length-1){
try{
ShowMessageDialog("提示","请选择类型正确的文件");
}
catch(e){
if(document.getElementById("message")){
document.getElementById("message").innerHTML="<div class=\"error\">提示:请选择类型正确的文件</div>";
}
else{
alert("请选择类型正确的文件");
}
}
return false;
}
}
document.getElementById("message").innerHTML="";
return true;
}