/**
 * @author brandon
 */
// no conflicts with other frameworks
var $j = jQuery.noConflict();

//callbacks for carousel
function mycarousel_initCallback(carousel) {
    
    $j('.next').bind('click', function() {
        carousel.next();
        return false;
    });

    $j('.prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

$j(function() 
{
	// homepage rotator
	$j('#rotator-ad').cycle(
		{
			timeout:5000,
			cleartype: 1,
			pause:0, 
			pager:'#rotator-nav'
		});
	
	// slide homepage rotator-nav in
	$j('#rotator').hover(function()	
		{
			$j('#rotator-nav').slideToggle("fast");
		},function()
		{
			$j('#rotator-nav').slideToggle("fast");
		});

		
	//open windows without embedding target="_blank"
	$j('a[@rel$=external]').click(function()
		{
			this.target = "_blank";
		});

	//fix png transparency in IE<6 img[@src$=.png]
	$j('img[@src$=.png]').ifixpng();
	
	// round corners
	$j('#sidebar .nav').corner("7px");
	
	//j-carousel
	$j('#featured-list').jcarousel({
        scroll: 3,
		wrap: "both", 
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
	
	// flickr pull
	$j("#photos").flickr({   
		type: 'search',
	    api_key: '4b72700c62b16771aca731e359a0ed74',	//flickr api key
		user_id: '31608062@N03', // flickr user id
		//photoset_id: '72157602268911633', // flickr photoset id
	    per_page: 6,
		tags: 'messianic',
		callback: boxCallback
  	});
	

	
});

//flickr json pull to lightbox function
function boxCallback(el){
  $j('#photos a').lightBox();
}

//Giving form show/hide

function showDiv(id) {
	document.getElementById(id).style.display = 'block';
}

function hideDiv(id) {
	document.getElementById(id).style.display = 'none';
}

function hideContributionLength(){
	hideDiv("monthly_commitment");
}

function showContributionLength(){
	showDiv("monthly_commitment");
}

function hideGivingMethodBank(){
	hideDiv("divGivingMethodCard");
	showDiv("divGivingMethodBank");
}

function hideGivingMethodCard(){
	hideDiv("divGivingMethodBank");
	showDiv("divGivingMethodCard");
}
