// 
// 

function goBack() { window.history.back() }

// Preload pictures and function to display a picture at random
var possibilities = new Array(new Array('images/courtroom-session1.jpeg', 'Courtroom Session'), 
			      new Array('images/courtroom-session2.jpeg', 'Courtroom Session'), 
			      new Array('images/courtroom-session3.jpeg', 'Courtroom Session'), 
			      new Array('images/courtroom-session4.jpeg', 'Courtroom Session'), 
			      new Array('images/courtroom-session5.jpeg', 'Courtroom Session'), 
			      new Array('images/courtroom-session6.jpeg', 'Courtroom Session'),
			      new Array('images/board-meeting.jpeg', 'Board Meeting'));
var j=0, max = possibilities.length;
var preLoad = new Array()

for (i=0; i<max; i++) {
  preLoad[i] = new Image();
  preLoad[i].src = possibilities[i][0];
}

var num = Math.floor((Math.random() * max));

function showPix() {
  document.write('<img src="'+possibilities[num][0]+'" title="'+possibilities[num][1]+'" alt="'+possibilities[num][1]+'" />');
}

// Create the News message for the site
//
// function: shownews 
// 
function showNews() {
    var strtdate = "20110401";
    var stopdate = "20110726";
    var tooday;
    with (new Date) { 
        tooday = String((getFullYear() * 100 + getMonth() + 1) * 100 + getDate()); 
    }

    if (tooday >= strtdate && tooday <= stopdate) {
       var msg =  "<p id=\"daily-msg\">" +
                  "<em>Upcoming Events</em><br /><strong>Aftermath In the Wake of Murder</strong><br />" +
                  "A Guide for Survivors of Homicide Victims<br />" +
                  "Friday September 16, 2011 " +
                  "<strong><a href=\"aftermath-en.php\">Learn more...</a></strong><br />" +
                  "<strong>Para espanol <a href=\"aftermath-esp.php\">haga clique acqu&iacute;...</a></strong><br /><br />" +
                  "<strong>TAVA Speak Up &amp; Speak Out!</strong><br />" +
                  "CAFY's TAVA Youth Group " +
                  "<strong><a href=\"tava2011.php\">Learn more...</a></strong></p><br />" ;
    }
    else msg = "";
return(msg);
}


function checkBox1(email) {
    var str = email.value;
    if (str.length == 0) {
	alert("Please enter a valid email address (user@domain.com):");
	return false;
    }
    return true;
}

function checkBox2(name) {
    var str = name.value; 
    if(str.length == 0) {
	alert("Please fill in the required fields(*)"); 
	return false; 
    }
    return true; 
 }
 
function checkBox3(state) {
    var str = state.value; 
    if(str.length == 0) {
	alert("Please enter a valid state abbreviation");  
	return false; 
    }
    return true; 
}

    function checkForm(form) {
    if(checkBox1(form.email) && checkBox2(form.name) && checkBox3(form.state)) 
	return true; 
    return false;
}

