//GLOBALS
var defaultIGSettings = {
	phpFile: '/wp-content/themes/thinkandinnovate2010/js/imagegallery.php',
	mouseInfoDiv: {
		previousCSS: {
			'background': 'url(/wp-content/themes/thinkandinnovate2010/images/imagegallery_previous.png) center center no-repeat',
			'opacity': .6
		},
		nextCSS: {
			'background': 'url(/wp-content/themes/thinkandinnovate2010/images/imagegallery_next.png) center center no-repeat',
			'opacity': .6
		},
		closeCSS: {
			'background': 'url(/wp-content/themes/thinkandinnovate2010/images/imagegallery_close.png) center center no-repeat',
			'opacity': .6
		},
		mouseDistance: {
			top: 7,
			left: 0
		}
	}
}

$(document).ready(function() {
	$(document).pngFix();
	
	$('#more-news').toggle(function() {
		$('#toolbar').animate({height: "300px"}, {easing: "easeInQuart", duration: 300}).addClass('active');
	}, function() {
		$('#toolbar').animate({height: "33px"}, {easing: "easeInQuart", duration: 300}).removeClass('active');
	});

	if($('#start-flash').length > 0) {
		swfobject.embedSWF("/wp-content/themes/thinkandinnovate2010/main.swf", "start-flash", "100%", "100%", "9.0.0", "", {}, {wmode: "transparent"});
	}
	
	if($('#about-flash').length > 0) {
		swfobject.embedSWF("/wp-content/themes/thinkandinnovate2010/videoplayer.swf", "about-flash", "312", "244", "9.0.0", "", {}, {wmode: "transparent"});
	}
	
	$('.post table').addClass('post-table')
	
	$('.post table tr').each(function() {
		if($(this).find('td').length > 1)
			$(this).find('td:first').addClass('first-td');
	});
	
	$('.post table tr a[href=#]').click(function() {
		$(this).parent().parent().parent().find('tr.hidden').hide();
		
		var next_tr = $(this).parent().parent().next();
		
		if($(next_tr).hasClass('hidden')) {			
			$(next_tr).toggle();
		}
	});
	
	$(':radio').addClass('radio');
});

function toggleFields(id, display) {
	var opposite = (display) ? false : true;
	
	$(id).each(function(i) {
		if($(this).hasClass('hidden'))
			if(display)
				$(this).show();
			else
				$(this).hide();
		else
			if(opposite)
				$(this).show();
			else
				$(this).hide();
	});
}