/* ripped from http://www.onlinetools.org/articles/unobtrusivejavascript/cssjsseparation.html */
/*
	a
	    defines the action you want the function to perform.
	o
	    the object in question.
	c1
	    the name of the first class
	c2
	    the name of the second class

	Possible actions are:

	swap
	    replaces class c1 with class c2 in object o.
	add
	    adds class c1 to the object o.
	remove
	    removes class c1 from the object o.
	check
	    test if class c1 is already applied to object o and returns true or false
	toggle
	    test if class c1 is already applied to object o and remove if so, otherwise add class c1
*/
function jscss(a,o,c1,c2)
{
	switch (a)
	{
		case 'swap':
			o.className=!jscss('check',o,c1)?o.className.replace(c2,c1):
			o.className.replace(c1,c2);
			break;
		case 'add':
			if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1;}
			break;
		case 'remove':
			var rep=o.className.match(' '+c1)?' '+c1:c1;
			o.className=o.className.replace(rep,'');
			break;
		case 'check':
			return new RegExp('\\b'+c1+'\\b').test(o.className);
			break;
		case 'toggle':
			var operation = 'add';
			if(jscss('check',o,c1))
				operation = 'remove';

			jscss(operation,o,c1,c2);

			return operation;
			break;
	}
	return null;
	
	
	
};


function currentStyle(element, property)
{
	return parseInt(window.getComputedStyle ? window.getComputedStyle(element_m,'').getPropertyValue(property) : element.currentStyle.getAttribute(property));
};

