$j=jQuery.noConflict();


jQuery(function(){

	$j("#submit").click(function(){
		var key=$j("#directionBox").val();
		key=key.replace(/ /g,"+");
		key = "http://maps.google.com/maps?f=d&source=s_d&saddr=" + key + "&daddr=2323+Pennsylvania+Avenue+SE,+Washington+D.C.,+DC&hl=en";
		window.open (key);

		return false;
	})

	$j(".stacker").children("img:last").css("clear","left");
	$j(".stacker").each(function(){
		$j(this).width($j(this).children("div:first").children("img:first").width() + 3);
	})
	$j(".pic").each(function(){
		$j(this).children(".caption").children(".inner").html($j(this).children('img').attr('alt'));
	})
	$j("#slideshowClipper").cycle({ fx: 'scrollLeft', speed: 25000, continuous: true, easing: 'linear' });

	$j("#newForm .first-name input").attr("Value", "Name");
	$j("#newForm .e-mail input").attr("Value", "Email");
	$j("#newForm .wpcf7-submit").attr("Value", "Register for Updates");




	$j("#newForm .first-name input").focus(function(){
		
	if ($j(this).attr("Value") == "Name") {
		$j(this).attr("Value","")
	};
	});
	
	$j("#newForm .first-name input").blur(function(){
	if ($j(this).attr("Value") == "") {
		$j(this).attr("Value","Name")
	};
	});
	
	$j("#newForm .e-mail input").focus(function(){
		
	if ($j(this).attr("Value") == "Email") {
		$j(this).attr("Value","")
	};
	});
	
	$j("#newForm .e-mail input").blur(function(){
	if ($j(this).attr("Value") == "") {
		$j(this).attr("Value","Email")
	};
	});


})

window.onload = function(){

	$j(".middle-text-full-interior").append("<div id = 'slideshow' class = 'fullSize'><div id = 'bigBox'></div> <div class='pagers'> <div class = 'left'><a href = '#' class = 'btn-back'>&nbsp;</a></div> <div class = 'right'><a href = '#' class = 'btn-fwd'>&nbsp;</a></div> </div> <div id = 'thumbs'> <ul id = 'thumbList'></ul> </div></div> <div class = 'clear'></div> ")

	$j(".ngg-galleryoverview .ngg-gallery-thumbnail > a").each(function(){
		$j("#bigBox").append("<img src = '" + $j(this).attr('href') + "' width = '950' />");
		$j("#thumbList").append("<li><a href = '#'><img src = '" + $j(this).attr('href') + "' width = '80' /></a></li>");
	})

	$j('#bigBox').cycle({
		fx:     'fade',
		speed:  1500,
		timeout: 4500,
		prev:   '.btn-back',
		next:   '.btn-fwd',
		pager:  '#thumbs',
		pagerAnchorBuilder: function(idx, slide) {
			// return sel string for existing anchor
			return '#thumbs li:eq(' + (idx) + ') a'; } });


			var totalWidth = 0;

			$j("#thumbList li").each(function(){
				totalWidth = totalWidth + 10 + parseFloat($j(this).outerWidth());
			})		

			var slideWidth = totalWidth - parseFloat($j("#thumbList").width())

			$j("#thumbList").width(totalWidth + "px")

			$j(".middle-text-full-interior #slideshow").prepend("<div id = 'sliders'><p class = 'left'><a href = '#'>&nbsp;</a></p><p class = 'right'><a href = '#'>&nbsp;</a></p></div><div class = 'leftBox'></div><div class = 'rightBox'></div>");

			var position = 0;

			var i = 0;

			var speed = 35000;

			$j("p.left").hover(function(){
				$j("#thumbs").autoscroll({ 
					direction: "left", 
					step: 100,
					speed: '3500', 
					scroll: true, 
					onEvaluate: function () { 
						// code 
					}, 
					onEdge: function (edge) { 
						// code 
					} 
				});
			},function(){
				$j("#thumbs").autoscroll("destroy")
			})
			$j("p.right").hover(function(){
				$j("#thumbs").autoscroll({ 
					direction: "right", 
					step: 100,
					speed: '50', 
					scroll: true, 
					onEvaluate: function () { 
						// code 
					}, 
					onEdge: function (edge) { 
						// code 
					} 
				});
			},function(){
				$j("#thumbs").autoscroll("destroy")
			})

		}
