$(document).ready(function(){
	$('#social_bookmarks').bookmark({sites: ['misterwong', 'linkarena', 'webnews', 'yigg', 'delicious', 'digg', 'facebook', 'google', 'yahoo']}); 
	
	$all_nav = $('#header-main_menu > div, #footer-main_menu > div');
	
	$all_nav.mouseover(function(){
		$all_nav.not(this).find('ul').stop(1,1).slideUp('fast');
		$(this).stopTime('navTimer');
		$(this).find('ul').stop(1,1).slideDown('fast');
	}).mouseout(function(){
		$curr_subnav = $(this);
		$(this).oneTime('300ms', 'navTimer', function() {
			$curr_subnav.find('ul').slideUp('fast');
		});
	});
	
	/* $('#header-main_menu > div, #footer-main_menu > div').hover(function(){
		$(this).find('ul').stop(1,1).slideDown('fast');
	}, function(){
		$curr_subnav.find('ul').stop(1,1).slideUp('fast');
	}); */

	
	setInterval('slideSwitch("#header-slideshow")', 10000 );

	$('#content .col1, .col0_box').equalizeCols();
	$('#mailform fieldset').not(".noequalize").equalizeCols();
	$('.eHeight').each(function(){
		$('.box', this).equalizeCols();
	});

	// $('a.zoom').colorbox();

	$('a.zoom').slimbox({/* Put custom options here */}, null, function(el) {
		return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
	});
	
	if(history.length < 2) {
		$('.news-single-backlink').css('visibility','hidden');
	}
	
	toggleStatus('#fh-ownbooth','#fh-hall,#fh-booth');
	toggleStatus('#fh-interest2','#fh-spec_comp');
	toggleStatus('#fh-interest3','input[id^=fh-centrum]');
	toggleStatus('#fh-interest4','#fh-interest4_txt');
	
});

$(window).load( function() {
	
});

function slideSwitch(el) {
	var $act = $('div.act', el);
	
	if ( $act.length == 0 ) $act = $('div:last', el);

	// use this to pull the divs in the order they appear in the markup
	var $next =  $act.next().length ? $act.next() : $('div:first', el);

	// uncomment below to pull the divs randomly
	// var $sibs  = $act.siblings();
	// var rndNum = Math.floor(Math.random() * $sibs.length);
	// var $next  = $($sibs[rndNum]);

	$act.addClass('cur');

	$next.css({opacity: 0.0}).addClass('act').animate({opacity: 1.0}, 2000, function() {
            $act.removeClass('act cur');
        });
}


function toggleStatus(checkbox,input) {
	if ($(checkbox).is(':checked, :selected')) {
		$(input).removeAttr('disabled');
	} else {
		$(input).attr('disabled', true);
	}   
}