

var responseSuccessPages = function(o)
{ 
    try
    {

        var xmldoc;   
        
        var tr = document.getElementById("trPaging");        
        var tbl = document.getElementById("tblPaging");

        var rows = tr.cells; 
        while(rows.length) // length=0 -> stop 
            tr.deleteCell(rows.length-1); 
        
        if (window.ActiveXObject)
        {
            xmldoc = new ActiveXObject("MSXML2.DOMDocument");
            xmldoc.async="false";
            xmldoc.loadXML(o.responseText);           
        } 

        else if (document.implementation && document.implementation.createDocument)
        {
            var parser=new DOMParser();
            var xmldoc=parser.parseFromString(o.responseText,"text/xml");      
        }     

        var root = xmldoc.getElementsByTagName('MenuDisplay');
        //maxRight = Math.ceil( (((root.childNodes.length) * 100) / 400) );

        var r = 0; //row counter
        var lastPage = 1;
        //var row = tbl.insertRow(); 

        for (i=0; i < (root.length); i++)
        {     
        
            var arr = new Array(3);
            var c = 0;
           
            for (j=0; j < (root[i].childNodes.length); j++)
            {
                  if (root[i].childNodes[j].nodeType == 1)
                  {       
                    arr[c] = root[i].childNodes[j].firstChild.nodeValue;
                    c++;
                  }

            }
     
             var td = document.createElement('td'); 
             var a = document.createElement('a');
             a.href = "javascript:GetPages(" + arr[1] + ")"; 
             a.innerHTML = arr[0];
             td.appendChild(a);  
             tr.appendChild(td); 
             
             lastPage = arr[1]; 
             
            
           //var cell = row.insertCell();
           //cell.innerText = arr[1];



        }
        
     
        if ( (CurPage - 1) > 0 )
        {
            PreviousPage = CurPage - 1;
        }
        else
        {
            PreviousPage = 1;
        }
        
        if ( (CurPage + 1) <= lastPage )
        {
            NextPage = CurPage + 1;
        }
        else
        {
            NextPage = lastPage;
        }        
  
  
        AircraftList(CurPage);
        //InitScroll();
    }
	catch(error)
	{
	}
   
}
var responseFailurePages = function(o)
{
    try
    {
        //alert(MessageGet(o));
    }
	catch(error)
	{
	}
}


function GetPages(curPage)
{
    try
    {

        CurPage = curPage; 

        var uri = WS_LOCATION + "GetPages";
        var postData = "CurrentPage=" + curPage;
        YAHOO.util.Connect.asyncRequest('POST', uri, callbackPages, postData);
    
    }
	catch(error)
	{
	}
}

var callbackPages =
{
   success : responseSuccessPages,
   failure : responseFailurePages,
   timeout: 10000
};
