var xmlHttp


function ajax_commit(strTable, strField, intID, strValue, strDivID1, strDivID2)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	document.getElementById(strDivID1).innerHTML="<div align='center' border=1 width='100%' style='text-align:center'><img src='/layout/icons/loading.gif' alt='Loading...' /></div>";
	document.getElementById(strDivID2).style.display='none';
	document.getElementById(strDivID1).style.display='block';	
	var url="/inc/functions_ajax.asp"
	url=url+"?func=ajaxCommit"
	var vars = "strTable="+strTable
	vars=vars+"&strField="+strField
	vars=vars+"&intID="+intID
	vars=vars+"&strValue="+strValue;
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", vars.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(vars);
	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			document.getElementById(strDivID1).innerHTML=xmlHttp.responseText;
		}
	 }	 
	xmlHttp.send(null);
	
	
}

function page_commit(strPage, strField, strValue, strDivID1, strDivID2)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	document.getElementById(strDivID1).innerHTML="<div align='center' border=1 width='100%' style='text-align:center'><img src='/layout/icons/loading.gif' alt='Loading...' /></div>";
	document.getElementById(strDivID2).style.display='none';
	document.getElementById(strDivID1).style.display='block';	
	var url="/inc/functions_ajax.asp"
	url=url+"?func=pageCommit"
	var vars="strPage="+strPage
	vars=vars+"&strField="+strField
	vars=vars+"&strValue="+strValue;
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", vars.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(vars);
	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			document.getElementById(strDivID1).innerHTML=xmlHttp.responseText;
		}
	 }
	xmlHttp.send(null);
}

function changeValue(strValue, strID, strWhere, intWhat) {

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="script/ajax.mainfunc.asp"
	url=url+"?func=parseEdit&feed="+document.getElementById('frmUrl').value
	url=url+"&where="+strWhere
	url=url+"&what="+intWhat
	url=url+"&value="+strValue
	xmlHttp.open("GET",url,true);
  xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			document.getElementById(strID).innerHTML = strValue;
		}
	 }
	xmlHttp.send(null);
}

function ajax_parseEdit(strWhere, strWhat, intID, strValue)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="/inc/functions_ajax.asp"
	url=url+"?func=parseEdit&where="+strWhere
	url=url+"&what="+strWhat
	url=url+"&id="+intID
	url=url+"&value="+strValue
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function ajax_domenu(strFunc, strWhat, intID)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	document.getElementById('div_menu').innerHTML="<div align='center' border=1 width='100%' style='text-align:center'><img src='/layout/icons/loading.gif' alt='Loading...' /></div>";
	var url="/inc/functions_ajax.asp"
	url=url+"?func="+strFunc
	url=url+"&strWhat="+strWhat
	url=url+"&intid="+intID
	xmlHttp.open("GET",url,true);
  	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			document.getElementById('div_menu').innerHTML=xmlHttp.responseText;
		}
	 }
	xmlHttp.send(null);
} 

function ajax_dofunc(strFunc, intID)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="/inc/functions_ajax.asp"
	url=url+"?func="+strFunc
	url=url+"&intid="+intID
	xmlHttp.open("GET",url,true);
  	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			window.location.reload();
		}
	 }
	xmlHttp.send(null);
}

function ajax_dofunc2(strFunc, str1, str2)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="/inc/functions_ajax.asp"
	url=url+"?func="+strFunc
	url=url+"&value1="+str1
	url=url+"&value2="+str2
	xmlHttp.open("GET",url,true);
  	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			window.location.reload();
		}
	 }
	xmlHttp.send(null);
}

function ajax_itemCommit(strField, strValue, intID)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="/inc/functions_ajax.asp"
	url=url+"?func=itemCommit"
	url=url+"&strField="+strField
	url=url+"&strValue="+strValue
	url=url+"&intid="+intID
	xmlHttp.open("GET",url,true);
  	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			window.location.reload();
		}
	 }
	xmlHttp.send(null);
}

function ajax_renFile(strDiv, strFile, strFolder, strValue)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById(strDiv).innerHTML="<div align='center' border=1 width='100%' style='text-align:center'><img src='/layout/icons/loading.gif' alt='Loading...' /></div>";	
	var url="/inc/functions_ajax.asp"
	url=url+"?func=renfile"
	url=url+"&strFile="+strFile
	url=url+"&strFolder="+strFolder
	url=url+"&strValue="+strValue
	xmlHttp.open("GET",url,true);
  	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			window.location.reload();
		}
	 }
	xmlHttp.send(null);
}

function ajx_httppost(strForm, strID)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	document.getElementById(strID).innerHTML="<div align='center' border=1 width='100%' style='text-align:center'><img src='/layout/icons/loading.gif' alt='Loading...' /></div>";	
	var url="/inc/functions_newpost.asp"
    xmlHttp.open('POST', url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", strForm.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(strForm);
    xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			document.getElementById(strID).innerHTML=xmlHttp.responseText;
		}
	 }
	xmlHttp.send(null);
}


function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}
