/* Theme Switcher (IE5+Mac, IE5.5+Win, Moz)
 * by: Liorean <http://members.evolt.org/liorean/> <mailto:liorean@user.bip.net>
 * url: <http://members.evolt.org/liorean/themeswitch.js>
 * rel:
  *   syntax file - <http://members.evolt.org/liorean/themeswitch.txt>
 *   description - <http://members.evolt.org/liorean/themeswitch.html>
 *   tutorial - <http://members.evolt.org/liorean/themeswitch-t.html>
 *   stylesheet for tutorial - <http://members.evolt.org/liorean/explain.css>
 * 
 * Theme Switcher is dependent on Cookies Handler and Event Handler.
 * A version with named scripts baked in is available at <http://members.evolt.org/liorean/themeswitch-ce.js>
 * A package with all related files is available at <http://members.evolt.org/liorean/themeswitch.zip>
 */

var style={
  Set:function(t){for(var i in this.col)for(var j=0,f;(f=(j<this.col[i].length)?this.col[i][j]:null);j++)f.disabled=i!=t?true:false;},
  Get:function(){for(var i in this.col)if(!this.col[i][0].disabled)return i;return this.Pref()},
  Pref:function(){for(var i in this.col)if(!this.col[i][0].disabled)return i;return null},
  sum:function(){var s=document.styleSheets,i=0;for(var f;(f=(i<s.length)?s[i]:null);i++)switch(f.title){case '':break;default:switch(typeof this.col[f.title]){case 'object':this.col[f.title][this.col[f.title].length]=f;break;default:this.col[f.title]=[f]}}},
  onload:function(){style.sum();if(cookie.Sup()){var c=cookie.Get('style');style.Set(c||style.Pref())}},
  onunload:function(){if(cookie.Sup()){var s=style.Get();cookie.Set('style',s,356,'/')}},
  col:{}
};

event.Add(style.onload);
window.onunload=style.onunload;
