;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);


$(document).ready(function() {

var rc =$('.element').size();
var lastpage = parseInt(rc)-4;
var panewidth = rc * 175

	$(".elements").width(panewidth);
	
		$("#numresults").empty();
		if(parseInt(rc)==1){
			$("#numresults").html('1 record found.');
		}
		else{
			$("#numresults").html(''+rc+' records found.');
		}

if(parseInt(rc) < 5){
				 $("#searchNav").empty();
}
			$("dl.faq dt").each(function() {
		$("#faqnav").append($( "<li><a class=anchorLink href=#"+ $(this).attr("id") + ">" + $(this).text() + "</a></li>" )
		);
});
			
				
	$("a.anchorLink").click(function () {	
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top;
   	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-120}, 800 );
						return false;
		})
	


jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

	
$.easing.easeInCirc = function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;

	}

		//by default, the scroll is only done vertically ('y'), change it to both.
	$.scrollTo.defaults.axis = 'x'; 			
	//this one is important, many browsers don't reset scroll on refreshes
	$('div.pane').scrollTo(0);//reset all scrollable panes to (0,0)
	$.scrollTo(0);//reset the screen to (0,0)



var $paneTarget = $('#pane-target');

$('.next').click(function(){																				
		if ($("#pane-target").is(":animated")) {
			return false;
		}
		else {
			$paneTarget.stop().scrollTo( {top:'0px',left:'+=175'}, 1000, { easing:'easeInCirc'} );
		}																								
});


$('.nextPage').click(function(){		 
	if ($("#pane-target").is(":animated")) {
			return false;
		}
		else {
			$paneTarget.stop().scrollTo( {top:'0px',left:'+=700'}, 1000, { easing:'easeInCirc' } );
 }			
});
	
$('.prev').click(function(){
		if ($("#pane-target").is(":animated")) {
			return false;
		}
		else {
		$paneTarget.stop().scrollTo( {top:'0px',left:'-=175'}, 1000, { easing:'easeInCirc' } );
		}
});

$('.prevPage').click(function(){
		if ($("#pane-target").is(":animated")) {
			return false;
		}
		else {
		$paneTarget.stop().scrollTo( {top:'0px',left:'-=700'}, 1000, { easing:'easeInCirc' } );	
		}
});



$('#eventExternal').click(function() {
     var checked = $(this).attr('checked');
       if (checked) {
         $("tr.eventInternal0").show()
       } else {
         $("tr.eventInternal0").hide()
       }
     });
	 
$('#eventInternal').click(function() {
     var checked = $(this).attr('checked');
       if (checked) {
         $("tr.eventInternal1").show()
       } else {
         $("tr.eventInternal1").hide()
       }
     });	






});
