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 savescore(appealid,validationid,score)
{
    vid=validationid;
    scoreg=score;
   // alert("Rajasekar");
//comment=document.getElementById("comment").value;

var requestUrl="";

//alert("aaa");



	requestUrl = "xml_saveScore.php" + "?validationid="+ encodeURIComponent(validationid)+"&score="+score+"&appealid="+appealid;
    //alert(requestUrl);		
	
//alert(requestUrl);
	// use the following line if using php
	// requestUrl = "xml_data_provider.php" + "?filter=" + encodeURIComponent(selectedContinent);
	//alert(requestUrl);
	//CreateXmlHttpObj();
    XmlHttpObj=GetXmlHttpObject();
	// verify XmlHttpObj variable was successfully initialized
	if(XmlHttpObj)
	{
		//		alert("XmlHttpObj");
		// assign the StateChangeHandler function ( defined below in this file)
			// to be called when the state of the XmlHttpObj changes
		// receiving data back from the server is one such change
		XmlHttpObj.onreadystatechange = StateChangeHandlerconfirmIssue;
		// define the iteraction with the server -- true for as asynchronous.
		XmlHttpObj.open("GET", requestUrl,  true);
		// send request to server, null arg  when using "GET"
		XmlHttpObj.send(null);
	}

}
// this function called when state of  XmlHttpObj changes
// we're interested in the state that indicates data has been
// received from the server

function StateChangeHandlerconfirmIssue()
{
	//	alert("readystate " + XmlHttpObj.readyState);
	// state ==4 indicates receiving response data from server is completed
	if(XmlHttpObj.readyState == 4)
	{
		//		alert("readystate " + XmlHttpObj.status);
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpObj.status == 200)
		{
			//			alert("in 200:"+XmlHttpObj.responseXML.documentElement);
			//PopulatedistrictsconfirmIssue();
            document.getElementById("hiddenscore"+vid).value=scoreg;
            //alert(document.getElementById("hiddenscore"+vid).value);
            document.getElementById("scoretext"+vid).innerHTML=XmlHttpObj.responseText;
		}
		else
		{
			alert("problem retrieving data from the server, status code: "  + XmlHttpObj.status);
		}
	}
}
// populate the contents of the country dropdown list

function PopulatedistrictsconfirmIssue()
{
//history.go(0);
}
// returns the node text value 
function openscoretext(id)
{
    
   // alert(id);
    //id=id-1;
    document.getElementById("div"+id).className="showdiv";
    document.getElementById("volunteer_docvideo"+id).className="showdiv";
    document.getElementById("scoretext"+id).className="showdiv";
    document.getElementById("assigntofriend"+id).className="hiddendiv";
   
    
}

function openscoretextdirectsave(id,type)//
{
  
  document.getElementById("authenticateloadimg"+id).style.display='block';     
//alert("Rajasekar");
var requestUrl="";

//alert("aaa");
    actype=type;


	requestUrl = "volunteer_docvideo_save.php?" + "volunteer_docvideoid_id="+id+"&type="+type;
    //alert(requestUrl);		
	
//alert(requestUrl);
	// use the following line if using php
	// requestUrl = "xml_data_provider.php" + "?filter=" + encodeURIComponent(selectedContinent);
	//alert(requestUrl);
	//CreateXmlHttpObj();
    XmlHttpObj=GetXmlHttpObject();
	// verify XmlHttpObj variable was successfully initialized
	if(XmlHttpObj)
	{
		//		alert("XmlHttpObj");
		// assign the StateChangeHandler function ( defined below in this file)
			// to be called when the state of the XmlHttpObj changes
		// receiving data back from the server is one such change
		XmlHttpObj.onreadystatechange = StateChangeHandlerconfirmIssue1;
		// define the iteraction with the server -- true for as asynchronous.
		XmlHttpObj.open("GET", requestUrl,  true);
		// send request to server, null arg  when using "GET"
		XmlHttpObj.send(null);
	}
    
}
function StateChangeHandlerconfirmIssue1()
{
    //alert(actype);
	//	alert("readystate " + XmlHttpObj.readyState);
	// state ==4 indicates receiving response data from server is completed
	if(XmlHttpObj.readyState == 4)
	{
		//		alert("readystate " + XmlHttpObj.status);
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpObj.status == 200 && actype!=5)
		{
			history.go(0);
            
		}
        else if(actype==5)
        {
            window.location = 'patient_edit.php?errmsg=.';
        }
		else
		{
			alert("problem retrieving data from the server, status code: "  + XmlHttpObj.status);
		}
	}
}

function assigntofriend(id)
{
    document.getElementById("div"+id).className="showdiv";
    document.getElementById("volunteer_docvideo"+id).className="hiddendiv";
     document.getElementById("scoretext"+id).className="hiddendiv";
    document.getElementById("assigntofriend"+id).className="showdiv";
}
function showvalidationdiv(id)
{
    //alert(id);
    document.getElementById(id).style.display="block";
}
