// JavaScript Document

$(document).ready(function(){

	var cycleFx = "fade";

	/*
	if( navigator.userAgent.match(/Firefox/gi) == "Firefox" ) {
		cycleFx = "fade";
	}
	*/
	
	$('.home-page-hero').cycle({
		fx: cycleFx, // choose your transition type, ex: fade, scrollUp, shuffle, etc... fx: 'scrollHorz', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout:  7500,
		//startingSlide: Math.floor(Math.random()*$('').size()),
		next: '.hero-next',
		prev: '.hero-prev',
		after:   onAfter,
		cleartype:  true,
		cleartypeNoBg:  true
		/*,
		cssAfter : {
			width: 865,
			display : "block"
		},
		cssBefore : {
			width: 865,
			display : "block"
		}
		*/
	});
	
	$("ol.project-list li, ol.press-list li").click(function () {
		var $url = $(this).find("a").attr("href");
		if ( $url != undefined ) {
			window.location=$url;
		}
		return false;
	});	

	
	
});

function onAfter(curr,next,opts) { 
	$(".home-page-hero-link a").attr("href", $(this).find("img").attr("data-url"));
	$(".home-page-hero-info").html($(this).find("img").attr("alt"));
	$(".home-page-hero-meta .pager .counter").html( (opts.currSlide + 1) + "/" + opts.slideCount);
}

