var t;

$(document).ready(function() {
	/*
	$(".bios").fancybox({
		'width'				:  670,
		'height'			: '100%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'scrolling'			: 'auto',
		'overflow-x'		: 'hidden'
	});
	*/
	
	initBinding();


	$('.video-popup').click(function() {
		$.fancybox({href:"/quicktime/fullpath_player.php?video=" + $(this).attr('href')});								 		return false;
    });

	t=setTimeout("buzzRotate()",5000);
});

function loadProjectPage(tag,page) {
	//$("#projects-list").fadeOut("slow", function() {alert('fadout done');});
	/*
	$("#header-title").fadeOut("slow", function() {
			$("#header-title").html(tag);
			$("#header-title").fadeIn("slow");		
		});
	*/
	
	$("#crumb-header").fadeOut("slow", function() {
			$("#crumb-header").html(tag);
			$("#crumb-header").fadeIn("slow");		
		});	
	
	
	$("#project-container").fadeOut("slow", function() {
			$('#project-container').load('/includes/ajax/load_project_page.php?t=' + escape(tag) + '&p=' + page, function() {
			  $("#project-container").fadeIn("slow");
			  initBinding();		
			});
		});
	
	

}

function initBinding() 
{ 
   /*
   $('.projects-list-popup').colorbox({iframe:true, innerWidth:425, innerHeight:344});
   */
   
   $('.projects-list-popup').fancybox({
		'width'				:  525,
		'height'			: 450,
		'autoScale'			: true,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'scrolling'			: 'auto',
		'overflow-x'		: 'hidden'
	}); 
}

var selectedBuzz = 1;
function buzzRotate() {
	selectedBuzz++;
	if ($('#buzz' + selectedBuzz).length == 0)
		selectedBuzz = 1;
	
	$(".buzz").hide();
	$('#buzz' + selectedBuzz).fadeIn("slow");		
		
	t=setTimeout("buzzRotate()",5000);
}

