var rdx = {};
// main menu
rdx.fx = {
	slideDown: 600,
	slideUp: 600,
	trigger: 100,
	to: {}
};


function revealContent(){
	$('#page').addClass('active');  
	}     
	
function enableContent(){   
		$('#main').addClass('active');
		$('#sections > ul > li > ul').slideUp(rdx.fx.slideUp);
   }
/**
 * jQuery stuff
 */
$(document).ready(function() { 
	/*counter
	$("#gpec2009-counter").flash({
		src: '/&amp;res/swf/counter_gpec.swf',
		width: 235,
		height: 110,
		wmode: 'transparent'
	});*/


	//lightbox
	$("div.box div.boxFunction ul.pictures li.picture a").lightBox();

	$('#sections').mouseover(function (e) {
		rdx.fx.to.down = setTimeout(function() {
			$('#sections > ul > li > ul').each(function () {
				if($(this).is(':hidden')) {
					$(this).slideDown(rdx.fx.slideDown);
				}
			});
		}, rdx.fx.trigger);
		clearTimeout(rdx.fx.to.up);
	}).mouseout(function (e) {
		rdx.fx.to.up = setTimeout(function() {
			$('#sections > ul > li > ul').each(function () {
				if($(this).is(':visible')) {
					$(this).slideUp(rdx.fx.slideUp);
				}
			});
		}, rdx.fx.trigger);
		clearTimeout(rdx.fx.to.down);
	});
	
	setTimeout(revealContent,2500);	
	setTimeout(enableContent,4000);	
		


	// slideshow
	rdx.slide = {
		height: 250,
		object: false
	}
	$('div.boxArticlesSlideshow > div.boxContent > div.boxFunction > ul.articles > li').each(function() {
		if(!rdx.slide.object) {
			rdx.slide.object = $(this).parent();
		}
		var currentHeight = $(this).height();
		if(currentHeight > rdx.slide.height) {
			rdx.slide.height = currentHeight;
		}
	});
	$(rdx.slide.object).css({'height':rdx.slide.height}).cycle('fade');

	// ie6 hover fix; pngfix
	if($.browser.msie && $.browser.version.substr(0,1) <= 6) {
		$('#subdomains > ul > li').hover(
			function () {
				$(this).addClass('hover');
			},
			function () {
				$(this).removeClass('hover');
			}
		);
		$('#sections > ul > li').hover(
			function () {
				$(this).addClass('hover');
			},
			function () {
				$(this).removeClass('hover');
			}
		);
		$(document).pngFix();        
		
		
		
		
	}

	// comment form focus fix
	$('.focus').each(function () {
		var defaultValue = $(this).val();
		if(defaultValue.length > 1) {
			$(this).click(function () {
				var currentValue = $(this).val();
				if(currentValue == defaultValue) {
					$(this).val('');
				}
			}).blur(function () {
				var currentValue = $(this).val();
				if(currentValue.length == 0 || currentValue == defaultValue) {
					$(this).val(defaultValue);
				}
			});
		}
	});



	// flash bg
/*	rdx.bg = {
		width: 0,
		height: 0,
		resizeTimer: null,
		setWidth: function() {
			rdx.bg.width = $.browser.msie && $.browser.version.substr(0,1) < 7 ? $(document).width() - $('#page').outerWidth(true) - 22 : $(document).width() - $('#page').outerWidth(true);
		},
		setHeight: function() {
			rdx.bg.height = $('#page').outerHeight(true);
		},
		render: function() {
			$('#bg').hide().show();
			rdx.bg.setWidth();
			rdx.bg.setHeight();
			if(rdx.bg.width > 100) {
				$('#bg').width(rdx.bg.width).height(rdx.bg.height).flash({
					src: '/&res/swf/bg_gpec.swf',
					width: '100%',
					height: '100%'
				});
			}
			else {
				$('#bg').hide();
			}
			//console.dir(rdx.bg);
		},
		resize: function() {
			$('#bg').width(rdx.bg.width);
		}
	};
	$(window).resize(function (e){
		if (rdx.bg.resizeTimer) clearTimeout(rdx.bg.resizeTimer);
		rdx.bg.resizeTimer = setTimeout(function () {
			rdx.bg.render();
		}, 100);
	});
	rdx.bg.render(); 
*/	
});