function isArray() {
	if (typeof arguments[0] == 'object') {
		var criterion = arguments[0].constructor.toString().match(/array/i);
 		return (criterion != null);
	}
	return false;
}

function set_content_height(){
	if ($('#info_veld_klein, #info_veld').height() > $('#content_field, #content_field_groot').height())
	{
		$('#content_field, #content_field_groot').css('height', $('#info_veld_klein, #info_veld').height()+20);
	}else if ($('#info_veld_klein, #info_veld').height() < $('#content_field, #content_field_groot').height())
	{
		$('#info_veld_klein, #info_veld').css({'height':$('#content_field, #content_field_groot').height()-20});

	}
}

function layout_fixes()
{

	$('#menu > li:last-child, #dropdown > a:last-child').css({ marginRight:"0px"});
	$('#footer_content > a:last-child').css({ borderRight:"0px"});

	// hover elementen aanzetten

	// menu click + andere clicks
	$('#menu li, #menu li li, #menu li li li, #intranet').click(function(){window.location=$(this).find("a").attr("href");return false;});

	// positie fixes //
	set_content_height();

	// menu gedeelte //
	$('#menu ul li, #menu ul li ul li').hoverIntent({sensitivity: 7, interval: 100 ,over: menu_slidedown, timeout: 100, out: menu_slideup})
		.hover(
			function(){
				$(this).addClass('hover');
			},
			function(){
				$(this).removeClass('hover');
			}
		);

}

function menu_slidedown()
{
	if($(this).is(":has(ul)")) {
	   $(this).children("ul").slideDown("fast");
	   pageTracker._trackPageview('/menu-getoond');
	}
}

function menu_slideup()
{
	$(this).children("ul").slideUp("fast");
}

function switch_color (el)
{
	if (el.css('color') == '#013888')
	{
		el.css('color', '#ff8933');
	} else if (el.css('color') == '#1d3b84')
	{
		el.css('color', '#ff6c00');
	}else if (el.css('color') == '#ff8933')
	{
		el.css('color', '#013888');
	} else if (el.css('color') == '#ff6c00')
	{
		el.css('color', '#1d3b84');
	}


}

function init()
{
	// layout fixes
	layout_fixes();

	// events voor button_top
	$('.button_top').click(
		function()
		{
			var id = $(this).attr('id');

			if (id == 'print') {
				if ( $('#content_block').length ) {
					PrintContent($('#content_block').html());
				} else if ( $('.contentLeft').length && $('.contentNieuws').length ) {
					PrintContent($('.contentLeft').html() + $('.contentNieuws').html());
				}
			} else if (id == 'archief') {
				// goto link
			} else if (id == 'lees') {
				// lees voor
			}
		}
	);

	$("#font_plus").click(
		function(){

			var currentFontSize = $('body').css('font-size');
			if(currentFontSize == '11px') {
				$('body').css('font-size', '13px');
				pageTracker._trackPageview('/fontplus-13px');
			} else if(currentFontSize == '9px') {
				$('body').css('font-size', '11px');
				pageTracker._trackPageview('/fontplus-11px');
			} else if(currentFontSize == '8px') {
				$('body').css('font-size', '9px');
				pageTracker._trackPageview('/fontplus-9px');
			}
			set_content_height();

			return false;
		}
	);
	$("#font_min").click(
		function()
		{
			var currentFontSize = $('body').css('font-size');
			if(currentFontSize == '9px') {
				$('body').css('font-size', '8px');
				pageTracker._trackPageview('/fontmin-8px');
			} else if(currentFontSize == '13px') {
				$('body').css('font-size', '11px');
				pageTracker._trackPageview('/fontmin-11px');
			} else if(currentFontSize == '11px') {
				$('body').css('font-size', '9px');
				pageTracker._trackPageview('/fontmin-9px');
			}
			set_content_height();

			return false;
		}
	);
}

function PrintContent(content_value)
{
    pageTracker._trackPageview('/printopdracht');
    var docprint = window.open("","","toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=650, height=600, left=100, top=25");
    docprint.document.open();
    docprint.document.write('<html><head><title>cdc kliniek</title></head><body onLoad="self.print();" id="printwindow"><div>' + content_value + '</div></body></html>');
    docprint.document.close();
    docprint.focus();
}

function dropdown_colapse(drop){
	$('#dropdown div').not('#fill').click(function(){
			window.location=$(this).find("a").attr("href");
			return false;
	});
	if (!drop){
		$('.contentContainer').css('margin-top', '0px');
		$('#dropdown > div > img').removeClass('hidden').css({'display':'block', 'cursor':'pointer'});
		$('#dropdown #fill').height($('#dropdown img:eq(0)').height() + $('#dropdown > div > a:eq(0)').height());
	}else
	{
		$('#dropdown').css('position', 'relative');
		$('.contentContainer').css('margin-top', '0px');
		$('#dropdown #fill').height( $('#dropdown > div > a:eq(0)').height());
	}
}