var xmlhttp;
var hinterval;
var content_tlev = "" ;
var mybrowser = navigator.userAgent ;
var mybrowsername = navigator.appName ;

function loadurl(dest)
{
//ajaxresponse.php-in enq uzum uxarkel ev stanal tvjalnery
    try
    {
    // Moz supports XMLHttpRequest. IE uses ActiveX.
    // browser detction is bad. object detection works for any browser
    xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");

    //alert('Ok');
    }
    catch (e)
    {
    // browser doesn't support ajax. handle however you want


    }



    // the xmlhttp object triggers an event everytime the status changes
    // triggered() function handles the events
    xmlhttp.onreadystatechange = triggered; // tvecinq funkcian, vory petq e katarvi uxarkats tvjalnery stanluc heto


    // open takes in the HTTP method and url.
    xmlhttp.open("GET", dest); // bacum enq dest hasceov ejy

    // send the request. if this is a POST request we would have
    // sent post variables: send("name=aleem&gender=male)
    // Moz is fine with just send(); but
    // IE expects a value here, hence we do send(null);
    xmlhttp.send(null);  // uxarkum enq tvjalnery . Ete POST-ov uxarkeinq, petq e parametry null-i pocharen popochakannery greinq : send("name=aleem&gender=male)








// function
}



function cleartimeoutHinterval()
{
clearTimeout(hinterval);
return true;
}







function triggered( ) //pop
{


    // if the readyState code is 4 (Completed)
    // and http status is 200 (OK) we go ahead and get the responseText
    // other readyState codes:
    // 0=Uninitialised 1=Loading 2=Loaded 3=Interactive

    if ( xmlhttp.readyState == 0  )
    {
    //document.getElementById("info_l").innerHTML = "Uninitialised!" ;
    //showhelp( event,  "loading..." );

    }


    if (xmlhttp.readyState == 1 )
    {
    //document.getElementById("info_l").innerHTML = "loading..." ;
    content_tlev = "<b>Загрузка...</b>" ;

    }


    if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200))
    {
    // xmlhttp.responseText object contains the response.
    //document.getElementById("output").innerHTML = xmlhttp.responseText;

    //alert("Stacanq pataschany: "+ xmlhttp.responseText);
    //document.write(xmlhttp.responseText);
    //document.getElementById("info_l").innerHTML = xmlhttp.responseText ;
    //alert("Loaded!");
    //content_tlev = "Hello from new content" ;
    document.getElementById("hlp").innerHTML = xmlhttp.responseText ;

    }






//function
}





//----------------------------------

function showhelp( event, helptext )
{

//alert(event.clientX);

document.getElementById("hlp").style.left=event.clientX+50 ;
document.getElementById("hlp").style.top=event.clientY-40 ;
document.getElementById("hlp").style.visibility="visible";

document.getElementById("hlp").innerHTML="<br>&nbsp;"+helptext+"&nbsp;<br><br />" ;

}





function createhelpdesk()
{

var helpdesk = document.createElement('div') ;
helpdesk.id = "hlp" ;
helpdesk.style.position="absolute";
helpdesk.style.backgroundColor='#F0F0F0';
helpdesk.style.border='1px #dc8a0c dotted';
helpdesk.style.width= "500" ;
helpdesk.style.padding= "10" ;
helpdesk.style.fontSize= "12" ;
helpdesk.style.fontFamily= "Verdana, Arial" ;
helpdesk.style.visibility="hidden";
helpdesk.style.zIndex = "999" ;

  if( mybrowser.indexOf('Opera')!= -1 || mybrowser.indexOf('Firefox')!= -1  )
  {
  helpdesk.setAttribute("onmouseover", "clearTimeout(hinterval)" );
  helpdesk.setAttribute("onmouseout", "hinterval1=setTimeout('hidehelp()', 300);" );
  }

  if( mybrowsername == "Microsoft Internet Explorer" && mybrowser.indexOf('Opera') == -1 )
  {
  //helpdesk.onmouseover = function(){clearTimeout( hinterval );   } ;
  helpdesk.setAttribute( 'onmouseover', function myOtherFunction(){ clearTimeout( hinterval ); } );   //
  helpdesk.setAttribute( 'onmouseout', function myOtherFunction1(){ hinterval1=setTimeout('hidehelp()', 300);  } );

  }


document.body.appendChild(helpdesk);


// function
}



function hidehelp()
{
document.getElementById("hlp").style.visibility="hidden";
}



function handleloading( event, topicnum  )
{

loadurl("show_tlev.php?t="+topicnum ) ;
showhelp( event, content_tlev );




// function
}


function levtest()
{
alert("Es ajstex em");


}