// JavaScript Document 
$(function(){ 

	$("ul.sf-menu").supersubs({ 
		minWidth:    12,   		// minimum width of sub-menus in em units 
		maxWidth:    27,   		// maximum width of sub-menus in em units 
		extraWidth:  1     		// extra width can ensure lines don't sometimes turn over 
						   		// due to slight rounding differences and font-family 
	}).superfish();  			// call supersubs first, then superfish, so that subs are 
					 			// not display:none when measuring. Call before initialising 
					 			// containing tabs for same reason. 
	$('#fader1').innerfade({ speed: 2000, timeout: 7000, type: 'sequence', containerheight: '350px' });
	$('#fader2').innerfade({ speed: 2000, timeout: 8500, type: 'sequence', containerheight: '350px' });
	$('.rounded').corners();  	// rounded corners. 
	
  // handle the directions search on homepage
  $('#frmDirections').submit(function(){
    
    if($('#saddr').val() == '')
    {
      alert('Please specify your address');
      $('#saddr').focus();
      return false;
    }
    
    if($('#daddr').val() == '')
    {
      alert('Please specify the surgery you wish to get directions to');
      $('#daddr').focus();
      return false;
    }
    
    window.open ('', 'drivingmap',"location=0,status=1,scrollbars=0,menubar=0,width=" + parseInt($(window).width() * 0.95) + ",height=" + parseInt($(window).height() * 0.95) + "");
    $(this).attr('target', 'drivingmap');
    
  });

}); 
 