$(document).ready(function($){
	var myvalue = "";
	$('.post').each(function(){
		myid = $(this).attr("id");
		myvalue = 'lightbox['+myid+']';
		$("#"+myid+" a[href$=.jpg],#"+myid+" a[href$=.png],#"+myid+" a[href$=.gif]").attr({
			rel: myvalue
		}).addClass('lightboxclass');
	});


	$("input[placeholder]")
		  .each(
		function () {
			 var term = $(this).attr("placeholder");
			 $(this).val(term); 
		}).focus(
		 function() { 
				$(this).val(""); 
		}).blur( 
			function(){ 
					if (this.value == '') { 
						var term = $(this).attr("placeholder");
						$(this).val(term); 
					};	
		});

	$("input[autofocus]").focus();


	
	
	$(".lightboxclass").prettyPhoto({
			animationSpeed: 'normal', /* fast/slow/normal */
			padding: 40, /* padding for each side of the picture */
			opacity: 0.35, /* Value betwee 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: true, /* true/false */
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'dark_square' /* light_rounded / dark_rounded / light_square / dark_square */
	});
	
	$("#foo2").carouFredSel({
		items       : 4,
		auto : false,	    
		prev : {   
	        button  : "#foo2_prev",
	        key     : "left"
	    },
	    next : {
			button  : "#foo2_next",
			key     : "right"
	    }
	});	
	$("#menu-item-255 a,.sitemap_button").click(function() {
		$("#sitemap").slideToggle();
	});
	
	if($(".each-slider").size() < 5){
		$(".prev,.next").hide();
	}
	
	$("#map-link a").click(function() {
		$(this).toggleClass("on");
		$("#map-image").slideToggle();
	});
	
	$("#map-link a").toggle(function() {
	  $(this).addClass("on").text("Click to hide map");
	  $("#map-image").slideDown();
	}, function() {
	  $(this).removeClass("on").text("Click here to view map");
	  $("#map-image").slideUp();
	});
	
	$("#form .wpcf7-checkbox#newsletter input").attr('checked', true);
	
});
