$(document).ready(function() {
	$("a[href='#']").click(function(e){e.preventDefault();});
	//toggleText('cerca', 'cerca nel sito');
	startList();
	startList2();
	$("#header ul ul li:first-child, #aside li:first-child, #mainContent ul#searchResults li:first-child").addClass("first-child");
});

var startList = function() {
   if (document.all&&document.getElementById) {
       task(document.getElementById("nav"));
   }
}

var startList2 = function() {
   if (document.all&&document.getElementById) {
       task(document.getElementById("languages"));
   }
}

function task(navRoot) {
   if (!navRoot.childNodes || navRoot.childNodes.length == 0) {
       return;
   }
   for (var i=0; i<navRoot.childNodes.length; i++) {
       var node = navRoot.childNodes[i];
       if (node.nodeName=="LI") {
           node.onmouseover=function() {
               this.className+=" over";
           }
           node.onmouseout=function() {
               this.className=this.className.replace(" over", "");
           }
       }
       task(node);
   }
};

function toggleText(p1, p2){
    $('input'+'#'+p1).focus(function () {
        if (this.value == p2) {this.value = '';}
    });
    $('input'+'#'+p1).blur(function () {
        if (this.value == '') {this.value = p2;}
    });
}