// JavaScript Document

function openPopup(url,name,h,w,opts){
	l = (screen.width - w) / 2;
	t = (screen.height - h) / 2;
	if (opts == '') {
		window.open(url,name,"top="+t+",left="+l+",height="+h+",width="+w);
	} else {
		window.open(url,name,"top="+t+",left="+l+",height="+h+",width="+w+","+opts);
	}
}

function switchClass(id,class1,class2){
	if (document.getElementById(id).className == class1){
		document.getElementById(id).className = class2;
	} else {
		document.getElementById(id).className = class1;
	}
}

function toggleApplicants(idx){
	switchClass('applicant'+idx,'applicant','applicant-selected');
	switchClass('applicantname'+idx,'applicantTab','applicantTab-selected');
}

function checkTimeSpan(){
	if (document.getElementById('timespan').value == 'more') {
		document.getElementById('timespandatepicker').style.display = '';
		displayDatePicker('timespandate', document.getElementById('timespan'), 'dmmmy', '-');
	} else {
		document.getElementById('timespandatepicker').style.display = 'none';
	}
}
function checkTimeSpan2(){
	if (document.getElementById('timespan2').value == 'more') {
		document.getElementById('timespandatepicker2').style.display = '';
		displayDatePicker('timespandate2', document.getElementById('timespan2'), 'dmmmy', '-');
	} else {
		document.getElementById('timespandatepicker2').style.display = 'none';
	}
}
function fTooltip(pText){
	var vOutStr = "";
	
	vOutStr = vOutStr + "<div class=\"tooltipHead\>Help</div>";
	vOutStr = vOutStr + "<div class=\"tooltipBody\">"+pText+"</div>";
	return vOutStr;
}
function fCheckRegCompany(){
	var bValid = true;
	if (document.getElementById('companyname').value == ''){
		bValid = false;
	}
	if (document.getElementById('companycontactperson').value == ''){
		bValid = false;
	}
	if (document.getElementById('companycontactpersonemail').value == ''){
		bValid = false;
	}
	if (document.getElementById('companyphone').value == ''){
		bValid = false;
	}
	if (document.getElementById('user_name').value == ''){
		bValid = false;
	}
	if (document.getElementById('pass_word').value == ''){
		bValid = false;
	}
	if (!document.getElementById('chkConfirm').checked){
		bValid = false;
	}
	if (bValid == false){
		alert('There are required fields that have no been entered. Please complete those fields before clicking send.');
		return false;
	}
	return true;
}
function fCheckRegUser(){
	var bValid = true;
	if (document.getElementById('firstname').value == ''){
		bValid = false;
	}
	if (document.getElementById('lastname').value == ''){
		bValid = false;
	}
	if (document.getElementById('email').value == ''){
		bValid = false;
	}
	if (document.getElementById('phone').value == ''){
		bValid = false;
	}
	if (document.getElementById('user_name').value == ''){
		bValid = false;
	}
	if (document.getElementById('pass_word').value == ''){
		bValid = false;
	}
	if (!document.getElementById('chkConfirm').checked){
		bValid = false;
	}
	if (bValid == false){
		alert('There are required fields that have no been entered. Please complete those fields before clicking send.');
		return false;
	}
	return true;
}
function fEditJob(nId){
	var sURL = 'index.cfm?p=editjob&id='+nId;
	document.location.href=sURL;
}
function fCheckJobFair(){
	var oFrm = document.getElementById("registerform");
	if (oFrm.txtCompanyName.value == '' || oFrm.txtAddress.value == '' || oFrm.txtCity.value == '' || oFrm.txtPostalCode.value == '' ||
		oFrm.txtContactPerson.value == '' || oFrm.txtTitle.value == '' || oFrm.txtPhone.value == '' || oFrm.txtFax.value == '' ||
		oFrm.txtEmail.value == '' || oFrm.txtWebsite.value == '' || oFrm.txtEmployees.value == '' || oFrm.txtPositions.value == ''){
		alert('Please fill in all required fields');
		return false
	}
	return true;
}
function clearFileInputField(tagId) {
	document.getElementById(tagId).innerHTML = document.getElementById(tagId).innerHTML; 
} 