// #@(#)index.js	1.3 14:01:11,08/04/22 (yy/mm/dd)
function OpenMonitor(name)
{
	nname=navigator.userAgent;
	features = "toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,copyhistory=0,width=795,height=500,top=20,left=0,resizable=1";
	nversion=navigator.appVersion.substring(0,1);
	if ((nname.lastIndexOf("MSIE")==-1) || (nversion!=4))
	{
		myWindow = window.open(name,"my_jobsite_sub_window",features);
		myWindow.focus();
	}
	else // IE 4 (but not 3 or 5) throws a security exception
	{    // when focusing on a window on another domain
	     //
		myWindow = window.open(name,"my_jobsite_sub_window",features);
	}
}

function remove_dropdown_focus()
{
   // blur doesn't work properly on "select" objects in IE5
   document.create_form.email.focus();
   document.create_form.email.blur();
}

function change_url(sec_select)
{
   var code = sec_select.options[sec_select.selectedIndex].value;

   remove_dropdown_focus();

   if (code != "NONE")
   {
      var url = '/sectorpages/' + code + '.html';
      document.location = url;
   }
}

function valid_email(address)
{
  if (address.indexOf("@")  == -1 || address.indexOf(".") == -1)
  {
    alert("Email addresses must contain one @ symbol and at least one dot");
    return false;
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'0123456789_-.@";
  var checkStr = address;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);

    if (checkOK.indexOf(ch) == -1)
    {
      alert("Please enter only letter, digit and \"_-'.@\" characters in this email field.");
      return(false);
    }   
  }

  return(true);
}

function create_form_check(theform) {
  if (theform.email.value == "")
  {
    alert("Please enter a value for the Email Address field.");
    theform.email.focus();
    return (false);
  }

  if (!valid_email(theform.email.value))
  {
    theform.email.focus();
    return (false);
  }

 return true;
}           

function login_form_check(theform) {
  if (theform.email.value == "")
  {
    alert("Please enter a value for the Email Address field.");
    theform.email.focus();
    return (false);
  }

  if (!valid_email(theform.email.value))
  {
    theform.email.focus();
    return (false);
  }

  if (theform.password.value == "")
  {
    alert("Please enter a value for the Password field.");
    theform.password.focus();
    return (false);
  }
 return true;
}           

function cl_login_form_check(theform) {
  if (theform.agency_id.value == "")
  {
    alert("Please enter a value for the Client's ID field.");
    theform.agency_id.focus();
    return (false);
  }

  if (theform.agency_pwd.value == "")
  {
    alert("Please enter a value for the Password field.");
    theform.agency_pwd.focus();
    return (false);
  }
 return true;
}   
function formVooDooBoth(theForm,myField){
	if(myField.defaultValue==myField.value)
        {
 	 theForm.fp_skill_include.value='';
	 theForm.location_include.value='';
        }
}
function formVooDoo(myField){
        if(myField.defaultValue==myField.value)
        myField.value='';
}
function search_form_check(theForm){	
	if(theForm.fp_skill_include.defaultValue==theForm.fp_skill_include.value || theForm.location_include.defaultValue==theForm.location_include.value){
		alert("Please enter your search criteria to continue");
		return false;
	}
}
