// JavaScript Document


function ajaxupdater(box_id,type)
{
	var xmlHttp;
	try
	  {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    try
	      {
	    	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	      }
	    catch (e)
	      {
	    	alert("Your browser does not support AJAX!");
	    	return false;
	      }
	    }
	  }
	 
	  xmlHttp.onreadystatechange=function()
	    { 
	    
		  if(xmlHttp.readyState==4)
	      {
			  if(type=="comments"){ idprefix="commentbox-"; }
			  if(type=="commnums"){ idprefix="comnum-"; }


			  document.getElementById(idprefix+box_id).innerHTML= xmlHttp.responseText;
		  }
		  
		  	  
		  
		  
	    
		}
		
		
	  

   	  var myDomain = document.domain;
	  
	  var url=_site_path+"comments-ajax.php";
	  
	  url=url+"?id="+box_id+"&type="+type+"&rand="+Math.random()*9999999999999;
	  xmlHttp.open("GET",url,true);
	  xmlHttp.send(null);
	  
	  
	  
	  
}





function ajaxupdater_daemon(x)
{
	id=x;
	type1="comments"; 
	setTimeout("ajaxupdater(id,type1)", 300);
	
}




function note_updater(id,note,success)
{

	parent.document.getElementById("comments-note-"+id).innerHTML=note;
	if(success=="yes")
	{
		parent.document.getElementById("comment-"+id).value="";
	}
	
}



function info_reset(id)
{
	x=id;
	document.getElementById("comments-note-"+id).innerHTML="Sending...";
	setTimeout("check_comment_status(x)",5000);
	
}


function check_comment_status(id)
{
	status=document.getElementById("comments-note-"+id).innerHTML;	
	if(status=="Sending...")
	{	
		note="Comment not sent. Please check required fields! Or it is spam/duplicate comment.";
		x=id;
		setTimeout("note_updater(x,note)",200);	
	}
}

