$(document).ready(
	function() {

		// Open links with rel="external" in new window - like ye ole' target="_blank"
		$('a[rel="external"]').click(function() {window.open( $(this).attr('href') ); return false;});


		// Zebra-stripe data tables
		$("table.data tbody").each(function() {
			$(this).removeClass("odd even");
			$("tr:odd", this).addClass("odd");
			$("tr:even", this).addClass("even");
		});


		// Initialize Lightbox
		$(".lightbox").lightbox();
		
		//HomePage Take Action nav
		$('ul.actionitemlist').cycle({ 
			fx:     'scrollHorz', 
			prev:   '#left', 
			next:   '#right', 
			timeout: 0 
		});


/*----- Tab Link functions
------------------------------------------------------------*/		

		$("a.tablink1").click(function() {
			$("#tabnav").removeClass();
			$("#tabnav").addClass("tab1");
			

			$("ul#tabcontent li#content1").show();					
			$("ul#tabcontent li#content2").hide();
			
			$('a#FacebookMore').show();				
			$('a#BlogMore').hide();		
			
			return false;
		});
		
		$("a.tablink2").click(function() {
			$("#tabnav").removeClass();
			$("#tabnav").addClass("tab2");
			
			$("ul#tabcontent li#content1").removeClass('show');
			
			$("ul#tabcontent li#content1").hide();					
			$("ul#tabcontent li#content2").show();		
			
			$('a#FacebookMore').hide();				
			$('a#BlogMore').show();					
			
			return false;
		});
				

/*----------------------------------------------------------*/

/* Input Field Default Text
------------------------------------------------------------*/


		$(".defaultText").focus(function(srcc)
		{
			if ($(this).val() == $(this)[0].title)
			{
				$(this).removeClass("defaultTextActive");
				$(this).val("");
			}
		});
		
		$(".defaultText").blur(function()
		{
			if ($(this).val() == "")
			{
				$(this).addClass("defaultTextActive");
				$(this).val($(this)[0].title);
			}
		});
		
		$(".defaultText").blur();
		
/*----------------------------------------------------------*/
	
/* Hide section block when the map is viewed	
----------------------------------------------------------*/



/*----------------------------------------------------------*/
		 	
		$("body.About #sectionblock").html("<h3>The mission of Harvest Hope Food Bank is to provide for the needs of hungry people by gathering and sharing quality food with dignity, compassion and education.</h3>");	
		$("body.Donate #sectionblock").html("<h3>For every dollar you donate, 98 cents will go toward programs and services to benefit hungry people.</h3>");	
		$("body.Find #sectionblock").html("<h3>Each week Harvest Hope Food Bank distributes food and related products to more than 400 non-profit member agencies across 20 counties in central South Carolina.</h3>");	
		$("body.Get #sectionblock").html("<h3>Volunteers allow us to maintain a minimal paid staff, enabling us to put more money toward serving those in need.</h3>");	
		$("body.Agency #sectionblock").html("<h3>Welcome to the Agency Zone!</h3><h4>Here you'll find all the tools you need to be the best member agency you can be.</h4>");	
		$("body.Media #sectionblock").html("<h3>For more information on our media releases or to be added to our media distribution list, please email:</h3><br/><h5 class=\"title\">Communications Manager</h5><h5 class=\"name\">Skot Garrick</h5><a class=\"email\" href=\"mailto:sgarrick@harvesthope.org\">sgarrick@harvesthope.org</a><br/><h6><span>or call</span> (803) 254-4432 ext. 2107.</h6>");	
		$("body.Contact #sectionblock").html("<h3>Can't find what you're looking for?</h3><h4>Use the form on this page to contact us now. We'll respond to your message as soon as possible.</h4>");	
		$("body.Food #sectionblock").html("<h3>Once a product is in widespread use, unforeseen problems can sometimes lead to a recall. On this page you will find a list of the most current food recalls.</h3>");	

		Cufon.replace('ul.mainnav li a');
		Cufon.replace('#sectionblock');
		Cufon.replace('label');
		Cufon.replace('.calendarbox th');
		Cufon.replace('.calendarbox td h5');
		Cufon.replace('.calendarheader td.nextprevmonth a');
		Cufon.replace('.calendarheader td');
		
		$("#takeactionnav").addClass('show');
		$("ul#tabcontent li#content1").addClass('show');
		
		$("ul#tabcontent li#content1").show();					
		$("ul#tabcontent li#content2").hide();	
		
		var randNum = Math.floor(Math.random() * 6 + 1); 
		$('body.internal .containerbackground').addClass('containerbackground' + randNum);
		
		$('a#BlogMore').hide();
	}
);


