﻿/*****************************************************************/
/*  This template uses the following for javascript:            
/*  jQuery:  JavaScript class library.  To use, make sure 
/*           jquery-1.2.6.min.js and jquery.curvycorners.min.js
/*           is included in your pages.  Then, make method calls to
/*           execute javascript code from here. jQuery library on 
/*           the internet is best place to start  
/*
/*  File path: jquery.js is most likely to be located in the 
/*             includes folder...
/*****************************************************************/

/******************* VARS ***************/

/************** DOCUMENT READY ****************/
/*  All jquery must start with this function
/*  and all other functions go in side it!  
/***********************************************/
$(document).ready(function()
{
    //---------------------------------- CHANGES TO LAYOUT AND CSS ----------------------------//
    /******* corner the div.outer *********/
    $("#bodyborder").corner();
    $(".outer").corner();
    $(".photoholders").corner();
    
    //---------------------------------- Page functions ----------------------------------------------//
    //slide show on home.asp for success stories and callback function to show appropriate text
    //pagerAnchorBuilder:  this creates thumbnails which are then styled in css by class=successthumbnails
    $("#success").cycle({
        fx:'fade',
        speed: 500,
        timeout: 10000,
        after: onAfter,
        pager:'#successthumbs',
        pagerEvent: 'mouseover',
        pagerAnchorBuilder: function(idx,slide){
            return '<a style="display:inline-table" href="'+slide.id+'"><img src="' + slide.src + '" class="successthumbnails" /></a>'; 
        }
    });	
	
	/******* handles the descriptions for each success image by substituting text in successdetails div *********/
	function onAfter(idx,slide)
	{
	    var num = slide.src.charAt(slide.src.length-5);
	    var text = "#story"+num;
        $("#successdetails").html($(text).html());
	}
	
	$("#successthumbs").hover(function(){
		$("#success").cycle('pause');
	},function(){
		$("#success").cycle('resume');
	});
	
	$("#success").hover(function(){
		$("#success").cycle('pause');
	},function(){
		$("#success").cycle('resume');
	});
	
	/***********************************************************************************************************/
});
