// JavaScript Document

$(document).ready(function () {	

	/* Every other row GREY (use display:none row's to equalize when isn't working correctly  */ 
	$('#reports tr:not(".thead_head"):even').css('background', '#ccc');
	
	$('.toggle_results').click(function(e){
		$('#poll_results').toggle();
		e.preventDefault();
	});
	
	/* Subnav Drop Down */
	$('#nav li').hover(
		function () {
			//show its submenu
			$('ul', this).slideDown(250);

		}, 
		function () {
			//hide its submenu
			$('ul', this).slideUp(250);			
		}
	);

	$('#nav li ul li:last a').css('border-bottom','none');

	
	/* <div class="expanding green">62%</div> in HTML to work this*/
	$('.expanding').each(function(){
		var size = $(this).html();
		$(this).css('width', size);
		var stuff = $(this).html();
	
		$(this).parent().next('td').html(stuff);
		$(this).parent().next('td').css(
			{'padding-left' : '15px',
			'padding-right' : '20px',
			'color' : '#099'
			
			});
		$(this).html('');
		
	});
	
	 $('#homeGallery').gallery({// set up gallery options
		'imageNextPrev' : false,
		'pager' : '#pager',
		'pagerType' : 'numbers', // false, div, numbers, images
		'onHoverStop' : true,
		'transitionType' : 'fade'
		}); 
		
		
	function minHeight(divName) { // min height function to set all heights equal to heighest value
        var minHeight = 0;
        var element = $(divName);
        element.each(function () {
            if ($(this).height() > minHeight) {
                minHeight = $(this).height();
            }
        });
        $(divName).height(minHeight); // set largest height
    }
    
    
    minHeight(".boxArea");
	
	

	
});

