var result = new Array(200);
var count = new Array(200);
var listline = new Array(200);
var resizeimg = new Array(200);
var myAjax = new Array(200);
function ctlsrhClear() {
var cnt=0;
if(document.catsrhform.ajax_bibid != null){
if (document.catsrhform.ajax_bibid.length) {
for (cnt = 0; cnt < document.catsrhform.ajax_bibid.length; cnt++) {
clearDisp(cnt);
}
}else{
clearDisp(0);
}
}
}
function ctlsrhInit() {
var resultid;
var countid;
var listlineid;
var resizeimgid;
var cnt=0;
if(document.catsrhform.ajax_bibid != null){
if (document.catsrhform.ajax_bibid.length) {
for (cnt = 0; cnt < document.catsrhform.ajax_bibid.length; cnt++) {
myAjax[cnt]=null;
listlineid="listline"+cnt;
listline[cnt] = $(listlineid);
listline[cnt].innerHTML ='
';
resizeimgid="resizeimg"+cnt;
resizeimg[cnt] = $(resizeimgid);
resizeimg[cnt].innerHTML ='
';
resultid="result"+cnt;
result[cnt] = $(resultid);
countid="count"+cnt;
count[cnt] = $(countid);
ctlsrhDisp(document.catsrhform.ajax_bibid[cnt].value,cnt,document.catsrhform.ajax_gcattp[cnt].value)
}
}else{
myAjax[0]=null;
listlineid="listline0";
listline[0] = $(listlineid);
listline[cnt].innerHTML ='';
resizeimgid="resizeimg"+cnt;
resizeimg[cnt] = $(resizeimgid);
resizeimg[cnt].innerHTML ='
';
resultid="result0";
result[0] = $(resultid);
countid="count0";
count[0] = $(countid);
ctlsrhDisp(document.catsrhform.ajax_bibid.value,0,document.catsrhform.ajax_gcattp.value)
}
}
}
function catsrmInit() {
var resultid;
var cnt=0;
if(document.catsrhform.ajax != null){
if (document.catsrhform.ajax.length) {
for (cnt = 0; cnt < document.catsrhform.ajax.length; cnt++) {
myAjax[cnt]=null;
resultid="result"+cnt;
result[cnt] = $(resultid);
countid="count"+cnt;
count[cnt] = $(countid);
catsrmDisp(document.catsrhform.ajax[cnt].value,cnt)
}
}else{
myAjax[0]=null;
resultid="result0";
result[0] = $(resultid);
catsrmDisp(document.catsrhform.ajax.value,0)
}
}
}
function ctlsrhDisp(bibid,cnt,gcattp) {
var tmpHtml0="";
tmpHtml0 += "";
tmpHtml0 += " |
";
tmpHtml0 += "
";
result[cnt].innerHTML = tmpHtml0;
var url = "/webopac/holsrh.do";
var paramList = "key=logoff&bibid="+bibid+"&gcattp="+gcattp+"&rgtn="+document.catsrhform.rgtn.value+"&lenid="+document.catsrhform.lenid.value+"&cln="+document.catsrhform.cln.value+"&holsc="+document.catsrhform.holsc.value+"&holph="+document.catsrhform.holph.value;
var i;
if(document.catsrhform.holar != null){
if(document.catsrhform.holar.length){
for (i = 0; i < document.catsrhform.holar.length; i++) {
paramList+="&holar="+document.catsrhform.holar[i].value;
}
}else{
paramList+="&holar="+document.catsrhform.holar.value;
}
}
if(document.catsrhform.hollc != null){
if(document.catsrhform.hollc.length){
for (i = 0; i < document.catsrhform.hollc.length; i++) {
paramList+="&hollc="+document.catsrhform.hollc[i].value;
}
}else{
paramList+="&hollc="+document.catsrhform.hollc.value;
}
}
myAjax[cnt] = new Ajax.Request(url,{
method: 'get',
onSuccess: getData,
onFailure: showErrMsg,
parameters: paramList
});
function getData(data){
var tmpHtml="";
var tmpHtml2="";
var hitcnt="";
var reccnt="";
var datatype="";
hitcnt=gethitcnt(data);
reccnt=getreccnt(data);
datatype=getdatatype(data);
var serial = "sr";
if(serial.indexOf(gcattp) != -1){
if(datatype=="tog"){
tmpHtml=gettog(data);
tmpHtml2="(Collective Holdings:"+hitcnt+"items)";
}else if(datatype=="hol"){
tmpHtml=getholsr(data);
if(hitcnt != 0) tmpHtml2="(Holdings:"+hitcnt+"items)";
}else if(datatype=="lnk"){
if(hitcnt != 0){
tmpHtml="";
tmpHtml += "";
tmpHtml += "
|
|
";
tmpHtml += "
";
tmpHtml2="(Lower Bibliography:"+hitcnt+"items)";
}else{
tmpHtml="";
tmpHtml += "";
tmpHtml += "
|
|
";
tmpHtml += "
";
}
}
}else{
if(datatype=="hol"){
tmpHtml=getholbk(data);
if(hitcnt != 0) tmpHtml2="(Holdings:"+hitcnt+"items)";
}else if(datatype=="lnk"){
if(hitcnt != 0){
tmpHtml="";
tmpHtml += "";
tmpHtml += "
|
|
";
tmpHtml += "
";
tmpHtml2="(Lower Bibliography:"+hitcnt+"items)";
}else{
tmpHtml="";
tmpHtml += "";
tmpHtml += "
|
|
";
tmpHtml += "
";
}
}
}
result[cnt].innerHTML = tmpHtml;
count[cnt].innerHTML = tmpHtml2;
}
function gethitcnt(data){
var hitcntValue;
var response = data.responseXML.getElementsByTagName('header');
var hitcnt = response[0].getElementsByTagName('hitcnt');
try{
hitcntValue = hitcnt[0].firstChild.nodeValue;
} catch (e) {
hitcntValue ="0";
}
return hitcntValue;
}
function getreccnt(data){
var reccntValue;
var response = data.responseXML.getElementsByTagName('header');
var reccnt = response[0].getElementsByTagName('reccnt');
try{
reccntValue = reccnt[0].firstChild.nodeValue;
} catch (e) {
reccntValue ="0";
}
return reccntValue;
}
function getdatatype(data){
var datatypeValue;
var response = data.responseXML.getElementsByTagName('header');
var datatype = response[0].getElementsByTagName('datatype');
try{
datatypeValue = datatype[0].firstChild.nodeValue;
} catch (e) {
datatypeValue ="hol";
}
return datatypeValue;
}
function gettog(data){
var tmpHtml="";
var item="";
var itemValue="";
var response = data.responseXML.getElementsByTagName('body');
var record = response[0].getElementsByTagName('record');
try{
tmpHtml +="";
for(i = -1; i < 2; i++){
if(i==-1){
tmpHtml += " |
";
tmpHtml += "";
tmpHtml += "Holding library | ";
tmpHtml += "Holdings location | ";
tmpHtml += "Volume | ";
tmpHtml += "Available Years/Months | ";
tmpHtml += "Accession status | ";
tmpHtml += "
";
tmpHtml += " |
";
}else if(i>=record.length){
tmpHtml += "";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += "
";
}else{
tmpHtml += "";
item=""
itemValue=""
item = record[i].getElementsByTagName('holar');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hollc');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hlv');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hlyr');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('cont');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
tmpHtml += "
";
}
}
tmpHtml += "
\n";
} catch (e) {
;
}
return tmpHtml;
}
function getholbk(data){
var tmpHtml="";
var item="";
var itemValue="";
var response = data.responseXML.getElementsByTagName('body');
var record = response[0].getElementsByTagName('record');
if(record.length == 0){
return "Requested data could not be retrieved.
";
}
try{
tmpHtml +="";
for(i = -1; i < 2; i++){
if(i==-1){
tmpHtml += " |
";
tmpHtml += "";
tmpHtml += "Volumes | ";
tmpHtml += "Holding library | ";
tmpHtml += "Holdings location | ";
tmpHtml += "Call No | ";
tmpHtml += "Status | ";
tmpHtml += "
";
tmpHtml += " |
";
}else if(i>=record.length){
tmpHtml += "";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += "
";
}else{
tmpHtml += "";
item=""
itemValue=""
item = record[i].getElementsByTagName('volbr');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('holar');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hollc');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('cln');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hollistst');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
tmpHtml += "
";
}
}
tmpHtml += "
\n";
} catch (e) {
;
}
return tmpHtml;
}
function getholsr(data){
var tmpHtml="";
var item="";
var itemValue="";
var response = data.responseXML.getElementsByTagName('body');
var record = response[0].getElementsByTagName('record');
if(record.length == 0){
return "
Requested data could not be retrieved.
";
}
try{
tmpHtml +="";
for(i = -1; i < 2; i++){
if(i==-1){
tmpHtml += " |
";
tmpHtml += "";
tmpHtml += "Volumes | ";
tmpHtml += "Append vols | ";
tmpHtml += "YM of Serial | ";
tmpHtml += "Holding library | ";
tmpHtml += "Holdings location | ";
tmpHtml += "Call No | ";
tmpHtml += "Status | ";
tmpHtml += "
";
tmpHtml += " |
";
}else if(i>=record.length){
tmpHtml += "";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += " | ";
tmpHtml += "
";
}else{
tmpHtml += "";
item=""
itemValue=""
item = record[i].getElementsByTagName('volbr');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('vola');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('annul');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('holar');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hollc');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('cln');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hollistst');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="
";
}
tmpHtml += " | ";
tmpHtml += "
";
}
}
tmpHtml += "
\n";
} catch (e) {
;
}
return tmpHtml;
}
function showErrMsg(){
result[cnt].innerHTML += "";
for( i= 0; i<2; i++){
result[cnt].innerHTML += "Requested data could not be retrieved. | |
";
}
result[cnt].innerHTML += "
";
}
}
function catsrmDisp(bibid,cnt) {
clearsrmDisp(cnt);
result[cnt].innerHTML = "Retrieving data now....
\n";
var url = "/webopac/togsrh.do";
var paramList = "?bibid="+bibid;
var i;
myAjax[cnt] = new Ajax.Request(url,{
method: 'get',
onSuccess: getData,
onFailure: showErrMsg,
parameters: paramList
});
function getData(data){
var response = data.responseXML.getElementsByTagName('root');
var record = response[0].getElementsByTagName('record');
var tmpHtml="";
var item;
var itemValue;
for(i = 0; i < record.length; i++){
item=""
itemValue=""
item = record[i].getElementsByTagName('holar');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="";
}
tmpHtml += "" + itemValue + " ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hlyr');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="";
}
tmpHtml += "(" + itemValue + ") ";
item=""
itemValue=""
item = record[i].getElementsByTagName('hlv');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="";
}
tmpHtml += itemValue + " ";
item=""
itemValue=""
item = record[i].getElementsByTagName('cont');
try{
itemValue = item[0].firstChild.nodeValue;
} catch (e) {
itemValue ="";
}
tmpHtml += itemValue + " ";
tmpHtml += "
\n";
}
clearsrmDisp(cnt);
result[cnt].innerHTML = tmpHtml;
}
function showErrMsg(){
clearsrmDisp(cnt);
result[cnt].innerHTML = "Requested data could not be retrieved.
\n";
}
}
function httpAbort() {
for (cnt = 0; cnt < 200; cnt++) {
if(myAjax[cnt]!=null){
myAjax[cnt].transport.abort();
}
}
}
function clearDisp(cnt) {
var listlineid;
var resizeimgid;
result[cnt].innerHTML = "";
listlineid="listline"+cnt;
listline[cnt] = $(listlineid);
listline[cnt].innerHTML ="";
resizeimgid="resizeimg"+cnt;
resizeimg[cnt] = $(resizeimgid);
resizeimg[cnt].innerHTML ="";
}
function clearsrmDisp(cnt) {
result[cnt].innerHTML = "";
}