$(document).ready(function() { 
 
 $("#menu li:first").css("border","none");
 
 $("#footer li:last").css("backgroundImage","none");
  
 $("#nav").treeview({persist: "location", collapsed: true});
 
 $('#menu').css('visibility','visible');

 $(".carousel").carousel({loop: true});

});


function changeMargin()
{
	var menuWidth = document.getElementById('left_container').offsetWidth;
	
	
	//document.getElementById('footer_nav').style.marginLeft = menuWidth + 'px';
}


function insert_smiley(id)
{
	//document.forms['reactie-formulier'].message.value += " " + smiley;
	
	id = ' ' + id + ' ';
    var obj = document.getElementById('message');
    if(typeof(document.selection)!='undefined') 
    {
        obj.focus();
        var range = document.selection.createRange();
        if(range.parentElement() != obj) {
            return false;
        }
        var orig = obj.value.replace(/rn/g, "n");
        range.text = id;
        var actual = tmp = obj.value.replace(/rn/g, "n");
        for(var diff = 0; diff < orig.length; diff++) {
            if(orig.charAt(diff) != actual.charAt(diff)) break;
        }
        for(var index = 0, start = 0; (tmp = tmp.replace(id, "")) && (index <= diff); index = start + id.length) {
            start = actual.indexOf(id, index);
        }
    } else {
        var startPos = obj.selectionStart;
        var endPos = obj.selectionEnd;
        obj.value = obj.value.substr(0, startPos) + id + obj.value.substr(endPos, obj.value.length);
    }

	
}


sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
