// JavaScript Document
$(function(){
		   
	$("#agat-at-a-glance .slides").cycle({
		speed: 1,
		pager: '#nav-agat-at-a-glance',
		pagerAnchorBuilder: function(idx, slide) { 
			return '#nav-agat-at-a-glance li:eq(' + idx + ') a'; 
		},
		pagerClick: function(){ 
			$('#agat-at-a-glance .slides').cycle('pause');
		},
		activePagerClass: 'active'
	});	
	$("#agat-at-a-glance .slides").cycle('pause');
	$("body").snappyPlaceholder();
	/* pager dots */
	$("[name=e_services]").unbind('change').bind('change',function(){
		if($(this).val()!=""){
			var conf = confirm("The selected eService will now open in a new browser window.");
			if(conf) {
				window.open($(this).val(),'_blank');
			} else {
				$(this).val("").trigger('change');
			}
		}
	});
	/* e-services select box */
	$("#nav-agat-at-a-glance li").bind('click',function(){
		$("#pager-agat-at-a-glance .active").removeClass('active');
		var pager = $("#pager-agat-at-a-glance a").get($(this).index());
		$(pager).addClass('active');
	});
	$("#pager-agat-at-a-glance a").bind('click',function(){
		var index = $(this).parent().index();
		var tab = $("#nav-agat-at-a-glance a").get(index);
		$(tab).trigger('click');
		return false													 
	});
	
});
