function view_dynamic()
{
	var dyna=document.getElementById('dyna_comment');	
	var dynac=document.getElementById('com_counter');
	var xmlhttp=ajax_object();

	if(!xmlhttp)
	{
		dyna.innerHTML="Script Not Supported By Your Browser";
	}
	else
	{

		xmlhttp.onreadystatechange=function()
		{
			if(xmlhttp.readyState==4)
			{
				
				if(xmlhttp.status==200)
				{
				dyna.innerHTML=xmlhttp.responseText;
				var hic=document.getElementById('hidden_c');
				dynac.innerHTML=hic.value;
				}
				else
				{
				dyna.innerHTML="ERROR NUMBER: " + xmlhttp.status;
				}
			
			}
		}
		url="comment.php?id=" + Math.random() + "&dynaid=" + dynaid;
		xmlhttp.open("GET",url,true);
		xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		xmlhttp.send(null);
		setTimeout('view_dynamic()',1000);
	}

}


function clear_fom()
{
	var com_n=document.getElementById('com_name');
	com_n.focus();
	clear_capt();
}




function clear_capt()
{
	var capt=document.getElementById('captpic');
	var xmlhttp=ajax_object();
	
	if(!xmlhttp)
	{
		alert("Script Not Supported By Your Browser");
	}
	else
	{

		xmlhttp.onreadystatechange=function()
		{
			if(xmlhttp.readyState==4)
			{
				
				if(xmlhttp.status==200)
				{
				capt.setAttribute('src','captcha.php?hash=' + xmlhttp.responseText);
				}
				else
				{
				alert("ERROR NUMBER: " + xmlhttp.status);
				}
			
			}
		}
		url="hashcode.php?id=" + Math.random();
		xmlhttp.open("GET",url,true);
		xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		xmlhttp.send(null);
	}
}


function add_comm()
{
	var xmlhttp=ajax_object();
	var com_code=document.getElementById('com_capt');
	var com_n=document.getElementById('com_name');
	var com_e=document.getElementById('com_email');
	var com_w=document.getElementById('com_web');
	var com_m=document.getElementById('com_msg');
	if(!xmlhttp)
	{
		alert("Script Not Supported By Your Browser");
	}
	else
	{

		xmlhttp.onreadystatechange=function()
		{
			if(xmlhttp.readyState==4)
			{
				
				if(xmlhttp.status==200)
				{
					if(xmlhttp.responseText=="Comment Posted")
					{
						clear_capt();
						document.com_form.reset();
						alert(xmlhttp.responseText);
						document.location="#comments";
					}
					else
					{
						alert(xmlhttp.responseText);
					}
					
				}
				else
				{
				alert("ERROR NUMBER: " + xmlhttp.status);
				}
			
			}
		}
		url="post_comment.php?id=" + Math.random() + "&com_code=" + com_code.value + "&com_n=" + com_n.value + "&com_e=" + com_e.value + "&com_w=" + com_w.value + "&com_m=" + escape(com_m.value) + "&dynaid=" + dynaid;
		xmlhttp.open("GET",url,true);
		xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		xmlhttp.send(null);
	}
}
