$(document).ready(function(){


	$("a[rel*=external]").attr('target','_blank');

	$('a.confirm').click(function() {
	    var answer = confirm("Are you sure you want to delete this item?")
	    if (answer){
	        return true;
	    } else {
	        return false;
	    };
	});

	// menus
	$('div#top-nav ul#primary').superfish({
			animation: {height:'show'},
			speed: 'slow',
			delay: 1200
	});
	
	$('div#top-nav ul#secondary li:last-child').css({'border' : 'none'});
	$('div#footer div#footer-nav ul li').prepend('&raquo; ');

	// transparent menus for decent browsers
	if(!$.browser.msie){
    	$('body#home div#top-nav ul#primary ul').css({'background' : 'rgba(193,0,34,.95)'});
	} else {
		$('div#main div.main-split:last-child').css({'background' : '#F7F7F7', 'margin-right' : '0'});
	}

	// fancybox
	$("a#viewlarge").fancybox({
		'frameWidth':  560,	
		'frameHeight': 340,
		'zoomSpeedIn': 50,
		'zoomSpeedOut':	50,
		'overlayColor': '#000',
		'overlayOpacity': .9,
		'enableEscapeButton': true
	});
	
	// innerfade
	$('div#ticker ul').innerfade({
		timeout : 8000
	});


	$('p#p-death-date span.jq-replace').replaceWith('<input type="text" name="death-date" id="death-date" />');
	$('p#p-grant-date span.jq-replace').replaceWith('<input type="text" name="grant-date" id="grant-date" />');
	$('#death-date, #grant-date').datepicker({dateFormat: 'dd/mm/yy'});
	
	$('div#main h3:first').css({'border' : 'none', 'padding-top' : '0'});
	


	// activate certain form elements according to
	// what user selects	
	$('p#p-legal-specify, p#p-specify').hide();
	$('#legal-yes').click(function () {
		if ( $(this).is(':checked') ) { 
			$('p#p-legal-specify').show();
		} else {
			$('p#p-legal-specify').hide();
		}
	});
	$('#legal-no').click(function () {
		if ( $(this).is(':checked') ) { 
			$('p#p-legal-specify').hide();
		} else {
			$('p#p-legal-specify').show();
		}
	});
	
	$('#hear').change(function () {
		var heard = $('#hear').val();
			if( (heard == 'Other Lawyer') || (heard == 'TV') ) {
				$('p#p-specify').show();
			} else {
				$('p#p-specify').hide();
			}
	});

});





