// clears and replaces text in form input fields and textareas
// -----------------------------------------------------------------
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}

// Add bookmark script
// -----------------------------------------------------------------
function addBookmark(title,url) {   
     if (window.sidebar) {   
          window.sidebar.addPanel(title, url,"");   
     } else if( document.all ) {   
          window.external.AddFavorite( url, title);   
     } else if( window.opera && window.print ) {   
          return true;   
     }   
}


function FormSubmit(frm) {		// validate form1
	if (document.form1.name.value=='Full Name') {
		alert('Please enter your name');
		document.form1.name.focus()
		return false;
	}
	// check to see if email address field is of valid syntax
	substremail = document.form1.email.value.split("@")
	if (substremail.length > 1)
	{
		index = substremail[1].indexOf(".")
		if (index == -1)
 		{
		alert("Please enter a valid e-mail address")
		document.form1.email.focus()
		return false
		}
	}
	else {
		alert("Please enter a valid e-mail address")
		document.form1.email.focus()
		return false
	}
	if (document.form1.phone.value=='Phone') {
		alert('Please enter phone number');
		document.form1.phone.focus()
		return false;
	}
//	document.form1.name.value = document.form1.fname.value + ' ' + document.form1.name.value
	return true;
} 	


$(document).ready(function() {
						   
$('.submitbutton').click(function() {												 
	// if ($('input([type=checkbox]').slice(0,3).is(':checked') == 'true') { alert('hi') } 
	if ($('#discForm input').eq(4).attr('checked')) { window.location.href = 'http://www.pensacola-lawyer.com/'; }
	else { if ($('#discForm input[type=checkbox]').eq(0).attr('checked') && $('#discForm input[type=checkbox]').eq(1).attr('checked') && $('#discForm input[type=checkbox]').eq(2).attr('checked') && $('#discForm input[type=checkbox]').eq(3).attr('checked')) { window.location.href = 'http://www.pensacola-lawyer.com/testimonials/'; } }
	return false;
	
});

});

$(function() {
  $('#divorce-button,#child-button').stop().fadeTo("fast", .9).mouseover(function() { $(this).stop().fadeTo('normal', 1) }).mouseout(function() { $(this).stop().fadeTo("fast", .9) }).mousedown(function() { $(this).css({backgroundPosition: '-286px 0px'}); }).mouseup(function() { $(this).css({backgroundPosition: '0px 0px'}); });
});
