$(document).ready(function() {
	// 钩子，回调。 请在具体的html文档中定义
	try{
		if(typeof(onInitDocument)=='function');
			onInitDocument();
	}catch(e){
	}
	
	// 回调验证器绑定功能
	try{
		if(typeof(onPrepValidation)=='function');
			onPrepValidation();
	}catch(e){
	}
	
	try{
		// 文本框等获得焦点自动变色
		$("input[type='text'],input[type='password'],textarea").not(".readonly").focus(function(){
			this.style.background="#fefce2";
		});
		$("input[type='text'],input[type='password'],textarea").not(".readonly").blur(function(){
			this.style.background="";
		});
		$("input[type='radio'],input[type='checkbox']").addClass('noBorder');//去掉radio,checkbox的边框,避免input指定了边框殃及radio
	}catch(e){
	}
});

/*
 * 用于设置A标签的onclick属性，将其禁用或开启
 * 避免firefox等浏览器中不支持A标签的disabled
*/
function setDisabled(el, disabled){
	if(typeof(el)=='undefined'){
		return;
	}
	if(disabled){
		if(!document.all){
	    	el.setAttribute('_onclick', el.getAttribute("onclick"));
	    	$(el).addClass("disabled");
	    	el.removeAttribute('onclick');
	    } else {
	    	el.setAttribute('disabled',true);
	    }
	} else {
		if(!document.all){
			var attr = el.getAttribute("_onclick");
			if(attr != null){
				el.setAttribute('onclick', attr);
				$(el).removeClass("disabled");
			}
    	}else {
    		el.setAttribute('disabled',false);
    	}
	}
}