/*var email="jdahl@norwichtownrehab.com";*/
var admin_email="jdahl@norwichtownrehab.com";
var admiss_email="HBarnett@norwichtownrehab.com";
var billing_email="rmcgirr@norwichtownrehab.com";
var fss_email="kfrink@norwichtownrehab.com";
var dns_email="acaswell@norwichtownrehab.com";
var ss_email="pmarshall@norwichtownrehab.com";
var webmaster="rmcgirr@norwichtownrehab.com";
var address="93 West Town Street";
var city="Norwich";
var state="CT";
var zip="06360";
var country="United States";
var specialty="Long and Short Term Skilled Nursing";
var default_lang="en_only";
var phone="Ph: 860-889-2614";
var fax="Fax: 860-823-1329";
$(function(){

	var maps = $('#mapsUsSaddr');
	var scroll_timer;
	var displayed = false;
	var $message = $('#scroll a');
	var $window = $(window);
	var top = $(document.body).children(0).position().top;
	$window.scroll(function () {
		window.clearTimeout(scroll_timer);
		scroll_timer = window.setTimeout(function () {
			if($window.scrollTop() <= top)
			{
				displayed = false;
				$message.fadeOut(500);
			}
			else if(displayed == false)
			{
				displayed = true;
				$message.stop(true, true).show().click(function () { $message.fadeOut(500); });
			}
		}, 100);
	});
	
	$("#" + page).addClass("hidden");

	$("#gallery").easySlider({
		auto: true,
		continuous: true,
		speed: 600,
		pause: 5000,
		controlsShow: false
	});
	$("#slider").easySlider({
		afterDiv: true,
		numeric: false,
	});	
	//clicking "to top" swings us to top instead of jumping
	$('a[href=#top]').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow', 'swing');	
		return false;
	});
	$(window).scroll(function (){ 
		$("#go_top").show("fast"); 
	});
		maps.focus(function(){
		$(this).addClass("focusField");
		if ($(this).val() != this.defaultValue)
		{
			$(this).val();
		}
		else
		{
			$(this).val('');
		}
		$('#helptext').fadeIn();
	});
		maps.blur(function(){
		$(this).removeClass("focusField");
		if ($(this).val() == false)
		{
			$('#helptext').fadeOut();
			$(this).val(this.defaultValue ? this.defaultValue : '');
		}
	});
	$('#contact_submit').click(function(){
			maps.delay(500).queue(function(){
			$(this).val(this.defaultValue ? this.defaultValue : '');
		});
		$('#helptext').fadeOut();
	});	
	
});

function sendEmail(email){
	document.location.href='mailto:' + email; 
	return false;

}
function getMap(){
	document.location.href='http://maps.google.com/maps?oi=map&q='+address+','+city+','+state+' '+zip;
	
}
