/*
	www.ambientage.com/scripts/global.js
	
	Written for jquery 1.3
	copyright 2008, Ambient Age
	www.ambientage.com
*/
$(document).ready(function()
{	

// Homepage blog link hovers
	$('.home-post-single').mouseover(function(){
			$(this).css({backgroundColor: '#efefef', cursor: 'pointer'});
		}).mouseout(function(){
			$(this).css({backgroundColor: '#fff'});
		}).click(function(){
			var url = $(this).find('a').attr('href');
			window.location = url;
	});

// pages top navigation links
	if(!$('#nav-main ul').hasClass('.home')){
		$('#nav-main ul li a').css({paddingTop: '15px'});
	}
	var currentPage = $('#container').attr('class');
	if(currentPage){
		$('#' + currentPage).css({color: '#666', backgroundImage: 'url("../images/grey_ball.gif")', backgroundRepeat: 'no-repeat', backgroundPosition: 'top center'});
	}
				
// footer contact form display
	$('#show-contact-form').click(function(){
		$('#show-contact-form, #footer-contact address, #footer-contact dl').slideUp('fast');
		$('#footer-contact-form').slideDown('fast');
		return false;
	});
	$('#show-contact-details').click(function(){
		$('#footer-contact-form').slideUp('fast');
		$('#footer-contact address, #footer-contact dl').slideDown('fast');
		$('#show-contact-form').css({display: 'inline'});
		return false;
	});
	

// fix prob with sociable buttons...	 
	 $('.sociable ul li a').css({borderBottom: 'none'});

});	// end document.ready(function)

function validateMail()
	{
		
		var name, em, message, err;
		name = document.getElementById("nm").value;
		em = document.getElementById("em").value;
		message = document.getElementById("cmnt").value;
		
		if(name == "" || isNaN(name) == false)
		{
			err = "Please Enter Your Name";
			mailErrorFeedback("nm", err);
			return false;
		}
		else if((em == "") || (em.indexOf("@") == -1) || (em.lastIndexOf("@") != em.indexOf("@")) || (em.indexOf(".") == -1))
		{
			err = "Please Enter a valid email address";
			mailErrorFeedback("em", err);
			return false;
		}
		else if (message == "")
		{
			err = "Please Enter a Message";
			mailErrorFeedback("cmnt", err);
			return false;
		}
		return true;
	}// End validateMail
	
	function mailErrorFeedback(loc, e)
	{
		var error_out = loc + "_e";
		document.getElementById(error_out).innerHTML = e;
	}
