﻿function processSlideshow(elem, imageList, imageAlt, imageDuration, fadeSpeed, current) 
{
	var listSize = imageList.length;
    if (!current || current >= listSize) current = 0;
    if (!imageDuration) imageDuration = 2000;
    if (!fadeSpeed) fadeSpeed = 1000;
    $(elem + " img").attr({src: imageList[current], alt: hpAltTags[current]} );
   
    if (current == (listSize - 1)) { $(elem).css("background", "transparent url(" + imageList[0] + ") no-repeat");
    } else {
        $(elem).css("background", "transparent url(" + imageList[current + 1] + ") no-repeat");
    }
    $(elem + " img").animate({ opacity: "1" }, imageDuration).
	      animate({ opacity: "0.01" }, fadeSpeed, function() 
		   { 
		     $(this).css("opacity", "1"); processSlideshow(elem, imageList, imageAlt, imageDuration, fadeSpeed, current + 1) 
			});

} 
function startSlideshow()
{
      processSlideshow(".hplogo-container", hpLogoArr, hpAltTags, 3000, 900);
}


  $(document).ready(function(){
	//On Click Event
	$(".block").click(function() {
        $(".finder-contents").hide(); //Hide all content
		var activeFinder = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeFinder).fadeIn(300); //Fade in the active ID content
		try {pageTracker._trackPageview("/WelcomeTool/"+activeFinder)} catch(err) {}
		return false;
	});
	$(".block").click(function() {
	        var activeFinder = $(this).find("a").attr("href")
	        $('a.more.finder').hide()
		    $(activeFinder).find("a.more").show()
    		$('.button-container').animate({marginTop: 40 }, 400);
			$('#welcome').animate({opacity: 0.05}, 100);
			$('.block').animate({height: 52, paddingTop: 28, marginTop: 22 }, 400);
			$('.block').removeClass('active')
			$(this).addClass('active')
			$('#finder-content').slideDown(400).animate({height:190 }, 400);	
  	});
	 $(".close").click(function() {
	        $('#finder-content > .more').hide()
	        $('.button-container').animate({marginTop: 6 }, 300);
			$('#welcome').animate({opacity: 1}, 20);
			$('.block').animate({ height: 64, paddingTop: 46 }, 300);
			$('.block').removeClass('active')
			$('#finder-content').slideUp(200);
			return false;	
	 })
	$(".block").hover(
      function () {$(this).addClass('hover')}, 
      function () {$(this).removeClass('hover')}
    );
	$(".block").corner('5px');
	$("#finder-content").corner('5px');
	$(function() {
	    $("div.scrollable").scrollable({size: 2});
    });
    
    	   //define a javascript array that contains your images
		
		



       startSlideshow()
  });

