﻿// JScript File

var req;
var req2;
var req3;
var obj1 = 'cur1';
var obj2 = 'forum_posts';
var obj3 = 'new_posts';

function loadXMLDoc3(url) {
    DisplayResult1("Тече актуализация...", obj3);
	req3 = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req3 = new XMLHttpRequest();
        } catch(e) {
			req3 = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req3 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req3 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req3 = false;
        	}
		}
    }
	if(req3) {
		req3.onreadystatechange = processReqChange3;
		req3.open("GET", url, true);
		req3.send("");
	}
}



function loadXMLDoc2(url) {
    DisplayResult1("Тече актуализация...", obj2);
	req2 = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req2 = new XMLHttpRequest();
        } catch(e) {
			req2 = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req2 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req2 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req2 = false;
        	}
		}
    }
	if(req2) {
		req2.onreadystatechange = processReqChange2;
		req2.open("GET", url, true);
		req2.send("");
	}
}

function loadXMLDoc(url) {
    DisplayResult1("Тече актуализация...", obj1);
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send("");
	}
}

function processReqChange() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            // ...processing statements go here...
			//alert(req.responseText);
			DisplayResult1(req.responseText, obj1);
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
        }
    }
}

function processReqChange2() {
    // only if req shows "loaded"
    if (req2.readyState == 4) {
        // only if "OK"
        if (req2.status == 200) {
            // ...processing statements go here...
//			alert(req2.responseText);
			DisplayResult1(req2.responseText, obj2);
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                req2.statusText);
        }
    }
}

function processReqChange3() {
    // only if req shows "loaded"
    if (req3.readyState == 4) {
        // only if "OK"
        if (req3.status == 200) {
            // ...processing statements go here...
			//alert(req.responseText);
			DisplayResult1(req3.responseText, obj3);
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                req3.statusText);
        }
    }
}


function DisplayResult1(value, obj) {
   //document.all[obj].innerHTML = value;
   var element;
   if (document.all) {
     element = document.all[obj];
   }
   else {
     element = document.getElementById(obj);
   }
   
   if (element) {
      element.innerHTML = value;
   }
}