/*
* iButton jQuery Plug-in
*
* Copyright 2011 Giva, Inc. (http://www.givainc.com/labs/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Date: 2011-07-26
* Rev: 1.0.03
*/
(function(e){e.iButton={version:"1.0.03",setDefaults:function(g){e.extend(f,g)}};e.fn.iButton=function(j){var k=typeof arguments[0]=="string"&&arguments[0];var i=k&&Array.prototype.slice.call(arguments,1)||arguments;var h=(this.length==0)?null:e.data(this[0],"iButton");if(h&&k&&this.length){if(k.toLowerCase()=="object"){return h}else{if(h[k]){var g;this.each(function(l){var m=e.data(this,"iButton")[k].apply(h,i);if(l==0&&m){if(!!m.jquery){g=e([]).add(m)}else{g=m;return false}}else{if(!!m&&!!m.jquery){g=g.add(m)}}});return g||this}else{return this}}}else{return this.each(function(){new c(this,j)})}};var a=0;e.browser.iphone=(navigator.userAgent.toLowerCase().indexOf("iphone")>-1);var c=function(n,i){var s=this,h=e(n),t=++a,k=false,u={},o={dragging:false,clicked:null},w={position:null,offset:null,time:null},i=e.extend({},f,i,(!!e.metadata?h.metadata():{})),y=(i.labelOn==b&&i.labelOff==d),z=":checkbox, :radio";if(!h.is(z)){return h.find(z).iButton(i)}else{if(e.data(h[0],"iButton")){return}}e.data(h[0],"iButton",s);if(i.resizeHandle=="auto"){i.resizeHandle=!y}if(i.resizeContainer=="auto"){i.resizeContainer=!y}this.toggle=function(B){var A=(arguments.length>0)?B:!h[0].checked;h.attr("checked",A).trigger("change")};this.disable=function(B){var A=(arguments.length>0)?B:!k;k=A;h.attr("disabled",A);v[A?"addClass":"removeClass"](i.classDisabled);if(e.isFunction(i.disable)){i.disable.apply(s,[k,h,i])}};this.repaint=function(){x()};this.destroy=function(){e([h[0],v[0]]).unbind(".iButton");e(document).unbind(".iButton_"+t);v.after(h).remove();e.data(h[0],"iButton",null);if(e.isFunction(i.destroy)){i.destroy.apply(s,[h,i])}};h.wrap('