$(document).ready(function() 
{ 
	$(".carousel").carousel({loop: true});
	
	$("#header_logo").click(function(){ window.location.href  = '/'; });
	
	$("#topMenu li:last").css("backgroundImage","none");
	$("#footer li:last").css("backgroundImage","none");
	
	$("#nav").treeview({persist: "location", collapsed: false});
 	
	$('div.container').shadow({ color: "#000", offset:5, opacity: 0.3 });
	
});


function changeMargin()
{
	var menuWidth = document.getElementById('footer_nav').offsetWidth / 2 - 4;
	//document.getElementById('footer_nav').style.marginLeft = '-'+menuWidth+'px';
	
	var contentHeight = document.getElementById('contentText').offsetHeight + 50;
	document.getElementById('content').style.height = contentHeight+'px';
}

function insert_smiley(text)
{
	var target 			  = document.getElementById('message');

	var Start			  = target.selectionStart;
	var End 	 		  = target.selectionEnd;
	
	target.value		  = target.value.substr(0, Start) + text + target.value.substr(End, target.value.length); 
	target.selectionStart = (Start == End)? Start + text.length:Start;
	target.selectionEnd   = Start + text.length;
	
	target.focus();
}


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);


