$(function () {
	// clear search default text on focus
	$(".clearDefault").focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
	// submit forms with links
	$("a.submit").click(function(){	
		$(this).closest("form").submit();
		return false;	
	});
	$('form input').keypress(function(e){
		var c = e.which ? e.which : e.keyCode;
		if(c == 13){
		    $(this).closest('form').submit();
		} 
	});
	// features 
	$("a.prevPop").click(function(){	
		$.fancybox.prev();
		return false;	
	});
	$("a.nextPop").click(function(){	
		$.fancybox.next();
		return false;	
	});
	// biblio
	$("div.hidden").hide();
	$("a.biblio").click(function(){	
		$("div.hidden").stop().slideUp(200);
		$(this).parent().next('div.hidden').stop().slideToggle(200);
		return false;	
	});
	// videos
	$(".popup").fancybox({
		'type'				: 'iframe',
		'width'				: 640,
		'height'			: 390,
		'overlayOpacity'	: '0.6',
		'overlayColor' 		: '#000000',
		'speedIn'			: 300,
		'speedOut'			: 300,
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'hideOnContentClick': true,
		'autoDimensions'	: true,
		'titlePosition'		: 'outside'
	});
	// info popup
	$(".popup2").fancybox({
		'type'				: 'inline',
		'autoDimensions'	: false,
		'width'				: 640,
		'height'			: 350,
		'overlayOpacity'	: '0.6',
		'overlayColor' 		: '#000000',
		'speedIn'			: 300,
		'speedOut'			: 300,
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'hideOnContentClick': true,
		'autoDimensions'	: true,
		'titlePosition'		: 'outside',
		'showNavArrows'		: false
	});
});
