$(function(){		
	$('#search-results tbody tr.extended div.left p').each(function(){
		if($(this).text() == '') {
			$(this).remove();
		}
	})
	
	// Clearing method for 3 column states
	$('div.multiselect label:nth-child(3n)').addClass('last').next().addClass('clear');
	$('body.job #primary-content ul.list.twoCol li:nth-child(2n)').addClass('last').next().addClass('clear');
	
	$('table').each(function(){
		$(this).find('tr:odd').addClass('odd');
	});
	
	$('#secondary-content h2:first').addClass('top');
	
	// Safe Mailto's
	if ($('a.email').length > 0){
		$.getScript('js/jquery.mailto.js',function(){ 
			// Execute this function once the plugin is loaded
			$('a.email').mailto();
		});
	}
	$('input[type="text"]').addClass('text');
	
	// Focus & Blur
	if ($('input.valueFx').length > 0) {
		$.getScript('/js/jquery.valueFx.js',function(){ 
			$('input.valueFx').valueFx();
		});
	}
	
	// Firefox Opacity Fix
	if (($.browser.mozilla && parseFloat($.browser.version) < 1.9) && (navigator.appVersion.indexOf('Mac') !== -1)) {
		$('body').css({'opacity': '0.9999'});
	}
	if ($('*.message').length > 0){
		$('*.message li:last').addClass('last');
	}
	
	// Current Nav States
	$.getScript('/js/jquery.url.packed.js',function(){
		var $dir = jQuery.url.attr("directory");
		//if($dir != '/') {			
		if($dir == '/blog/') {
			$('#mainnav li a').each(function(){
				var $href = $(this).attr('href');
				if ($href.indexOf($dir) > -1) {
					$(this).addClass('active');
				}
			});
		}
	});
	
	// Expand & Collapse Elements	
	$('ul.expand').each(function(){
		$('li.trigger', this).filter(':first').addClass('top').end().filter(':not(.open)').next().hide();
		$('li.trigger', this).click(function(){
			if($(this).hasClass('open')) {
				return false;
			} else {
				$(this).parent().find('li.trigger').removeClass('open').next().filter(':visible').slideUp();
				$(this).addClass('open').next().slideDown();
			}
		});
	});
	
	// Apply Create Account Form
	$('#create-professional-account').hide();
	$('input[name="create_account"]').click(function(){
		$('#create-professional-account').slideToggle();
	});
	
	// Expandable Content Area
	if ($('*.expandable h3').length > 0) {
		$('*.expandable h3').each(function(){
			$(this).next().hide();
			$(this).click(function(){
				$(this).toggleClass('open').next().toggle();
			});
		});
	}
	
	// In The News cURL
	if ($('#in-the-news').length > 0) {
		$('#primary-content #in-the-news li:last').addClass('last');
	}
	
	// Customer Testimonial Quotes
	if ($('#quotes').length > 0) {
		$.getScript('/js/jquery.cycle.all.min.js',function(){
			$('#quotes').cycle({
				fx: 		'fade',
				speed:    500, 
				timeout:  10000 
			});
		});
	}
	
});