// JavaScript Document

	function isemail(inputVal) 
	{
		var strValue = inputVal.toString();
		if (( strValue.indexOf("@") == -1 ) ||
	        ( strValue.indexOf(".") == -1 ) ||
		    ( strValue.indexOf(" ") != -1 ) || 
		    ( strValue.length < 6 ))
			return false;
		return true;
	}

function hidelayer(data) {
document.getElementById(data).style.display = "none";}
	
function showlayer(data) {document.getElementById(data).style.display = "";}

<!--
var tVar;

// check to see if there are any fields that do not meet the minimum requirements
function checkRequiredFields()
{ 
	var txtEmptyFields = "You're almost ready to begin using Vurv Express!\nPlease complete the following fields:\n";
	var tVar2 = 0;
	var tField = "";	
	
	function getFieldName( strFieldID )
	{
		switch ( strFieldID )
		{
			case "txtCompanyName":
				return "Company Name";
			case "cboCountry":
				return "Company Country";
			case "txtCompanyPhone":
				return "Company Phone";
			case "txtFTE":
				return "# of Employees";
			case "cboCompanyIndustryType":
				return "Industry";
			case "txtFirstName":
				return "Firstname";
			case "txtLastName":
				return "Lastname";
			case "txtContactEmail":
				return "E-mail";
			case "txtEmail2":
				return "E-mail validation";
			case "txtUserPassword":
				return "Password";
			case "txtUserPassword2":
				return "Password validation";
			case "txtContactPhone":
				return "Contact Phone Number";
			case "cboReferralSourceID":
				return "How did you hear about us?";
			
		}
	}
	
	// make sure the user has selected the either HR or Recruiter company type	

	function checkCompanyType()
	{
		if 	( 
				( document.getElementById( 'cboCompanyType1' ).checked )
				||
				( document.getElementById( 'cboCompanyType2' ).checked )	
			)
		{}
		else
		{
			tVar2++;
			txtEmptyFields = txtEmptyFields + tVar2 + ") Company Type\n";
		}
	}


	// make sure the user input has at least one alphanumeric character in the first two places
	function validateUserInput( strUserInput )
	{
	
	
	
		var Pattern = /\S/;
		var thisValue = document.getElementById( strUserInput ).value;
		
		
	if 
		( 
			( thisValue == "" ) 
			|| 
			( thisValue.match( Pattern ) == null ) 
		)
		{
			if ( tVar2 == 0  && tField == "")
			{
				tField = document.getElementById( strUserInput );
			}
			tVar2++;
			txtEmptyFields = txtEmptyFields + tVar2 + ") " + getFieldName( strUserInput ) + "\n";			
		}
	}


		
	function checkResults()
	{
		if ( tVar2 == 0 )
			return true;
		else
		{
			alert( txtEmptyFields );
			if ( tField != "" && tField != null )
				tField.select();
			return false;
		}
	}

	function finalValidation()
	{
		// if the e-mail values entered do not match, alert the user to the error
		if  
		(
			( document.companyaddupdate.txtContactEmail.value != document.companyaddupdate.txtEmail2.value )
		)
		{
			alert( "Your email was not properly verified" );
			return false;
		}

		if (isemail(document.companyaddupdate.txtContactEmail.value))	{
					return true;
					}
					
					else 
					
					{
						alert('You must enter a valid email address');	
						return false;
					}
		

			return true;
			

	}
	

	checkCompanyType();

		
	validateUserInput( 'txtFirstName' );
	validateUserInput( 'txtLastName' );
	validateUserInput( 'txtContactPhone' );
	validateUserInput( 'txtContactEmail' );
	

	validateUserInput( 'txtEmail2' );
	validateUserInput( 'txtCompanyName' );
	validateUserInput( 'cboCountry' );
	
	if (document.companyaddupdate.cboCompanyType1.checked == true)	{
	validateUserInput( 'txtFTE' );
	}

	validateUserInput( 'cboCompanyIndustryType' ); 
	validateUserInput( 'txtCompanyPhone' );

	validateUserInput( 'cboReferralSourceID' );
	if ( checkResults() )
		return finalValidation();	
	else
		return false;
}
//-->




// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function ValidatePhone(myPhone){
	
	if ((myPhone==null)||(myPhone=="")){
		alert('1');
		return false
	}
	if (checkInternationalPhone(myPhone)==false){
		alert('2');
		return false
	}
 }
 
function showFTE ()	{
	
	if(document.companyaddupdate.cboCompanyType1.checked || document.companyaddupdate.cboCompanyType1.value == 5)	{

		showlayer('div_FTE');
		}
		else
			{
		hidelayer('div_FTE');
		document.companyaddupdate.txtFTE.value = '';
		}
}	
