<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,77 +1,52 @@
 /*
-------------------------------------------------------------------------------
-switch:    version 1.2
-           &#8220;on the fly layout adjustment&#8221;
-           MIT License
-------------------------------------------------------------------------------
-Requires:  MooTools v1.2 (MIT License)
-------------------------------------------------------------------------------
+  switch 1.2.1 &#8220;on the fly&#8221; layout adjustment 
+  requires mootools v1.2 (MIT License)
 */
-function swClassy()
-{//swClassy removes any existing swhich class from &lt;body&gt;
-  var swBody = $$('body');
 
-  if (swBody.hasClass('xx-small') == 'true')
-    swBody.removeClass('xx-small');
-
-  if (swBody.hasClass('x-small') == 'true')
-    swBody.removeClass('x-small');
-
-  if (swBody.hasClass('small') == 'true')
-    swBody.removeClass('small');
-
-  if (swBody.hasClass('medium') == 'true')
-    swBody.removeClass('medium');
-
-  if (swBody.hasClass('large') == 'true')
-    swBody.removeClass('large');
-
-  if (swBody.hasClass('x-large') == 'true')
-    swBody.removeClass('x-large');
-
-  if (swBody.hasClass('xx-large') == 'true')
-    swBody.removeClass('xx-large');
-
-  if (swBody.hasClass('xxx-large') == 'true')
-    swBody.removeClass('xxx-large');
+var sw_std_sizes = new Hash ({
+  'xx-small': '584',
+  'x-small': '744',
+  'small': '968',
+  'medium': '1096',
+  'large': '1344',
+  'x-large': '1384',
+  'xx-large': '1544'
+});
+
+function sw_cssy() {
+  var sw_class = sw_std_sizes.getValues();
+  for(var i = sw_class.length - 1; i &gt;= 0; i--) {
+    if ($$('body').hasClass('xxx-large') == 'true') {
+      $$('body').removeClass('xxx-large');
+    }
+    else if ($$('body').hasClass(sw_std_sizes.keyOf(sw_class[i])) == 'true') {
+      $$('body').removeClass(sw_std_sizes.keyOf(sw_class[i]));
+    }
+  }
 };
 
 function swhich()
 {//swhich applies a size based class on &lt;body&gt;
-  swClassy();
-  var swBody = $$('body');
-  var swSize = window.getSize().x;
-  var swXXSmall = 584;
-  var swXSmall = 744;
-  var swSmall = 968;
-  var swMedium = 1096;
-  var swLarge = 1344;
-  var swXLarge = 1384;
-  var swXXLarge = 1544;
-  
-  if (swSize &lt;= swXXSmall)
-    swBody.addClass('xx-small');
-  
-  if (swSize &gt; swXXSmall &amp;&amp; swSize &lt;= swXSmall)
-    swBody.addClass('x-small');
-  
-  if (swSize &gt; swXSmall &amp;&amp; swSize &lt;= swSmall)
-    swBody.addClass('small');
-  
-  if (swSize &gt; swSmall &amp;&amp; swSize &lt;= swMedium)
-    swBody.addClass('medium');
-  
-  if (swSize &gt; swMedium &amp;&amp; swSize &lt;= swLarge)
-    swBody.addClass('large');
-  
-  if (swSize &gt; swLarge &amp;&amp; swSize &lt;= swXLarge)
-    swBody.addClass('x-large');
-  
-  if (swSize &gt; swXLarge &amp;&amp; swSize &lt;= swXXLarge)
-    swBody.addClass('xx-large');
-
-  if (swSize &gt; swXXLarge)
-    swBody.addClass('xxx-large');
+  sw_cssy();
+  var sw_width = String(window.getSize().x);
+  if (sw_std_sizes.keyOf(sw_width) !== null) {
+    $$('body').addClass(sw_std_sizes.keyOf(sw_width));
+  }
+  else {
+    var sw_width = Number(sw_width);
+    var sw_size = sw_std_sizes.getValues();
+    var i = 0;
+    while (i &lt; sw_size.length) {
+      var sw_comp = Number(sw_size[i]);
+      if (sw_width &gt; 1544) {
+        $$('body').addClass('xxx-large');
+      }
+      else if (sw_width &lt;= sw_comp) {
+        $$('body').addClass(sw_std_sizes.keyOf(sw_size[i])); var i = 9;
+      }
+      i++;
+    }
+  }
 };
 
 window.addEvent('domready', function() { swhich(); });</diff>
      <filename>switch.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7f599937ebd5bbaad877f33ea6d571ffcb01e7a6</id>
    </parent>
  </parents>
  <author>
    <name>johnmuhl</name>
    <email>git@johnmuhl.com</email>
  </author>
  <url>http://github.com/johnmuhl/switch/commit/0c4f46eaa728704f5569e327479bc4bc2b8398fd</url>
  <id>0c4f46eaa728704f5569e327479bc4bc2b8398fd</id>
  <committed-date>2008-06-29T13:11:02-07:00</committed-date>
  <authored-date>2008-06-29T13:11:02-07:00</authored-date>
  <message>hash crazy</message>
  <tree>5335d32d283fbaa18cc6e0c0e091baab0f8b73ca</tree>
  <committer>
    <name>johnmuhl</name>
    <email>git@johnmuhl.com</email>
  </committer>
</commit>
