// JavaScript Document
$(document).ready(function() {   
if(window.location.href.indexOf('thx=true') > 0) {
	alert('Thank you.\n A Bullhorn representative will contact you shortly.');
	redirUrl = '';
}
else (window.location.href.indexOf('?')>0)? redirUrl = '&thx=true' : redirUrl = '?thx=true';
$('#formRelocateURL').val(window.location.href + redirUrl);

$('#businesstypeother').focus(function(){
	$('#businesstypeother').attr('value','');
	$('#otherCheck').attr('checked',true);
});

$('#contactForm').submit(function(){
	
	var dataString = '';
	var errorCount = 0;
	var checkCount = 0;
	
	$('#formContent input').each(function(input){
		$(this).removeClass('error');
		if($.trim(this.value).length < 1 ){
			$(this).addClass('error');
			errorCount ++;
		}
		dataString += this.name + '=' + escape(this.value) + '&';
	}); 
	$('#formContent select').each(function(input){
		$(this).removeClass('error');
		if(this.value == 0 ){
			$(this).addClass('error');
			errorCount ++;
		}
	});
	$('.checkGroup .checkLabel').removeClass('error');
	if($('.checkGroup input:checked').length < 1) $('.checkGroup .checkLabel').addClass('error');

	if(errorCount == 0) return $.post("calltoactioncontact-submit.php",$("#contactForm").serialize(), function(data){return true;});
	else{
		alert('Highlighted fields are required');
		errorCount = 0;
		
	}
	return false;
});



});