$(document).ready(function() {		
	$(".popup").hover(function() {
		$("#popup").fadeIn("fast")
		.html($(this).attr("rel"));		
		var top = $(this).offset().top + $(this).height();
		var left = $(this).offset().left - $("#popup").width() - 20;
		$("#popup").css("top", top).css("left", left);
		return true;
	
	}, function() {
		$("#popup").hide();		
	})
	.click(function() { return false; });
	
	$(".menu li:has(ul)").hover(function() {		
		$(this).find(">ul").stop(true, true).slideDown(300, "easeInQuad");
  	}, function() {
		$(this).find(">ul").stop(true, true).hide();		
	}).find(">a").append("<div class='arrow'></div>");
		
	
	$(".menu li:last-child a").css("border-bottom", "none").css("border-right", "none");
	
	$(".menu li a").hover(function() {
		$(this).addClass("hovered");
	}, function() { 
		$(this).removeClass("hovered");		
	})
	
	$("a[href*='mailto']").each(function() {
		var address = $(this).attr("href");
		address = address.replace(" at ", "@");
		address = address.replace(" dot ", ".");
		var text = $(this).html();
		text = text.replace(" at ", "@");
		text = text.replace(" dot ", ".");
		$(this).attr("href", address).html(text);
	});
	
	$("#top_image").innerfade( { containerheight: "148px", timeout: "7000" } );
	
	
});

function popup(elem, text) {
	$("#popup").fadeIn("fast")
	.html(text);
	alert(elem.css("top"));
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function autoSave(name, question, answer, formname) {
	$.post("include/ajax.php", { action: "autoSave", name: name, question: question, answer: answer, formname: formname }, function(){
		
	} );
}
