//jQuery ulSlide ----------------------------------------------------------//
$(function() {
    $('#slide').ulslide({
        effect: {
            type: 'carousel', // slide or fade
            axis: 'x',     // x, y
            distance: 7,   // Distance between frames
			showCount:4
        },
        duration: 500,
        autoslide: 5000,
        width: 235,
        height: 150,
        mousewheel: false
    });
});

// Flickr ------------------------------------------------------------------//
;$(document)
	.ready(function() {
		// This is for the flickr pull
		var url = "";	
		url = "http://api.flickr.com/services/feeds/photos_public.gne?id=63566208@N07&lang=en-us&format=rss_200"	;
		$.getJSON(url+"&format=json&jsoncallback=?", 
			function(data){
				$("#flickrJson").html("");
          			$.each(data.items, function(i,item){
            				if ( i == 12 ) return false;
					$("<a/>")
						.attr('href', item.link)
						.attr('target', '_blank')
						.addClass('flickLink')
						.html(
              						$("<img/>").attr("src", item.media.m)
						)
						.appendTo("#flickrJson");
          			});
				// Now lets do the opacity type stuff	
				$("#flickrJson a")
					.hover(
						function() {
							$("#flickrJson a").stop().animate({opacity: 0.5},600);
							$(this).stop().animate({opacity: 1.0},600);
        				},
        				function(){
        					$("#flickrJson a").stop().animate({opacity: 1.0},600);
            				$(this).stop().animate({opacity: 1.0},600);
       				});
        		});
        		        	
	})
	
// Fancy rollover breadcrumbs -------------------------------------------------//
$(document).ready(function() {
		$('ul.navigation li').mouseover(function(){
		$(this).parents('li').children('a').addClass('active');
		$('#primary-navigation').addClass('over');
	});
		$('ul.navigation li').mouseout(function(){
		$(this).parents('li').children('a').removeClass('active');
		$('#primary-navigation').removeClass('over');
	});
});

//Equal Columns-----------------------------------------------------------------//
$(document).ready(function(){
    	$(function(){
    	    $('.column').equalHeight();
   	});
    });

// make sure the $ is pointing to JQuery and not some other library

(function($){
// add a new method to JQuery
$.fn.equalHeight = function() {
// find the tallest height in the collection
// that was passed in (.column)
tallest = 0;
this.each(function(){
thisHeight = $(this).height();
if( thisHeight > tallest)
tallest = thisHeight;
});

// set each items height to use the tallest value found
this.each(function(){
$(this).height(tallest);
});
}
})(jQuery);


//jQuery Innerfade-----------------------------------------------------------//
$(document).ready(
	function(){
		$('#news').innerfade({
			animationtype: 'slide',
			speed: 750,
			timeout: 2000,
			type: 'random',
			containerheight: '1em'
		});
	});
	
//Clear Text----------------------------------------------------------------//
function clearText(field){

if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;

}

// jQuery Validation ------------------------------------------------------//
$(document).ready(function(){
	$("#commentForm").validate();
});
