/**
 * Custom jQuery 
 * Ziggo Zakelijk 
 */

		
$(document).ready(function()
{	
	// MAKE STUFF ROUND
	function makeRound()
	{
		var els = document.getElementsByTagName('div'); for(var i=0; el=els[i]; i++) if(el.className.indexOf('round')>-1 && el.firstChild && el.firstChild.className!='t') el.innerHTML = '<b class="t"><b class="r"></b></b><div class="c"><b class="br"></b>'+el.innerHTML+'<b class="br"></b></div><b class="b"><b class="r"><!----></b></b>';
	}			
	
	makeRound();	
	
	
	
	
    
	if($(".subMenu"))
	{
		var $curr  = $(".subMenu ul li.active");		
		var $currPrev = $curr.prev();		
		var elms = $currPrev.find ('a');  

		elms.each ( function () 
		{  
			$(this).css("border-bottom","none");
		});  		
		
		
		var $curr2  = $(".subMenu ul li.subactive");		
		var $currPrev2 = $curr2.prev();		
		var elms2 = $currPrev2.find ('a');  

		elms2.each ( function () 
		{  
			$(this).css("border-bottom","none");
		});  		
	}
		
	
	$("#box1 .boxContent").css("min-height","160px");
	$("#box2 .boxContent").css("min-height","160px");
	$("#box3 .boxContent").css("min-height","160px");
	$("#box1 .boxContent ul").css("margin-bottom","20px");
	
	// HOMEPAGE CAROUSEL
	$.featureList(
		$("#tabs li a"),
		$("#output li"), {
			start_item	:	0
		}
	);
	
	if($("#featureList"))
	{		
		$("#tabs li a:first").addClass("first");
		$("#tabs li a:last").addClass("last");
				
	}
	
	// SITEMAP
	//hide the all of the element with class msg_body
	$(".msgBody").hide();
	
	// SITEMAP
	//toggle class msg_body
	$(".msgHead").click(function()
	{
		$(this).next(".msgBody").slideToggle(600);
	});    
	
    
    // TAGCLOUD
    $("#tagcloudTags a").tagcloud({
    	size: {
		start: 15, 
		end: 28, 
		unit: "px"
	}, 
	color: {
		start: "#c0d8ed", 
		end: "#0052a7"
    }});
	   
    
    // PRODUCT TEASERS
    $("div.teaserNext").wrapAll("<div id=\"productTeasers\">");
    
    $("div#productTeasers div:nth-child(3n)").css("margin-right","0px");
    
    
    // HOMEPAGE TEASERS
    $("div.teaser").wrapAll("<div id=\"homepageTeasers\">");
    
    $("div#homepageTeasers div:nth-child(3n)").css("margin-right","0px");    

    
 	/*TOOLTIP*/
 	if($(".tooltipInfo").length > 0)
	{	 			
		$('.tooltipInfo').tooltip(
		{
			track: true,
			delay: 0,
			showURL: false,
			extraClass: "chInfo",
			showBody: " - ",
			positionLeft: false,
			fade: 200
		});	
	}

 	
 	
 	
	$('ul.tree li span.daddy').click (function() 
	{
        if ((!$(this).parent('li').children('ul').attr('expanded')) || ($(this).parent('li').children('ul').attr('expanded') == 'false')) {
            $(this).parent('li').children('ul').slideDown(250);
            $(this).parent('li').children('ul').attr('expanded', 'true');
            $(this).attr ('class', 'expanded');
        }
        else {
            $(this).parent('li').children('ul').slideUp(250);
            $(this).parent('li').children('ul').attr('expanded', 'false');
            $(this).attr ('class', 'daddy');
        }
	}); 	
	
	
});        
