function getNeoDoc(k,dt,dn,i,a){
var tmp=document.getElementById('NEODOC'+dt+dn).innerHTML;
document.getElementById('NEODOC'+dt+dn).innerHTML='Fetching document ...';
    var callbackNeoDoc = {
        success: function(o) {
		document.getElementById('NEODOCI'+dt+dn).src='images/sp.gif';
		if(o.responseText.length > 0)
			{
				var r = o.responseText.split('|');
				if(r.length > 0){
					if(r[0] == 'SUCCESS'){
						document.getElementById('NEODOC'+dt+dn).innerHTML = '<a href="javascript:openNeoDoc(\''+r[1]+'\',\''+dt+dn+'\');">View</a>';
						openNeoDoc(r[1],dt+dn);
					} else {
						document.getElementById('NEODOC'+dt+dn).innerHTML=tmp;
						openNeoDoc('error.aspx?err='+escape(r[1]),dt+dn);
					}
				} else {
					document.getElementById('NEODOC'+dt+dn).innerHTML=tmp;
					openNeoDoc('error.aspx',dt+dn); //FAILURE
				}
			}
        },
        failure: function(o) {
			document.getElementById('NEODOC'+dt+dn).innerHTML=tmp;
			document.getElementById('NEODOCI'+dt+dn).src='images/sp.gif';
			openNeoDoc('error.aspx',dt+dn); //FAILURE
        }
    }
	if(document.getElementById('NEODOCI'+dt+dn))
	{
		document.getElementById('NEODOCI'+dt+dn).src='images/loading.gif';
	}
    var cb = YAHOO.util.Connect.asyncRequest('GET', 'neoDocs/?key='+k+'&doc_type='+dt+'&doc_number='+dn+'&installationaccount='+i+'&a='+a, callbackNeoDoc, null);    
}
function openNeoDoc(u,p)
{
	var openND=window.open('neoDocs/'+u,p);
}