var $j = jQuery.noConflict();
var ok = "";
jQuery(document).ready(function() {	
	if(jQuery('#content').height() < jQuery(window).height()){
		
		var move = jQuery(window).height()-jQuery('#content').height()+20;
		jQuery("#footer").css('margin-top', move+"px");
	}
	jQuery('.sub_menu_1').each(function(){
		var fromLeft = jQuery(this).width();
		jQuery(this).find('ul').css('left',fromLeft+'px');
	});
	
	jQuery('#logo').click(function(){
		window.location = "http://www.kraamzorgmidden.nl";
	});
	jQuery('#aanmelden a').attr('href','http://www.kraamzorgmidden.nl/aanmelden');
	jQuery('#login input[name=user]').focus(function(){
		if(jQuery(this).val()=='Gebruikersnaam')
			jQuery(this).val('');
	}).focusout(function(){
		if(jQuery(this).val()=='')
			jQuery(this).val('Gebruikersnaam');
	})
	
	jQuery('#login input[name=password]').focus(function(){
		if(jQuery(this).val()=='password')
			jQuery(this).val('');
	}).focusout(function(){
		if(jQuery(this).val()=='')
			jQuery(this).val('password');
	})
	jQuery('#inloggen').click(function(){
		jQuery('#login').submit();
	});
	jQuery('#sendmessage').click(function(){
		jQuery('#login').submit();
	});
	
	jQuery('#h').mouseenter(function(){
		jQuery(this).addClass('h2');
	}).mouseleave(function(){
		jQuery(this).removeClass('h2');
	});
	jQuery('#t').mouseenter(function(){
		jQuery(this).addClass('t2');
	}).mouseleave(function(){
		jQuery(this).removeClass('t2');
	});
	jQuery('#f').mouseenter(function(){
		jQuery(this).addClass('f2');
	}).mouseleave(function(){
		jQuery(this).removeClass('f2');
	});
	jQuery("a[rel^='prettyPhoto']").prettyPhoto();
	jQuery('.box-shadow').css('bottom','-18px');
	
	
	jQuery("#tree").treeview({
			collapsed: true,
			animated: "medium",
			control:"#sidetreecontrol"
	});
	jQuery('.box').css('behavior','url(http://www.kraamzorgmidden.nl/templates/default/pie.htc)');
});
function ShowMenu(el,duration,dir){
	var $el = $j(el);
	xx = $el.attr('id');
	yy = xx.split('_');
	height = yy[1];
	if(dir){
		$el.show().stop().animate({height: height}, {duration: duration,complete:function(){
				$el.css({'visibility':'visible','width':'auto'});
			}
		});
	}else{
		$el.stop().animate({height: 0}, {duration: duration, complete:function (){
	        $el.hide();
	      }
	    });
	}
}

function slideToggle(el, bShow){
	var $jel = $j(el), height = $jel.data("originalHeight"), visible = $jel.is(":visible");

	// if the bShow isn't present, get the current visibility and reverse it
	if( arguments.length == 1 ) bShow = !visible;

	// if the current visiblilty is the same as the requested state, cancel
	if( bShow == visible ) return false;

	//alert(height);
	//height = $jel.innerHeight();
	// get the original height
	if( !height ){
		// get original height
		height = $jel.show().height();
		// update the height
		$jel.data("originalHeight", height);
		// if the element was hidden, hide it again
		if( !visible ) $jel.hide().css({height: 0});
	  }

	  // expand the knowledge (instead of slideDown/Up, use custom animation which applies fix)
	  if( bShow ){
	    $jel.show().animate({height: height}, {duration: 400});
	  } else {
	    $jel.animate({height: 0}, {duration: 400, complete:function (){
	        $jel.hide();
	      }
	    });
	  }
	}
        
