function textSize() {
	document.write('<form action=\"\" title=\"Change Text Size\" id=\"tab\"><p class=\"textsize\"><input type=\"image\" src=\"textlarger.gif\" name=\"largertext\" title=\"Larger Text\" class=\"top\" onclick=\"javascript:fontsizeup();\" id=\"largertext\" /><input type=\"image\" src=\"textsmaller.gif\" name=\"Smaller Text\" title=\"Smaller Text\"  onclick=\"javascript:fontsizedown();\" id=\"smallertext\" />');
	document.write('<input type=\"image\" src=\"pdaicon.gif\" title=\"Display in PDA Format\" name=\"pda\" id=\"pda\" border=\"0\" onclick=\"javascript:pda_on();" /><input type=\"image\" src=\"pcicon.gif\" title=\"Display in normal PC Screen Format\" name=\"nopda\" id=\"nopda\" border=\"0\" onclick=\"javascript:pda_off();\" /></p></form>');
	if(getActiveStyleSheet()=='xpda'){
	document.getElementById('nopda').style.display='inline';
	 }
	if(getActiveStyleSheet()!='xpda'){
	document.getElementById('pda').style.display='inline';
	 }
	if(getActiveStyleSheet()=='A-'){
	document.getElementById('smallertext').src='textsmallergrey.gif';
	 }
	if(getActiveStyleSheet()=='A+++'){
	document.getElementById('largertext').src='textlargergrey.gif';
	 }
	 }

function pda_on() {
if(WM_acceptsCookies==false){alert('You will need to enable cookies to use the text-size changer');}
setActiveStyleSheet('xpda');
}
function pda_off() {
if(WM_acceptsCookies==false){alert('You will need to enable cookies to use the text-size changer');}
setActiveStyleSheet('A');
}


function fontsizeup() {
if(WM_acceptsCookies==false){alert('You will need to enable cookies to use the text-size changer');}
  active = getActiveStyleSheet();
  switch (active) {
    case 'A-' : 
      setActiveStyleSheet('A');
      break;
    case 'A' : 
      setActiveStyleSheet('A+');
      break;
    case 'A+' : 
      setActiveStyleSheet('A++');
      break;
    case 'A++' :
      setActiveStyleSheet('A+++');
      break;
    case 'A+++' :
      break;
    default :
      setActiveStyleSheet('A');
      break;
  }
}

function fontsizedown() {
if(WM_acceptsCookies==false){alert('You will need to enable cookies to use the text-size changer');}
  active = getActiveStyleSheet();
  switch (active) {
    case 'A+++' : 
      setActiveStyleSheet('A++');
      break;
    case 'A++' : 
      setActiveStyleSheet('A+');
      break;
    case 'A+' : 
      setActiveStyleSheet('A');
      break;
    case 'A' : 
      setActiveStyleSheet('A-');
      break;
    case 'A-' : 
      break;
    default :
      setActiveStyleSheet('A-');
      break;
  }
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  return ('A');
}

window.onload = function(e) {
  var cookie = WM_readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  WM_setCookie("style", title, 365);
}

var cookie = WM_readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if (title == 'null') {
  title = getPreferredStyleSheet();
}

setActiveStyleSheet(title);

///////////////////////// fade.js //////////////////////////
var over

///////////////////////////////////////////////////////////////////////
// Developed from an original idea at brainerror.net, Communis 2004  //
///////////////////////////////////////////////////////////////////////
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart >= opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        	}
    	} else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++){
       	   	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
           	timer++;
			}
	    }
	}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	if (document.getElementById('ahem').style.display == 'none' && getActiveStyleSheet() != 'xpda') {
	    var object = document.getElementById(id).style;
	    object.opacity = (opacity / 100);
	    object.MozOpacity = (opacity / 100);
	    object.KhtmlOpacity = (opacity / 100);
	    object.filter = "alpha(opacity=" + opacity + ")";
	} 
}

function dy(id){
document.getElementById(id).style.display = 'none';
}

function instantClear(id) {
	if (document.getElementById('ahem').style.display == 'none' && getActiveStyleSheet() != 'xpda') {
		var object = document.getElementById(id).style;
		instantOpac(0,id)
		object.visibility = "hidden";
		object.display = "none";
	} 
}

function instantOpac(opac,id) {
	if (document.getElementById('ahem').style.display == 'none' && getActiveStyleSheet() != 'xpda') {
	    var object = document.getElementById(id).style;
	    object.opacity = opac;
	    object.MozOpacity = opac;
	    object.KhtmlOpacity = opac;
	    object.filter = "alpha(opacity=" + opac + ")";
	} 
}
	
/////////////////Site-Specific Code -- by Communis 2004////////////////////

/////////// menu calls ////////////
	
	function bye(theId) {
	if (over==0) {
		instantClear(theId);
		}
	}

	function byeAllNow() {
	  instantClear('co'); // top menus
	  instantClear('re');
	  instantClear('tr');
	  instantClear('si');
	  instantClear('ar');
	  instantClear('rs');

	  instantClear('co2'); // base menus
	  instantClear('re2');
	  instantClear('tr2');
	  instantClear('si2');
	  instantClear('ar2');
	  instantClear('rs2');
	  }

	function byeAll() {
	if (over==0) {
	byeAllNow();
		}
	}	

	function mOver(){
	over=1;
	}

	function mOut(){
	over=0;
    string="byeAll();";
    setTimeout(string,1400);
	}

	function subnav(theId,num) {
	if (document.getElementById('ahem').style.display == 'none' && getActiveStyleSheet() != 'xpda') {
	  if (num == null) num = 0.5;
    	byeAllNow();
		mOver()
		emstring = ' '+num+'em';
		changeOpac(0, theId);
		document.getElementById(theId).style.display="inline";		// remove from some screenreaders
		document.getElementById(theId).style.visibility="visible";	// remove from other screenreaders
		document.getElementById(theId).style.position='absolute';		// relative to parent element
		document.getElementById(theId).style.top='1.75em';				// move down
		document.getElementById(theId).style.left=emstring;
		opacity(theId,0,90,300);
		}
	}

//////////// menu writes //////////////
var a = 'onmouseover="mOver();" onmouseout="mOut();">';
var b = '</a></li><li title=""><a';
var c = '" class="sub"><li title=""><a';

function submenu(id,here) {
	if (document.getElementById('ahem').style.display == 'none' && getActiveStyleSheet() != 'xpda') {
		if (here == 1) {
			here = ' class="here"';
		}
		else {
			here = ' ';
		}
		if (id == 'co2' || id == 'co') {
			document.write('<ul title="Volunteer submenu" id="' + id + c + here + ' href="starting-an-acn-chapter.html" ' + a + 'Start An ACN Chapter' + b + here + ' href="the-acn-immersion-visit.html" ' + a + 'The ACN Immersion Visit' + b + here + ' href="consultancy.html#rewrites" ' + a + 'Template Rewrites' + b + here + ' href="consultancy.html#ongoing" ' + a + 'Ongoing Audits</a></li></ul>');
		}
		if (id == 're' || id == 're2') {
			document.write('<ul title="Research submenu" id="' + id + c + here + ' href="research.html#gis" ' + a + 'GIS Applications' + b + here + ' href="research.html#community" ' + a + 'Community Tools' + b + here + ' href="research.html#search" ' + a + 'Search Engine</a></li></ul>');
		}
	 	if (id == 'tr' || id == 'tr2') {
			document.write('<ul title="Volunteer submenu" id="' + id + c + here + ' href="training.html#general" ' + a + 'Start An ACN Chapter' + b + here + ' href="training.html#technical" ' + a + 'The ACN Immersion Visit</a></li></ul>');
		}
	 	if (id == 'si' || id == 'si2') {
			document.write('<ul title="Site Design submenu" id="' + id + c + here + ' href="sitedesign.html#rewrites" ' + a + 'Template Rewrites' + b + here + ' href="sitedesign.html#new" ' + a + 'New Sites' + b + here + ' href="sitedesign.html#examples" ' + a + 'Examples' + b + here + ' href="sitedesign.html#next" ' + a + 'What next?' + b + here + ' href="sitedesign.html#probono" ' + a + 'Pro Bono</a></li></ul>');
		}
	 	if (id == 'rs' || id == 'rs2') {
			document.write('<ul title="Resources submenu" id="' + id + c + here + ' href="resources.html#browser" ' + a + 'Browser Options' + b + here + ' href="resources.html#sites" ' + a + 'Web Sites' + b + here + ' href="resources.html#organisations" ' + a + 'Organisations' + b + here + ' href="resources.html#software" ' + a + 'Software</a></li></ul>');
		}
	}
}

function submenusep(id,here,subNum) {
	if (document.getElementById('ahem').style.display == 'none' && getActiveStyleSheet() != 'xpda') {
		if (here != 1) {
			subNum = 0;
			here = ' ';
		}
		else {
			here = ' class="here"';
			subNum = subNum;
		}
	 	if (id == 'ar' || id == 'ar2') {
			if (subNum == 1 || subNum == 0) {
				document.write('<ul title="Donate submenu" id="' + id + c + here + ' href="a-personal-appeal.html" ' + a + 'A Personal Appeal' + b + ' href="how-to-contribute.html" ' + a + 'How To Contribute</a></li></ul>');
			}
			if (subNum == 2) {
				document.write('<ul title="Donate submenu" id="' + id + c + here + ' href="a-personal-appeal.html" ' + a + 'A Personal Appeal' + b + ' href="how-to-contribute.html" ' + a + 'How To Contribute</a></li></ul>');
			}
			if (subNum == 3) {
				document.write('<ul title="Donate submenu" id="' + id + c + here + ' href="a-personal-appeal.html" ' + a + 'A Personal Appeal' + b + ' href="how-to-contribute.html" ' + a + 'How To Contribute</a></li></ul>');
			}
		}
	}
}

