// JavaScript Document

function iframebackground()
	{
	var bgcolor = "transparent";
	for (var i=0;i<frames.length;i++)
		{
		frames[i].document.body.style.backgroundColor=bgcolor;
		
		var divs = frames[i].document.getElementsByTagName('div');
		for (var j=0;j<divs.length;j++)
			{
			divs[j].style.backgroundColor=bgcolor;
			}
			
		}	
	}

function changecss(theClass,element,value)
	{
	//Custom JavaScript Functions by Shawn Olson
	//Copyright 2006-2008
	//http://www.shawnolson.net
	//If you copy any functions from this page into your scripts, you must provide credit to 
	//Shawn Olson & http://www.shawnolson.net//Last Updated on June 23, 2009
	//documentation for this script at
	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
var cssRules;
var added = false;

for (var S = 0; S < document.styleSheets.length; S++){

if (document.styleSheets[S]['rules']) {
cssRules = 'rules';
} else if (document.styleSheets[S]['cssRules']) {
cssRules = 'cssRules';
} else {
//no rules found... browser unknown
}

for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
if(document.styleSheets[S][cssRules][R].style[element]){
document.styleSheets[S][cssRules][R].style[element] = value;
added=true;
break;
}
}
}
if(!added){
if(document.styleSheets[S].insertRule){
document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
} else if (document.styleSheets[S].addRule) {
document.styleSheets[S].addRule(theClass,element+': '+value+';');
}
}
}
}

function changecss1(theClass,element,value)
	{
	//Custom JavaScript Functions by Shawn Olson
	//Copyright 2006-2008
	//http://www.shawnolson.net
	//If you copy any functions from this page into your scripts, you must provide credit to 
	//Shawn Olson & http://www.shawnolson.net//Last Updated on June 23, 2009
	//documentation for this script at
	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
	//Modified by Mark Paglin August 12, 2009: Added iframe loop (changes all class styles in all iframes).
	var cssRules;
	var added = false;
		
	for (var i=0;i<frames.length;i++)
		{
		for (var S = 0; S < frames[i].document.styleSheets.length; S++)
			{
			if (frames[i].document.styleSheets[S]['rules'])
				{
				cssRules = 'rules';
				}
			else if (frames[i].document.styleSheets[S]['cssRules'])
				{
				cssRules = 'cssRules';
				}
			else
				{
				//no rules found... browser unknown
				}
			
			for (var R = 0; R < frames[i].document.styleSheets[S][cssRules].length; R++)
				{
				if (frames[i].document.styleSheets[S][cssRules][R].selectorText == theClass)
					{
					if(frames[i].document.styleSheets[S][cssRules][R].style[element])
						{
						frames[i].document.styleSheets[S][cssRules][R].style[element] = value;
						added=true;
						break;
						}
					}
				}
			if (!added)
				{
				if(frames[i].document.styleSheets[S].insertRule)
					{
					frames[i].document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',frames[i].document.styleSheets[S][cssRules].length);
					}
				else if (frames[i].document.styleSheets[S].addRule)
					{
					frames[i].document.styleSheets[S].addRule(theClass,element+': '+value+';');
					}
				}
			}
		}
	}	

function changecss2(theClass,element,value)
	{
	//Custom JavaScript Functions by Shawn Olson
	//Copyright 2006-2008
	//http://www.shawnolson.net
	//If you copy any functions from this page into your scripts, you must provide credit to 
	//Shawn Olson & http://www.shawnolson.net//Last Updated on June 23, 2009
	//documentation for this script at
	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
	//Modified by Mark Paglin August 12, 2009: Added iframe variable.
var cssRules;
var added = false;
var iframe = frames["leftnavsrc"];

for (var S = 0; S < iframe.document.styleSheets.length; S++){

if (iframe.document.styleSheets[S]['rules']) {
cssRules = 'rules';
} else if (iframe.document.styleSheets[S]['cssRules']) {
cssRules = 'cssRules';
} else {
//no rules found... browser unknown
}

for (var R = 0; R < iframe.document.styleSheets[S][cssRules].length; R++) {
if (iframe.document.styleSheets[S][cssRules][R].selectorText == theClass) {
if(iframe.document.styleSheets[S][cssRules][R].style[element]){
iframe.document.styleSheets[S][cssRules][R].style[element] = value;
added=true;
break;
}
}
}
if(!added){
if(iframe.document.styleSheets[S].insertRule){
iframe.document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',iframe.document.styleSheets[S][cssRules].length);
} else if (iframe.document.styleSheets[S].addRule) {
iframe.document.styleSheets[S].addRule(theClass,element+': '+value+';');
}
}
}
}