/* Author: 

*/

var slideShowSpeed = 7000;
var slideshowStatus = 1;
var id;
var timeOut;

$(document).ready(
	function(){

 

$('#scroller img').css({opacity:0});
$('#scroller img').animate({opacity:1},1500);
	
		
var scroller = $('#scroller ul').cycle({
			//fx: 'scrollLeft',
			speed: 1000,
			easing: 'easeInOutQuad',
			timeout: slideShowSpeed,
			random: 1,
			delay: -1000
		});
		
	
$('#our_work_grid li span').hide();
$('#our_work_grid li').hover(
	function(){
		$(this).find('span').show();
		},
	function(){
		$(this).find('span').hide();
		}
	)

	if ($('#frontpage .newsList').get(0)) {
		$('#frontpage .newsList').cycle({
			fx:	'fade',
			timeout: 5000,
			speed: 1500,
			sync: 0,
			pause: 1,
			slideExpr:'li',
			cleartype:0
		});
	}



if ($('#projectList').get(0)) {

var myTable;

$('.directFilter').click(function(){
		var myValue = $(this).html();
		$('#projectList_filter input').val(myValue);
		myTable.fnFilter(myValue);
		} );


myTable = $('#projectList').dataTable({
			"bPaginate": false,
			"oLanguage": {
				"sSearch": "Filter:",
				"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
				"sInfoFiltered": "(filtered from _MAX_ total entries)",
				"sInfoPostFix": "<a href='/about/projects/' id='clearFilter'>Show all</a>"
				}
			}) 


function filterTable(filter) {
		$('#projectList_filter input').val(filter);
		myTable.fnFilter(filter);
}

}


// Project page hash filter
if(($('body').attr('id') == 'projects')  && window.location.hash) {
	var h = $.URLDecode(window.location.hash);
	var filter = h.substring(1);
	filterTable(filter);		
	}

// Work page hash filter
if(($('body').attr('class') == 'work')  && window.location.hash) {
	var h = window.location.hash;
	var filter = h.substring(1);
	//filterTable(filter);
	$('#workList li').show();
	$('#workList li:not(.'+filter+')').hide();
}

			
$('#map li').each(function(i){
		$(this).addClass("hidden").fadeTo(1000, 0, function() {
			$(this).removeClass("hidden")
		}).fadeTo(i*100, 0).fadeTo("slow", 1);
})

$('#map li span').hide();

$('#map li').hover(
	function(){
		$(this).css('z-index',1000);
		$(this).find('span').show();
	},
	function() {
		$(this).css('z-index', '500');
		$(this).find('span').hide();
	}
)




$("label").inFieldLabels();


if ($('#freeform').get(0)) {
	$("#freeform").validate();
	}


if ($("#newsticker").length > 0) {
	$("#newsticker dl").cycle({
			fx:	'fade',
			timeout: 5000,
			speed: 1500,
			sync: 0,
			pause: 1,
			slideExpr:'dd',
			cleartype:0
	});
}

$(".slideshow").cycle({
		timeout: 0,
		next: $(".slideshow")
});


$(".video-js").VideoJS()


})


