$(document).ready(function() {
	// $(".contactForm input, .contactForm textarea").focus(function() {this.value='';});
	if(window.location.pathname == '/' || window.location.pathname == '/practice-areas/bankruptcy/'){ contactForm = '#mainContactForm'; } else { contactForm = '#sideContactForm'; }
	console.log(contactForm);
	
	$(contactForm+" input:nth-child(1)").focus(function() { if(this.value=='Name') {this.value='';} });
	$(contactForm+" input:nth-child(2)").focus(function() { if(this.value=='Phone') {this.value='';} });
	$(contactForm+" input:nth-child(3)").focus(function() { if(this.value=='Email') {this.value='';} });
	$(contactForm+" textarea").focus(function() { if(this.value=='Your Comments') {this.value='';} });
	
	$(contactForm+" input:nth-child(1)").blur(function() { if(this.value=='') {this.value='Name';} });
	$(contactForm+" input:nth-child(2)").blur(function() { if(this.value=='') {this.value='Phone';} });
	$(contactForm+" input:nth-child(3)").blur(function() { if(this.value=='') {this.value='Email';} });
});

function checkForm(){
	var regex = /\d/g; 
	var phone = $(contactForm+" input:nth-child(2)").val();
	if(!regex.test(phone)){
		alert('Please enter your phone number.');
	} else {
		$(contactForm).submit();
	}
}

