$(document).ready(function(){

	$('#home div.slideshow img').css("visibility", "visible");

	$('.slideshow').cycle({
	fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

	$("#category_list li").hover(function () {
        $(this).css({'background-color': '#ccc'});
	}, 
	function () {
        $(this).css({'background-color': 'white'});
	});

	//Set height of the Camp Details container if it is smaller than the image
	//$('#camp_details').each(function(){
	//var height1 = $('.campImage').innerHeight();
	//imgPos = imgPos.top;
	//var height1 =$("#camp_body img:first").css('height');
	//var height2 = $('#camp_details').css('height');
	//alert(height1);
	//	alert(height2);
	//if (height1 > height2) {
	//	alert(height1);
	//	alert(height2);
	//	//$('#camp_details').css({'height' : height1 + 'px'});
	//	$('#camp_details').height(height1);
	//	} 
	//document.write (height1);
	//document.write (height2);
	//});
	
	$("#camp_body img:first").remove();
	
	$(".camp_details br").remove();

	
	var altText = $('.campImage').attr("alt");
	$('.campImage').attr('alt', altText);

	var cookies = get_cookies_array();
	
	$('.addFav').each(function(){
	var favId = $(this).attr("id");
		if ($.cookie(favId)){
			$(this).css("display", "none");
		}
	});

	$('.addFav').live("click", function(){
	var favId = $(this).attr("id");
	var postLink = $(this).attr("rel");
	//var favId = (favId.substring(4));
	var favTitle = $(this).attr("title");
        $('#favArea').prepend("<li class=\"blah\" id=\"" + favId + "\"><a id=\"del_" + favId + "\" class=\"removeFav " + favId + "\" href=\"#\"></a><a href=\"/" + postLink + "\">" + favTitle + "</a></li>");
	$.cookie(favId, favTitle, {path: '/', domain: 'mainecamps.org'});
	$(this).css("display", "none");
	
	return false;
    	});

	$(".removeFav").live("click", function(){
	var favId = $(this).attr("id");
	var favId = (favId.substring(4));
        $(this).parent().remove();
	//alert( $.cookie(favId) );
	$.cookie(favId, null, {path: '/', domain: 'mainecamps.org'});
	//alert( favId );
	$('#' + favId).css("display", "inline");
	return false;
    	});

	//alternate backgrounds on camp search results
	$(".camp_details:even").css("background-color", "#e1ebf5");


	$("#catSubmit").click(function() {
	if($('input[name^=session]:checked').size() == 0){
	
	alert('Please Make A Selection for session length.');
	return false;
	}
	});

	//Business Members list
	$('div#show_hide > div > div.entry').hide();  
	$('div#show_hide > div > span.toggler').click(function() {
		$(this).toggleClass('opened');
		$(this).next('div').slideToggle('fast')
		.siblings('div:visible').slideUp('fast');
		$(this).siblings('h3.opened').removeClass('opened');
		});

	//alternate backgrounds on business member results
	$(".bm_list_item:even").css("background-color", "#e1ebf5");

	$("#jmg_form br").remove();

	$("img.campImage").removeAttr("style");
	
});	
