var head=document.getElementsByTagName("HEAD")[0];var body=document.getElementsByTagName("Body")[0];var script=document.createElement("SCRIPT");var coverStable="";script=document.createElement("SCRIPT");script.src="http://s7.addthis.com/js/250/addthis_widget.js";head.appendChild(script);script=document.createElement("SCRIPT");script.src="http://yui.yahooapis.com/combo?2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&2.8.0r4/build/dragdrop/dragdrop-min.js&2.8.0r4/build/container/container-min.js";head.appendChild(script);var canvas_support={canvas_compatible:false,check_canvas:function(){try{this.canvas_compatible=!!(document.createElement("canvas").getContext("2d"));}catch(e){this.canvas_compatible=!!(document.createElement("canvas").getContext);}return this.canvas_compatible;}};canvas_support.check_canvas();var OnSearchComplete=function(sc,_2){if(_2.results&&_2.results.length>0){if(unescape(_2.results[0].url).toQueryParams().sig){$("googleBook").innerHTML="<a href='"+unescape(_2.results[0].url)+"' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/googlebook.gif'></img></a> ";}}};var searchControl=null;var isbn=null;var options1={writeResult:function(_3,_4){if(_3.length>0){coverStable=_3[0].cover;addthis_title=_3[0].title+" "+_3[0].subtitle;addthis_url="http://bots.lib.ntu.edu.tw/Webpac/app?page=BookMark&service=external&sp=S"+id+"?";if(_3[0].thesis=="m"||_3[0].thesis=="p"){addExportBibtex();}if(_3[0].media_type=="a"||_3[0].media_type=="aa"||_3[0].media_type=="\u653f"){addExportRIS();}if(_3[0].isbn!=null&&_3[0].isbn!=""){addMetaCat("ISBN",_3[0].isbn);if($("CoverDiv")==null){insertCoverDiv();}if(_3[0].ean!=null&&_3[0].ean!=""){showCover(_3[0].ean,true);}}if(_3[0].issn!=null&&_3[0].issn!=""){addMetaCat("ISSN",_3[0].issn);addJADE(id);}addQRCode(_3[0]);addBookMark();addComment();addShowComment();}else{}}};function addLoadEvent(_5){var _6=window.onload;if(typeof window.onload!="function"){window.onload=_5;}else{window.onload=function(){_6();_5();};}}var showAmazon=true;var showErrorReport=true;var showComments=true;var showBibTex=true;var showEndnote=true;var isbnArray=[];var issnArray={};var codeArray={};var coverDIV;var barcode="";addLoadEvent(insertCover);function test(_7,_8){if(_7.width>50){$("buffer").update();if(id!=null){$("coverDiv").update("<center><img src='http://static.findbook.tw/image/book/"+_8+"/large'/><br/><a href='http://findbook.tw/b/ISBN/"+_8+"' alt='Search FindBook' target='_blank'>Search in FindBook</a><br/><b>[Beta Testing]</b></center>");script=document.createElement("SCRIPT");script.src="http://140.112.113.54/TulipsOnDemand/app?page=UpdateCover&service=external&sp=S"+id+"&sp=Sfindbook";head.appendChild(script);}else{$("coverDiv").update("<center><img src='http://static.findbook.tw/image/book/"+_8+"/large'/><br/><a href='http://findbook.tw/b/ISBN/"+_8+"' alt='Search FindBook' target='_blank'>Search in FindBook</a><br/><b>[Beta Testing]</b></center>");}}else{if(showAmazon){$("buffer").update("<img  src='http://images.amazon.com/images/P/"+_8+".01.MZZZZZZZ.jpg' onload='test2(this,\""+_8+"\");' onerror='test2(this,\""+_8+"\");'/>");}}}function test2(_9,_a){$("buffer").update();if(_9.width>50){$("coverDiv").update("<center><img  src='http://images.amazon.com/images/P/"+_a+".01.MZZZZZZZ.jpg' /><br/><a href='http://findbook.tw/b/ISBN/"+_a+"' alt='Search FindBook' target='_blank'>Search in FindBook</a> <b>[Beta Testing]</b><br/><a href='http://www.amazon.com/exec/obidos/ASIN/"+_a+"' alt='Search Amazon' target='_blank'>Search in Amazon</a><br/><b>[Beta Testing]</b></center>");}else{if(isbnArray.length>1){showCover(isbnArray.shift(),true);}}}function testVideoCover(_b,id){if($("CoverDiv")==null){insertCoverDiv();}if(_b.width>50){document.getElementById("buffer").innerHTML="";var _d=document.getElementById("coverDiv");_d.innerHTML="<center><img  src='http://newbooks.lib.ntu.edu.tw/wp-content/b/"+id+".jpg' /><br/></center>";}}function showCover(_e,_f){if(_f){if(coverStable=="findbook"){$("coverDiv").update("<center><img src='http://static.findbook.tw/image/book/"+_e+"/large'/><br/><a href='http://findbook.tw/b/ISBN/"+_e+"' alt='Search FindBook' target='_blank'>Search in FindBook</a><br/><b>[Beta Testing]</b></center>");}else{$("buffer").update("<img src='http://static.findbook.tw/image/book/"+_e+"/large' onload='test(this,\""+_e+"\");' onerror='test(this,\""+_e+"\");'/>");}}}function showVideoCover(_10,_11){if(_11){var div=document.getElementById("buffer");div.innerHTML="<img src='http://newbooks.lib.ntu.edu.tw/wp-content/b/"+_10+".jpg' onload='testVideoCover(this,\""+_10+"\");' />";}}function findGoogleBook(_13){script=document.createElement("SCRIPT");script.src="http://books.google.com/books?bibkeys="+_13+"&jscmd=viewapi&callback=mycallback";head.appendChild(script);}var __callback;function mycallback(_14){__callback=_14;}function extractISBN(){var _15=document.getElementsByClassName("bibInfoData");_15.each(function(ele){if(ele.innerHTML.match(/[\d-]{9,}[\dX]/g)){isbnArray[isbnArray.length]=ele.innerHTML.match(/[\d-]{9,}[\dX]/g)[0];}});isbnArray.each(function(_17,_18){isbnArray[_18]=_17.replace(/-/g,"");findGoogleBook("ISBN:"+isbnArray[_18]);});}function extractISSN(){var _19=document.documentElement.innerHTML.match(/ISSN[^<]*<[^t]*td>[^<]*<td[^>]*>[^<]*</g);try{issnArray=_19[0].match(/[\d-]{7,}[\dX]/g);}catch(e){}issnArray.each(function(_1a,_1b){issnArray[_1b]=_1a.replace(/-/g,"");});}function extractCode(){codeArray=document.documentElement.innerHTML.match(/>[\d]{7}</g);codeArray.each(function(_1c,_1d){codeArray[_1d]=_1c.replace(/[><]/g,"");});barcode=codeArray.first();}function insertCoverDiv(){var tds=document.getElementsByTagName("td");var td;for(var i=0;i<tds.length;i++){if(tds[i].getAttribute("width")=="12%"){td=tds[i];}}var _21=td.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;var row=_21.getElementsByTagName("TBODY")[0].childNodes[0];var td1=row.insertCell(row.cells.length);coverDIV=document.createElement("div");coverDIV.setAttribute("id","coverDiv");td1.appendChild(coverDIV);td1.appendChild(document.createElement("br"));coverDIV=document.createElement("div");coverDIV.setAttribute("id","QRDiv");td1.appendChild(coverDIV);$("QRDiv").hide();}function insertDiv(){isbn=null;if(isbnArray.length>0){isbn=isbnArray.shift();}insertCoverDiv();if(isbn!=null){showCover(isbn,true);}else{}}function buildBufferDiv(){var div=document.createElement("div");div.setAttribute("id","buffer");div.setAttribute("style","position:absolute;top:-5000px");document.getElementsByTagName("body")[0].appendChild(div);}function eJournalsCallback(){alert(eJournals.length);}var addthis_url=location.href;var addthis_title=null;var addthis_pub="brent";var webpacSearch=null;var id=null;function insertCover(){if($$("table.browseList").length>0){return;}try{id=$("recordnum").getAttribute("href").match(/b[\d]{7}/);showVideoCover(id,true);addShowErrorReport();extractCode();head=document.getElementsByTagName("HEAD")[0];script=document.createElement("SCRIPT");script.src="http://dbi.lib.ntu.edu.tw/Webpac/app?page=TulipsStatisticAPI&service=external&sp=S"+id;head.appendChild(script);}catch(e){}try{buildBufferDiv();insertDiv();}catch(e){}_init();}function addQRCode(_25){var _26=[];$$("tr.bibItemsEntry").each(function(_tr){_26[_26.length]=(_tr.select("td")[0]).innerHTML.stripTags().gsub("&nbsp;","");});_26=_26.uniq().compact();$("QRDiv").update("<img src='http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl="+encodeURIComponent(_25.title+"\r\n"+_25.callNo+"\r\n"+(_26.length>0?_26.join(","):"")+((_25.ean=="")?"":"\r\n"+_25.ean))+"&choe=UTF-8'>");}function addBookMark(){new Insertion.Top($("additionTD"),"<a href=\"http://www.addthis.com/bookmark.php\" onmouseover=\"return addthis_open(this, '', '"+addthis_url+"', '"+addthis_title+"');\"   onmouseout=\"addthis_close();\"  onclick=\"return addthis_sendto();\"><img   src=\"http://tulips.ntu.edu.tw/screens/bookmark.jpg\" style=\"border:0px;padding:2px;\"/></a>");}function addComment(){new Insertion.Top($("additionTD"),"<a style='text-decoration:none;' href='"+"http://dbi.lib.ntu.edu.tw/Webpac/app?page=AddTulipsCommentAPI&service=external&sp=S"+id+"' target='_blank'>.</a> ");}function addShowComment(){if(showComments){var _28=document.getElementsByTagName("HEAD")[0];var _29=document.createElement("SCRIPT");_29.id="Comment";_29.src="http://dbi.lib.ntu.edu.tw/Webpac/app?page=GetTulipsCommentAPI&service=external&sp=S"+id;_28.appendChild(_29);}}function addGoogleBook(_2a){new Insertion.Top($("additionTD"),"<span id='googleBook'></span>");}function addShowErrorReport(){if(showErrorReport){if(id){try{Element.insert(($$("div.bibRecordLink")[0]),{After:"<table cellspacing='1' border='0' width='100%'><tr><td width='15%' style='font-weight:bold; valign='top'>&nbsp;Beta :<span id='viewOnline'></span></td><td id ='additionTD'><a href='http://140.112.113.2/libsuggestion.html?"+id+"' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/trouble.jpg'/></a><font color='white'>"+id+"</font> </td></tr></table>"});}catch(e){}webpacSearch=new NTULib.WebPACSearch(null,null,null,options1);var _2b=document.getElementsByTagName("HEAD")[0];var _2c=document.createElement("SCRIPT");_2c.id="NTUDotB";_2c.src="http://140.112.114.67/Webpac/app?page=DotBSearchWebAPI&service=external&sp=S"+id+"&sp=S0";_2b.appendChild(_2c);}}}function addExportBibtex(){if(id&&showBibTex){try{new Insertion.Top($("additionTD"),"<a href='http://dbi.lib.ntu.edu.tw/Webpac/app?page=DotBToBibTexAPI&service=external&sp=S"+id+"&sp=S0' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/bibtex.jpg'></img></a>");}catch(e){}}}function addMetaCat(_t,_q){try{new Insertion.Top($("additionTD"),"<a  href='http://metacat.ntu.edu.tw/metacat2/app?t="+_t+"&l=0&q="+_q+"' alt='Search MetaCat' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/metacat.jpg'></img></a>");}catch(e){}}function addJADE(_q){try{new Insertion.Top($("additionTD"),"<a  href='http://jade.lib.ntu.edu.tw/rapid_frontend/index.html?record="+_q+"' alt='Go JADE' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/jade.jpg'></img></a>");}catch(e){}}function addExportRIS(){if(id&&showEndnote){try{new Insertion.Top($("additionTD"),"<a href='http://www.lib.ntu.edu.tw/CI/services/webpac/help.html' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/help.jpg'/></img></a> ");new Insertion.Top($("additionTD"),"<a href='http://140.112.114.67/Webpac/app?page=DotBToRISAPI&service=external&sp=S"+id+"&sp=S0' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/RIS.jpg'/></img></a>");}catch(e){}}}function addExportEndNote(){if(id&&showEndnote){try{new Insertion.Top($("additionTD"),"<a href='http://dbi.lib.ntu.edu.tw/Webpac/app?page=DotBToEndNoteAPI&service=external&sp=S"+id+"&sp=S0' target='_blank'><img style='border:0px;padding:2px;' src='http://tulips.ntu.edu.tw/screens/endnote03.gif'/></img></a>");}catch(e){}}}function CommentLoaded(){var _30=eval(id+"Comment");if(_30.length>0){new Insertion.Before($("buffer"),"<div id='comments' style='display:none'>Comments :<br/><div>");}_30.each(function(_31,_32){new Insertion.Bottom($("comments"),"<div>"+_31.author+" Says:<br/><pre>"+_31.content+"</pre></div>");});}var viewer;try{if(google){function OnLoad(){}}}catch(err){}var kp1;var kp2;var _keystrokes=[];var _init=function(){var _33=function(_34,_35,obj){if(_35[0]=="49"){$("coverDiv").hide();$("QRDiv").show();}else{$("QRDiv").hide();$("coverDiv").show();}};var _37=function(_38,_39,obj){if(_keystrokes.length==22){_keystrokes.shift();}_keystrokes[_keystrokes.length]=_39[0];if(_keystrokes.length==22){if((_keystrokes[0]==38)&&(_keystrokes[1]==38)&&(_keystrokes[2]==38)&&(_keystrokes[3]==38)&&(_keystrokes[4]==40)&&(_keystrokes[5]==40)&&(_keystrokes[6]==40)&&(_keystrokes[7]==40)&&(_keystrokes[8]==37)&&(_keystrokes[9]==37)&&(_keystrokes[10]==37)&&(_keystrokes[11]==37)&&(_keystrokes[12]==39)&&(_keystrokes[13]==39)&&(_keystrokes[14]==39)&&(_keystrokes[15]==39)&&(_keystrokes[16]==66)&&(_keystrokes[17]==66)&&(_keystrokes[18]==65)&&(_keystrokes[19]==65)&&(_keystrokes[20]==13)&&(_keystrokes[21]==13)){$("banner").src="http://140.112.113.1/screens/christmasTULIPS.jpg";$("banner").removeAttribute("width");$("banner").removeAttribute("height");$("bannerBG").setAttribute("background","http://140.112.113.1/screens/christmasTULIPS_bg.jpg");$("bannerBG").background="http://140.112.113.1/screens/christmasTULIPS_bg.jpg";snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD");snowletter="*";for(i=0;i<=snowmax;i++){$("s"+i).innerHTML=snowletter;}initsnow();}if((_keystrokes[0]==38)&&(_keystrokes[1]==38)&&(_keystrokes[2]==38)&&(_keystrokes[3]==38)&&(_keystrokes[4]==40)&&(_keystrokes[5]==40)&&(_keystrokes[6]==40)&&(_keystrokes[7]==40)&&(_keystrokes[8]==37)&&(_keystrokes[9]==37)&&(_keystrokes[10]==39)&&(_keystrokes[11]==39)&&(_keystrokes[12]==37)&&(_keystrokes[13]==37)&&(_keystrokes[14]==39)&&(_keystrokes[15]==39)&&(_keystrokes[16]==66)&&(_keystrokes[17]==66)&&(_keystrokes[18]==65)&&(_keystrokes[19]==65)&&(_keystrokes[20]==13)&&(_keystrokes[21]==13)){snowcolor=new Array("#990000","#990033","#990066");snowletter="&hearts;";for(i=0;i<=snowmax;i++){$("s"+i).innerHTML=snowletter;}initsnow();}}};kp1=new YAHOO.util.KeyListener(document,{alt:true,keys:[49,50]},{fn:_33});kp1.enable();kp2=new YAHOO.util.KeyListener(document,{keys:[38,40,37,39,66,65,13]},{fn:_37});kp2.enable();};var snowmax=35;var snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD");var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS");var snowletter="&hearts;";var sinkspeed=0.6;var snowmaxsize=22;var snowminsize=8;var snowingzone=3;var snow=new Array();var marginbottom;var marginright;var timer;var i_snow=0;var x_mv=new Array();var crds=new Array();var lftrght=new Array();var browserinfos=navigator.userAgent;var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/);var ns6=document.getElementById&&!document.all;var opera=browserinfos.match(/Opera/);var browserok=ie5||ns6||opera;function randommaker(_3b){rand=Math.floor(_3b*Math.random());return rand;}function initsnow(){if(ie5||opera){marginbottom=document.body.clientHeight;marginright=document.body.clientWidth;}else{if(ns6){marginbottom=window.innerHeight;marginright=window.innerWidth;}}var _3c=snowmaxsize-snowminsize;for(i=0;i<=snowmax;i++){crds[i]=0;lftrght[i]=Math.random()*15;x_mv[i]=0.03+Math.random()/10;snow[i]=document.getElementById("s"+i);snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)];snow[i].size=randommaker(_3c)+snowminsize;snow[i].style.fontSize=snow[i].size;snow[i].style.color=snowcolor[randommaker(snowcolor.length)];snow[i].sink=sinkspeed*snow[i].size/5;if(snowingzone==1){snow[i].posx=randommaker(marginright-snow[i].size);}if(snowingzone==2){snow[i].posx=randommaker(marginright/2-snow[i].size);}if(snowingzone==3){snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4;}if(snowingzone==4){snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2;}snow[i].posy=randommaker(6*marginbottom-marginbottom-6*snow[i].size);snow[i].style.left=snow[i].posx;snow[i].style.top=snow[i].posy;}movesnow();}function movesnow(){for(i=0;i<=snowmax;i++){crds[i]+=x_mv[i];snow[i].posy+=snow[i].sink;snow[i].style.left=snow[i].posx+lftrght[i]*Math.sin(crds[i]);snow[i].style.top=snow[i].posy;if(snow[i].posy>=marginbottom-6*snow[i].size||parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){if(snowingzone==1){snow[i].posx=randommaker(marginright-snow[i].size);}if(snowingzone==2){snow[i].posx=randommaker(marginright/2-snow[i].size);}if(snowingzone==3){snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4;}if(snowingzone==4){snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2;}snow[i].posy=0;}}var _3d=setTimeout("movesnow()",50);}for(i=0;i<=snowmax;i++){document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>");}
