function openWin(url, width, height) {
	var win;
	var windowName;
	var params;
	windowName  = "buttons";
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=1,";
	params += "menubar=0,";
	params += "scrollbars=1,";
	params += "resizable=0,";
	params += "top=50,";
	params += "left=50,";
	params += "width="+width+",";
	params += "height="+height;
	win = window.open(url, windowName, params);
}

function openWin2(url, width, height) {
	var win;
	var windowName;
	var params;
	windowName  = "buttons";
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=1,";
	params += "resizable=1,";
	params += "top=50,";
	params += "left=50,";
	params += "width="+width+",";
	params += "height="+height;
	win = window.open(url, windowName, params);
}

function popSend(url, width, height, reqVars) {
	var win;
	var windowName;
	var params;
	windowName  = "buttons";
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=1,";
	params += "menubar=0,";
	params += "scrollbars=1,";
	params += "resizable=0,";
	params += "top=50,";
	params += "left=50,";
	params += "width="+width+",";
	params += "height="+height;
	win = window.open(url+"?"+reqVars, windowName, params);
}

function show_fund(onLayer,offLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var Layer = document.getElementsByTagName("DIV");
		for (var i = 0; i < Layer.length; i++){
			if (Layer[i].getAttribute('name') == "fund_detail"){
				Layer[i].style.display="none";
			}
		}
		var style2 = document.getElementById(onLayer).style;
		style2.display = style2.display=="block"?"none":"block";
	}
	else if (document.all)
	{
		//alert('document.all');
		// this is the way old msie versions work
		var style2 = document.all[onLayer].style;
		style2.display = style2.display=="block"?"none":"block";
	}
	else if (document.layers)
	{
		//alert('document.layers');
		// this is the way nn4 works
		var style2 = document.layers[onLayer].style;
		style2.display = style2.display=="block"?"none":"block";
	}
}


function show_bio(onLayer,offLayer)
{
	if (document.getElementById)
	{
		//alert('getElementById');
		// this is the way the standards work
		var Layer = document.getElementsByTagName("DIV");
		for (var i = 0; i < Layer.length; i++){
			if (Layer[i].getAttribute('name') == "bio_detail"){
				Layer[i].style.display="none";
			}
		}
		var style2 = document.getElementById(onLayer).style;
		style2.display = style2.display=="block"?"none":"block";
	}
	else if (document.all)
	{
		//alert('document.all');
		// this is the way old msie versions work
		var style2 = document.all[onLayer].style;
		style2.display = style2.display=="block"?"none":"block";
	}
	else if (document.layers)
	{
		//alert('document.layers');
		// this is the way nn4 works
		var style2 = document.layers[onLayer].style;
		style2.display = style2.display=="block"?"none":"block";
	}
}


//
// store functions
//



var selected;

function selectRowEffect(object, buttonSelect) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;

// one button is not an array
  if (document.checkout_address.shipping[0]) {
    document.checkout_address.shipping[buttonSelect].checked=true;
  } else {
    document.checkout_address.shipping.checked=true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}


function check_form_optional(form_name) {
  var form = form_name;

  var firstname = form.elements['firstname'].value;
  var lastname = form.elements['lastname'].value;
  var street_address = form.elements['street_address'].value;

  if (firstname == '' && lastname == '' && street_address == '') {
    return true;
  } else {
    return check_form(form_name);
  }
}

function echeck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false
	 }

	 return true					
}


function check_lecture1() {
  
  goCheckTickets();
  if(document.donation_form.checkTickets.value < 1){alert('You must choose a Ticket Qty');return false;} 
  if(document.donation_form.first_name.value == ''){alert('First Name is a required field');document.donation_form.first_name.focus();return false;}
  if(document.donation_form.last_name.value == ''){alert('Last Name is a required field');document.donation_form.last_name.focus();return false;}
  if(document.donation_form.address1.value == ''){alert('Address Line 1 is a required field');document.donation_form.address1.focus();return false;}
  if(document.donation_form.city.value == ''){alert('City is a required field');document.donation_form.city.focus();return false;}
  if(document.donation_form.state.value == ''){alert('State is a required field');document.donation_form.state.focus();return false;}
  if(document.donation_form.zip.value == ''){alert('Zip is a required field');document.donation_form.zip.focus();return false;}
  if(document.donation_form.day_phone_number.value.length < 7){alert('Daytime Phone must be at least 7 digits');document.donation_form.day_phone_number.focus();return false;}
  if(echeck(document.donation_form.email.value)==false){alert('Email Address is not in the correct format');document.donation_form.email.focus();return false;}
  if(document.donation_form.attendee_names.value == ''){alert('Attendees is a required field');document.donation_form.attendee_names.focus();return false;}
  
  return true;

}


function check_dinner1() {
  
  goCheckTickets();
  if(document.reservation_form.checkTickets.value < 1){alert('You must choose a Ticket or Donation (checkTickets='+document.reservation_form.checkTickets.value+')');return false;} 
  return true;

}

function check_dinner2() {

  var totSeats = 0;
  var tickets = (document.reservation_form.dinnerseats.value*1)
  totSeats += (document.reservation_form.entree_10061.value*1);
  totSeats += (document.reservation_form.entree_10062.value*1);
  totSeats += (document.reservation_form.entree_10063.value*1);
  if(document.reservation_form.entree_10090) {
  	totSeats += (document.reservation_form.entree_10090.value*1);
  }
  if(document.reservation_form.entree_10157) {
  	totSeats += (document.reservation_form.entree_10157.value*1);
  }
  if(totSeats != tickets){alert('You have '+ tickets +' dinner tickets, please choose a meal for each ticket.\n\nYou have chosen '+ totSeats +' meals');document.donation_form.entree_10061.focus();return false;}
  return true;

}

function check_dinner3() {

  if(document.reservation_form.cc_first_name.value == ''){alert('First Name is a required field');document.reservation_form.cc_first_name.focus();return false;}
  if(document.reservation_form.cc_last_name.value == ''){alert('Last Name is a required field');document.reservation_form.cc_last_name.focus();return false;}
  if(document.reservation_form.cc_address1.value == ''){alert('Address Line 1 is a required field');document.reservation_form.cc_address1.focus();return false;}
  if(document.reservation_form.cc_city.value == ''){alert('City is a required field');document.reservation_form.cc_city.focus();return false;}
  if(document.reservation_form.cc_state.value == ''){alert('State is a required field');document.reservation_form.cc_state.focus();return false;}
  if(document.reservation_form.cc_zip.value == ''){alert('Zip is a required field');document.reservation_form.cc_zip.focus();return false;}
  if(document.reservation_form.cc_day_phone_number.value.length < 7){alert('Daytime Phone must be at least 7 digits');document.reservation_form.cc_day_phone_number.focus();return false;}
  if(echeck(document.reservation_form.cc_email.value)==false){alert('Email Address is not in the correct format');document.reservation_form.cc_email.focus();return false;}
  
  return true;

}


function check_donation() {
  
  if(document.donation_form.first_name.value == document.donation_form.last_name.value){alert('First Name and Last Name match');document.donation_form.first_name.focus();return false;}
  if(document.donation_form.first_name.value == ''){alert('First Name is a required field');document.donation_form.first_name.focus();return false;}
  if(document.donation_form.last_name.value == ''){alert('Last Name is a required field');document.donation_form.last_name.focus();return false;}
  if(document.donation_form.address1.value == ''){alert('Address Line 1 is a required field');document.donation_form.address1.focus();return false;}
  if(document.donation_form.city.value == ''){alert('City is a required field');document.donation_form.city.focus();return false;}
  if(document.donation_form.state.value == ''){alert('State is a required field');document.donation_form.state.focus();return false;}
  if(document.donation_form.zip.value == ''){alert('Zip is a required field');document.donation_form.zip.focus();return false;}
  if(document.donation_form.day_phone_number.value.length < 7){alert('Daytime Phone must be at least 7 digits');document.donation_form.day_phone_number.focus();return false;}
  if(echeck(document.donation_form.email.value)==false){alert('Email Address is not in the correct format');document.donation_form.email.focus();return false;}
  if(document.donation_form.fund.value == ''){alert('Please choose a benefiting fund');document.donation_form.fund.focus();return false;}
  if(document.donation_form.donation_amount.value < 20){alert('The minimum donation amount is $20.00');document.donation_form.donation_amount.focus();return false;}

  return true;

}