function cssjs(a,o,c1,c2){
// cssjs
// written by Christian Heilmann (http://icant.co.uk)

switch (a){
case 'swap':
o.className=!cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
break;
case 'add':
if(!cssjs('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;}}

function change2display(what) { 
if (!document.getElementById) return;
for (var l=1; l<20; l++) {
var a = 'more'; 
var theid = a + l;
if (!document.getElementById(theid)){
if (what == 'none'){
for (var m=1; m<20; m++) {
var b = 'show'; 
var otherid = b + m;
if (!document.getElementById(otherid)) return; 
document.getElementById(otherid).style.display = 'block';}}
if (what == 'block'){
for (var m=1; m<20; m++){
var b = 'show'; 
var otherid = b + m;
if (!document.getElementById(otherid)) return; 
document.getElementById(otherid).style.display = 'none';}}}
document.getElementById(theid).style.display = what;}}

function jsenabled() {
for (var m=1; m<20; m++) {
var b = 'show';
var otherid = b + m;
if (!document.getElementById(otherid))
{for (var m=1; m<20; m++) {
var b = 'innershow';
var otherid = b + m;
if (!document.getElementById(otherid)) return; 
cssjs('swap',document.getElementById(otherid),'javascript','javascriptyes');}}
cssjs('swap',document.getElementById(otherid),'javascript','javascriptyes');}}

function display(ide) {
document.getElementById(ide).style.display = "block";}

function hide(ide) {
document.getElementById(ide).style.display = "none";}

function checkCSS() {
//This function tries to discover if CSS is enabled

//var el = document.body;
var el = document.getElementById('testspan');

// Change the above if you want to use another element to check the applied style. Always use one
// style that is not the default one!
// In this case I am testing a particular paragraph (id=testspan") display value
// that should be 'none' if CSS is enabled and the stylesheet loaded. 
// Paragraphs have usually a default value of 'block' for this property.
if (document.uniqueID && el.currentStyle) { // Internet Explorer
var checkappliedstyle = el.currentStyle.display; 
} else if(document.defaultView && document.defaultView.getComputedStyle){ // Mozilla
var checkappliedstyle = document.defaultView.getComputedStyle(el, '').getPropertyValue("display");
} else if (document.all) { // Opera
var checkappliedstyle = document.all("testspan").style.display;
}
if (checkappliedstyle == "none") {
var cssEnabled = 1; return true;} 
else {var cssEnabled = 0; return false;}
}

function createshowlink(text,ref,title,show,hide){
// Creates the 'Show hidden box' link. Follows generated HTML:
/*
<p id="showX" class="javascript">
<a href="#moreX" onclick="display('show');hide('showX')" title="title">text</a><
/p>
*/
// See below for an explanation on the integer X used above.
if (checkCSS()) {
document.write ('<a ');
document.write ('href="#' + ref +'" ' + 'title="' + title + '" ');
document.write('onclick="display(\''+ show +'\');hide(\''+ hide +'\')"');
document.write ('>');
document.write (text);
document.write ('</a>');


} else return;
}

function createinneroptions(innershow,ref,title,show,hide){
// Creates the 'Open...' and 'Close..' options. Follows generated HTML:
/*
<ul id="innershowX" class="javascript">
<li><a href="#more1" onclick="hide('hideX');display('showX')" title="title">title</a></li>
<li><a href="#more1" onclick="change2display('none')" title="Close all help boxes">Close all</a></li>
<li><a href="#more1" onclick="change2display('block')" title="Open all help boxes">Open all</a></li>
</ul>
*/
// See below for an explanation on the integer X used above.

if (checkCSS()) {
document.write('<ul id="' + innershow + '" class="javascript">');
document.write ('<li><a href="#' + ref +'" ' + 'title="' + title + '" ');
document.write('onclick="display(\''+ show +'\');hide(\''+ hide +'\')"');
document.write ('>');
document.write (title);
document.write ('</li></a>');
//document.write('<li><a href=#"'+ ref +'" onclick="change2display(\'none\')" title="Close all help boxes">Close all</a></li>');
//document.write('<li><a href=#"'+ ref +'" onclick="change2display(\'block\')" title="Open all help boxes">Open all</a></li>');
document.write('</ul>');
} else return;
}

function changeClass(element, newclass){
	element.className=newclass;
}

