// JavaScript Document
$(document).ready(function(){
       if($("#print").length >0){
		   $("#print").css('cursor','pointer');
			$("#print").bind('click', function(){
				width = $("#content").width();
				body = $("body").html();
				$("body").html("<div id=\"content\">"+$("#content").html()+"</div>");
				$("#print").html("Return to Page");
				$("#print").bind("click", function(){
					 window.location.reload(true);
				});
			});
	   }
});
function interstate_selected(){
	$("#interstate_load").show();
	var st = $("#campgroundEstate").val();
	$.post('/campgrounds/search_interstate', {state:st}, function(j){
		$('#campgroundInterstate').find('option').remove().end();
		$('#campgroundExit').find('option').remove().end().attr("disabled","disabled");
		$('interstate',j).each(function(apx){
			$('#campgroundInterstate').append($("<option></option>").attr("value",$(this).find('option').text()).text($(this).find('option').text())).attr("disabled",""); 
		});
		$("#interstate_load").hide();
	});
}

function exit_selected(){
	$("#exit_load").show();
	var inter = $("#campgroundInterstate").val();
	var st = $("#campgroundEstate").val();
	$.post('/campgrounds/search_exit', {state:st, interstate:inter}, function(j){
		$('#campgroundExit').find('option').remove().end();
		$('interstate',j).each(function(apx){
			$('#campgroundExit').append($("<option></option>").attr("value",$(this).find('option').text()).text($(this).find('option').text())).attr("disabled",""); 
		});		
		$("#exit_load").hide();
		distance_selected();
	});
}

function distance_selected(){
	$("#campgroundDistance").attr("disabled", "");
}