/*
表單中控制全選及取消操作
*/
jQuery.fn.selectall = function(option) {
	var obj = $(option);
	$(this).eq(0).bind("click",function(){
		if($(this).is(":checked")){
			obj.attr("checked",true).parent().parent().css({background:"#CBF3FB"});
		}else{
			obj.attr("checked",false).parent().parent().css({background:"#FFFFFF"});
		}
	});
	
	obj.bind("click",function(){
		$(this).is(":checked")?$(this).parent().parent().css({background:"#CBF3FB"}):$(this).parent().parent().css({background:"#FFFFFF"});
	});
};
/* -------------------------------------------------------------------------------------------------------- */
/*
jQuery插件
限定指定容器只能输入数字，并不能操作复制/粘贴/右击/選擇及其他输入法。
*/
jQuery.fn.onlypressnum = function() {
	$(this).css({imeMode:"disabled",'-moz-user-select':"none"});
	$(this).bind("keypress",function(e){
		if(e.ctrlKey == true || e.shiftKey == true)
			return false;
		if((e.which >= 48 && e.which <= 57 && e.ctrlKey == false && e.shiftKey == false) || e.which == 0 || e.which == 8)
			return true;
		else if(e.ctrlKey == true && (e.which == 99 || e.which == 118))
			return false;
		else
			return false;
	})
	.bind("contextmenu",function(){return false;})
	.bind("selectstart",function(){return false;})
	.bind("paste",function(){return false;});
};
/* -------------------------------------------------------------------------------------------------------- */

