// JavaScript Document

function getHTTPObject() {
    if (typeof XMLHttpRequest != 'undefined') {
        return new XMLHttpRequest();
    }
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
    return false;
}

var http = getHTTPObject();
var http2 = getHTTPObject();
var div2show;
var div2show2;


function callPage(path,div){
hide('content3Div');
	div2show=div;
	//show loading animation in div - i put text in here for now
	div2=document.getElementById(div)
	div2.innerHTML='';
	div2.style.display='inline';
	document.getElementById(div2show).innerHTML =  '<img src=images/ajax/loader1.gif width=16 height=16>';
	http.open("GET", path, true);
	http.onreadystatechange = updateDiv;
	http.send(null);
}

function updateDiv() {
	if (http.readyState == 4) {
	    //div2.style.visibility='visible';	
		//display document in div
		document.getElementById(div2show).innerHTML =  http.responseText;
	
	}
}

function callPage2(path,div,path2,div2){
	callPage(path,div);
	callPage2b(path2,div2);
//alert('done');
}

function callPage2b(path,div){
	div2show2=div;
	//show loading animation in div - i put text in here for now
	div2=document.getElementById(div)
	div2.innerHTML='';
	div2.style.display='inline';
	document.getElementById(div2show2).innerHTML =  '<img src=images/ajax/loader1.gif width=16 height=16>';
	http2.open("GET", escape(path), true);
	http2.onreadystatechange = updateDiv2b;
	http2.send(null);
}

function updateDiv2b() {
	if (http2.readyState == 4) {
	    //div2.style.visibility='visible';	
		//display document in div
		document.getElementById(div2show2).innerHTML =  http2.responseText;
	
	}
}


function hide(div2hide){
	div2=document.getElementById(div2hide)
	div2.style.display='none';
}

//ljs function for displaying results single...

function jump(w){
//hide the div2  and show the div3
hide('content2Div');
	callPage('server/html_parse/'+w,'content3Div');
}

function jumpBack(){
	hide('content3Div');
	var divy=document.getElementById('content2Div')
	divy.style.display='inline';
}
