//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
// scripts.js, part of the garden fare web site
//
// This contains all common JavaScript functions for the site.
//
// Developed by Michael Fuchs,
//   consult@michaelfuchs.org
//
// _revision history_
// 2009.05.20, MF: first written
// see individual functions for revision histories
//
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////////////////
//
// function init ( )
//
// This function performs all page initialisation tasks.
//
// Params:		none
//
// Returns:		nothing
//
// Developed by Michael Fuchs,
//   fuchs@michaelfuchs.org
//
// _revision history_
// 2009.05.20, MF: first written
//
//////////////////////////////////////////////////////////////////////////

function init ( ) {


	// Make nav elements change on mouseover.
	
    $(".nav_element")
        .mouseover(function() { 
            var src = $(this).attr("src").match(/[^\.]+/) + "-over.gif";
            $(this).attr("src", src);
        })
        .mouseout(function() {
            var src = $(this).attr("src").replace("-over", "");
            $(this).attr("src", src);
        });


}



//////////////////////////////////////////////////////////////////////////
//
// function generateEmail ( )
//
// This function creates a spammer-harvest-proof email address on the
// on the page, via document.write()
//
// Params:		none
//
// Returns:		nothing (but does write to the document)
//
// Developed by Michael Fuchs,
//   fuchs@michaelfuchs.org
//
// _revision history_
// 2009.05.17, MF: first written
//
//////////////////////////////////////////////////////////////////////////

function generateEmail ( type ) {

	if ( type == "gf" ) {

		var username = "inquiries";
		var hostname = "mygardenfare.com";

	}
	
	if ( type == "sa" ) {
	
		var username = "inquiries";
		var hostname = "starappleediblegardens.com";	
	
	}

	document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + ">" + username + "@" + hostname + "</a>");
	return true;

}








