
var elem_id = 'cadre_content';
var isFade = false;
var isMorphing = false;

function resetVal(id, val) { 
    if(document.getElementById(id).value == val) document.getElementById(id).value = '';
}
var startList = function() {
    try {
        if($(elem_id).length && $(elem_id).parentNode)
            Element.addClassName($(elem_id).parentNode, 'loading');
    } catch(err) {}

	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("menu_navigation");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace("over", "");
				}
			}
		}
	}
}
window.onload=startList;

function updateContent(tab, sites_id, lang) {
	
	if(document.getElementById('cadre_content') && !isMorphing)
	{
		isMorphing = true;
		new Ajax.Request(
				'/request.php',
				{
					  method: 'post'
					, parameters: 'class=content&method=get&params[tab]='+tab+'&params[sites_id]='+sites_id+'&params[lang]='+lang+'&display=list'
					, onLoading: function() {
						Effect.Fade(elem_id, {from: 1.0, to: 0.01, afterFinish: function(){isFade = true}});
					}
					, onComplete: function(xmlhttp) {
						inWaiting(elem_id,  xmlhttp.responseText);
					}
				}
		);
	}
}

function inWaiting(id, response){
	setTimeout(function(){
		if(isFade){
			$(id).innerHTML = response;
			Effect.Appear(id, {from: 0.01, to: 1.0, afterFinish: function(){isMorphing = false}});
			isFade = false;
		}
		else
			inWaiting(id, response);
	}, 0.5);
}

