       return if not $.iphoneStyle.currentlyClicking
       event.preventDefault()
   
-      x: event.pageX || event.originalEvent.changedTouches[0].pageX
+      x = event.pageX || event.originalEvent.changedTouches[0].pageX
       $($.iphoneStyle.currentlyClicking).trigger 'iPhoneDragEnd', [x]
       
-    $.iphoneStyle.initComplete: true
+    $.iphoneStyle.initComplete = true
   
   this
   
-$.iphoneStyle.defaults: {
+$.iphoneStyle.defaults = {
   # Time spent during slide animation
   duration:          200
   

# Copyright Thomas Reynolds, licensed GPL & MIT

# Constructor
$.iphoneStyle: (elem, options) ->
  @elem = $(elem)
  
  # Import options into instance variables
  obj: this
  
  for key, value of options
    obj[key]: value

  # Initialize the control
  @wrapCheckboxWithDivs()

    $(el).attr("unselectable", "on")

# Automatically resize the handle or container
$.iphoneStyle::optionallyResize = (mode) -> 
  onLabelWidth  = @onLabel.width()
  offLabelWidth = @offLabel.width()
  newWidth      = if (onLabelWidth < offLabelWidth) then onLabelWidth else offLabelWidth

  if mode is "container"
    newWidth += @handle.width() + 15 
    @container.css width: newWidth
  else
    @handle.css width: newWidth

$.iphoneStyle::attachEvents = ->
  # A mousedown anywhere in the control will start tracking for dragging
  @container.bind 'mousedown touchstart', (event) =>
    event.preventDefault()
