/*---------------
 * jQuery iToggle Plugin by Engage Interactive
 * Examples and documentation at: http://labs.engageinteractive.co.uk/itoggle/
 * Copyright (c) 2009 Engage Interactive
 * Version: 1.0 (10-JUN-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
---------------*/
//bg fix
(function($){var $div=$('<div style="background-position: 3px 5px">');$.support.backgroundPosition=$div.css('backgroundPosition')==="3px 5px"?true:false;$.support.backgroundPositionXY=$div.css('backgroundPositionX')==="3px"?true:false;$div=null;var xy=["X","Y"];function parseBgPos(bgPos){var parts=bgPos.split(/\s/),values={"X":parts[0],"Y":parts[1]};return values;}if(!$.support.backgroundPosition&&$.support.backgroundPositionXY){$.cssHooks.backgroundPosition={get:function(elem,computed,extra){return $.map(xy,function(l,i){return $.css(elem,"backgroundPosition"+l);}).join(" ");},set:function(elem,value){$.each(xy,function(i,l){var values=parseBgPos(value);elem.style["backgroundPosition"+l]=values[l];});}};}if($.support.backgroundPosition&&!$.support.backgroundPositionXY){$.each(xy,function(i,l){$.cssHooks["backgroundPosition"+l]={get:function(elem,computed,extra){var values=parseBgPos($.css(elem,"backgroundPosition"));return values[l];},set:function(elem,value){var values=parseBgPos($.css(elem,"backgroundPosition")),isX=l==="X";elem.style.backgroundPosition=(isX?value:values["X"])+" "+(isX?values["Y"]:value);}};$.fx.step["backgroundPosition"+l]=function(fx){$.cssHooks["backgroundPosition"+l].set(fx.elem,fx.now+fx.unit);};});}})(jQuery);

(function($){$.fn.iToggle=function(options){clickEnabled=true;var defaults={type:'checkbox',keepLabel:true,easing:'easeInExpo',speed:200,onClick:function(){},onClickOn:function(){},onClickOff:function(){},onSlide:function(){},onSlideOn:function(){},onSlideOff:function(){}},settings=$.extend({},defaults,options);this.each(function(){var $this=$(this);if($this.get(0).tagName=='INPUT'){var id=$this.attr('id');label(settings.keepLabel,id);$this.addClass('iT_checkbox').before('<label class="itoggle" for="'+id+'"><span></span></label>');if($this.attr('checked')){$this.prev('label').addClass('iTon');}else{$this.prev('label').addClass('iToff');}}else{$this.children('input:'+settings.type).each(function(){var id=$(this).attr('id');label(settings.keepLabel,id);$(this).addClass('iT_checkbox').before('<label class="itoggle" for="'+id+'"><span></span></label>');if($(this).attr('checked')){$(this).prev('label').addClass('iTon');}else{$(this).prev('label').addClass('iToff');}
if(settings.type=='radio'){$(this).prev('label').addClass('iT_radio');}});}});function label(e,id){if(e==true){if(settings.type=='radio'){$('label[for='+id+']').addClass('ilabel_radio');}else{$('label[for='+id+']').addClass('ilabel');}}else{$('label[for='+id+']').remove();}}
$('label.itoggle').click(function(){if(clickEnabled==true){clickEnabled=false;if($(this).hasClass('iT_radio')){if($(this).hasClass('iTon')){clickEnabled=true;}else{slide($(this),true);}}else{slide($(this));}}
return false;});$('label.ilabel').click(function(){if(clickEnabled==true){clickEnabled=false;slide($(this).next('label.itoggle'));}
return false;});function slide($object,radio){settings.onClick.call($object);h=$object.innerHeight();t=$object.attr('for');if($object.hasClass('iTon')){settings.onClickOff.call($object);$object.animate({backgroundPositionX:'100%'},settings.speed,settings.easing,function(){$object.removeClass('iTon').addClass('iToff');clickEnabled=true;settings.onSlide.call(this);settings.onSlideOff.call(this);});$('input#'+t).removeAttr('checked');}else{settings.onClickOn.call($object);$object.animate({backgroundPositionX:'0%'},settings.speed,settings.easing,function(){$object.removeClass('iToff').addClass('iTon');clickEnabled=true;settings.onSlide.call(this);settings.onSlideOn.call(this);});$('input#'+t).attr('checked','checked');}
if(radio==true){name=$('#'+t).attr('name');slide($object.siblings('label[for]'));}}};})(jQuery);