function RemoveBad(strTemp) { 
	strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-/g,""); 
return strTemp;
} 


function validateSP(){	
	if(document.sendpage.sName.value == ""){
		alert("Please enter your name to continue.");
		document.sendpage.sName.focus();
		return false;
	}
	if(document.sendpage.sEmail.value == ""){
		alert("Please enter your e-mail to continue.");
		document.sendpage.sEmail.focus();
		return false;
	}
	if(document.sendpage.email.value == ""){
		alert("Please enter the recipient's email address to continue.");
		document.sendpage.email.focus();
		return false;
	}
}

function checkResumeSub(){
	
	var resumeForm = document.frmSend;

	if(RemoveBad(resumeForm.fname.value) == ""){
		alert("Please enter your first name to continue.");
		resumeForm.fname.focus();
		return false;
	}
	if(RemoveBad(resumeForm.lname.value) == ""){
		alert("Please enter your last name to continue.");
		resumeForm.lname.focus();
		return false;
	}
	if(RemoveBad(resumeForm.phone.value) == ""){
		alert("Please enter your phone number to continue.");
		resumeForm.phone.focus();
		return false;
	}
	if(RemoveBad(resumeForm.email.value) == ""){
		alert("Please enter your email to continue.");
		resumeForm.email.focus();
		return false;
	}
    if (resumeForm.attach1.value == ""){
        alert("Please press the browse button and pick a file.")
		resumeForm.attach1.focus();
		return false;
	}

	var sAttachValue = resumeForm.attach1.value.toLowerCase();
	var sAttachValue2 = resumeForm.attach2.value.toLowerCase();
	if(sAttachValue.indexOf(".doc") == -1 && sAttachValue.indexOf(".pdf") == -1){
		alert("We only accept attachments with .doc and .pdf extensions.");
		return false;
    }
    //prevents the submission of files with a colon or semi colon 
    if (sAttachValue.indexOf(";") != -1 && sAttachValue.indexOf(":") != -1) {
        alert("For security reasons, we do not accept attachments with ; or : in the filename.");
        return false;
    }
        
	// skip over this field if its blank
	if(sAttachValue2 != ""){
		if(sAttachValue2.indexOf(".doc") == -1 && sAttachValue2.indexOf(".pdf") == -1){
			alert("We only accept attachments with .doc and .pdf extensions.");
			return false;
        }
        //prevents the submission of files with a colon or semi colon 
        if (sAttachValue2.indexOf(";") != -1 && sAttachValue2.indexOf(":") != -1) {
            alert("For security reasons, we do not accept attachments with ; or : in the filename.");
            return false;
        }
	}
}

function validateForm(){
	if(document.add.jobtitle.value == ""){
		alert("Please enter Job Title to continue.");
		document.add.jobtitle.focus();
		return false;
	}
	if(document.add.city.value == ""){
		alert("Please select a location to continue.");
		document.add.city.focus();
		return false;
	}
	if(document.add.jobdesc.value == ""){
		alert("Please enter the job dsecription to continue.");
		document.add.jobdesc.focus();
		return false;
	}
	if(document.add.qualifications.value == ""){
		alert("Please enter the qualifications to continue.");
		document.add.qualifications.focus();
		return false;
	}
	if(document.add.postingdate.value == ""){
		alert("Please enter the posting date to continue.");
		document.add.postingdate.focus();
		return false;
	}
	if(document.add.deadline.value == ""){
		alert("Please enter the application deadline to continue.");
		document.add.deadline.focus();
		return false;
	}
}
function pnSearch(){
	if(document.pn_search.pnum.value == "" || document.pn_search.pnum.value == "EBA-"){
		alert("Please enter posting number to continue your search.");
		document.pn_search.pnum.focus();
		return false;
	}
}
function kwSearch(){
	if(document.kw_search.group.value == "" && document.kw_search.city.value == "" && document.kw_search.keywords.value == ""){
		alert("Please select a group, location, or enter your keywords to continue your search.");
		document.kw_search.city.focus();
		return false;
	}
}
function submitResume(){
	window.open('submitresume.asp', 'resume', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=400, height=410')
	if(checkForBlocker('resume')==false){
		alert("Please disable your popup blocking software.");
	}
}
function editAdminComments(sID){
	window.open('admin_comments.asp?ID=' + sID, 'comments', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=400, height=180')
	if(checkForBlocker('comments')==false){
		alert("Please disable your popup blocking software.");
	}
}

function checkForBlocker(sWindow){
		if(!sWindow){
			return false
		}else{
			return true
		}
}
function openPreview(){
	window.open('preview.asp', 'preview', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=700, height=480')
	if(checkForBlocker('preview')==false){
		alert("Please disable your popup blocking software.");
	}
}
function openSendPage(sLink, pTitle){
	window.open('sendpage.asp?link=' + sLink + "&pt=" + pTitle , 'preview', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=520, height=420')
	if(checkForBlocker('preview')==false){
		alert("Please disable your popup blocking software.");
	}
}
function confirmDelete(ID,PN){
	if(confirm("This will delete the selected applicant and their corresponding attachments.\nPress OK to continue.")){
		self.location.href="deleteApplicant.asp?ID=" + ID + "&pn=" + PN;
	}
}
function openPresentation(){
	window.open('flash/arctic_soq.html', 'preview', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=798, height=558')
	if(checkForBlocker('preview')==false){
		alert("Please disable your popup blocking software.");
	}
}
function viewApplicant(ID){
	window.open("viewApplicant.asp?ID=" + ID, 'preview', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=450, height=258')
	if(checkForBlocker('preview')==false){
		alert("Please disable your popup blocking software.");
	}
}
function loadCityToText(){
	if(document.kw_search.city.options[document.kw_search.city.selectedIndex].text != "Choose a location...."){
		document.kw_search.citytext.value = document.kw_search.city.options[document.kw_search.city.selectedIndex].text;	
	}else{
		document.kw_search.citytext.value = "";	
	}
}