// setup actions we want to happen on document ready
$(document).ready(function(){

	// initiate carousel
	$("#galleryCarousel").jCarouselLite({
		btnNext: "#galleryPrev",
		btnPrev: "#galleryNext",
		circular: "true",
		visible:4,
		easing: "expoinout",
		speed: 500,
		scroll: 4
	});
	
	// balance our columns
	//balanceColumnsWithFooter("#subCol1,#subCol2,#subCol3",true);   
		
	// set up drop cap
	swap_letter();

});

	 
	function swap_letter() {
		var first_paragraph = $('#divAuthorComment')[0];
        var text, current_paragraph;

		current_paragraph = get_text_node(first_paragraph); 
        if (current_paragraph)
		    text = current_paragraph.nodeValue;
		if (text != null)
		{
		    // Added by Hariharan Dec 27 2007 - remove trailing and leading spaces
		    text = text.replace(/^\s+|\s+$/g,"");
		    // Added by Hariharan Dec 27 2007 - remove trailing and leading spaces
    		
		    var first_letter = text.substr(0,1);
		    if ((first_letter.search(/[a-zA-Z0-9]/) > -1) && (text))
		    {
			    current_paragraph.nodeValue = text.slice(1);
    		    $('<div></div>').html(first_letter).addClass('dropCap').prependTo( current_paragraph.parentNode );
		    }
		}
	}

    //locate text node by traversing the bookblurb node
	function get_text_node(current_paragraph)
	{
	    var text_node;
	    
	    if (current_paragraph != null)
	    {
	        for(var i=0; i < current_paragraph.childNodes.length; i++)
	        {
	            if (current_paragraph.childNodes[i].nodeType == 3)
	                return current_paragraph.childNodes[i];
	            else
	            {
	               text_node = get_text_node(current_paragraph.childNodes[i]);    
	               if (text_node)
	                return text_node;
	            }
	        }
	    }
	    
	    return null;
	}
	

	// do our sifr setup
	var helvetica = {
	  src: '/sifr/helveticaCondensed2_v3.swf'
	};
	
	//sIFR.activate(helvetica);
	//sIFR.debug.ratios({ src: '/sifr/helveticaCondensed2_v3.swf', selector: 'h1' });
	
	
	//sIFR.replace(helvetica, {
	//  wmode: "transparent",
	//  selector: 'h1',
	//  ratios: [8,1.43,11,1.38,16,1.33,23,1.32,24,1.29,28,1.3,30,1.27,34,1.28,37,1.27,41,1.28,53,1.27,76,1.26,79,1.25,80,1.26,83,1.25,84,1.26,87,1.25,88,1.26,1.25],
	//  css: {'.sIFR-root': {'font-size': '54', 'color': '#000000', leading: -4, 'letter-spacing': -2.5, 'font-weight': 'bold'}}
	//});

