﻿function getCurrentPageName(){path=window.location.toString();var b=new Array();b=path.split("/");var a=b[b.length-1];return a}function itemoptions(d){var c="";var l="0";var a="";if(document.getElementsByName("resultfrom")){a=document.getElementsByName("resultfrom");if(a.length>0){for(var f=0;f<a.length;f++){if(a[f].checked){l=a[f].value;break}}}}var h="1";if(document.getElementById("DDoptword")){h=document.getElementById("DDoptword").value}var j="";var g=0;var k="";if(document.getElementById("DDSearchIn")&&document.getElementById("DDSearchIn").value!=""){g=1;k=document.getElementById("DDSearchIn").value}var b="0";if(document.getElementById("chkSearchWithin")){if(document.getElementById("chkSearchWithin").checked){b="1"}else{opac.newArrivalModeOff();opac.wishlistModeOff()}}j=j.replace("'","\\'");opac.savesearchword(j);opac.savesearchstring(d+"#"+j+"#"+h+"#1#"+g+"#"+k+"#"+l+"#"+b);return true}function searchonitem(a){if(itemoptions(a)){window.location="searchresult.aspx"}}function collectOptions(){var c="";var d="";var l="0";var a="";if(document.getElementsByName("OptSearchBy")){c=document.getElementsByName("OptSearchBy");for(var f=0;f<c.length;f++){if(c[f].checked){d=c[f].value;break}}}if(document.getElementsByName("resultfrom")){a=document.getElementsByName("resultfrom");if(a.length>0){for(var f=0;f<a.length;f++){if(a[f].checked){l=a[f].value;break}}}}var h="1";if(document.getElementById("DDoptword")){h=document.getElementById("DDoptword").value}var j=document.getElementById("ctl00_ContentPlaceHolder1_txtSearch").value;if(j==""){alert("insert word to search");document.getElementById("ctl00_ContentPlaceHolder1_txtSearch").focus();return false}var g=0;var k="";if(document.getElementById("DDSearchIn")&&document.getElementById("DDSearchIn").value!=""){g=1;k=document.getElementById("DDSearchIn").value}var b="0";if(document.getElementById("chkSearchWithin")){if(document.getElementById("chkSearchWithin").checked){b="1"}else{opac.newArrivalModeOff();opac.wishlistModeOff()}}j=j.replace("'","\\'");opac.savesearchword(j);opac.savesearchstring(d+"#"+j+"#"+h+"#1#"+g+"#"+k+"#"+l+"#"+b);return true}function collectOptions2(j,k,g){j=j.replace("'","\\'");var c=document.getElementsByName("OptSearchBy");var d="";for(var f=0;f<c.length;f++){if(c[f].checked){d=c[f].value;break}}var a=document.getElementsByName("resultfrom");var l="0";if(a.length>0){for(var f=0;f<a.length;f++){if(a[f].checked){l=a[f].value;break}}}var h=document.getElementById("DDoptword").value;document.getElementById("ctl00_ContentPlaceHolder1_txtSearch").value="";var b="0";if(document.getElementById("chkSearchWithin")){if(document.getElementById("chkSearchWithin").checked){b="1"}else{opac.newArrivalModeOff();opac.wishlistModeOff()}}opac.savesearchword(j);opac.savesearchstring(d+"#"+j+"#"+h+"#1#"+g+"#"+k+"#"+l+"#"+b)}function advanceoptions(){var a="0";var d="";var g="";var d="";var c="0";for(b=1;b<6;b++){if(document.getElementById("txtadsearch"+b).value!=""){c="1";if(b==1){g=document.getElementById("txtadsearch"+b).value;d=document.getElementById("DDSearchIn"+b).value}else{g=g+"~("+document.getElementById("DDRelation"+(b-1)).value+")"+document.getElementById("txtadsearch"+b).value;d=d+"~"+document.getElementById("DDSearchIn"+b).value}}}if(c=="0"){alert("insert word to search.");return false}var f="";if(document.getElementsByName("resultfrom")){f=document.getElementsByName("resultfrom");if(f.length>0){for(var b=0;b<f.length;b++){if(f[b].checked){a=f[b].value;break}}}}g=g.replace("'","\\'");opac.savesearchstring("#"+g+"#1#1#2#"+d+"#"+a+"#0");opac.savesearchword("");return true}function checkForEnter(b,a){if(a.keyCode==13){startsearch()}}function startsearch(){if(collectOptions()){window.location="searchresult.aspx"}}function searchagain(){if(collectOptions()){getRecords("1")}}function searchfilter(c,b,a){collectOptions2(c,b,a);getRecords("0")}function searchfilter1(c,b,a){collectOptions2(c,b,a);getRecords("1")}function advancesearch(){if(advanceoptions()){window.location="searchresult.aspx"}}function tagsearch(j){var c="";var d="";var l="0";var a="";if(document.getElementsByName("OptSearchBy")){c=document.getElementsByName("OptSearchBy");for(var f=0;f<c.length;f++){if(c[f].checked){d=c[f].value;break}}}if(document.getElementsByName("resultfrom")){a=document.getElementsByName("resultfrom");if(a.length>0){for(var f=0;f<a.length;f++){if(a[f].checked){l=a[f].value;break}}}}var h="1";if(document.getElementById("DDoptword")){h=document.getElementById("DDoptword").value}var g=0;var k="";if(document.getElementById("DDSearchIn")&&document.getElementById("DDSearchIn").value!=""){g=1;k=document.getElementById("DDSearchIn").value}var b="0";if(document.getElementById("chkSearchWithin")){if(document.getElementById("chkSearchWithin").checked){b="1"}else{opac.newArrivalModeOff();opac.wishlistModeOff()}}j=j.replace("'","\\'");opac.savesearchword(j);opac.savesearchstring(d+"#"+j+"#"+h+"#1#"+g+"#"+k+"#"+l+"#"+b);window.location="searchresult.aspx"}function ViewNextPrevPage(f){var b=opac.getsearchstring();if(b.value==""){alert("Please Search Again.");return}var c=new Array();c=b.value.split("#");opac.savesearchstring(c[0]+"#"+c[1]+"#"+c[2]+"#"+f+"#"+c[4]+"#"+c[5]+"#"+c[6]+"#"+c[7]);document.getElementById("tdResult").innerHTML="<img src=images/loading.gif>";var a=new Asynchronous();a.call("searchrecords.aspx?o=0&rnd="+Math.random(),"tdPager,tdPager1","0","");var d=new Asynchronous();d.call("searchrecords.aspx?o=1&rnd="+Math.random(),"tdResult","0","")}function getRecords(f){document.getElementById("tdPager").style.display="";document.getElementById("tdPager1").style.display="";document.getElementById("tdResult").innerHTML="<img src=images/loading.gif>";var b=new Asynchronous();b.call("searchrecords.aspx?o=0&rnd="+Math.random(),"tdPager,tdPager1","0","");var c=new Asynchronous();c.call("searchrecords.aspx?o=1&rnd="+Math.random(),"tdResult","0","trResult");var a=new Asynchronous();a.call("searchrecords.aspx?o=6&rnd="+Math.random(),"tdYourSearch","0","trYourSearch");if(f=="1"){var d=new Asynchronous();d.call("searchrecords.aspx?o=4&tagsubfield=100a&rnd="+Math.random(),"tdSearchAuthorFilter","0","");var d=new Asynchronous();d.call("searchrecords.aspx?o=4&tagsubfield=260b&rnd="+Math.random(),"tdSearchPublisherFilter","0","")}}function addtoCart(){var a=new Array();a=document.getElementsByName("searchresult");var f=false;var b="";for(var c=0;c<a.length;c++){if(document.getElementById(a[c].id).checked){b=b+a[c].id+",";f=true;document.getElementById(a[c].id).checked=false;document.getElementById("td"+a[c].id).className="NumberRow1"}}if(f==false){alert("Select Item(s) to Add Into Cart.");return}var d=opac.addtocart(b);document.getElementById("spanTotal").innerHTML=d.value;document.getElementById("spanTotal1").innerHTML=d.value;alert("Selected Item(s) Added to Cart.")}function removefromCart(){var a=new Array();a=document.getElementsByName("searchresult");var g=false;var b="";for(var c=0;c<a.length;c++){if(document.getElementById(a[c].id).checked){b=b+a[c].id+",";g=true;document.getElementById(a[c].id).checked=false;if(document.getElementById("td"+a[c].id)){document.getElementById("td"+a[c].id).className="NumberRow"}}}if(g==false){alert("Select Item(s) to Remove From Cart.");return}var f=opac.removefromcart(b);if(f.value=="-1"){document.getElementById("spanTotal").innerHTML="0";document.getElementById("spanTotal1").innerHTML="0";alert("No item(s) Into Cart.");return}document.getElementById("spanTotal").innerHTML=f.value;document.getElementById("spanTotal1").innerHTML=f.value;alert("Selected Item(s) Removed From Cart.");var d=opac.getcurrentmode();if(d.value!=""){if(d.value=="ViewCart"){viewcart()}}}function exportdata(){var d=methods.CheckCredit("DCredit");if(d.value=="Not Enough Resource Credit."){alert(d.value);return}var h=opac.getCartItems();if(h.value=="No Item(s) in Cart."){alert(h.value);return}var g=h.value;var c=new Array();c=g.split(",");for(var j=0;j<c.length;j++){var k=opac.checkforRecord(c[j]);var f=new Array();f=k.value.split("#");if(f[0]=="0"){opac.exportData(c[j],"0")}else{if(f[0]=="1"){if(confirm(f[1])){opac.exportData(c[j],"1")}}}}opac.setDownLoadCredit();var b=new Array();b=document.getElementsByName("searchresult");for(var j=0;j<b.length;j++){document.getElementById(b[j].id).className="NumberRow"}document.getElementById("spanTotal").innerHTML="0";document.getElementById("spanTotal1").innerHTML="0";alert("Succesfully Downloaded !!!");viewcart()}function findavailablelocation(b){var a=new Asynchronous();a.call("searchrecords.aspx?o=2&bibid="+b+"&rnd="+Math.random(),"tdavailablelocation"+b,"0","")}function findavailablebranch(a){var b=new Asynchronous();b.call("searchrecords.aspx?o=7&bibid="+a+"&rnd="+Math.random(),"tdavailablebranch"+a,"0","")}function findavailablelocation1(b,c){var a=new Asynchronous();a.call(c+"searchrecords.aspx?o=2&bibid="+b+"&rnd="+Math.random(),"tdavailablelocation"+b,"0","")}function viewcart(){document.getElementById("tdPager").style.display="none";document.getElementById("tdPager1").style.display="none";var a=new Asynchronous();a.call("searchrecords.aspx?o=3&rnd="+Math.random(),"tdResult","0","")}function searchon(a){opac.searchon(a)}function Cybraryresultfrom(b){opac.resultfrom(b);var a=new Asynchronous();a.call("searchrecords.aspx?o=8&rfrom="+b+"&rnd="+Math.random(),"ctl00_ContentPlaceHolder1_tdItemTypes","0","")}function getposOffset2(a,d){var c=(d=="left")?a.offsetLeft:a.offsetTop;var b=a.offsetParent;while(b!=null){c=(d=="left")?c+b.offsetLeft:c+b.offsetTop;b=b.offsetParent}return c}function setoverlyposition(f,d,a,j,g){var c=document.getElementById(d);c.style.display="block";var b=getposOffset2(f,"left")+((typeof a!="undefined"&&a.indexOf("right")!=-1)?-(c.offsetWidth-f.offsetWidth):0);var h=getposOffset2(f,"top")+((typeof a!="undefined"&&a.indexOf("bottom")!=-1)?f.offsetHeight:0);c.style.left=b+j+"px";c.style.top=h+g+"px";return false}function overlaydisplay(a){document.getElementById(a).style.display=""}function overlayclose2(a){document.getElementById(a).style.display="none"}function createBlockforbranch(d,c,a){var f=opac.holdingbranch(c,a);if(f.value!=""){var b=document.createElement("div");b.setAttribute("id","holdingbranch"+c);b.innerHTML=f.value;b.style.position="absolute";document.aspnetForm.appendChild(b);setoverlyposition(d,"holdingbranch"+c,"",0,20)}}function destroyBlockforbranch(b,a){var c=document.getElementById("holdingbranch"+b);document.aspnetForm.removeChild(c)}function createBlocksuggestion(c,d){var a=methods.cr2sug(d);if(a.value!=""){var b=document.createElement("div");b.setAttribute("id","sug"+d);b.innerHTML=a.value;b.style.position="absolute";document.aspnetForm.appendChild(b);setoverlyposition(c,"sug"+d,"",0,15)}}function destroyBlockforsuggestion(b){var a=document.getElementById("sug"+b);document.aspnetForm.removeChild(a)}function logoutfromsearch(){var a=opac.logoutfromsearch();window.location=a.value}function truebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}function setRunningProcess(){if(document.getElementById("divProcess")&&document.getElementById("tbAll")){document.getElementById("divProcess").style.width=getClientWidth();document.getElementById("divProcess").style.height=getClientHeight();document.getElementById("tbAll").style.width=getClientWidth();document.getElementById("tbAll").style.height=getClientHeight();document.getElementById("tbAll").style.position="absolute";document.getElementById("divProcess").style.left=0+"px";document.getElementById("tbAll").style.left=0+"px";document.getElementById("divProcess").style.top=window.pageYOffset?window.pageYOffset:truebody().scrollTop?truebody().scrollTop:0+"px";var a=window.pageYOffset?window.pageYOffset:truebody().scrollTop?truebody().scrollTop:0;document.getElementById("tbAll").style.top=a+"px"}}function showReservation(a){opac.SaveBibID(a);e=document.getElementById("spanBranch");res=opac.FillBranch(e.innerHTML);e=document.getElementById("spanBranch");e.innerHTML=res.value;e=null;document.getElementById("txtNotes").value="";document.getElementById("divProcess").style.display="";document.getElementById("tbAll").style.display="";document.getElementById("divReservation").style.display="";setRunningProcess()}function closeReservation(){document.getElementById("divProcess").style.display="none";document.getElementById("divReservation").style.display="none";document.getElementById("tbAll").style.display="none"}function reserve(){if(document.getElementById("DDBranch").value==""||document.getElementById("DDBranch").value=="0"){alert("Select Branch");return}var d="";var c=document.getElementById("DDBranch").value;var b=document.getElementById("txtNotes").value;var a=opac.reserve(d,c,b);alert(a.value);closeReservation()}function showSuggestion(){document.getElementById("txtTitle").value="";document.getElementById("txtIsbn").value="";document.getElementById("txtAuthor").value="";document.getElementById("txtPName").value="";document.getElementById("txtPYear").value="";document.getElementById("txtPPlace").value="";document.getElementById("txtNotes2").value="";document.getElementById("divProcess").style.display="";document.getElementById("tbAll").style.display="";document.getElementById("divSuggestion").style.display="";setRunningProcess()}function closeSuggestion(){document.getElementById("divProcess").style.display="none";document.getElementById("divSuggestion").style.display="none";document.getElementById("tbAll").style.display="none"}function saveSuggestion(){if(document.getElementById("txtTitle").value==""){alert("Enter Title");return}var j=document.getElementById("txtTitle").value;var b=document.getElementById("txtIsbn").value;var g=document.getElementById("txtAuthor").value;var f=document.getElementById("txtPName").value;var h=document.getElementById("txtPYear").value;var a=document.getElementById("txtPPlace").value;var d=document.getElementById("txtNotes2").value;var c=opac.saveSuggestion(j,b,g,f,h,a,d);alert(c.value);closeSuggestion()}function showHolidays(){document.getElementById("divProcess").style.display="";document.getElementById("tbAll").style.display="";document.getElementById("divHolidays").style.display="";setRunningProcess()}function closeHolidays(){document.getElementById("divProcess").style.display="none";document.getElementById("divHolidays").style.display="none";document.getElementById("tbAll").style.display="none"}function showAlerts(){var a=new Asynchronous();a.call("searchrecords.aspx?o=5&rnd="+Math.random(),"tdAlerts","0","")}function closeAlerts(){document.getElementById("divProcess").style.display="none";document.getElementById("divAlerts").style.display="none";document.getElementById("tbAll").style.display="none"}function donotshow(){var d="";var c="false";for(i=0;i<document.aspnetForm.elements.length;i++){if(document.aspnetForm.elements[i].checked==true&&document.aspnetForm.elements[i].type=="checkbox"&&document.aspnetForm.elements[i].name.substring(0,9)=="chkalert-"){var f=new Array();f=document.aspnetForm.elements[i].name.split("-");d=d+f[1]+",";c="true"}}if(c=="true"){var b=methods.donotshowalerts(d);alert(b.value);var a=new Asynchronous();a.call("searchrecords.aspx?o=5&rnd="+Math.random(),"tdAlerts","0","")}else{alert("Select to remove");return}}function getAboutUs(){var a=opac.getAboutUs();if(a.value!=""&&a.value!=null&&a.value!="null"){document.getElementById("tdAboutUs").innerHTML=a.value;document.getElementById("divProcess").style.display="";document.getElementById("tbAll").style.display="";document.getElementById("divAboutUs").style.display="";setRunningProcess()}}function closeAboutUs(){document.getElementById("divProcess").style.display="none";document.getElementById("divAboutUs").style.display="none";document.getElementById("tbAll").style.display="none"}function checksearchwithin(a){if(a.checked){document.getElementById("trItemTypes").style.display="none"}else{document.getElementById("trItemTypes").style.display=""}}function blockaction(f,b){var d=new Array();d=b.split(",");for(var c=0;c<d.length;c++){var a=d[c];if(document.getElementById(a).style.display==""){document.getElementById(a).style.display="none";if(f.innerHTML=="Hide"){f.innerHTML="Show"}}else{document.getElementById(a).style.display="";if(f.innerHTML=="Show"){f.innerHTML="Hide"}}}}function getNewArrival(b){opac.newArrivalModeOn();opac.savesearchword("");opac.savesearchstring(b+"##1#1#0##1#0");var a=getCurrentPageName();var c=new Array();c=a.split("?");a=c[0];if(a==""){a="Default.aspx"}if(a.indexOf("searchresult.aspx")==-1){window.location="searchresult.aspx"}else{getRecords("1")}}function gotopage(b){var c="";var a=new Array();a=document.getElementsByName("txtgoto");for(i=0;i<a.length;i++){c=a[i].value;if(Number(c)){break}}if(c==""){alert("Invalid Page number.");return}if(Number(c)<1||Number(c)>Number(b)){alert("Invalid Page number.");return}ViewNextPrevPage(c)}function setPageTitle(a,c){var g=document.getElementById("ctl00_ContentPlaceHolder1_txtSearch").value;var f=document.getElementsByName("OptSearchBy");var d="";for(var b=0;b<f.length;b++){if(f[b].checked){d=f[b].value;break}}if(c=="0"){document.title=a;return}if(g==""){if(d==""){document.title=a}else{document.title=a+" on "+d}}else{document.title=a+' for "'+g+'"'}}function showChnagePassword(){document.getElementById("txtoldpwd").value="";document.getElementById("txtnewpwd").value="";document.getElementById("txtcnfpwd").value="";document.getElementById("divProcess").style.display="";document.getElementById("divChangePassword").style.display="";document.getElementById("tbAll").style.display=""}function ChangePassword(){if(document.getElementById("txtoldpwd").value==""){alert("Insert old password");return}if(document.getElementById("txtnewpwd").value==""){alert("Insert New password");return}if(document.getElementById("txtnewpwd").value!=document.getElementById("txtcnfpwd").value){alert("Password mismatch");return}var a=opac.changepassword(document.getElementById("txtoldpwd").value,document.getElementById("txtnewpwd").value);alert(a.value);if(a.value=="Password changed"){document.getElementById("divProcess").style.display="none";document.getElementById("divChangePassword").style.display="none";document.getElementById("tbAll").style.display="none"}}function closeChangePassword(){document.getElementById("txtoldpwd").value="";document.getElementById("txtnewpwd").value="";document.getElementById("txtcnfpwd").value="";document.getElementById("divProcess").style.display="none";document.getElementById("divChangePassword").style.display="none";document.getElementById("tbAll").style.display="none"}function showLogin(){document.getElementById("divProcess").style.display="";document.getElementById("tbAll").style.display="";document.getElementById("divLogin").style.display="";setRunningProcess()}function closelogin(){document.getElementById("divProcess").style.display="none";document.getElementById("divLogin").style.display="none";document.getElementById("tbAll").style.display="none"}function showReview(a,b){opac.SaveBibID(a);opac.saveTitle(b);document.getElementById("divProcess").style.display="";document.getElementById("tbAll").style.display="";document.getElementById("divReview").style.display="";setRunningProcess()}function SaveReview(){var a=document.getElementById("txtReview").value;if(a==""){alert("Enter Review");return}var b=opac.savereview(a);if(b.value=="Review Saved."){closeReview()}alert(b.value)}function closeReview(){document.getElementById("divProcess").style.display="none";document.getElementById("divReview").style.display="none";document.getElementById("tbAll").style.display="none"}function SaveTowishlist(c,a){if(confirm("Are you sure to save?")){var b=opac.SaveTowishlist(a);if(b.value!="Error to save in wishlist."){c.style.background="url(images/006.png) top left no-repeat"}alert(b.value)}}function RemoveFromwishlist(c,a){if(confirm("Are you sure to Remove?")){var b=opac.RemoveFromwishlist(a);if(b.value=="Removed."){c.style.background="url(images/001.png) top left no-repeat"}alert(b.value)}}function getMywishlist(){opac.wishlistModeOn();opac.savesearchword("");opac.savesearchstring("##1#1#0##1#0");var a=getCurrentPageName();var b=new Array();b=a.split("?");a=b[0];if(a==""){a="Default.aspx"}if(a.indexOf("searchresult.aspx")==-1){window.location="searchresult.aspx"}else{getRecords("1")}}function findReviews(a){var b=new Asynchronous();b.call("searchrecords.aspx?o=9&bibid="+a+"&rnd="+Math.random(),"tdavailablebranch"+a,"0","")};
