
var req;
var which;
function retrieveURL(url, divid) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divid).innerHTML = response;
	if (window.XMLHttpRequest) { // Non-IE browsers
        req = new XMLHttpRequest();
        req.onreadystatechange = function () {
            processStateChange(divid);
        };
        try {
            req.open("POST", url, true);
        }
        catch (e) {
            alert(e);
        }
        req.send(null);
    } else {
        if (window.ActiveXObject) { // IE
            req = new ActiveXObject("Microsoft.XMLHTTP");
            if (req) {
                req.onreadystatechange = function () {
                    processStateChange(divid);
                };
                req.open("POST", url, true);
                req.send();
            }
        }
    }
}

/*************
*    FUNCTION: createXMLHttpReq
* DESCRIPTION: Create and returns the Request Object Used for Ajax Calls
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:
*************/
function createXMLHttpReq() {
    var reqObject = null;
    try {
        reqObject = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
    }
    try {
        reqObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) {
    }
    try {
        reqObject = new XMLHttpRequest();
    }
    catch (e) {
    }
    return reqObject;
}
/*************
*    FUNCTION: populateDivTag
* DESCRIPTION: populates the give div witht the responce obj data. 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS: XMLHttpReq - Ajax Responce,
*			   divId - Id of the dig tag
*************/
function populateDivTag(XMLHttpReq, divId) {
    if (document.getElementById(divId) != null) {   	
        document.getElementById(divId).innerHTML = XMLHttpReq.responseText;
    }
}
/*************
*    FUNCTION: commericalAviation
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function commericalAviation(url, divId) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;    
    var params = "parameter=swapTabs&activeChannel=ca";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}

/*************
*    FUNCTION: defence
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function defence(url, divId) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;
    var params = "parameter=swapTabs&activeChannel=defense";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}

/*************
*    FUNCTION: businessAviation
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function businessAviation(url, divId) {
	var response = "<tr><td valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;
    var params = "parameter=swapTabs&activeChannel=business";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}

/*************
*    FUNCTION: mro
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function mro(url, divId) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;
    var params = "parameter=swapTabs&activeChannel=mro";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}

/*************
*    FUNCTION: space
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function space(url, divId) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;
    var params = "parameter=swapTabs&activeChannel=space";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}



/*************
*    FUNCTION: chartGraphs
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function chartGraphs(url, divId) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;
    var params = "parameter=getHeadlinesFive";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}


