// JavaScript Document
////////////////////////////////////////////////////////////////////////////////////////////
////////////////// this sections collapses parts of the page
////////////////////////////////////////////////////////////////////////////////////////////

 function togvis(item) {
      if(document.getElementById(item) != null){
		  if (document.getElementById(item).style.display == "block") {
			document.getElementById(item).style.display = "none";
			document.getElementById(item + "tog").innerHTML = " Expand <b>Directions</b> section [+]";
			document.getElementById(item + "tog").title = "Expand  Directions  section";
		  } else {
			document.getElementById(item).style.display = "block";
			document.getElementById(item + "tog").innerHTML = " Collapse <b>Directions</b> section [-]";
			document.getElementById(item + "tog").title = "Collapse Directions section";
		  }
	  }
	  
    }
 function posts(item) {
      if(document.getElementById(item) != null){
		  if (document.getElementById(item).style.display == "block") {
			document.getElementById(item).style.display = "none";
			document.getElementById(item + "tog").innerHTML = " Expand this post [+]";
			document.getElementById(item + "tog").title = "Expand  this post";
		  } else {
			document.getElementById(item).style.display = "block";
			document.getElementById(item + "tog").innerHTML = " Collapse this post [-]";
			document.getElementById(item + "tog").title = "Collapse this post";
		  }
	  }
	  
    }
//////////////////////////////////////////////////////////////////////////////////////////
////////////////// this section validates fields
//////////////////////////////////////////////////////////////////////////////////////////
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false}
else {return true}
}
}

function validate_neweventform(thisform)
{
with (thisform)
{
if (validate_required(txt_programname,"you need to give the event a title")==false)
  {txt_programname.focus();return false}
if (validate_required(txt_description,"describe this event a little.  A paragraph or two would be great! Let Dragos know if you need to put up any pictures.")==false)
  {txt_description.focus();return false}
if (validate_required(txt_registration,"we need the first day of event  (it helps list the date on the site)")==false)
  {txt_registration.focus();return false}
if (validate_required(txt_other1,"when is this happening?   (for example: Friday and Saturday, May 11-12, at 4 pm)  ")==false)
  {txt_other1.focus();return false}
if (validate_required(txt_other2,"where is this going to take place?  (for example: Ritchie Center - Hamilton Gymnasium)")==false)
  {txt_other2.focus();return false}
if (validate_required(txt_programdates,"no Post Start Date?   this tells the website when to first post your event ")==false)
  {txt_programdates.focus();return false}
if (validate_required(txt_costs,"no Post End Date?  this tells the website when to stop posting your event ")==false)
  {txt_costs.focus();return false}
if (validate_required(txt_prerequisites,"you should post this at least on one venue page")==false)
  {txt_prerequisites.focus();return false}
}
}

///expand collapse code


function hiddendesc(item) {
      if(document.getElementById(item) != null){
		  if (document.getElementById(item).style.display == "block") {
			document.getElementById(item).style.display = "none";
			document.getElementById(item + "tog").innerHTML = "Expand to read more [+]";
			document.getElementById(item + "tog").title = "Expand to read more ";
		  } else {
			document.getElementById(item).style.display = "block";
			document.getElementById(item + "tog").innerHTML = " Collapse this section of the headline  [-]";
			document.getElementById(item + "tog").title = "Collapse this section of the headline ";
		  }
	  }
	  
    }
	

//// end expand collapse code