      // Check whether string s is empty.
      function isEmpty(s)
      { return ((s == null) || (s.length == 0)) }

      /****************************************************************/

      function isWhitespace (s)
      {
           var i;
     var whitespace = " \t\n\r";

           // Is s empty?
           if (isEmpty(s)) return true;

           // Search through string's characters one by one
           // until we find a non-whitespace character.
           // When we do, return false; if we don't, return true.

           for (i = 0; i < s.length; i++)
           {
                // Check that current character isn't whitespace.
                var c = s.charAt(i);

                if (whitespace.indexOf(c) == -1) return false;
           }

           // All characters are whitespace.
           return true;
      }

      /****************************************************************/

      function ForceEntry(val, str) {
     var whitespace = " \t\n\r";
           var strInput = new String(val.value);

           if (isWhitespace(strInput)) {
                alert(str);
                return false;
           } else
                return true;

      }

      /****************************************************************/

      function ValidateRanking() {
     var whitespace = " \t\n\r";
           // This function ensures document.forms[0].nRanking.value >=1 && <= 10

           if (parseInt(document.forms[0].nRanking.value) >= 1 && parseInt(document.forms[0].nRanking.value) <=10)
                return true;
           else
                return false;
      }

      /****************************************************************/

      function ValidateData() {
     	   var whitespace = " \t\n\r";
           var CanSubmit = false;

           // Check to make sure that the full name field is not empty.
           //CanSubmit = ForceEntry(document.forms[0].txtName,"You supply a full name.");

           // Check to make sure ranking is between 1 and 10
           //if (CanSumbit) CanSubmit = ValidRanking();

	  if ((document.forms[0].cat.value) == "9999"){
	     //alert (document.forms[0].cat.value);
	     alert ("Please select a Job Category")
	     return CanSubmit = False;
          }
	  else
	     return CanSubmit = True;

	  //alert (document.forms[0].cat.value);

           //return CanSubmit;
      }

      /****************************************************************/

      function ValidateData_Sub() {
     	   var whitespace = " \t\n\r";
           var CanSubmit = false;

           // Check to make sure that the full name field is not empty.
           //CanSubmit = ForceEntry(document.forms[0].txtName,"You supply a full name.");

           // Check to make sure ranking is between 1 and 10
           //if (CanSumbit) CanSubmit = ValidRanking();

	  if (isEmpty(document.forms[0].firstname.value)) {
	     alert ("Please enter your first name.");
	     return False;
          }
	  else if (isEmpty(document.forms[0].lastname.value)) {
	     alert ("Please enter your last name.");
	     return False;
          }
	  else if (isEmpty(document.forms[0].email.value)) {
	     alert ("Please enter your email address.");
	     return False;
          }
	  else
	     document.forms[0].submit();
	     return True;

      }


      /****************************************************************/

      function ValidateRadarData() {
    	   var whitespace = " \t\n\r";
           var CanSubmit = false;


	  if (isEmpty(document.forms[0].firstname.value)) {
	     alert ("Please enter your first name.");
	     return  false;
          }
	  if (isEmpty(document.forms[0].lastname.value)) {
	     alert ("Please enter your last name.");
	     return false;
          }
	  if (isEmpty(document.forms[0].tel.value)) {
	     alert ("Please enter your contact number.");
	     return false;
          }
	  if (isEmpty(document.forms[0].email.value)) {
	     alert ("Please enter your email address.");
	     return false;
          }
	  if ( (document.forms[0].pwd1.value) != (document.forms(0).pwd2.value) ) {
	     alert ("Please retype your new password.");
	     return false;
          }
	  if ( (document.forms[0].pwd1.value) != "" ) {
	     alert ("You have changed your password.");
	     return true;
          }
	  if ((document.forms[0].cat.value) == "9999"){
	     alert ("Please select a desired category")
	     return false;
          };
	
	   return true;

      }

      /****************************************************************/

      function ValidateUserLogon() {
    	   var whitespace = " \t\n\r";
           var CanSubmit = false;


	  if (isEmpty(document.forms[0].logonid.value)) {
	     alert ("Please enter your logon ID.");
	     return  false;
          }
	  if (isEmpty(document.forms[0].password.value)) {
	     alert ("Please enter your password.");
	     return false;
          }
	
	   return true;

      }
      
      /****************************************************************/
	  // not checking
      function ValidateRadarData2() {
    	   var whitespace = " \t\n\r";
           var CanSubmit = false;


		
	   return true;

      }
        /****************************************************************/

      function ValidateRecommend(recommend) {
    	   var whitespace = " \t\n\r";
           var CanSubmit = false;


	  if (isEmpty(document.recommend.r_name.value)) {
	     alert ("Please enter your friend's name.");
	     return  false;
          }
	  if (isEmpty(document.recommend.r_email.value)) {
	     alert ("Please enter your friend's email address.");
	     return false;
          }
			// test if valid email address, must have @ and .
		var checkEmail2 = "@.";
		var checkStr2 = document.recommend.r_email.value;
		var EmailValid2 = false;
		var EmailAt2 = -1;
		var EmailPeriod2 = -1;
		for (i = 0;  i < checkStr2.length;  i++)
		{
			ch = checkStr2.charAt(i);
			if (ch == "@")
				EmailAt2 = i;
			if (ch == ".") 
				EmailPeriod2 = i;
		}
		// if both the @ and . were in the string
		if ((EmailAt2 > -1) && (EmailPeriod2 > -1) && (EmailAt2 < EmailPeriod2))	EmailValid2 = true;
	
		if (!EmailValid2)
		{
		alert("The \"r_email\" field must contain an \"@\" and a \".\".");
		return (false);
		}
	
	  if (isEmpty(document.recommend.r_phone.value)) {
		 if (isEmpty(document.recommend.r_mphone.value)) {
	     alert ("Please enter your friend's mobile number or home phone number.");
	     return false;
		}
          }
	if (isEmpty(document.recommend.s_name.value)) {
	     alert ("Please enter your name.");
	     return  false;
          }
	  if (isEmpty(document.recommend.s_email.value)) {
	     alert ("Please enter your email address.");
	     return false;
          }
		  
	// test if valid email address, must have @ and .
	var checkEmail = "@.";
	var checkStr = document.recommend.s_email.value;
	var EmailValid = false;
	var EmailAt = -1;
	var EmailPeriod = -1;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		if (ch == "@")
			EmailAt = i;
		if (ch == ".") 
			EmailPeriod = i;
	}
	// if both the @ and . were in the string
	if ((EmailAt > -1) && (EmailPeriod > -1) && (EmailAt < EmailPeriod))	EmailValid = true;

	if (!EmailValid)
	{
	alert("The \"s_email\" field must contain an \"@\" and a \".\".");
	return (false);
	}
		  
	   if (isEmpty(document.recommend.r_state.value)) {
	     alert ("In which state, your friend lives in.");
	     return false;
          }
		if (isEmpty(document.recommend.comment.value)) {
	     alert ("Please enter what your friend will be interested in.");
	     return false;
          }
		if (isEmpty(document.recommend.securityCode.value)) {
		alert ("Please enter the [verification code]");
		return (false);
	}
	   recommend.submit();

      }

//

      function ValidateSubmitcv(submitcv) {
    	   var whitespace = " \t\n\r";
           var CanSubmit = false;


	  if (isEmpty(document.submitcv.cv_name.value)) {
	     alert ("Please enter your name.");
	     return  false;
          }
	  if (isEmpty(document.submitcv.cv_email.value)) {
	     alert ("Please enter your email address.");
	     return false;
          }
			// test if valid email address, must have @ and .
		var checkEmail2 = "@.";
		var checkStr2 = document.submitcv.cv_email.value;
		var EmailValid2 = false;
		var EmailAt2 = -1;
		var EmailPeriod2 = -1;
		for (i = 0;  i < checkStr2.length;  i++)
		{
			ch = checkStr2.charAt(i);
			if (ch == "@")
				EmailAt2 = i;
			if (ch == ".") 
				EmailPeriod2 = i;
		}
		// if both the @ and . were in the string
		if ((EmailAt2 > -1) && (EmailPeriod2 > -1) && (EmailAt2 < EmailPeriod2))	EmailValid2 = true;
	
		if (!EmailValid2)
		{
		alert("The \"cv_email\" field must contain an \"@\" and a \".\".");
		return (false);
		}
	
	  if (isEmpty(document.submitcv.cv_phone.value)) {
		 if (isEmpty(document.submitcv.cv_mphone.value)) {
	     alert ("Please enter your mobile number or home phone number.");
	     return false;
		}
          }
	
	
		  
	   if (isEmpty(document.submitcv.cv_state.value)) {
	     alert ("In which state, you live.");
	     return false;
          }
		if (isEmpty(document.submitcv.attachment.value)) {
	     alert ("Please upload your CV.");
	     return false;
          }
		if (isEmpty(document.submitcv.cv_comment.value)) {
	     alert ("Please enter what you are interested in.");
	     return false;
          }
		if (isEmpty(document.submitcv.securityCode.value)) {
		alert ("Please enter the [verification code]");
		return (false);
	}
	   submitcv.submit();

      }


      function ValidateFriend(sendfriend) {
    	   var whitespace = " \t\n\r";
           var CanSubmit = false;


	  if (isEmpty(document.sendfriend.f_name.value)) {
	     alert ("Please enter your friend's name.");
	     return  false;
          }
	  if (isEmpty(document.sendfriend.f_email.value)) {
	     alert ("Please enter your friend's email address.");
	     return false;
          }
			// test if valid email address, must have @ and .
		var checkEmail2 = "@.";
		var checkStr2 = document.sendfriend.f_email.value;
		var EmailValid2 = false;
		var EmailAt2 = -1;
		var EmailPeriod2 = -1;
		for (i = 0;  i < checkStr2.length;  i++)
		{
			ch = checkStr2.charAt(i);
			if (ch == "@")
				EmailAt2 = i;
			if (ch == ".") 
				EmailPeriod2 = i;
		}
		// if both the @ and . were in the string
		if ((EmailAt2 > -1) && (EmailPeriod2 > -1) && (EmailAt2 < EmailPeriod2))	EmailValid2 = true;
	
		if (!EmailValid2)
		{
		alert("The \"f_email\" field must contain an \"@\" and a \".\".");
		return (false);
		}
	
	  if (isEmpty(document.sendfriend.y_name.value)) {
		 if (isEmpty(document.sendfriend.y_name.value)) {
	     alert ("Please enter your name.");
	     return false;
		}
          }
	
	  if (isEmpty(document.sendfriend.y_email.value)) {
		 if (isEmpty(document.sendfriend.y_email.value)) {
	     alert ("Please enter your email address.");
	     return false;
		}
          }

	if (isEmpty(document.sendfriend.securityCode.value)) {
		alert ("Please enter the [verification code]");
		return (false);
	}
	   sendfriend.submit();

      }

function showlayout(temp_url, temp_title){
		
						
		var tt = encodeURIComponent(temp_url);
		var tt_title = encodeURIComponent(temp_title); 
	
		var spth = "sendfriend.asp?u=" +  tt + "&t=" + tt_title;
		var whdl = window.open(spth, "share", "top=10, left=10, width=510, height=600, scrollbars=yes, resizable=yes, status=yes");
		whdl.focus();
}

