$(document).ready (function(){
	$('#nav li').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	$('.contact-box').css('display','block');
});

function checkHeight(){
	var h = $('#aside').height() + 200;
	//if (this_is_ie6) h = h+20;
	$("#debugger").html($("#debugger").html() + $("#twocolumns").height() + "px\n") ;
	$("#debugger").html($("#debugger").html() + $('#aside').height() + "px\n") ;
	if ($("#twocolumns").height() < h) {
		/*$("#twocolumns").animate({
			height: h
			},"fast");*/
        $("#twocolumns").css("height",h + "px"); 
        $("#debugger").html($("#debugger").html() + $("#twocolumns").height() + "px\n") ;
	}
}

var chkhtint = false;
var war_child = false;

function initMenu() {
	$('#nav ul').hide();
	$('#nav li a').click(function() {
			var checkElement = $(this).next();
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				checkElement.slideUp('normal');
				checkElement.parent().removeClass('active');
				return false;
		}
		if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$('#nav ul:visible').slideUp('normal');
			$('#nav ul:visible').parent().removeClass('active');
			chkhtint = setInterval('checkHeight()',100);
			checkElement.slideDown('normal',function(){
				clearInterval(chkhtint);
			});
			checkElement.parent().addClass('active');
			return false;
		}
	});
	/*$('#nav ul li').mouseleave(function(){
		$('#nav ul:visible').slideUp('normal');
		$('#nav ul:visible').removeClass('active');
	});*/
	var el = $('#nav li.current_page_item').parent();
	if (el.is('#nav')) {
		$('#nav li.current_page_item a').trigger("click");
		war_child = true;
	} else {
		el.parent().children("a").trigger("click");
		war_child = true;
	}

}
$(document).ready(function() {
	initMenu();
	if (this_is_ie && $("#twocolumns").height() < 320) $("#twocolumns").css("height","320px");
	if (this_is_ie && war_child && $("#twocolumns").height() < 500) $("#twocolumns").css("height","500px");
	$("#debugger").html($("#debugger").html() + $('#twocolumns').height() + "px\n") ;
	$("#debugger").html($("#debugger").html() + $('#aside').height() + "px\n") ;
	$("#debugger").html($("#debugger").html() + $('#nav').height() + "px\n") ;
	checkHeight();
	//setInterval("show_title()",5000);
	setTimeout('setInterval("show_title()",10000)',2500);
	$('#topslider').DDSlider({
		columns: 12,
		rows: 3,
		waitTime: 10000,
		duration: 800,
		stopSlide: 0
	});
	setTimeout('show_title()',2500);
	
});
function show_title() {
	setTimeout("hide_title()",7000);
	$('div.slide_title').animate({
		opacity: 0.7
	},600);
}
function hide_title() {
	$('div.slide_title').animate({
		opacity: 0
	},400);

}

