                                                                                                                                                                                                                                                                                                                                        /* 

JavaScript Document

	:: NOTES ::
	
	Project: Burke Law
	Author: RR
	Description: This is the javascript used throughout the Burke Law site. It is currently using the JQuery Library version 1.2.6.
	Recent Modified Date: 06/01/09 
	Recent Notes:
		05/11/09 -- Creation of the JS File
*/

// News and publications fade animation

function slideSwitch() {
    try{
		var $active = $('#slideshow .active');

		if ( $active.length == 0 ) $active = $('#slideshow .slideShowContent:last');
	
		var $next =  $active.next().length ? $active.next()
			: $('#slideshow .slideShowContent:first');
	
	
		$active.animate({opacity: 0.0}, 2000, function(){
			$(this).removeClass('active').addClass('last-active');
		});
	
		$next.css({opacity: 0.0})
			.addClass('active').removeClass('last-active')
			.animate({opacity: 1.0}, 2000, function() {
				$active.animate({opacity: 0.0}, 2000).removeClass('active').addClass('last-active');
			});
	}catch(err){}
}

$(function(){
$('#slideshow .slideShowContent:first').addClass("active");
// run list of functions
setInterval( "slideSwitch()", 7000 );


	// Add Value for the Search textbox in navigation
	try{
		$("#ctl01_tbSearch").val("Search the Site").focus(function(){
			$(this).val("").css({"color":"#666","background":"#fff"});
		});
			
	}catch(err){}
		
	// Add Value for the Email Sign up textbox in footer
	try{
		$(".emailSignUpTextBox").val("Email Address").focus(function(){
			$(this).val("").css("color","#363434");
		});	
	}catch(err){}
	

	// Adds alt class to table row
	try{
		$(".attorneyList tr:odd").addClass("alt");
	}catch(err){}
	
	// Adds the Selected  states for main navigation
	
	try{
		var hiddenNav = $(".hiddenNav").attr("id");
		$("#menu ul li[rel="+hiddenNav+"]").addClass("selected");
	}
	catch(err){}
	
	// Search Results display if items are found
	
	/*$("#searchResults div ul").each(function(){
		if($("li", this).length > 0){
			$("li", this).parent().parent("div").show();
		}
	});*/
	
      // Replaces "," in Focus of Practice with a space and removes last ","

$('.fop').each(function(){
    var x = $(this).html(); 
    lastComma = x.lastIndexOf(",");
    x = x.substring(0, lastComma);
    $(this).html(x);
});

$('.linkList').each(function(){
    var x = $(this).html(); 
    var itemValue = x.toString();
    itemArr = itemValue.split(','); 
    $(this).html("");
    for(var i=0; i < itemArr.length; i++){
         var currentItem = ("<a href='/Practice+Areas/"+itemArr[i]+"'>"+itemArr[i]+"</a>, ");
         $(this).append(currentItem);
    }
    x = $(this).html(); 
    lastComma = x.lastIndexOf(",");
    x = x.substring(0, lastComma);
    $(this).html(x);
});


	// Removes right Margin from Featured Attorneys
	
	$("dl:eq(1), dl:eq(3), dl:eq(5), dl:eq(7)",".featuredAttorneys").addClass("noMargin");

	// Removes widows from Publication list

	var pubText ='';
	$('.pubList ul li a').each(function() {
		pubText = $(this).text().replace(/ (\w+)$/,'&nbsp;$1');
		$(this).html(pubText);
	});

	// Adding Fixed Positioning to Map on Scroll
	
	
	// $(window).scroll(function() {
	// 		
	// 		if($(window).scrollTop() > 0) {
	// 			var scroll_to = 137 - $(window).scrollTop();
	// 			if(scroll_to < 0) {
	// 				$('.map').addClass('fixed');
	// 				}
	// 				else {
	// 					$('.map').removeClass('fixed');
	// 					}
	// 			}
	// 			else {
	// 				$('.map').removeClass('fixed');
	// 			}
	// 	});



// Hides DIV if no result if found
/*$(".noSearchResults").each(function(){
    if($(this).text() == "No results found")
    $(this).parent().parent("div").hide();
});*/


// Hides Title on the right hand side of attorney's info if no content is found

$(".wysiwyg").each(function(){	
var alphaExp = new RegExp(/[A-Za-z0-9_]/); 
var txt = $(this).text();
if(alphaExp.test(txt) == false){
$(this).siblings("h3").hide();
}
});

});

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    