var time = 3000;
var numofitems = 4;

//menu constructor
function menu(allitems,thisitem,startstate){ 
  callname= "gl"+thisitem;
  divname="subglobal"+thisitem;  
	this.numberofmenuitems = allitems;
	this.caller = document.getElementById(callname);
	this.thediv = document.getElementById(divname);
	if (this.thediv != null)
		this.thediv.style.visibility = startstate;
}
				 
//menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
	  var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.visibility="hidden";
	}
	theobj.thediv.style.visibility="visible";
}
				
function closesubnav(event){
  if ((event.clientY <170)||(event.clientY > 260)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
			shutdiv.style.visibility='hidden';
		}  
	}
}
// -->
//Mail page
function mailpage()
{
  mail_str = "mailto:?subject= makingthedifference.org: " + document.title;
  mail_str += "&body= I recommend this Web page -- " + document.title;
  mail_str += ". You should check it out at, " + location.href; 
  location.href = mail_str;
}
//-->


// Print Page 
function Clickheretoprint()
{ 
  var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
  disp_setting += "scrollbars=yes,width=650,height=600,left=100,top=25";
  var content_vlue = document.getElementById("content").innerHTML;

  var docprint=window.open("","",disp_setting);
  docprint.document.open();
  docprint.document.write('<html><head><title>Making The Difference: Print Page</title>');
  docprint.document.write('</head><body onLoad="self.print()">');
  docprint.document.write(content_vlue);
  docprint.document.write('</body></html>');
  docprint.document.close();
  docprint.focus();
}

//-->


/*
pullquote function by Roger Johansson, http://www.456bereastreet.com/
*/
var pullquote = {
	init : function() {
	// Check that the browser supports the methods used
		if (!document.getElementById || !document.createElement || !document.appendChild) return false;
		var oElement, oPullquote, oPullquoteP, oQuoteContent, i, j;
	// Find all span elements with a class name of pullquote
		var arrElements = document.getElementsByTagName('span');
		var oRegExp = new RegExp("(^|\\s)pullquote(\\s|$)");
		for (i=0; i<arrElements.length; i++) {
	// Save the current element
			oElement = arrElements[i];
			if (oRegExp.test(oElement.className)) {
	// Create the blockquote and p elements
				oPullquote = document.createElement('blockquote');
				oPullquote.className = oElement.className
				oPullquoteP = document.createElement('p');
	// Insert the pullquote text
				for(j=0;j<oElement.childNodes.length;j++) {
					oPullquoteP.appendChild(oElement.childNodes[j].cloneNode(true));
				}
				oPullquote.appendChild(oPullquoteP);
	// Insert the blockquote element before the span elements parent element
				oElement.parentNode.parentNode.insertBefore(oPullquote,oElement.parentNode);
			}
		}
	},
	// addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	addEvent : function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener( type, fn, false );
		else if (obj.attachEvent)
		{
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
			obj.attachEvent( "on"+type, obj[type+fn] );
		}
	}
};

pullquote.addEvent(window, 'load', function(){pullquote.init();});


/*table style script*/



// source: http://www.quirksmode.org/dom/getElementsByTagNames.html
function getElementsByTagNames(list,obj) {
	if (!obj) var obj = document;
	var tagNames = list.split(',');
	var resultArray = new Array();
	for (var i=0;i<tagNames.length;i++) {
		var tags = obj.getElementsByTagName(tagNames[i]);
		for (var j=0;j<tags.length;j++) {
			resultArray.push(tags[j]);
		}
	}
	var testNode = resultArray[0];
	if (!testNode) return [];
	if (testNode.sourceIndex) {
		resultArray.sort(function (a,b) {
				return a.sourceIndex - b.sourceIndex;
		});
	}
	else if (testNode.compareDocumentPosition) {
		resultArray.sort(function (a,b) {
				return 3 - (a.compareDocumentPosition(b) & 6);
		});
	}
	return resultArray;
}

/*
 * plaid
 *
 * A JavaScript class for dynamically striping HTML data tables.
 *
 * @author Aaron Collegeman <acollegeman@clutch-inc.com>
 * @version 1.0.0 2006/30/31
 *
 */

function plaid() {

	// some sensible row-color defaults
	var _evenRowColor = 'white';
	var _oddRowColor = '#eee';
	var _specialRowColor = 'black';
	var _reverseSpecialRowTextColor = true;
	var _specialColColor = 'black';
	var _reverseSpecialColTextColor = true;
	var _evenOverlapColor = '#bbb';
	var _oddOverlapColor = '#ddd';
	var _overlapOnClass = null;
	var _paintOverlap = false;

	/*
	 * Performs the formatting configured in this plaid object.
	 * @className Optional; only fix those tables with this class name
	 */
	this.stripe = function(className) {

		var allTables = getElementsByTagNames('table');

		for (var i=0; i<allTables.length; i++) {
			var table = allTables[i];

			if (className && table.className != className)
				continue;

			var tbody;

			for (var c=0; c<table.childNodes.length; c++)
				if (table.childNodes[c].nodeName.toLowerCase() == 'tbody')
					tbody = table.childNodes[c];

			var rowCount = 0;
			var overlapOnCol = new Array();
			for (var c=0; c<tbody.childNodes.length; c++) {

				if (tbody.childNodes[c].nodeName.toLowerCase() == 'tr') {
					var tr = tbody.childNodes[c];
					if (rowCount % 2 == 0)
						tr.style.backgroundColor = _evenRowColor;
					else
						tr.style.backgroundColor = _oddRowColor;

					if (_paintOverlap) {
						var colCount = 0;
						for (var col=0; col<tr.childNodes.length; col++) {
							var node = tr.childNodes[col];
							var nodeName = node.nodeName.toLowerCase();
							if (nodeName == 'th' || nodeName == 'td') {
								//if ((_overlapOnClass && (node.className == _overlapOnClass || overlapOnCol[col] == true)) || (!_overlapOnClass && colCount % 2 != 0)) {
								if ((_overlapOnClass && (node.className == _overlapOnClass || overlapOnCol[colCount])) || (!_overlapOnClass && colCount % 2 != 0)) {
									overlapOnCol[colCount] = true;
									if (rowCount % 2)
										node.style.backgroundColor = _evenOverlapColor;
									else
										node.style.backgroundColor = _oddOverlapColor;
								}
								colCount++;
							}
						}
					}

					rowCount++;
				}
			}
		}
	}

	this.setEvenRowColor = function(color) {
		_evenRowColor = color;
	}

	this.setOddRowColor = function(color) {
		_oddRowColor = color;
	}

	this.setSpecialRowColor = function(color) {
		_specialRowColor = color;
	}

	this.setReverseSpecialRowTextColor = function(color) {
		_reverseSpecialRowTextColor = color;
	}

	this.setSpecialColColor = function(color) {
		_specialColColor = color;
	}

	this.setReverseSpecialColTextColor = function(color) {
		_specialColTextColor = color;
	}

	this.setEvenOverlapColor = function(color) {
		_evenOverlapColor = color;
	}

	this.setOddOverlapColor = function(color) {
		_oddOverlapColor = color;
	}

	this.setOverlapOnClass = function(color) {
		_overlapOnClass = color;
		_paintOverlap = true;
	}

	this.setPaintOverlap = function(b) {
		_paintOverlap = b;
	}

}


