// JavaScript Document
/////////////AJAX//////////////////////////////////////////
/* The following function creates an XMLHttpRequest object... */

function createRequestObject() {

	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer") {
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}	else {
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}


/* The variable http will hold our new XMLHttpRequest object. */
var http = createRequestObject(); //create the object here
//Function for retriving that community name is available or not
/* For getting class according to school */

// For Getting The Location Of Client and set the cookies
function postdata(id){
	
	document.getElementById("flag").value = id;
	http.open('get', 'internal_request.php?mode=postjudge&judge_id='+ document.getElementById("judge_str").value+'&val='+ id);
	
	http.onreadystatechange = handlepostjudge;
	
	http.send(null);

}
function handlepostjudge()
{
	if(http.readyState == 4){ 
	   
	   var response = http.responseText;
        var id = document.getElementById("flag").value;
		document.getElementById("judge_"+id).innerHTML = "";
		document.getElementById("flag_"+id).innerHTML = "";
		document.getElementById("flag_"+id).innerHTML = response;
		//alert(response);
	}
}



function dopost(id){

	http.open('get', 'internal_request.php?mode=postabuse&val=' 
			+id);
	
	http.onreadystatechange = handlepostabuse;
	
	http.send(null);
}
function handlepostabuse()
{
	if(http.readyState == 4){ 
	   
	   var response = http.responseText;
        
	     if(response != 0 ){
 	     	  document.getElementById("flagpostdiv_flaglink_"+response).style.display = "none";
              document.getElementById("flagpostdiv_flaglinkmsg_"+response).style.display = "";
		 }
	}
}

