//nav bar fade border
$(document).ready(function() {
	$("#page-list .page_item, #page-list .cat-item").not(".current_page_item, .current-cat, .current-cat-parent").hover(function() {
		$(this).animate({ borderTopColor: "#F9BDB1" }, {queue:false,duration:200});
		$(this).find('a').animate({ "color": "#F9BDB1" }, {queue:false,duration:200});
	}, function() {
		$(this).animate({ borderTopColor: "#FFFFFF" }, {queue:false,duration:500});
		$(this).find('a').animate({ "color": "#333333" }, {queue:false,duration:500});
	});
});

//X h4 a fade background
$(document).ready(function() {
	$("h4 a").hover(function() {
		$(this).animate({ backgroundColor: "#FDF8F2" }, {queue:false,duration:200});
	}, function() {
		$(this).animate({ backgroundColor: "#FFFFFF" }, {queue:false,duration:500});
	});
});

//post fade-in background highlight
$(document).ready(function() {
	$("#blog .post").hover(function() {
		$(this).animate({ backgroundColor: "#C8F0E9" }, {queue:false,duration:500});
	}, function() {
		$(this).animate({ backgroundColor: "#FFFFFF" }, {queue:false,duration:500});
	});
});

//comment fade-in background highlight
$(document).ready(function() {
	$("#comments .comment").hover(function() {
		$(this).animate({ backgroundColor: "#FDF8F2" }, {queue:false,duration:500});
	}, function() {
		$(this).animate({ backgroundColor: "#FFFFFF" }, {queue:false,duration:500});
	});
});

//Tabs fade-in background highlight
$(document).ready(function() {
	$(".three-tab").hover(function() {
		$(".three-tab").animate({ backgroundColor: "#FFFFFF" }, {queue:false,duration:500});
		if ($(this).is(".three-tab:first-child") || $(this).is(".three-tab:last-child")) {
			$(this).animate({ backgroundColor: "#C8F0E9" }, {queue:false,duration:500});
			$("#panes").animate({ backgroundColor: "#C8F0E9" }, {queue:false,duration:500});
		} else {
			$(this).animate({ backgroundColor: "#F9BDB1" }, {queue:false,duration:500});
			$("#panes").animate({ backgroundColor: "#F9BDB1" }, {queue:false,duration:500});
		}
	}, function() {
		//do nothing
	});
});

//Tabs fader
$(document).ready(function() {	
	$("#tabs").tabs("#panes > div", {event:'mouseover', effect: 'fade', fadeOutSpeed: 400});
	$(".three-tab:first").animate({ backgroundColor: "#C8F0E9" }, {queue:false,duration:500});
});

//tooltip
$(document).ready(function() { 
    $("#sign-up :input").tooltip({
    	tip: "#perfect-match-list",
    	position: "top center",
		slideInSpeed: 500,
        effect: 'slide',
        delay: 500,
        opacity: 0.8
    }); 
});

$(document).ready(function() { 
    $("#coffee").tooltip({
    	tip: "#complimentary",
    	position: "bottom left",
		slideInSpeed: 500,
        effect: 'slide',
        direction: 'down', 
        delay: 1000,
        opacity: 0.8
    }); 
});

//fade thumbnails
$(document).ready(function() {
		$('.thumbnails').not('.thmblist').hover(function(){
		   $(this).find('img').animate({opacity:0.1},{queue:false,duration:500});
		}, function(){
		   $(this).find('img').animate({opacity:0.8},{queue:false,duration:500});
		});
});

//up arrow
$(document).ready(function() {
	$('#up').hover(function() {
	   $(this).animate({bottom: "10px"},{queue:false,duration:500});
	}, function(){
	   $(this).animate({bottom: "0px"},{queue:false,duration:500});
	});
});

//Modal input
$(document).ready(function() {
	var triggers = $("a.modalInput").overlay({ 
	 
	    // some expose tweaks suitable for modal dialogs 
	    expose: { 
	        color: '#FFF', 
	        loadSpeed: 200, 
	        opacity: 0.6,
	        speed: 'slow'
	    }, 

	    closeOnClick: true
	});
	$("#prompt form").submit(function(e) { 
 
	    // close the overlay 
	    triggers.eq(1).overlay().close(); 
	 
	    /* get user input 
	    var input = $("input", this).val(); 
	 
	    // do something with the answer 
	    triggers.eq(1).html(input); 
	 
	    // do not submit the form 
	    return e.preventDefault(); */
	});
});

//Clear input fields
function clearText(thefield){
	if (thefield.defaultValue==thefield.value) {
		thefield.value = "";
		thefield.style.color = "#333";
	}
} 

//Is there history
function isThereHistory() {
	if(history.length < 2) {
		document.write("please use the navigation at the top to browse through this site.");
	} else {
		document.write("<a href='javascript:history.back(1)'>click here to go back</a> to where you were.");
	}		
}
