// variables for faq ticker
var faqTips;
var curritem=0;
var paused = false;
var itemID = document.location.href.match(/\#\w+$/);
	itemID = (itemID)?itemID.toString():null;
//when doc is ready
jQuery(faqFXInit);
// ticker function
function faqTick() {
	if( !paused ) {
		$("div.tip:eq("+curritem+")").fadeOut("slow", function() {
			curritem = ++curritem%faqTips;
			$("div.tip:eq("+curritem+")").fadeIn("slow");
		});
	}
}
//pause button function
function pauseBtn(){
	if(paused == true){
		$("#pause span").html("start");
	}
		if(paused == false){
		$("#pause span").html("pause");
	}
}
//faq FX init
function faqFXInit(){
	//hightlight an item if coming from another page to a specific item
	if( itemID != null){
		$(itemID).addClass( "highlight" );
	}
//scoll to a faq and pause the ticker
	$("div.faqlinks a").click(function(){
		$( "div.faq h3" ).removeClass( "highlight" );
		window.scrollBy(0,1);
		var linkRel = $(this).attr("rel");
        var offSet = $(linkRel).offset().top;
        $( linkRel ).addClass( "highlight" );
		$( "html,body" ).animate({scrollTop: offSet}, 1000);//ScrollTo(990);
		return(false);
	});
//scroll to the top
	$("a.toplink").click(function(){
        var offSet = "-"+$(this).offset().top
        $("html,body").animate({scrollTop: offSet}, 2000);
        $( "div.faq h3" ).removeClass( "highlight" );
		return(false);
	});
// grab the size of the tips, hide them and run the ticker function
	if( $( "div.tip" ).size() > 0 ){
		faqTips = $("div.tip").size();
		$("div.tip").hide();
		$("div.tip:eq("+curritem+")").fadeIn("slow");
		$("#pause").toggle(function() { paused = true;pauseBtn(); },function() { paused = false;pauseBtn(); } );
		setInterval("faqTick()",10000);
	}
}