function cycleFaces() {
	img_captions = new Array();

//  captions: (link-url,image-path,caption)
//	img_captions[n] = Array('#','/images/someone.jpg','This is a caption');	

	img_captions[0] = Array('#','/stylesheets/images/card_trick.jpg','Students learn new ways of doing math');
	img_captions[1] = Array('#','/stylesheets/images/denver07.jpg','The Denver community enjoys a weekend hike');
	img_captions[2] = Array('#','/stylesheets/images/ace_marathon_2007.jpg','ACErs pose before running the 2007 Fort Worth marathon on behalf of their schools');
	img_captions[3] = Array('#','/stylesheets/images/joe_manning_with_student.jpg','Joe Manning helps a student solve a math problem');
	img_captions[4] = Array('#','/stylesheets/images/carolyn_and_katie_marathon_2007.jpg','Carolyn and Katie show off their medals after raising money for their ACE school');
	img_captions[5] = Array('#','/stylesheets/images/kelleher_with_student.jpg','Mike Kelleher works with a student in Los Angeles');


// DO NOT CHANGE ANYTHING BELOW
var num = img_captions.length;
	img_number  = Math.floor(Math.random()*(num));
	img_output = 
		'<a href="' + img_captions[img_number][0] + '"><img src="' + img_captions[img_number][1] + '" alt="' + img_captions[img_number][2] + '" border="0" /></a>' +
		'<p id=pic_caption>' + img_captions[img_number][2] + '</p>';
	document.write(img_output);

}


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function attachEventListener(target,eventType,functionRef,capture){
	if (typeof target.attachEvent != "undefined") {
		// IE
		var functionString=eventType+functionRef;
		target["e"+functionString]=functionRef;
		target[functionString]=function(event){
			if(typeof event=='undefined'){
				event=window.event;
			}
			target["e"+functionString](event);
		};
		target.attachEvent("on"+eventType,target[functionString]);
	} else if (typeof target.addEventListener != "undefined") {
		target.addEventListener(eventType,functionRef,capture);
	}
}

if (document.observe) {
    document.observe('dom:loaded', function(e) {
        if($('mailerform')) {
						new Validation('mailerform');
            data = $('mailerform').getElements().collect(function(i){ if(i.name.match(/^data/)) return i.name.replace(/data\[/, '').replace(/\]/, ''); }).compact().uniq();
            h = document.createElement("input");
            h.name = 'ordered_input_names';
            h.type = 'hidden';
            h.value = data;
            $('mailerform').appendChild(h);
        }
    });
}


