$(document).ready(function() {
						   
	// BACK TO TOP
	$('a.backtotop').click(function(){
		 $('html, body').animate({scrollTop: '0px'}, 800);
		 return false;
	});
	
	//PRINT PAGE
	$('span.print').click(function(){
		if (window.print) { window.print(); } else { alert("Sorry, your browser doesn't support this feature."); }
		return false;
	});
	
	//ATTORNEY EXPAND/COLLAPSE AREAS
	$('.expand').hide(); // Hide containers
	$('.expand').prev('h2').prepend('<a href="#" class="toggle">Click to Expand</a>'); 
	$('.toggle').click(function(){
			$(this).parent().next('.expand').slideToggle(300); 

			if ( $(this).text() == 'Click to Collapse' ) {
				$(this).text('Click to Expand');
				$(this).removeClass('toggle2');
			} else {
				$(this).text('Click to Collapse');	
				$(this).addClass('toggle2');
			}

			return false; 
	});
	
	// GOOGLE MAP COLORBOX
	$(".googlemap").colorbox({ width:"77%", height:"77%", iframe:true, onLoad:function(){ $('#cboxClose').show(); } });

	//CONTACT FORM OVERLAY
	$('#contact-submit').colorbox({ inline:true, href:"#overlay", onLoad:function(){$('#cboxClose').hide();}  });
	$('#overlay a.cancel').click(function(){ $.colorbox.close(); return false; });
	$('#overlay a.agree').click(function(){ $('#contact-side form').submit(); });
	$('#overlay a.agree2').click(function(){ $('.section form').submit(); });
	$('#overlay a.agree-email').click(function(){ $.colorbox.close(); });
	
	//EMAIL LINKS
	$("a.email").colorbox({ 
		inline:true, 
		href:"#overlay", 
		onLoad:function(){
			$('#cboxClose').hide(); //remove corner (X)
			var mailto = $(this).attr('href');
			$('a.agree-email').attr('href', mailto); // Add email to HREF attribute on AGREE button
		}  
	});
	

	//.colorbox({ href:function(){ return "/includes/custom/disclaimer.php?email=" + $(this).attr('href'); } });
	
	
	/*
	// checkbox must be checked to submit form
	$(function() {
		$('#contact-submit').click(function(e) {
			var checked = $('#contact-side :checkbox:checked').length;
			if (checked == 0) {
				alert('Before this form can be sent, you must agree to the disclaimer.');
				e.preventDefault();
			} else {
				$('#contact-side form').submit();	
			}
		});
	});
	*/
	
});

$(window).load(function() {
	//ATTORNEY BIO SLIDER
	$('#slider br').remove(); //hide any BRs in the slider area
	$('#slider').nivoSlider({ directionNavHide:true, controlNav:false, directionNav:false, pauseTime:4300, effect:'sliceDown'  });
});
	

// CLEAR FORM TEXT
function focusTxt(field){
    if (field.defaultValue == field.value) field.value = '';
}
function blurTxt(field){
    if (field.value == '') field.value = field.defaultValue;
}



