function trySubmit(){ return ( failEmail( document.forms[0].email ) )}

function failEmail(vField){
   var checkString = vField.value ;
   var checkChar;
   var newstr = "";
   var posSpace = checkString.indexOf(" ");
   if( posSpace > -1 ) {
      alertBox (vField, "The email address you have entered contains a space.", "text");
      return (true);
    } 
   var posAt = checkString.indexOf("@");
   if (posAt < 0 ) {
      alertBox (vField, "The email address you have entered does not contain\n an @ symbol.", "text");
      return (true);
    } 
   var posDot = checkString.lastIndexOf(".");
    if ( posDot < posAt+4) {
      alertBox (vField, "The email address you have entered either does not contain\n a dot after the @ symbol or not at least three characters separation.", "text");
      return (true);
    }
   var posEnd = checkString.length;
    if ( posEnd < posDot+3) {
      alertBox (vField, "The email address you have entered does not contain\n at least two characters after the final dot.", "text");
      return (true);
    }
   for (var i = 0; i < posEnd; i++) {
      checkChar = checkString.substring(i, i + 1);
      if ((checkChar >= "A" && checkChar <= "Z") || (checkChar >= "a" && checkChar <= "z") || (checkChar == "@") || (checkChar == ".") || (checkChar == "_") || (checkChar == "-") || (checkChar >= "0" && checkChar <= "9")) {
         newstr += checkChar;
      } else {
         alertBox ( vField, checkChar + " Is not allowed.\n\nPlease use only the following non-alphanumeric characters:\n\ndot hyphen underscore @", "text" ); 
         return (true);
      }
      return (false);
   }
}

function alertBox (vField, vMessage, vType ) {
	if ( vMessage == "null" ) { return; }
	alert ("Field Contains Incorrect Value:\n\n" + vMessage )
	if ( vType == "radio" ) { return ; }
	if ( vType == "text" ) { 
		vField.focus(); 
		vField.select();
	} else {
		vField.focus() ; 
	}
	return ;
}

function mailWrite( user, textSubject, textShow ){
  var query = ( textSubject.length < 1 ) ? "" : "?subject=" + textSubject ;
  document.write( '<a href=\"mailto:' + user + '%40gerb'+ 'erg.com' + query + '\">');
  document.write( textShow + '</a>' );
}

function mailWrite( user, textSubject, textShow ){
  if( user == "information" ){user == "inform"}
  var query = ( textSubject.length < 1 ) ? "" : "?subject=" + textSubject ;
  document.write( '<a href=\"mailto:' + user + '%40CareerCounseling'+ 'NewYork.com' + query + '\" style=\"color:blue;\">');
  document.write( textShow + '</a>' );
}

function openWindow(pageToLoad, winName, width, height, center){
    xposition=0; yposition=0;
    args = "width=" + width + ","
    + "height=" + height + ","
    + "location=0,"
    + "menubar=0,"
    + "resizable=1,"
    + "scrollbars=1,"
    + "status=0,"
    + "toolbar=0,"
    window.open( pageToLoad,winName,args );
}
function statusSetter() {
  window.defaultStatus = "gerberg & co" ;
  window.status = window.defaultStatus ;
  var cS = ( screen.colorDepth === undefined) ? ( screen.pixelDepth ) : ( screen.colorDepth ) ;
}

function gifChange( gifName, gifID, statusText ){
  document.images[gifName].src=gifID;
  window.status=statusText;
  return true;
}

