$(document).ready(function() {
	
	//convert richtext popup full size images to fancybox images
	$(".contentLeft img").each(function(){
		if(!$(this).parent().is("a"))
			$(this).wrap("<a class='single_image' href='" + $(this).attr("src") + "'></a>");
	});
	//end convert richtext popup full size images to fancybox images
	
	//convert richtext popup thumb images to fancybox images
	$(".contentLeft a").each(function(){
		var href = $(this).attr("href");
		if(href != undefined){
			var index = href.indexOf("viewImage");
			if(index > -1){
				href = href.replace("javascript:viewImage('", "");
				href = href.replace("')","");
				$(this).attr("href", href);
				$(this).addClass("single_image"); 
			}
		}
	});
	    //SEARCH FIELD
	$('label.searchLabel').click(function(){$('input.searchField').focus();});
	$('input.searchField').focusin(function(){$('label.searchLabel').fadeOut('fast');});
	$('input.searchField').focusout(function(){
		var searchText = $('input.searchField').val()
		if(searchText == "") {
			$('label.searchLabel').text('Site Search...');
			$('label.searchLabel').fadeIn('fast');
		}
	});
	//END SEARCH FIELD

	$("#getDirections").formfocus({
        focus : true,
        blur : true,
        keyup : true,
        label : false
    });
	$("a.single_image").fancybox();
	//end convert richtext popup images to fancybox images
	
	    $('.ddMaterials').hoverIntent(
    	function() {
    		$('#ddMaterials').show();
    	},
    	function() {
    		$('#ddMaterials').hide();
    	}
    );
	    $('.ddApplication').hoverIntent(
    	function() {
    		$('#ddApplication').show();
    	},
    	function() {
    		$('#ddApplication').hide();
    	}
    );
	    $('.ddAbout').hoverIntent(
    	function() {
    		$('#ddAbout').show();
    	},
    	function() {
    		$('#ddAbout').hide();
    	}
    );

});
