//Passes and validates values from 'get e-mail updates' field
$(window).load(function() {
	//Add onClick event that will gather user input from the text box and dropdown box and pass that into a the business card
	$('#jotc-form-id').submit(function(){
		var baseURL = '/talentcommunity/subscribe/?';
		var emailSegment = 'email='+$('#tc-form-q').val();
		var interestSegment = '&keywords='+$('#home-jotc-dropdown').val();
		
		var emailBox = $('#tc-form-q');
		var interestBox = $('#home-jotc-dropdown');
		
		if(interestBox.val()=='Select Job Category'){
			alert('Please Select Job Category.');
		}else if(emailBox.val()=='e-mail address') {
			alert('Please enter your e-mail address.');
		}else{
			//Set the document's location to our new URL, including the keyword
			document.location.href=baseURL+emailSegment+interestSegment;
		}
		
		//Do not return to the form's default action
		return false;
		
	});
	
});

//Passes values from 'job category' banner field
$(window).load(function() {
	//Add onClick event that will gather user input from the dropdown box
	$('#home-job-cat-id').submit(function(){		
		if($('#home-job-cat-dropdown').val()=='Select Job Category'){
			alert('Please Select Job Category.');
		}else{
			//Set the document's location to the dropdown value URL
			document.location.href=$('#home-job-cat-dropdown').val();
		}
		
		//Do not return to the form's default action
		return false;
		
	});
	
});
