<!-- General
function GetXmlHttpObject(){
    var xmlHttp=null;
    try {
        xmlHttp=new XMLHttpRequest();
    } catch (e){
        try {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}
function getByID(whichLayer)
{
    var elem;
    if(document.getElementById) elem = document.getElementById(whichLayer);
    else if(document.all) elem = document.all[whichLayer];
    else if(document.layers) elem = document.layers[whichLayer];
    return elem;
}
function getViewport(){
    var viewport = {width:0,height:0};
    if (typeof(window.innerHeight)=='number'){
        viewport.height=window.innerHeight;
        viewport.width=window.innerWidth;       
    }else{
        if (document.documentElement&&document.documentElement.clientHeight){
            viewport.height=document.documentElement.clientHeight;
            viewport.width=document.documentElement.clientWidth;
        }else{
            if (document.body&&document.body.clientHeight){
                viewport.height=document.body.clientHeight;
                viewport.width=document.body.clientWidth;
            }
        }
    }
    return viewport;
}

// Return true if number is an integer
function isInteger(value){
  return ( !(value % 1) );
}
<!-- General END -->

<!-- Filtre
filterFix = function() {
    if (document.all&&document.getElementById){
        barRoot = document.getElementById("bar");
        if (barRoot){
	        for (i=0; i<barRoot.childNodes.length; i++){
	            node = barRoot.childNodes[i];
	            if (node.nodeName=="LI" && node.className != "unu"){
	                node.onmouseover=function() {
	                    this.className+="over";
	                }
	                node.onmouseout=function() {
	                    this.className=this.className.replace("over", "");
	                }
	            }
	        }        
        }
    }
}

// Search
var xmlHttp, timerID;

function search_now(str, lang)
{
    if (str.length < 3) return;
    
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null){
        getByID("ajax-loader").style.display = "none";
        return;
    }    
    var url=root_url + "search.php?keywords="+encodeURIComponent(str)+"&lang="+lang+"&page=articles&rand="+Math.random();
    if (typeof sess_params!='undefined'){
        url=url+"&"+sess_params;
    }
    if (timerID) {
        clearTimeout(timerID);
    }
    timerID = setTimeout("requestData('"+url+"')",500);
} 

function requestData(url){
    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
}

function stateChanged() { 
    if (xmlHttp.readyState==4){ 
        getByID("dynamiczone").innerHTML=xmlHttp.responseText;
        getByID("ajax-loader").style.display = "none";
        filterFix();
    } else {
    	getByID("ajax-loader").style.display = "inline";
    }
}

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/
<!-- Hide me from old browsers
var offsetfrommouse=[50,-20] //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0 //duration in seconds image should remain visible. 0 for always.

if (document.getElementById || document.all){
	document.write('<div id="trailimageid" style="position:absolute;top:0;left:0;"></div>');
}
function getTrailObjStyle(){
	return getByID("trailimageid").style;
}
function getTrailObj(){
	return getByID("trailimageid");
}
function truebody(){
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function hidetrail(){
	getTrailObj().innerHTML = " ";
	getTrailObjStyle().display="none";
	getTrailObjStyle().left="-500px";
}
function showtrail(imagename){
	newHTML = '<div>';
	newHTML = newHTML + '<div style="position:absolute;z-index:100;top:0;left:0;padding:5px;border:1px solid #000;background-color:#fff;"><img src="images/ajax-loader.gif"></div>';
	newHTML = newHTML + '<div style="position:absolute;z-index:200;top:0;left:0;padding:5px;border:1px solid #000;background-color:#fff;" id="popupimage"><img src="' + imagename + '" border="0"></div>';
	newHTML = newHTML + '</div>';
	getTrailObj().innerHTML = newHTML;
	getTrailObjStyle().zIndex = 300;
	getTrailObjStyle().display="inline";	
}

function followmouse(e){
	var min_distance_x=offsetfrommouse[0]
	var min_distance_y=offsetfrommouse[1]
	var relativeX = 0;
	var relativeY = 0;
	if (typeof e != "undefined")
	{
		xcoord=e.pageX
		ycoord=e.pageY
		relativeX=e.clientX;
		relativeY=e.clientY;
	}
	else if (typeof window.event !="undefined")
	{
		xcoord=truebody().scrollLeft+event.clientX
		ycoord=truebody().scrollTop+event.clientY
	}
	if (typeof window.event !="undefined")
	{
	    relativeX=event.clientX;
	    relativeY=event.clientY;
	}
    var elem, element_height, element_width;
    elem = getByID("popupimage");
    if (elem==null)return;
    
    if(elem.offsetHeight)
    {
    	element_height=elem.offsetHeight;
    	element_width=elem.offsetWidth; 
    }
    else if(elem.style.pixelHeight)
    {
        element_height=elem.style.pixelHeight;
        element_width=elem.style.pixelWidth;
    }
    
    xcoord = xcoord + min_distance_x;
    ycoord = ycoord + min_distance_y;
    
    var viewport = getViewport();
    if (viewport!=null)
    {
		//if (relativeX + element_width + min_distance_x >= viewport.width)
		//{
		//	 xcoord = xcoord - (relativeX + min_distance_x + element_width - viewport.width) - 5;
		//}
		if (xcoord - min_distance_x >= viewport.width/2)
		{
			 xcoord = xcoord - min_distance_x*2 - element_width;
		}
		var initialY=ycoord;
		if (relativeY + element_height + min_distance_y >= viewport.height)
		{ 
			ycoord = ycoord - (relativeY + min_distance_y + element_height - viewport.height) - 5;
		}  
    }
			    	
	getTrailObjStyle().display="block"
	getTrailObjStyle().left=xcoord+"px"
	getTrailObjStyle().top=ycoord+"px"
}

document.onmousemove=followmouse

if (displayduration>0)
setTimeout("hidetrail()", displayduration*1000)


// Forms
var xmlHttp, timerID, targetDiv, targetForm;
function draw_form(whichForm, articles_id, lang){
    //if (str.length < 3) return;
    targetDiv = (whichForm=="comments2"?"commentsform":"optionsform");
    targetForm = whichForm;
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null){ getByID(targetDiv).style.display = "none"; return; }   

    var url=root_url + "/live.php?P=article&form="+whichForm+"&articles_id="+articles_id+"&lang="+lang+"&rand="+Math.random();
    if (typeof sess_params!='undefined') { url=url+"&"+sess_params; }
    xmlHttp.onreadystatechange=insertForm;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null); 
} 
function insertForm(){ 
    if (xmlHttp.readyState==4){ 
        getByID(targetDiv).innerHTML=xmlHttp.responseText;
        getByID(targetDiv).style.display = "block";
        document.forms[targetForm].elements[2].focus();
    } else {
        getByID(targetDiv).innerHTML='<span style="color:red">Loading...</span>';
        getByID(targetDiv).style.display = "block";    	
    	//getByID("optionsform").style.display = "none";
    }
}

startList = function() {
	if (document.all && document.getElementById) {
	navRoot = document.getElementById("tabs");
	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", "");
	   }
	   }
	  }
	 }
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	
	if (typeof window.onload != "function") {
		window.onload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		}
	}
}

addLoadEvent(filterFix);

<!-- hide END -->
