﻿// Functions specific to a site.

Cufon.replace("h1, .blog h2 a", { fontFamily: 'DIN-Medium' });

(function($) {
	$(document).ready(function() {
							   
		jQuery('#header').css('display', 'block');	
							   
							   
		// Place document manipulation code here
		var bgImageSource, bgImageFinal;
		$('#subnav li').each(function() {
			bgImageSource = $(this).css('background-image');
			if(bgImageSource != 'none')
				bgImageFinal = bgImageSource.replace(/"/g,"").replace(/url\(|\)$/ig, ""); 
			else
				bgImageFinal = '/images/sub-nav_hover.png';
			$(this).css({'background-image':'none'});
			$(this).prepend('<img class="bg-stretch" src="' + bgImageFinal +  '" style="height: ' + $(this).height() + 'px; width: 100%; position: absolute; z-index: 1;" />');

			if(!$(this).hasClass('active'))
				$(this).find('img').hide();
				
			$(this).find('a').each(function() {
				$(this).css({'z-index':'5', 'position':'relative'});
			});
		});

		$('#subnav li:not([class~=active])').hover(function() {
			$(this).find('img').show();
		},
		function() {
			$(this).find('img').hide();
		});

		/*$('#mainnav ul.l2').superfish({
			delay: 500,                            // one second delay on mouseout 
			animation: { opacity: 'show' },  // fade-in and slide-down animation 
			speed: 'fast',                          // faster animation speed 
			autoArrows: false,
			dropShadows: false
		});			*/
		// Alternate font replacement
		Cufon.replace("h1, .subnav-title", {color: '#78A22E'});
		//Cufon.replace("h2");
		
	}); 



})(jQuery);


$(document).ready(function() {

var showText='Show';
var hideText='Hide';

var is_visible = false;

$('.toggle').hide();
$('a.toggleLink').click(function() {

is_visible = !is_visible;

$(this).parent().next('.toggle').toggle('slow');
return false;
});
});
