/*
Multiple Checkboxes
Works for IE7, FF3, Chrome, Safari, Opera
By: Chonla
Create Date: 2 September 2009
URL: http://blog.chonla.com
*/

(function($){$.fn.checkall=function(){this.attr("checked",true);};$.fn.checknone=function(){this.attr("checked",false);};$.fn.invertcheck=function(){this.each(function(){$(this).attr("checked",!$(this).attr("checked"));});};$.fn.multicheck=function(options){var defaults={};uid=(new Date()).getTime();options=$.extend(defaults,options);this.each(function(i){$(this).attr("mc_i",i).attr("mc_g",uid);});this.click(function(e){if(!e)e=window.event;mcg="[mc_g="+$(this).attr("mc_g")+"]";c=$(this).attr("checked");if(e.shiftKey){lastclicked=$("input[type=checkbox]"+mcg+"[mc_l=yes]");if(lastclicked.size()>0){lastmci=lastclicked.attr("mc_i");nowmci=$(this).attr("mc_i");r1=lastmci<nowmci?lastmci:nowmci;r2=lastmci>nowmci?lastmci:nowmci;$("input[type=checkbox]"+mcg).each(function(){o=$(this);if((o.attr("mc_i")>=r1)&&(o.attr("mc_i")<=r2)){o.attr("checked",c);}});}}$("input[type=checkbox]"+mcg).removeAttr("mc_l");$(this).attr("mc_l","yes");});};})(jQuery);
