

function show_div(div_id, crt) {
    
    document.getElementById(div_id).style.display = 'block';
	document.getElementById("open" + crt).style.display = 'none';
	document.getElementById("close" + crt).style.display = 'block';
}
function hide_div(div_id, crt) {
   
    document.getElementById(div_id).style.display = 'none';
	document.getElementById("open" + crt).style.display = 'block';
	document.getElementById("close" + crt).style.display = 'none';
}

function showEdit_div(div_id) {
   
	document.getElementById("edit" + div_id).style.display = 'none';
	document.getElementById("show" + div_id).style.display = 'block';
	limiter(div_id);
	
}
function cancelupdate(div_id){
	document.getElementById("edit" + div_id).style.display = 'block';
	document.getElementById("show" + div_id).style.display = 'none';
}


var ccount = "1500";   
function limiter(tt){
var ctex = document.getElementById("comment" + tt).value;

var clen = ctex.length;

	if(clen > ccount){
			ctex = ctex.substring(0,count);
			document.getElementById("comment" + tt).value =ctex;
			return false;
	}
var tot = ccount-clen
document.getElementById("limit" + tt).value = tot;
}


var xmlHttp
function updateDesc(strID){ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	var desc=document.getElementById("comment" + strID).value;
	document.getElementById("DescIDReturn").value=strID;
	
	//alert(strID);
	//alert(desc);
	
		var url="CommentUpdate.aspx";
		url=url+"?comment="+desc;
		url=url+"&commentID="+strID;
		url=url+"&sid="+Math.random();
		//alert(url);
		xmlHttp.onreadystatechange=comStateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		
}

function comStateChanged() { 
	if (xmlHttp.readyState==4){ 
	
	//document.getElementById("DescIDReturn").innerHTML=xmlHttp.responseText;
		var reply = xmlHttp.responseText; 
		//alert(reply);
		var str = parseInt(reply)
		if (str==-1){
		} else {
			var div_id = document.getElementById("DescIDReturn").value;
			//alert(div_id);
			var desc = document.getElementById("comment" + div_id).value;
			//alert(desc);
			
			//var desc =document.getElementById("DescIDReturn").value
			document.getElementById("desc" + div_id).innerHTML=desc;
			document.getElementById("edit" + div_id).style.display = 'block';
			document.getElementById("show" + div_id).style.display = 'none';
		}
	} 
}



function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}


function deletePost(ID) {
	if (ID!="") {
		bConfirm = confirm("This will permanently remove the comment. Continue?") 
		if (bConfirm) {
			var myURL = "CommentDelete.aspx?CommentID=" + ID
			window.location = myURL
		}
	}
}
function voliation(ID) {
	if (ID!="") {
	var myURL = "ReportVoilation.aspx?CommentID=" + ID
	window.location = myURL
		}
}
