///******************************************************    
///	FileName: Certificate.js
///	Action: 后台管理中心证书页面JS处理文件
///	Copyright(c)  2004-2008 网胜科技公司技术开发部
///	Writer:XYF
///	Create Date: 2008-12-24
///	Rewriter:
///	Rewrite Date:
///******************************************************  
var rightIcon="../../../images/websen.gif"
var rightIcons="../../../images/icon_nothing.gif";
var txtjbo=new  Array("txtName","txtOrganization");

$(document).ready(function(){
	for(var i=0;i<=txtjbo.length;i++){ 
        $("#"+txtjbo[i]).bind("focus",{dd:i,ss:txtjbo[i]},ChkInfo);
        $("#"+txtjbo[i]).bind("blur",{dd:i,ss:txtjbo[i]},ChkInfo);
	};
    $("#btnSave").bind("click",Server);
 });

function ChkInfo(event){
    var obj="txt"+event.data.dd;
    if($("#"+event.data.ss).attr("value")==""){
        document.getElementById(obj).innerHTML=TjZs[event.data.dd];
        return false;
    }
    else{
         document.getElementById(obj).innerHTML="";
    }
}
function Server(){
    var arr = 0;
    for(var i=0;i<txtjbo.length;i++){
        obj="txt"+i
        if ($("#"+txtjbo[i]).attr("value")==""){
            document.getElementById(obj).innerHTML=TjZs[i];
            arr=1
        }
    }
    if(arr==1){ 
        return false;
    } 
    else{
        return true;
    }
}




//function oo(){
//    $("yc").style.display="none";
//}
//function $(id){
//    return document.getElementById(id);
//}
//for(var i=0;i<txtjbo.length;i++){ 
//    $(txtjbo[i]).onfocus =function (){
//        for (var j=0;j<txtjbo.length;j++){
//            if (txtjbo[j]==event.srcElement.id){
//                postobj(j);
//            }
//        }
//    }
//}
//function postobj(num)
//{
//obj = "txt"+num;
//document.getElementById(obj).innerHTML =zs[num];
//if (num==3 || num==4)
// {
// calendar()
// }
//}
//for(var i=0;i<txtjbo.length;i++){ $(txtjbo[i]).onblur =function ()
//{for (var j=0;j<txtjbo.length;j++)
//{if (txtjbo[j]==event.srcElement.id){postob(j);}}}}
//function postob(num)
//{
//obj="txt"+num
// if (document.getElementById(obj).innerHTML !="")
//{document.getElementById(obj).innerHTML =""}

//}

//function getobj(objName)
//{
//	if ($) {return eval('$("'+ objName +'")');}
//	else {return eval('document.all["'+ objName +'"]');}
//}
//$("btnSave").onclick=function Server(){
//var  k = new Array();
//var arr = new Array();
//for(var i=0;i<2;i++)
//{
//obj="txt"+i
//k[i]= getobj(txtjbo[i]).value;
//if (k[i]=="")
//{
//document.getElementById(obj).innerHTML=TjZs[i];
//arr=1
//}
//}
//if(arr==1)
//{ return false;} else
//{return true;}
//           }
//添加证书
var TjZs=new Array(4)
TjZs[0]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>证书名称不能为空</font>";
TjZs[1]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>发证机构不能为空</font>";
TjZs[2]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>发证机构不能为空</font>";
TjZs[3]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>发证日期不能为空</font>";
TjZs[4]="<img src="+rightIcon+" width=\"19\" height=\"16\" align=\"absmiddle\"> <font color=#FF0000>证书有效期不能为空</font>";
//处理信息
var title="<table border=0 cellpadding=0 cellspacing=0 id=yc onclick=oo() oncontextmenu=oo()><tr><td valign=middle bordercolor=#999999 ><img src="+rightIcons+" width=19 height=17 ><font color=#999999>";
var titles="</font></td></tr></table>"
var zs=new Array(5)
zs[0]=title+"请输入有效的证书证书名称"+titles
zs[1]=title+"请输入发证机构"+titles
zs[2]=title+"请输入有效的发证机构单位"+titles
zs[3]=title+"请选择有效的发怔日期"+titles
zs[4]=title+"请选择证书有效期"+titles