/* counts character length in field of a form and compares to a maximum limit */  
function textCounter(field, countfield, maxlimit) 
		{
			if (field.value.length > maxlimit) // if too long...trim it!
				field.value = field.value.substring(0, maxlimit);
				// otherwise, update 'characters left' counter
			else 
				countfield.value = maxlimit - field.value.length;
		}

/* use to run a URL for forms in a popup window */    
function PopUp(strURL, strWindowName)
   	{
    	var nw = screen.width-80;
    	var nh = screen.height-80;     
     	PopUpWin=open(strURL,strWindowName, "status,resize,width=900,height=500,menubar=yes,location=yes,toolbar=yes,scrollbars,resizable");
 			//    
 			if (!PopUpWin)
      	window.location=strURL
      else 
      {
        PopUpWin.focus();
      }
 		}
 		
function confirmSubmit()
{
	var agree=confirm("Please confirm decision.");
	if (agree)
		return true;
	else
		return false;
}

function CreateChair_Form_Validator(theForm)
{
 
 if (theForm.Name.value.length < 1)
  {
    alert("Please enter a \"Name\".");
    theForm.Name.focus();
    return (false);
  }
if (theForm.ID.value.length < 4)
  {
    alert("Please enter at least 4 characters for your \"ID\".");
    theForm.ID.focus();
    return (false);
  }
  
 if (theForm.Password.value.length < 4)
  {
    alert("Please enter at least 4 characters for your \"Password\".");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Email.value.length < 3)
  {
    alert("Please enter an \"Email\" address.");
    theForm.Email.focus();
    return (false);
  }
 
return (true);
}

function EditChair_Form_Validator(theForm)
{
 
 if (theForm.Name.value.length < 1)
  {
    alert("Please enter a \"Name\".");
    theForm.Name.focus();
    return (false);
  }
  
 if (theForm.Password.value.length < 4)
  {
    alert("Please enter at least 4 characters for your \"Password\".");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Email.value.length < 3)
  {
    alert("Please enter an \"Email\" address.");
    theForm.Email.focus();
    return (false);
  }
 
return (true);
}

function Presenter_Form_Validator(theForm)
{
 
 if (theForm.Name.value.length < 1)
  {
    alert("Please enter a \"Name\".");
    theForm.Name.focus();
    return (false);
  }
  
   if (theForm.Email.value.length < 3)
  {
    alert("Please enter an \"Email\" address.");
    theForm.Email.focus();
    return (false);
  }
 
return (true);
}



function Session_Form_Validator(theForm)
{

 if (theForm.Title.value.length < 1)
  {
    alert("Please enter a \"Title\".");
    theForm.Title.focus();
    return (false);
  }
  
  return (true);
}

function Event_Form_Validator(theForm)
{

 if (theForm.StartDate.value.length < 7)
  {
    alert("Please enter a valid \"start date\".");
    theForm.StartDate.focus();
    return (false);
  }
  
  if (theForm.Title.value.length < 1)
  {
    alert("Please enter a \"Title\".");
    theForm.Title.focus();
    return (false);
  }
  return (true);
}


window.onload=show;
function show(id) 
{
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) 
	{
		if (document.getElementById('smenu'+i)) 
		{
			document.getElementById('smenu'+i).style.display='none';
		}
	}
	if (d) 
	{
		d.style.display='block';
	}
}

function close(id) 
{
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) 
	{
		if (document.getElementById('smenu'+i)) 
		{
			document.getElementById('smenu'+i).style.display='block';
		}
	}
	if (d) 
	{
		d.style.display='none';
	}
}
 


menu_status = new Array(); 
function showHide(id)
{
    if (document.getElementById) 
    {
    	var switch_id = document.getElementById(id);
      if(menu_status[id] != 'show') 
      {
      	switch_id.className = 'show';
      	menu_status[id] = 'show';
       }
       else
       {
          switch_id.className = 'hide';
          menu_status[id] = 'hide';
       }
    }
    
    
}

