function DESemail(emailname,emailserver) {
	document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
	document.write(emailname + "@" + emailserver); 
	document.write("</a>"); 
}

$(document).ready(function(){
	
	// focus on error messages
	if (document.getElementById("errors")) {
		var $target = $("#errors");
		var targetOffset = $target.offset().top;
		$('html,body').animate({scrollTop: targetOffset}, 500);
		$("#errors").animate( { backgroundColor: '#FACDCD' }, 750).animate( { backgroundColor: '#FBEEEE' }, 750);
		
		$("input.error").animate( { backgroundColor: '#FFDCDC' }, 750).animate( { backgroundColor: '#fff' }, 750);
		$("textarea.error").animate( { backgroundColor: '#FFDCDC' }, 750).animate( { backgroundColor: '#fff' }, 750);
	}
	
	// focus on updated messages (only hitting comment form)
	if (document.getElementById("updated")) {
		var $target = $("#updated");
		var targetOffset = $target.offset().top;
		$('html,body').animate({scrollTop: targetOffset}, 500);
		$("#updated").animate( { backgroundColor: '#B4EB9F' }, 750).animate( { backgroundColor: '#E7FDDF' }, 750);
	}
	
	$('a.back_top').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
		  var $target = $(this.hash);
		  $target = $target.length && $target
		  || $('[name=' + this.hash.slice(1) +']');
		  if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 500);
				//$("#faqs h5").css("font-size","1em");
			  return false;	  
			}
		}
  });
  
  $('a.comments_link').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
		  var $target = $(this.hash);
		  $target = $target.length && $target
		  || $('[name=' + this.hash.slice(1) +']');
		  if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 500);
				//$("#faqs h5").css("font-size","1em");
			  return false;	  
			}
		}
  });
	
	
	// onchange filter for regions
	$("#region_filter").change(
		function() {
			var theLink = $(this).val();
			if (theLink != '') {
				window.location=theLink;
			}
		}
	);
	
	
	
	$("#search_show_opinions").click( function() {
		var textVal = $(this).text();
		if (textVal=='Show All') {
			$("#search_all_opinions").show();
			$(this).text('Hide All');
		}
		else {
			$("#search_all_opinions").hide();
			$(this).text('Show All');
		}
		return false;
	});
	
	$("#search_show_news").click( function() {
		var textVal = $(this).text();
		if (textVal=='Show All') {
			$("#search_all_news").show();
			$(this).text('Hide All');
		}
		else {
			$("#search_all_news").hide();
			$(this).text('Show All');
		}
		return false;
	});
	
	// Activate News Ticker if present
	if (document.getElementById("ticker"))
	{
		$("div#ticker").show();
		$("ul#news_ticker").Ticker();
	}



}); // End jQuery

