// Adds a class focus to input text when focused
function focusfix(selector, className) {
$(selector).focus(function() {
$(this).addClass(className);
});
// Removes class when focus is lost
$(selector).blur(function() {
$(this).removeClass(className);
});
}

jQuery(document).ready(function($) {
focusfix('input', 'focus');
});

jQuery(document).ready(function($) {
focusfix('textarea', 'focus');
});

// Filetype icons and external links
$(document).ready(function() {	
		

	//Add external link icon to external links - 
	//$('a').filter(function() {
		//Compare the anchor tag's host name with location's host name
	//    return this.hostname && this.hostname !== location.hostname;
	//  }).addClass("external").attr("target", "_blank");	
	
	$("table.services_directory tr:first").addClass("dark");
	$("table.services_directory th:first").addClass("section_title");
	$("table.services_directory tr:nth-child(2)").addClass("first_row");
	$("table.services_directory tr:nth-child(even) td:nth-child(1)").addClass("listing_logo");
    $("table.services_directory tr:nth-child(even) td:nth-child(2)").addClass("listing_contact_details");
	$("table.services_directory tr:nth-child(even) td:nth-child(3)").addClass("listing_services");
	$("table.services_directory tr:nth-child(odd) td:nth-child(1)").addClass("listing_logo");
    $("table.services_directory tr:nth-child(odd) td:nth-child(2)").addClass("listing_contact_details");
	$("table.services_directory tr:nth-child(odd) td:nth-child(3)").addClass("listing_services");
	 
});

$(document).ready(function(){
$("a.external").attr('target','_blank');
});
