$(function() {
	function setContentHeight() {
		var contentH = $('#content').height() - $('#cnt-top-left').height();
		var cntContentH = $('#cnt-content').height();
		if (contentH > cntContentH) {
			$('#cnt-content').height(contentH);
		}
	}
	$('input[type="text"]').focus(function() {
		var $this = $(this);
		if ($this.hasClass('text-def') && $this.val() == $this.metadata().defval) {
			$this.removeClass('text-def').val('');
		}
	}).blur(function() {
		var $this = $(this), defVal = $this.metadata().defval;
		if ($this.val() == '' || $this.val() == defVal) {
			$this.addClass('text-def').val(defVal);
		}
	});
	setContentHeight();
	
	// Left menu

	$('#main-menu .text-container').bind('mouseenter', function() {
		var $this = $(this);
		$this.find('ul.sub').show();
	}).bind('mouseleave', function() {
		var $this = $(this);
		$this.find('ul.sub').hide();
	});
	
	$('#main-menu .text-container .sub li.expand').each(function(i){
		i = i+1;
		var parent = $(this);
		parent.hover(function(){
			parent.find('ul.inner').show();
		},function(){
			parent.find('ul.inner').hide();
		});
	});

	$('#main-menu .text-container .sub li.expand2').each(function(i){
		i = i+1;
		var parent = $(this);
		parent.hover(function(){
			parent.find('ul.inner2').show();
		},function(){
			parent.find('ul.inner2').hide();
		});
	});

	
});
