/* <![CDATA[ */

// JOB FAIRS INSIDE PAGE, TOGGLE OF LESS MORE
jQuery(document).ready(function() {
	// alternate colors for each row
	jQuery('table#jobData tr.event:odd').addClass('alt');
	jQuery('table#jobData tr.mInfo:odd').addClass('alt');

});

// http://adipalaz.awardspace.com/experiments/jquery/expand.html

(function($) {
$.fn.expandAll = function(options) {
    var defaults = {
         trigger1 : '+ Expand All',
         trigger2 : '- Collapse All',
         cllps : 'tr.mInfo',
         exp : 'a.moreInfo',
         container : '#' + this.attr("id") + ' ',
         ref : 'tr',
         showMethod : 'show',
         hideMethod : 'hide',
         speed : ''
    };
	
    var o = $.extend({}, defaults, options); 
	
    return this.each(function() {
        $('table#jobData th:eq(1)').append('<a class="expCol" href="#">' + o.trigger1 + '</a>');
		
		$(this).find('a.expCol').click(function() {
        var $cllps = $(this).closest(o.container).find(o.cllps),
            $exp = $(this).closest(o.container).find(o.exp);
        if ($(this).text() == o.trigger1) {
          $(this).text(o.trigger2);
          $exp.parents('tr').addClass('exp').next().removeClass('hide');
		  $exp.text('- Less Info');
          $cllps[o.showMethod](o.speed);
        } else {
          $(this).text(o.trigger1);
          $exp.parents('tr').removeClass('exp').next().addClass('hide');
		  $exp.text('+ More Info');
          $cllps[o.hideMethod](o.speed);
        }
        return false;
    });
});};

})(jQuery);

$(function() {
    jQuery('#jobData').expandAll().find('tr.mInfo').addClass('hide');
	jQuery('td.fairName').append('<br /><a href="#" class="moreInfo" title="Expand/Collapse">+ More Info</a>');
    
    $('#jobData a.moreInfo').click(function() {
	
			
	if ($(this).text() == '+ More Info') {
    $(this).text('- Less Info');
	jQuery(this).parents('tr').addClass('exp').next().removeClass('hide').addClass('show');
	}
	
	else if ($(this).text() == '- Less Info') {
    $(this).text('+ More Info');
	jQuery(this).parents('tr').removeClass('exp').next().removeClass('show').addClass('hide');
	}
	
		var minfo = $('#jobData tr.mInfo').length;
		var visible = $('#jobData tr.mInfo:hidden').length;
		// alert(visible);
		
		if (visible == minfo) {
		$('a.expCol').text('+ Expand All');
		}
		else if (visible == 0) {
		$('a.expCol').text('- Collapse All'); 
		}
		
    return false;
    });
	
	
});


/* ]]> */
