$(document).ready(function () {
	$("#subscribe a").click(function () {
		$("#subscribeform").fadeToggle(300);
		var brws = $.browser.name;
		var ops = $.os.name;
		if (ops == "win"){
			$("object").toggle(0);
		}
		return false;
	});
	$("a.close").click(function () {
		$("#subscribeform").fadeOut(300);
		var brws = $.browser.name;
		var ops = $.os.name;
		if (ops == "win"){
			$("object").toggle(0);
		}
		return false;
	});
	
	$("#maplink").click(function () {
		var location = $("#maplink").attr("href");
		viewMap(location)
		return false;
	});
	$("div.onhover h3").mouseover(function () {
		$(this).css("color","#ffffff");
	});
	$("div.onhover h3").mouseout(function () {
		$(this).css("color","#ffbf51");
	});
	$("div.newsitem h3.newslink").click(function () {
		var newsid = $(this).attr("id");
		getNewsItem(newsid);
	});
	$("div.newsitem a.newslink").click(function () {
		var newsid = $(this).parent().find("h3.newslink").attr("id");
		getNewsItem(newsid);
		return false;
	});
	
	$("input[@name=hearabout]").change(function(){
		if ($(".othrb").is(':checked')){
			$(".other").slideDown(200);
		} else {
			$(".other").slideUp(200);
		}
	});
	
	
	
});

jQuery.fn.fadeToggle = function(speed, easing, callback) { 
   return this.animate({opacity: 'toggle'}, speed, easing, callback); 
}; 

function email(user,domain,subject) {
	locationstring = "mailto:" + user + "@" + domain+"?subject="+subject;
	window.location = locationstring;
}

function getNewsItem(newsid){
	$("#bignews").load("/php/getnews.php", {id:newsid});
}

function printForm(){
	var urlname = "/print/";
	openWindow(urlname, 635, 800, true, "orderform");
}

function viewMap(urlname) {
	openWindow(urlname, 635, 800, true, "map");
}

function openWindow(src, width, height, scroll, windowname) {
	window.open(src, windowname, "width=" + width + ",height=" + height + ",left=" + Math.round((screen.width - width) / 2) + ",top=" + Math.round((screen.height - height) / 2 - 40) + ",scrollbars=" + (scroll ? 1 : 0) + ",resizable=0,status=0").focus();
}
