function iotbs() { switcher = new switchManager();
var screenSwitcher = new bodySwitcher('screen-switcher', '');
screenSwitcher.defineClass('default', 'Normal');
screenSwitcher.defineClass('medium', 'Medium');
screenSwitcher.defineClass('high', 'High');
};
var switcher;
if(typeof window.addEventListener != 'undefined')
{
	window.addEventListener('load', iotbs, false);
}
else if(typeof document.addEventListener != 'undefined')
{
	document.addEventListener('load', iotbs, false);
}
else if(typeof window.attachEvent != 'undefined')
{
	window.attachEvent('onload', iotbs);
}
function switchManager()
{
	this.string  = '';
	this.body = document.getElementsByTagName('body')[0];
	this.initial = this.body.className;
	if(this.initial == '')
	{
		this.initial = 'itobs';
	}
	this.cookie = this.read();
	if(this.cookie != null)
	{
		this.string = this.cookie;
		this.body.className = this.initial + this.string;
	}
};
switchManager.prototype.set = function(days)
{
	this.date = new Date();
	this.date.setTime(this.date.getTime() + ( days *24*60*60*1000));
		this.info = this.string.replace(/ /g,'#');
		if(this.info == '') { this.date.setTime(0); }
		document.cookie = 'bodySwitcher=' + this.info
		+ '; expires=' + this.date.toGMTString() 
		+ '; path=/';
};
switchManager.prototype.read = function()
{
	this.cookie = null;
		if(document.cookie)
	{
		if(document.cookie.indexOf('bodySwitcher')!=-1)
		{
			this.cookie = document.cookie.split('bodySwitcher=');
			this.cookie = this.cookie[1].split(';');
			this.cookie = this.cookie[0].replace(/#/g,' ');
		}
	}
	return this.cookie;
};
function bodySwitcher(divid, label)
{
	this.classes = [];
	this.options = 0;
	this.attrs = { 'action' : '' };
	this.form = this.createElement('form', this.attrs);
	this.fieldset = this.createElement('fieldset');
	this.form.appendChild(this.fieldset);
	this.attrs = { 'for' : 'select-' + divid };
	this.label = this.createElement('label', this.attrs);
	this.fieldset.appendChild(this.label);
	this.attrs = { 'text' : label };
	this.span = this.createElement('span', this.attrs);
	this.label.appendChild(this.span);
	this.attrs = { 'id' : 'select-' + divid };
	this.select = this.createElement('select', this.attrs);
	this.label.appendChild(this.select);
	var self = this;
	this.select.onchange = function()
	{
		this.classLen = self.classes.length;
		for(var i=0; i < this.classLen; i++)
		{
			switcher.string = switcher.string.replace(' ' + self.classes[i] + ' ','');
		}
		this.chosen = this.options[this.options.selectedIndex].value;
		if(this.chosen != 'default')
		{
			switcher.string += ' ' + this.chosen + ' ';	
		}
		switcher.body.className = switcher.initial + switcher.string;
		switcher.set(365)
	};
};
bodySwitcher.prototype.defineClass = function(key, val)
{
	this.attrs = { 'value' : key, 'text' : val }; 
	this.option = this.createElement('option', this.attrs);
	this.select.appendChild(this.option);
	if(switcher.cookie != null)
	{
		if(switcher.cookie.indexOf(' ' + key + ' ')!=-1)
		{
			this.select.selectedIndex = this.options;
		}
	}
	this.classes[this.options] = key;
	this.options ++;
};
bodySwitcher.prototype.createElement = function(tag, attrs)
{
	this.ele = (typeof document.createElementNS != 'undefined') ? document.createElementNS('http://www.w3.org/1999/xhtml',tag) : document.createElement(tag);
	if(typeof attrs != 'undefined')
	{
		for(var i in attrs)
		{
			switch(i)
			{
				case 'text' :
					this.ele.appendChild(document.createTextNode(attrs[i]));
					break;
				case 'class' : 
					this.ele.className = attrs[i];
					break;
				case 'for' : 
					this.ele.setAttribute('htmlFor',attrs[i]);
					break;
				default : 
					this.ele.setAttribute(i,'');
					this.ele[i] = attrs[i];
					break;
			}
		}
	}
	return this.ele;
};