// Main JavaScript Document

// LinkAnimationExpert Class
var LinkAnimationExpert = Class.create({
							
    // initialize()
    // Constructor runs on completion of the DOM loading.  Creates the events that handle the highlighting
	// animation of the various text in, as well as the opacity animation of the various image links
    //
    initialize: function() 
	{    
		// Give the privacy policy link colour hover animation
		this.ColourAnimateTextLink("privacypolicylink", "#838281");
		
		// Give the menu bar items colour hover animation
		this.ColourAnimateTextLink("menubarhome", "#FFFFFF");
		this.ColourAnimateTextLink("menubarabout", "#FFFFFF");
		this.ColourAnimateTextLink("menubarweb", "#FFFFFF");
		this.ColourAnimateTextLink("menubarprint", "#FFFFFF");
		this.ColourAnimateTextLink("menubaranimation", "#FFFFFF");
		this.ColourAnimateTextLink("menubarseo", "#FFFFFF");
		this.ColourAnimateTextLink("menubarhosting", "#FFFFFF");
		this.ColourAnimateTextLink("menubarrelated", "#FFFFFF");
		this.ColourAnimateTextLink("menubarportfolio", "#FFFFFF");
		this.ColourAnimateTextLink("menubarfaq", "#FFFFFF");
		this.ColourAnimateTextLink("menubarcontact", "#FFFFFF");
		
		// Give the footer list items colour hover animation 
		this.ColourAnimateTextLink("footerlistweb1", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistweb2", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistweb3", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistweb4", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistweb5", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistanimation1", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistanimation2", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistanimation3", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint1", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint2", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint3", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint4", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint5", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint6", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint7", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint8", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint9", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint10", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint11", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint12", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint13", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistprint14", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistport1", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistport2", "#FFFFFF");
		this.ColourAnimateTextLink("footerlistport3", "#FFFFFF");
		
		// Give the web, print and animation page's link lists hover animation
		this.ColourAnimateTextLink("contentlist1", "#000000");
		this.ColourAnimateTextLink("contentlist2", "#000000");
		this.ColourAnimateTextLink("contentlist3", "#000000");
		this.ColourAnimateTextLink("contentlist4", "#000000");
		this.ColourAnimateTextLink("contentlist5", "#000000");
		this.ColourAnimateTextLink("contentlist6", "#000000");
		this.ColourAnimateTextLink("contentlist7", "#000000");
		this.ColourAnimateTextLink("contentlist8", "#000000");
		this.ColourAnimateTextLink("contentlist9", "#000000");
		this.ColourAnimateTextLink("contentlist10", "#000000");
		this.ColourAnimateTextLink("contentlist11", "#000000");
		this.ColourAnimateTextLink("contentlist12", "#000000");
		this.ColourAnimateTextLink("contentlist13", "#000000");
		this.ColourAnimateTextLink("contentlist14", "#000000");
		
		this.ColourAnimateTextLink("offerslistweb1", "#000000");
		this.ColourAnimateTextLink("offerslistweb2", "#000000");
		this.ColourAnimateTextLink("offerslistweb3", "#000000");
		this.ColourAnimateTextLink("offerslistweb4", "#000000");
		this.ColourAnimateTextLink("offerslistweb5", "#000000");
		this.ColourAnimateTextLink("offerslistanimation1", "#000000");
		this.ColourAnimateTextLink("offerslistanimation2", "#000000");
		this.ColourAnimateTextLink("offerslistanimation3", "#000000");
		this.ColourAnimateTextLink("offerslistprint1", "#000000");
		this.ColourAnimateTextLink("offerslistprint2", "#000000");
		this.ColourAnimateTextLink("offerslistprint3", "#000000");
		this.ColourAnimateTextLink("offerslistprint4", "#000000");
		this.ColourAnimateTextLink("offerslistprint5", "#000000");
		this.ColourAnimateTextLink("offerslistprint6", "#000000");
		this.ColourAnimateTextLink("offerslistprint7", "#000000");
		this.ColourAnimateTextLink("offerslistprint8", "#000000");
		this.ColourAnimateTextLink("offerslistprint9", "#000000");
		this.ColourAnimateTextLink("offerslistprint10", "#000000");
		this.ColourAnimateTextLink("offerslistprint11", "#000000");
		this.ColourAnimateTextLink("offerslistprint12", "#000000");
		this.ColourAnimateTextLink("offerslistprint13", "#000000");
		this.ColourAnimateTextLink("offerslistprint14", "#000000");
		
		// Give the general offers column links hover animation
		this.ColourAnimateTextLink("freeprojectquotelink", "#000000");
		this.ColourAnimateTextLink("nichecontactformlink", "#000000");
		
		
		// Animate the footer's quote request button
		this.AnimateImageLink("topqrlink");
		// Animate the footer's quote request button
		this.AnimateImageLink("logoqrlink");
		
				// Animate the footer's quote request button
		this.AnimateImageLink("topsmlink");
		// Animate the footer's quote request button
		this.AnimateImageLink("logosmlink");
		
						// Animate the footer's quote request button
		this.AnimateImageLink("topbloglink");
		// Animate the footer's quote request button
		this.AnimateImageLink("logobloglink");
		
								// Animate the footer's quote request button
		this.AnimateImageLink("toptclink");
		// Animate the footer's quote request button
		this.AnimateImageLink("logotclink");
		
		
										// Animate the footer's quote request button
		this.AnimateImageLink("topemaillink");
		// Animate the footer's quote request button
		this.AnimateImageLink("logoemaillink");
		
		
		
		
		
		
		// Animate the logo's quote request button
		this.AnimateImageLink("logoquoterequest");
		
		// Animate the logo's email us button
		this.AnimateImageLink("logoemailus");
				
		// Animate the footer's quote request button
		this.AnimateImageLink("footerquoterequest");
		
		// Animate the footer's email us button
		this.AnimateImageLink("footeremailus");
		
				// Animate the footer's privacy button
		this.AnimateImageLink("footerprivacy");
		
		// Animate the index page's eflyer signup button
		this.AnimateImageLink("mainbodyofferseflyersignup");
		
		// Animate the contact us page's submit button
		this.AnimateImageLink("mainbodycontentcontactussubmit");
		
		// Animate the general quote request page's submit button
		this.AnimateImageLink("mainbodycontentquotesubmit");
		
		// Animate the detail button
		this.AnimateImageLink("mainbodyoffersdetailsimg");
		
		// Animate the get started button
		this.AnimateImageLink("mainbodycontentonepagewebsitegetstarted");
    },

    //
    // ColourAnimateTextLink()
    // Grabs the link that matches the give link id, and setups up the hover in and hover out
	// colour animation.
    //
    ColourAnimateTextLink: function(linkId, colour) 
	{   
		var textlink = $(linkId);
		
		if(textlink != null)
		{
			Event.observe(textlink, 'mouseover', 
				function()
				{
					
					new Effect.Morph(textlink, 
					{ 
						style: 
						{
							color: '#E39AC1'
						},
						duration: 0.5
					});
				}
			);
				
			Event.observe(textlink, 'mouseout', 
				function()
				{
					new Effect.Morph(textlink, 
					{ 
						style: 
						{
							color: colour
						},
						duration: 0.5
					});
				}
			);
		}
    },
	
	//
    // AnimateImageLink()
    // Grabs the image that matches the give link id, and setups up the hover in and hover out
	// colour animation.
    //
    AnimateImageLink: function(imageId, colour) 
	{   
		var imagelink = $(imageId);
		
		if(imagelink != null)
		{
			
			Event.observe(imagelink, 'mouseover', 
				function()
				{	
					new Effect.Opacity(imagelink, 
					{ 
						from: 1.0,
						to: 0.0,
						duration: 0.5
					});
				}
			);
				
			Event.observe(imagelink, 'mouseout', 
				function()
				{
					new Effect.Opacity(imagelink, 
					{ 
						from: 0.0,
						to: 1.0,
						duration: 0.5
					});
				}
			);
		}
    }
});

// On DOM load function
document.observe('dom:loaded', 
	function () 
	{
		// Create and initialise the LinkAnimationExpert Javascript
		new LinkAnimationExpert();
		
		// Create and initialise the Lightbox Javascript
		new Lightbox(); 
	}
);

// Email Display Functions
function EmailLinkOutputGivenStyle(style)
{
	document.write("<a style='");
	document.write(style);
	document.write("' href='mailto:");
	EmailOutput();
	document.write("'>");	
	EmailOutput();
	document.write("</a>");
}

function EmailLinkOutputGivenStyleAndLinktext(style, linkText)
{
	document.write("<a style='");
	document.write(style);
	document.write("' href='mailto:");
	EmailOutput();
	document.write("'>");	
	document.write(linkText);
	document.write("</a>");
}

function EmailOutput()
{
 	document.write("niche");
	document.write("@");
	document.write("nichedesigns.");
	document.write("org");
}
