﻿function showHideOther(dropdownid, textboxdiv)
{
	var job =  document.getElementById(dropdownid);	
	var jobOtherDiv = document.getElementById(textboxdiv);
		
	if (job.options[job.selectedIndex].value == "5")
	{
		//ValidatorEnable(reqValidator, true);		
		jobOtherDiv.style.display = 'block';
	}
	else
	{
		//ValidatorEnable(reqValidator, false);
		jobOtherDiv.style.display = 'none';
	}
}

function showHideStateAsterix()
{
	stateAst = document.getElementById('stateAsterix');
	countrId = document.getElementById('CountryId');
	
	if (countrId.options[countrId.selectedIndex].value == "US")
	{
		stateAst.style.visibility = 'visible';
	}
	else
	{
		stateAst.style.visibility = 'hidden';
	}
}

function validateEmployeeReferral(first, last, email)
{
	empFirstName = document.getElementById(first).value;
	empLastName = document.getElementById(last).value;
	empEmail =  document.getElementById(email).value;

	if (empFirstName != "" || empLastName != "" || empEmail != "")
	{
		// if any of them are not empty then check to make sure that none of them are empty.
		if (empFirstName == "" || empLastName == "" || empEmail == "")
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	
	return true;
}

String.prototype.endsWith = function(str) 
{return (this.match(str+"$")==str)}

String.prototype.trim = function(){return 
(this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""))}

function checkUploadRadioButton(uploadRadio, resumeFileUpload)
{
	file = document.getElementById(resumeFileUpload);
	if (document.getElementById(uploadRadio).checked == true)
	{
		if (file.value == "")
		{
			return false;
		}
	}
	return true;
}

function checkUploadFileExtention(uploadRadio, resumeFileUpload)
{
	file = document.getElementById(resumeFileUpload);
	if (document.getElementById(uploadRadio).checked == true)
	{
		if (!file.value.endsWith("txt") && !file.value.endsWith("doc") && !file.value.endsWith("pdf") && !file.value.endsWith("rtf"))
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	return true;
}

function resumeTypeSelected(uploadRadio, copyAndPastRadioButton)
{
	if (document.getElementById(uploadRadio).checked == true || document.getElementById(copyAndPastRadioButton).checked == true)
	{
		return true;
	}
	return false;
}

function checkCopyAndPaste(copyAndPastRadioButton, copyAndPasteTextBox)
{
	if (document.getElementById(copyAndPastRadioButton).checked == true)
	{
		if (document.getElementById(copyAndPasteTextBox).value.trim() == "")
		{
			return false;
		}
	}
	return true; 
}