﻿function DoCallback(url, params)
{
	// url:    URL to invoke
	// params: string object to pass to the remote URL
	//Add some parameters to the query string	
	var pageUrl = url+'?'+params+'&'+Math.random();
	var xmlHttp=null;
	try
	{
		//Mozilla Browsers		
		//xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
		xmlHttp=new XMLHttpRequest();

	}
	catch (e)
	{
		try
		{
			//IE
			//xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");

			//xmlRequest = new XMLHttpRequest();
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");			
		}
		catch (e)
		{
			//Something else that won't work with this code...
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

			//xmlRequest=false;
		}
	}
	// Post our XmlRequest and get our desired string
	xmlHttp.open("GET", pageUrl, false);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	
	xmlHttp.send(null);
	// Return the XmlHttp object
	return xmlHttp;
}
function AddItemToCombo(ComboName,ComboValue,ComboText)
{
	var objCmbOptions=document.getElementById(ComboName);
	objCmbOptions.options[objCmbOptions.options.length] = new Option(ComboText,ComboValue);
}

function ClearComboBox(ComboName)
{
    var objCmbOptions=document.getElementById(ComboName);
	objCmbOptions.options.length=0;
}

function GetCategory()
{
    var xml=new DoCallback('/XMLResponse.aspx','command=Category&command1=retrieve');
    var resp=xml.responseText;
    return resp;
}

function setDocumentStatInxsdl_DocumentStats(docid, dnnuserid, dnnuserfullname)
{
    var xml=new DoCallback('/XMLResponse.aspx','command=InsertDocStat&docid=' + docid + '&dnnuserid=' + dnnuserid + '&dnnuserfullname=' + dnnuserfullname);
    var resp=xml.responseText;
    return resp;
}