$(document).ready(function(){
	$('.secondary #contact_form .hid').hide();
    $('.secondary #contact_form').click(function() {
    	$('.secondary #contact_form .hid').fadeIn();
    });
       		$('.secondary #contact_form textarea').focus(function() {
    		    if (this.value == this.defaultValue){ 
    		    	this.value = '';
				}
				if(this.value != this.defaultValue){
	    			this.select();
	    		}
    		});
    		$('.secondary #contact_form textarea').blur(function() {
    		    if ($.trim(this.value) == ''){
			    	this.value = (this.defaultValue ? this.defaultValue : '');
				}
    		});
	$('#contact_form #captcha input').focus(function() {
													 $('#captcha img').addClass('captcha-focus') });
	$('#contact_form #captcha input').blur(function() {
													 $('#captcha img').removeClass('captcha-focus') });

	$('#practice-areas ul ul').hover(
					function () {
									$(this).parent('li').addClass('active');
								 },
					function () {
									$(this).parent('li').removeClass('active');
								}
	);
	$('#site-nav .search span#search').live('click', function() {
								
													  $('#site-nav #box').fadeIn().focus();
													  $(this).replaceWith('<input type="submit" id="search"/>');
													 });
	$(' #site-nav .search, #site-nav #box ').blur(function() {
											$('#site-nav #box').fadeOut('fast');
											$('#site-nav .search input#search').replaceWith('<span id="search"></span>')
										});												 

	$('#representing div').hide();
	$('#representing').mouseenter(function() {
										$('#representing div').slideDown('slow');
										});
	
	
	$('#representing span').click(function() {
										$('#representing div').slideUp('fast');
										});
	$('.esp').click(function(){
								$('body').addClass('translated').translate( 'en', 'es', {toggle: true } );
								$.cookie('language','es',{ path: '/' })
							});
	var language = $.cookie('language');
	if (language == 'es') {
								$('body').addClass('translated').translate( 'en', 'es', { toggle: true } );
						  };

	$('.eng').click(function(){
								$('body').removeClass('translated').translate( 'en', { toggle:true });
								$.cookie('language', null ,{ path: '/' })
								}
					);
	var language = $.cookie('language');
	if (language == null ) {
								$('body').removeClass('translated').translate( 'en', { toggle:true });
						  };
	
	$('.js #disclaimer').hide();
	$('<div class="modal"></div>').appendTo('.js #disclaimer');
	$('#disclaimer-inner').append('<span id="accept">accept</span>');
	$('#accept').click(function() {
								$('#disclaimer').fadeOut('fast');
								$.cookie('disclaimer', 'accepted');
								});
	var disclaimer = $.cookie('disclaimer');
	if (disclaimer == null) {
		$('#disclaimer').delay(500).show();
	};
	$('a[href*=".pdf"]').click( function() {
										 window.open(this.href);
										 return false;
										 });
	$('a.external').click( function() {
										 window.open(this.href);
										 return false;
										 });

	$('#contact_form').validate();
	$('a[href|="http://www.burnetti.com/EE/index.php/resources/glossary"]').replaceWith('<a href="http://www.burnetti.com/EE/index.php/resources/glossary#content">Glossary of Legal Definitions &amp; Law Terms</a>')
	$('input[type|="radio"]').addClass('radio');
       
});


