///******************************************************    
///	FileName:ManageVIPGrade.js
///	Action: 后台添加会员等级管理页面JS处理文件
///	Copyright(c)  2004-2008 网胜科技公司技术开发部
///	Writer:XYF
///	Create Date: 2008-12-25
///	Rewriter:
///	Rewrite Date:
///******************************************************  
var rightIcon="../../images/websen.gif"
var rightIcons="../../images/icon_nothing.gif";
var txtjbos=new  Array("txtGradeName","txtFolderSize")

function $(id){
    return document.getElementById(id);
}

function oo(){
    $("yc").style.display="none";
}

//得到焦点
for(var i=0;i<txtjbos.length;i++){ 
    $(txtjbos[i]).onfocus =function (){
        for (var j=0;j<txtjbos.length;j++){
            if (txtjbos[j]==event.srcElement.id){
                postobj(j);
            }
        }
    }
}

function postobj(num){
    obj = "txt"+num;
    document.getElementById(obj).innerHTML =Grade[num];
}

//失去焦点
for(var i=0;i<txtjbos.length;i++){ 
    $(txtjbos[i]).onblur =function (){
        for (var j=0;j<txtjbos.length;j++){
            if (txtjbos[j]==event.srcElement.id){
                postob(j);
            }
        }
    }
}

function postob(num){
    obj = "txt"+num;
    if (document.getElementById(obj).innerHTML !=""){
        document.getElementById(obj).innerHTML ="";
    }
    if ($("txtFolderSize").value!=""){
        if (!isNumber($("txtFolderSize").value)){
            document.getElementById(obj).innerHTML=Grade[2];
                return false;
        }
    }
}

function getobj(objName){
    if ($) {
        return eval('$("'+ objName +'")');
    }
    else {
        return eval('document.all["'+ objName +'"]');
    }
}
//提交
$("btnSave").onclick=function Server(){
    var arr=0;
    if ($("txtGradeName").value==""){
        document.getElementById("txt0").innerHTML=Grade[3];
        arr=1;
    }
    if ($("txtFolderSize").value==""){
        document.getElementById("txt1").innerHTML=Grade[4];
        arr=1;
    } 
    else if (!isNumber($("txtFolderSize").value)){
        document.getElementById(obj).innerHTML=Grade[2];
        arr=1;
    }
    if(arr==1){
        return false;
    }
    else {
        return true ;
    }
}
//显示信息
var title="<p>";
var titles="<p>"
var wrong ="<font color=#FF0000>"
var wrongs="</font>"
var Grade =new Array()
Grade[0]=title+"请写一个会员的等级名称"+titles
Grade[1]=title+"请输入空间大小"+titles
Grade[2]=wrong+"请输入数字类型"+wrongs
Grade[3]=wrong+"用户名不能为空，请重新设置用户名！"+wrongs
Grade[4]=wrong+"空间大小不能为空，请重新设置空间大小！"+wrongs