var mesbody;
var namevalue;


function initialize()
{



komentars('comment','0')

}

/*
function submitForm()
{ 
    var xhr; 
    try {  xhr = new ActiveXObject('Msxml2.XMLHTTP');   }
    catch (e) 
    {
        try {   xhr = new ActiveXObject('Microsoft.XMLHTTP');    }
        catch (e2) 
        {
          try {  xhr = new XMLHttpRequest();     }
          catch (e3) {  xhr = false;   }
        }
     }
  
    xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
              if(xhr.status  == 200) 
                  document.ajax.dyn="Received:"  + xhr.responseText; 
              else 
                 document.ajax.dyn="Error code " + xhr.status;
         }
    }; 

   xhr.open(GET, "data.txt",  true); 
   xhr.send(null); 
} 
*/
//////////////////////////////////////////////////////////////////////////////////////////////


//var active_clip = 1;

if (window.XMLHttpRequest) { http=new XMLHttpRequest(); } 
else if (window.ActiveXObject) { http=new ActiveXObject("Microsoft.XMLHTTP"); }

function komentars(fnc,pg) {
	var rand_no = Math.random();
  http.abort();
    element="jelement";
if (fnc=="comment"){
  http.open("GET", "xcom.php?show=comment&id="+active_clip+"&start="+pg+"&data=" + rand_no, true);
  element="jelement";
} else if (fnc=="commentsave"){
  namevalue = encodeURIComponent(namevalue);
  mesbody = encodeURIComponent(mesbody);
  http.open("GET", "xcom.php?show=commentsave&id="+active_clip+"&name="+namevalue+"&mesbody="+mesbody+"&start="+pg+"&data=" + rand_no, true);
  element="jelement";
}

  http.onreadystatechange=function() {
    if(http.readyState == 4) {
	document.getElementById(element).innerHTML = "";
	//document.getElementById("writeroot").innerHTML = "";
    document.getElementById(element).innerHTML = http.responseText;
    }
  }
  http.send(null);
}


