// remap jQuery to $
(function($){})(window.jQuery);


/* trigger when page is ready */
$(document).ready(function (){

	$("#foo1").carouFredSel({
		items : {
			visible			: 3
		},
		scroll : {
			items			: 1,
			duration		: 1000,
			pauseDuration	: 5000
		},
		auto	: true,
		prev	: "#foo1_prev",
		next	: "#foo1_next"
	});
	
	$("#media").carouFredSel({
		items : {
			visible			: 1,
			start			: true //starts on #item
		},
		scroll : {
			items			: 1,
			duration		: 500,
			pauseDuration	: 500,
			fx				: "fade"
		},
		auto		: false,
		prev		: "#media_prev",
		next		: "#media_next",
		circular 	: false
	});
	
	$("#team").carouFredSel({
		items : {
			visible			: 1,
			start			: true //starts on #item
		},
		scroll : {
			items			: 1,
			duration		: 500,
			pauseDuration	: 500,
			fx				: "fade"
		},
		auto		: false,
		prev		: "#team_prev",
		next		: "#team_next",
		circular 	: true
	});
	
	$(".colorbox").colorbox({iframe:true, width:"840px", height:"670px"});
	$(".newsletter").colorbox({iframe:true, width:"690px", height:"80%", title: function(){
		var url = $(this).attr('href');
		return '<a style="color:#333;" href="' + url + '" target="_blank">Open In New Window</a>';
	}
	});
	$(".inline").colorbox({inline:true, width:"650px"});
	$(".iframe").colorbox({iframe:true, width:"620px", height:"480px"});
	
	//Highlight current menu item
	var path = location.pathname;
	jQuery("a[href='" + path + "']").addClass("active");
	
	$('#login-trigger').click(function(){
		$(this).next('#login-content').slideToggle();
		$(this).toggleClass('active');                                  

		if ($(this).hasClass('active')) $(this).find('span').html('&#x25B2;')
			else $(this).find('span').html('&#x25BC;')
	})

});

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

/* optional triggers

$(window).load(function() {
	
});

$(window).resize(function() {
	
});

*/
