/*
File: jquery.config.js
Copyright: (c) 2011 Brand Rich Media
Author: Brandon Neil Richards
Author URI: http://www.brandrichmedia.com/
*/

function onBefore() { 
	
	$('.photo-headline h1').empty();
	$('.photo-headline p').empty(); 

} 
function onAfter() { 

	var theheader = $(this).attr("title");
	var thecaption = $(this).find('img').attr("alt");
    $('.photo-headline h1').html(theheader);
    $('.photo-headline p').html(thecaption); 
  
}

$(function() 
{
		
		// jquery.cycle.min.js
		$('.slides').cycle({
			fx:     'fade', 
	    	timeout: 7500,
			height: '295px',
	 		pause: 1,
	 		before:  onBefore, 
	 		after:   onAfter,
	 		prev: '#prev',
	 		next: '#next'
		});
		
		
		// open close archive lists
		//toggle archives
				$("#2010, #2011, #2012").siblings().hide();
				  //toggle the componenet
				  $("#2010, #2011, #2012").click(function()
				  {
				    $(this).siblings().slideToggle(600);
				  });
				
				//add hand icon to event selectors
				$('.archives dt').hover(function() 
				{
			   		$(this).addClass('hand');
				}, function() {
					$(this).removeClass('hand');
				});
		
		// remove input text
		$('.rmv').click(function() {
			if (this.value == this.defaultValue) {
				this.value = '';
			}
		});
		
		$('.rmv').blur(function() {
			if (this.value == '') {
				this.value = this.defaultValue;
			}
		});
		
		//open windows without embedding target="_blank"				
		$('a[rel="external"]').each(function() {
			$(this).attr('target', '_blank');
		});
		

});
