
// used to toggle the display of the practice areas
function PracticeAreaToggle(id) {
	var obj = document.getElementById("pa_container"+ id);
	if (obj.style.display == "none" || obj.style.display == "") {
		$('#pa_container'+ id).show("fast", function() { UpdateSIFR(); });
	} else {
		$('#pa_container'+ id).hide("fast");
	}
}
function UpdateSIFR() {
	sIFR.replace(gillSansMT, {
	  selector: 'h3',
	  css: [
		'.sIFR-root { color: #004f76; font-size: 14px; letter-spacing: 0; font-weight:bold; }',		
		,'a { text-decoration: none; color: #004f76; line-height: 1em; }'
		,'a:link { color: #004f76; }'
		,'a:hover { color: #004f76; text-decoration:underline; }'
		,'a:visited { text-decoration:none; color:#FFFFFF; }'	  
		,'em { color:#004f76; font-style: normal; font-size:20px; }'	  	  
		],	
		wmode: 'transparent', selectable: true, tuneWidth: 20 
	});
}
// practice area search functions -- ajax
function PracticeAreaSearch() {
	var sQuery = $('#keywords').val();
	$('#pa_searchResults').html("<img src='images/loading.gif' border='0'/>");
	$.post('module_practiceSearchAJAX.aspx', { keywords: sQuery }, function(sData) { 
		$('#pa_searchResults').html(sData);
	});
	return false; // stops the page from processing the form
}
// attorney search functions -- ajax
function AttorneySearch(sortDir,sFilterLetter) {
	var iFirstName = $('#fName').val();
	var iLastName = $('#l_name').val();
	//var iOffice = $('#office').val();
	var iPractice = $('#practice').val();
	var iSchool = $('#school').val();
	$('#atty_searchResults').html("<img src='images/loading.gif' border='0'/>");
	$.post('module_attorneysAJAX.aspx', { f_name: iFirstName, l_name: iLastName, practice: iPractice, school: iSchool, sortDir: sortDir, l:sFilterLetter }, function(sData) { 
		$('#atty_searchResults').html(sData);
	});
	return false; // stops the page from processing the form
}
// career application stuff
function TogglePartTime() { 
	if ($('#part_time').attr("checked") == true) {
		$('#ca_partTimeHours').show("fast"); 
	} else {
		$('#ca_partTimeHours').hide("fast"); 
	}
}
function ToggleCitizen() {
	if ($('#citizen_no').attr("checked") == true) {
		$('#ca_citizenNo').show("fast");
	} else {
		$('#ca_citizenNo').hide("fast");
	}
}	
function ToggleCrime() {
	if ($('#crime_yes').attr("checked") == true) {
		$('#ca_crimeYes').show("fast");
	} else {
		$('#ca_crimeYes').hide("fast");
	}
}
function ToggleFamily() {
	if ($('#family_yes').attr("checked") == true) {
		$('#ca_familyYes').show("fast");
	} else {
		$('#ca_familyYes').hide("fast");
	}
}
function ToggleSelf() {
	if ($('#self_yes').attr("checked") == true) {
		$('#ca_selfYes').show("fast");
	} else {
		$('#ca_selfYes').hide("fast");
	}
}
function ToggleReferrer() {
	if ($('#referrer').attr("selectedIndex") == 7) {
		$('#ca_referrer').show("fast");
	} else {
		$('#ca_referrer').hide("fast");
	}
}
function ToggleTyping() {
	if ($('#typing').attr("checked") == true) {
		$('#ca_typing').show("fast");
	} else {
		$('#ca_typing').hide("fast");
	}
}
function ToggleShorthand() {
	if ($('#shorthand').attr("checked") == true) {
		$('#ca_shorthand').show("fast");
	} else {
		$('#ca_shorthand').hide("fast");
	}
}
function ToggleDischarged() {
	if ($('#discharged_yes').attr("checked") == true) {
		$('#ca_discharged').show("fast");
	} else {
		$('#ca_discharged').hide("fast");
	}
}
// form submit function
function SubmitApplication() {
	// data variables
	var fromEmail = $('#fromEmail').val();
	var name = $('#name').val();
	var date = $('#date').val();
	var phone1 = $('#phone1').val();
	var phone2 = $('#phone2').val();
	var street = $('#street').val();
	var city = $('#city').val();
	var state = $('#state').val();
	var zip = $('#zip').val();
	var position = $('#position :selected').text();
	if (position == "") {
		position = $('#position').val();
	}
	var dateAvail = $('#date_available').val();
	var salary = $('#salary').val();
	var fullTime = ($('#full_time').attr("checked") == true) ? 1 : 0;
	var partTime = ($('#part_time').attr("checked") == true) ? 1 : 0;
	var temp = ($('#temporary').attr("checked") == true) ? 1 : 0;
	var summer = ($('#summer').attr("checked") == true) ? 1 : 0;
	var partTimeAvailability = $('#availability').val();
	var essentialYes = ($('#essential_yes').attr("checked") == true) ? 1 : 0;
	var essentialNo = ($('#essential_no').attr("checked") == true) ? 1 : 0;
	var overtimeYes = ($('#overtime_yes').attr("checked") == true) ? 1 : 0;
	var overtimeNo = ($('#overtime_no').attr("checked") == true) ? 1 : 0;
	var citizenYes = ($('#citizen_yes').attr("checked") == true) ? 1 : 0;
	var citizenNo = ($('#citizen_no').attr("checked") == true) ? 1 : 0;
	var ageYes = ($('#18_yes').attr("checked") == true) ? 1 : 0;
	var ageNo = ($('#18_no').attr("checked") == true) ? 1 : 0;
	var crimeYes = ($('#crime_yes').attr("checked") == true) ? 1 : 0;
	var crimeNo = ($('#crime_no').attr("checked") == true) ? 1 : 0;
	var relativesYes = ($('#family_yes').attr("checked") == true) ? 1 : 0;
	var relativesNo = ($('#family_no').attr("checked") == true) ? 1 : 0;
	var selfYes = ($('#self_yes').attr("checked") == true) ? 1 : 0;
	var selfNo = ($('#self_no').attr("checked") == true) ? 1 : 0;
	var referred = $('#referrer').attr("selectedIndex");
	var referredOther = $('#referrer_other').val();
	var crimeReason = $('#crimeExplain').val();
	var visaType = $('#visa_type').val();
	var visaNum = $('#visa_number').val();
	var relativeName = $('#family_name').val();
	var relativeRelationship = $('#family_relationship').val();
	var prevEmployed = $('#self_when').val();
	var bName = $('#b_name').val();
	var bLoc = $('#b_location').val();
	var b_major = $('#b_major').val();
	var b_degree = $('#b_degree').val();
	var b_qpa = $('#b_qpa').val();
	var b_graduate_yes = ($('#b_graduate_yes').attr("checked") == true) ? 1 : 0;
	var b_graduate_no = ($('#b_graduate_no').attr("checked") == true) ? 1 : 0;
	var hsName = $('#hs_name').val();
	var hsLoc = $('#hs_location').val();
	var hs_major = $('#hs_major').val();
	var hs_degree = $('#hs_degree').val();
	var hs_qpa = $('#hs_qpa').val();
	var hs_graduate_yes = ($('#hs_graduate_yes').attr("checked") == true) ? 1 : 0;
	var hs_graduate_no = ($('#hs_graduate_no').attr("checked") == true) ? 1 : 0;
	var colName = $('#col_name').val();
	var colLoc = $('#col_location').val();
	var col_major = $('#col_major').val();
	var col_degree = $('#col_degree').val();
	var col_qpa = $('#col_qpa').val();
	var col_graduate_yes = ($('#col_graduate_yes').attr("checked") == true) ? 1 : 0;
	var col_graduate_no = ($('#col_graduate_no').attr("checked") == true) ? 1 : 0;
	var gradName = $('#grad_name').val();
	var gradLoc = $('#grad_location').val();
	var grad_major = $('#grad_major').val();
	var grad_degree = $('#grad_degree').val();
	var grad_qpa = $('#grad_qpa').val();
	var grad_graduate_yes = ($('#grad_graduate_yes').attr("checked") == true) ? 1 : 0;
	var grad_graduate_no = ($('#grad_graduate_no').attr("checked") == true) ? 1 : 0;
	var otherName = $('#other_name').val();
	var otherLoc = $('#other_location').val();
	var other_major = $('#other_major').val();
	var other_degree = $('#other_degree').val();
	var other_qpa = $('#other_qpa').val();
	var other_graduate_yes = ($('#other_graduate_yes').attr("checked") == true) ? 1 : 0;
	var other_graduate_no = ($('#other_graduate_no').attr("checked") == true) ? 1 : 0;
	var honors = $('#honors').val();
	var training = $('#training').val();
	var software = $('#software').val();
	var typing = ($('#typing').attr("checked") == true) ? 1 : 0;
	var typingWpm = $('#typing_wpm').val();
	var shorthand = ($('#shorthand').attr("checked") == true) ? 1 : 0;
	var shorthandWpm = $('#shorthand_wpm').val();
	var dictaphone = ($('#dictaphone').attr("checked") == true) ? 1 : 0;
	var switchboard = ($('#switchboard').attr("checked") == true) ? 1 : 0;
	var pc = ($('#pc').attr("checked") == true) ? 1 : 0;
	var windows = ($('#windows').attr("checked") == true) ? 1 : 0;
	var office = ($('#office').attr("checked") == true) ? 1 : 0;
	var word = ($('#word').attr("checked") == true) ? 1 : 0;
	var internet = ($('#internet').attr("checked") == true) ? 1 : 0;
	var sklemail = ($('#sklemail').attr("checked") == true) ? 1 : 0;
	var mailroom = ($('#mailroom').attr("checked") == true) ? 1 : 0;
	var calculator = ($('#calculator').attr("checked") == true) ? 1 : 0;
	var emp1 = $('#emp_name1').val();
	var empPhone1 = $('#emp_phone1').val();
	var empStreet1 = $('#emp_address1').val();
	var empCity1 = $('#emp_city1').val();
	var empState1 = $('#emp_state1').val();
	var empZip1 = $('#emp_zip1').val();
	var empsSalary1 = $('#emp_ssalary1').val();
	var empeSalary1 = $('#emp_esalary1').val();
	var empsDate1 = $('#emp_start_date1').val();
	var empeDate1 = $('#emp_end_date1').val();
	var empDuties1 = $('#emp_duties1').val();
	var empReason1 = $('#emp_reason1').val();
	var emp2 = $('#emp_name2').val();
	var empPhone2 = $('#emp_phone2').val();
	var empStreet2 = $('#emp_address2').val();
	var empCity2 = $('#emp_city2').val();
	var empState2 = $('#emp_state2').val();
	var empZip2 = $('#emp_zip2').val();
	var empsSalary2 = $('#emp_ssalary2').val();
	var empeSalary2 = $('#emp_esalary2').val();
	var empsDate2 = $('#emp_start_date2').val();
	var empeDate2 = $('#emp_end_date2').val();
	var empDuties2 = $('#emp_duties2').val();
	var empReason2 = $('#emp_reason2').val();
	var emp3 = $('#emp_name3').val();
	var empPhone3 = $('#emp_phone3').val();
	var empStreet3 = $('#emp_address3').val();
	var empCity3 = $('#emp_city3').val();
	var empState3 = $('#emp_state3').val();
	var empZip3 = $('#emp_zip3').val();
	var empsSalary3 = $('#emp_ssalary3').val();
	var empeSalary3 = $('#emp_esalary3').val();
	var empsDate3 = $('#emp_start_date3').val();
	var empeDate3 = $('#emp_end_date3').val();
	var empDuties3 = $('#emp_duties3').val();
	var empReason3 = $('#emp_reason3').val();
	var emp4 = $('#emp_name4').val();
	var empPhone4 = $('#emp_phone4').val();
	var empStreet4 = $('#emp_address4').val();
	var empCity4 = $('#emp_city4').val();
	var empState4 = $('#emp_state4').val();
	var empZip4 = $('#emp_zip4').val();
	var empsSalary4 = $('#emp_ssalary4').val();
	var empeSalary4 = $('#emp_esalary4').val();
	var empsDate4 = $('#emp_start_date4').val();
	var empeDate4 = $('#emp_end_date4').val();
	var empDuties4 = $('#emp_duties4').val();
	var empReason4 = $('#emp_reason4').val();
	var empReferenceYes = ($('#emp_contact_yes').attr("checked") == true) ? 1 : 0;
	var empReferenceNo = ($('#emp_contact_no').attr("checked") == true) ? 1 : 0;
	var empDischargedYes = ($('#discharged_yes').attr("checked") == true) ? 1 : 0;
	var empDischargedNo = ($('#discharged_no').attr("checked") == true) ? 1 : 0;
	var dischargedReason = $('#discharged_reason').val();
	if ($('#agreeToTerms').attr("checked") != true) {
		alert("You must agree to the application terms before proceeding.");
	} else {
		var errors = 0;
		// make sure the fields are filled in
		if (name.length == 0) errors++;
		if (fromEmail.length == 0) errors++;
		if (date.length == 0) errors++;
		if (phone1.length == 0) errors++;
		if (street.length == 0) errors++;
		if (city.length == 0) errors++;
		if (state.length == 0) errors++;
		if (zip.length == 0) errors++;
		if (position.length == 0) errors++;
		if (partTime == 1) {
			if (partTimeAvailability.length == 0) errors++;
		}
		if (errors == 0) {
			$('#ca_appResult').html("Please wait while your application is processed. <br/><img src='images/loading.gif' border='0'/>");
			$.post('module_careerApplicationAJAX.aspx', {fromEmail: fromEmail, name:name, date:date, phone1:phone1, phone2:phone2, street:street, city:city, state:state, zip:zip, position:position, dateAvailable:dateAvail, salary:salary, fullTime:fullTime, partTime:partTime, temp:temp, summer:summer, partTimeAvailability:partTimeAvailability, essentialYes:essentialYes, essentialNo:essentialNo, overtimeYes:overtimeYes, overtimeNo:overtimeNo, citizenYes:citizenYes, citizenNo:citizenNo, ageYes:ageYes, ageNo:ageNo, crimeYes:crimeYes, crimeNo:crimeNo, relativesYes:relativesYes, relativesNo:relativesNo, selfYes:selfYes, selfNo:selfNo, referred:referred, referredOther:referredOther, visaType:visaType, visaNum:visaNum, crimeReason:crimeReason, relativeName:relativeName, relativeRelationship:relativeRelationship, prevEmployed:prevEmployed, hsName:hsName, hsLoc:hsLoc, hsMajor:hs_major, hsDegree:hs_degree, hsQpa:hs_qpa, hsGraduateYes:hs_graduate_yes, hsGraduateNo:hs_graduate_no,busName:bName, busLoc:bLoc, busMajor:b_major, busDegree:b_degree, busQpa:b_qpa, busGraduateYes:b_graduate_yes, busGraduateNo:b_graduate_no,colName:colName, colLoc:colLoc, colMajor:col_major, colDegree:col_degree, colQpa:col_qpa, colGraduateYes:col_graduate_yes, colGraduateNo:col_graduate_no,gradName:gradName, gradLoc:gradLoc, gradMajor:grad_major, gradDegree:grad_degree, gradQpa:grad_qpa, gradGraduateYes:grad_graduate_yes, gradGraduateNo:grad_graduate_no,otherName:otherName, otherLoc:otherLoc, otherMajor:other_major, otherDegree:other_degree, otherQpa:other_qpa, otherGraduateYes:other_graduate_yes, otherGraduateNo:other_graduate_no,honors:honors,training:training,software:software,typing:typing,typingWpm:typingWpm,shorthand:shorthand,shorthandWpm:shorthandWpm,dictaphone:dictaphone,switchboard:switchboard,pc:pc,windows:windows,office:office,word:word,internet:internet,sklemail:sklemail,mailroom:mailroom,calculator:calculator,emp1:emp1,empPhone1:empPhone1,empStreet1:empStreet1,empCity1:empCity1,empState1:empState1,empZip1:empZip1,empsSalary1:empsSalary1,empeSalary1:empeSalary1,empsDate1:empsDate1,empeDate1:empeDate1,emp2:emp2,empPhone2:empPhone2,empStreet2:empStreet2,empCity2:empCity2,empState2:empState2,empZip2:empZip2,empsSalary2:empsSalary2,empeSalary2:empeSalary2,empsDate2:empsDate2,empeDate2:empeDate2,emp3:emp3,empPhone3:empPhone3,empStreet3:empStreet3,empCity3:empCity3,empState3:empState3,empZip3:empZip3,empsSalary3:empsSalary3,empeSalary3:empeSalary3,empsDate3:empsDate3,empeDate3:empeDate3,emp4:emp4,empPhone4:empPhone4,empStreet4:empStreet4,empCity4:empCity4,empState4:empState4,empZip4:empZip4,empsSalary4:empsSalary4,empeSalary4:empeSalary4,empsDate4:empsDate4,empeDate4:empeDate4,empDuties1:empDuties1,empDuties2:empDuties2,empDuties3:empDuties3,empDuties4:empDuties4,empReason1:empReason1,empReason2:empReason2,empReason3:empReason3,empReason4:empReason4,empReferenceYes:empReferenceYes,empReferenceNo:empReferenceNo,empDischargedYes:empDischargedYes,empDischargedNo:empDischargedNo,dischargedReason:dischargedReason}, function(sData) { 
				$('#ca_application').fadeOut("fast");
				$('#ca_appResult').html(sData);
			});
		} else {
			alert("All fields marked with (*) are required");
		}
	}
	return false; // stops the page from processing the form
}
