/* 
 * Grace a cette classe le dispatchage des events se fait automatiquement
 * avec l'attribut jevent
 *          jevent="[{'evt':'click','data':{'texte':'montexte1'},'fun':'test1'},{'evt':'mouseover','class':'utils','fun':'test2'}]"
 */

function api(){
    this.gereEvent=function(){
        var apiObj;
        $("*[jevent]").each(function(){
            apiObj=utils.strToObj($(this).attr("jevent"))
            for (var i=0;i<apiObj.length;i++) {
                if(apiObj[i]["class"]){
                    $(this).bind(apiObj[i].evt,apiObj[i].data,eval(apiObj[i]["class"]+'.'+apiObj[i].fun))
                }else{
                    $(this).bind(apiObj[i].evt,apiObj[i].data,eval(apiObj[i].fun))
                }
            }
        })

        if($("form[class!='unvalidate']").length>0){
            $("form[class!='unvalidate']").validate({
                
            })
        }
        
        if($("body").attr("id")=="admin"){
        $("input:not([class~='unvalidate'])").each(function(){
           var that=this
            if($(that).attr("rulers")!=""){
                var obj=utils.strToObj($(that).attr("rulers"))

                $(that).rules("add",obj)

            }
        })
        }

        

    }
}
var api=new api();



