/*
Author: Tim Samshuijzen
Copyright 2008 Rockingstone
*/

var rsCommon={typeOf:function(value){var s=typeof value;if(s==='object'){if(value){if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))&&typeof value.splice==='function'){s='array'}}else{s='null'}}return s},isEmpty:function(o){if((o===null)||(typeof o==='undefined')){return true}return false},trim:function(s){return s.replace(/^\s+|\s+$/g,"")},int:function(aValue,aDefault){var res=Number(aValue);if(isNaN(res)){if(arguments.length>=2){res=aDefault;if(isNaN(res)){res=0}}else{res=0}}return res},getClientWidth:function(){var res=800;if(window.innerWidth){res=window.innerWidth}else if(document.documentElement&&document.documentElement.clientWidth){res=document.documentElement.clientWidth}else if(document.body){res=document.body.clientWidth}return res},getClientHeight:function(){var res=600;if(window.innerHeight){res=window.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){res=document.documentElement.clientHeight}else if(document.body){res=document.body.clientHeight}return res},getBodyHeight:function(){var res=600;if(window.innerHeight){res=window.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){res=document.documentElement.clientHeight;if(document.documentElement.scrollHeight&&(document.documentElement.scrollHeight>document.documentElement.clientHeight)){res=document.documentElement.scrollHeight}}else if(document.body){res=document.body.clientHeight;if(document.body.scrollHeight&&(document.body.scrollHeight>document.body.clientHeight)){res=document.documentElement.scrollHeight}}return res},scrollToTop:function(){if(document.body&&document.body.scrollTop){document.body.scrollTop=0}else if(document.documentElement&&document.documentElement.scrollTop){document.documentElement.scrollTop=0}}};var rsElements={get:function(element){if((typeof element=="string")||(typeof element=="number")){return document.getElementById(element)}else{return element}},setStyles:function(element,styles){element=rsElements.get(element);for(var i=1,length=arguments.length;i<length;i++){var arg=arguments[i];for(var property in arg)if(property!==null){element.style[property]=arg[property]}}return element},purgeHandlers:function(element){element=rsElements.get(element);var a=element.attributes,i,l,n;if(a){l=a.length;for(i=0;i<l;i+=1){n=a[i].name;if(typeof element[n]==='function'){element[n]=null}}}a=element.childNodes;if(a){l=a.length;for(i=0;i<l;i+=1){rsElements.purgeHandlers(element.childNodes[i])}}},setContent:function(element,content){var el=rsElements.get(element);if(1===0){var a=el.childNodes;if(a){l=a.length;for(i=0;i<l;i+=1){rsElements.purgeHandlers(el.childNodes[i])}}}el.innerHTML=content;return el},setTextContent:function(element,textContent){var el=rsElements.get(element);if(1===0){var a=el.childNodes;if(a){l=a.length;for(i=0;i<l;i+=1){rsElements.purgeHandlers(el.childNodes[i])}}}while(el.firstChild){el.removeChild(el.childNodes[0])}el.appendChild(document.createTextNode(textContent));return el},append:function(aContainerDOMID,aNewDOMID,aArguments){var args=aArguments||{};var res=document.createElement('div');var con=rsElements.get(aContainerDOMID);if(con){con.appendChild(res)}else{document.body.appendChild(res)}if(arguments.length>=2){res.id=aNewDOMID}if((typeof args.content=='string')&&(args.content!=='')){res.innerHTML=args.content}if((typeof args.textContent=='string')&&(args.textContent!=='')){res.nodeValue=args.textContent}return res},remove:function(element){var el=rsElements.get(element);if(1===0){rsElements.purgeHandlers(el)}el.parentNode.removeChild(el);return el}};var rsEvents=function(){var handlers=[];var lastHandlerID=0;var enableEvents=true;var that={indexOfHandler:function(aHandler){var hidx=-1;for(var i=0,length=handlers.length;i<length;i++){var hob=handlers[i];if((hob.handler==aHandler)||(hob.DOMHandler==aHandler)){hidx=i;break}}return hidx},indexOfHandlerID:function(aHandlerID){var hidx=-1;for(var i=0,length=handlers.length;i<length;i++){var hob=handlers[i];if(hob.handlerID==aHandlerID){hidx=i;break}}return hidx},add:function(aNode,aType,aHandler,aArguments){var node=rsElements.get(aNode);var domh=aHandler;var args=aArguments||{};lastHandlerID++;var lHandlerID=lastHandlerID;if(args.scope){if(args.once){domh=function(e){var ev=that.getEvent(e);if(enableEvents){rsEvents.removeByHandlerID(lHandlerID);return aHandler.apply(args.scope,ev)}else{return false}}}else{domh=function(e){var ev=that.getEvent(e);if(enableEvents){return aHandler.apply(args.scope,ev)}else{return false}}}}else if(args.once){domh=function(e){var ev=that.getEvent(e);if(EnableEvents){rsEvents.removeByHandlerID(lHandlerID);return aHandler(ev)}else{return false}}}else{domh=function(e){var ev=that.getEvent(e);if(enableEvents){return aHandler(ev)}else{return false}}}handlers[handlers.length]={handler:aHandler,DOMHandler:domh,node:node,type:aType,handlerID:lHandlerID};if(node.addEventListener){node.addEventListener(aType,domh,false)}else if(node.attachEvent){node.attachEvent('on'+aType,domh)}else{node['on'+aType]=domh}return domh},remove:function(aNode,aType,aHandler){var node=rsElements.get(aNode);var domh=aHandler;var eidx=that.indexOfHandler(domh);if(eidx>=0){domh=handlers[eidx].DOMHandler;handlers.splice(eidx,1)}if(node.removeEventListener){node.removeEventListener(aType,domh,false)}else if(node.detachEvent){node.detachEvent('on'+aType,domh)}else{node['on'+aType]=''}},removeByHandlerID:function(aHandlerID){var eidx=that.indexOfHandlerID(aHandlerID);if(eidx>=0){var hob=handlers[eidx];handlers.splice(eidx,1);if(hob.node.removeEventListener){hob.node.removeEventListener(hob.type,hob.DOMHandler,false)}else if(hob.node.detachEvent){hob.node.detachEvent('on'+hob.type,hob.DOMHandler)}}},removeByHandler:function(aHandler){var eidx=that.indexOfHandler(aHandler);if(eidx>=0){var hob=handlers[eidx];handlers.splice(eidx,1);if(hob.node.removeEventListener){hob.node.removeEventListener(hob.type,hob.DOMHandler,false)}else if(hob.node.detachEvent){hob.node.detachEvent('on'+hob.type,hob.DOMHandler)}}},getEvent:function(e){return e||window.event},getMousePosition:function(e){var pos={x:0,y:0};if(e.pageX||e.pageY){pos.x=e.pageX;pos.y=e.pageY}else if(e.clientX||e.clientY){pos.x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;pos.y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop}return pos}};return that}();var rsAjax={createXMLHTTPObject:function(){var xmlhttp=false;if(window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}else if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest()}return xmlhttp},sendRequest:function(url,callback,onerror){var req=this.createXMLHTTPObject();if(!req){return}var method="GET";var postData=null;req.open(method,url,true);req.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");if(method=="POST"){postData='dummy';req.setRequestHeader('Content-type','application/x-www-form-urlencoded')}req.onreadystatechange=function(){if(req.readyState!=4){return}if(req.status!=200&&req.status!=304){if(onerror){onerror(req)}return}callback(req)};if(req.readyState==4){return}req.send(postData);return req},evalReply:function(callpage){this.sendRequest(callpage,function(req){eval(req.responseText)})},alertReply:function(callpage){this.sendRequest(callpage,function(req){alert(req.responseText)})}};function TStringCat(){var sp;var ep=[];var l=0;var accum='';this.push=function(what){accum+=what;if(accum.length>2800){if(typeof(sp)=='undefined'){ep=[];sp=ep}else{var oep=ep;ep=[];oep[1]=ep}ep[0]=accum;accum='';++l}};this.toString=function(){if(accum!==''){if(!sp){ep=[];sp=ep}else{var oep=ep;ep=[];oep[1]=ep}ep[0]=accum;accum='';++l}if(l===0){return}ep[0]+=accum;while(l>1){var ptr=sp;var nsp=[];var nep=nsp;var nl=0;while(typeof(ptr)!='undefined'){if(typeof(nep[0])=='undefined'){nep[0]=ptr[0];++nl}else{if(typeof(ptr[0])!='undefined'){nep[0]+=ptr[0]}nep[1]=[];nep=nep[1]}ptr=ptr[1]}sp=nsp;ep=nep;l=nl}return sp[0]}}var g_WebDatabases=[{name:'abe',fullname:'ABE',url:'http://www.abebooks.com/',affiliateurl:'http://clickserve.cc-dt.com/link/click?lid=41000000024611511&pubid=21000000000157859',description:'AbeBooks is the world\'s largest online marketplace for books, listing over 110 million new, used, rare, and out of print books from 13,500 booksellers.',req:null,response:{},state:''},{name:'alibris',fullname:'Alibris',url:'http://www.alibris.com/',affiliateurl:'http://click.linksynergy.com/fs-bin/click?id=8wbHmAcw6qc&offerid=99238.10000005&type=3&subid=0',description:'Alibris offers over 60 million used, new, and out-of-print books from thousands of independent sellers.',req:null,response:{},state:''},{name:'amazon',fullname:'Amazon.com',url:'http://www.amazon.com/',affiliateurl:'http://www.amazon.com/',description:'Amazon.com, a very large retailer that needs little introduction. Whilst offering a wide collection of new books, it is also a marketplace for third-party booksellers offering used and rare books.',req:null,response:{},state:''},{name:'amazonca',fullname:'Amazon.ca',url:'http://www.amazon.ca/',affiliateurl:'http://www.amazon.ca/',description:'The Canadian based version of Amazon.com.',req:null,response:{},state:''},{name:'amazonuk',fullname:'Amazon.co.uk',url:'http://www.amazon.co.uk/',affiliateurl:'http://www.amazon.co.uk/',description:'The UK based version of Amazon.com.',req:null,response:{},state:''},{name:'amazonde',fullname:'Amazon.de',url:'http://www.amazon.de/',affiliateurl:'http://www.amazon.de/',description:'The German based version of Amazon.com.',req:null,response:{},state:''},{name:'amazonfr',fullname:'Amazon.fr',url:'http://www.amazon.fr/',affiliateurl:'http://www.amazon.fr/',description:'The French based version of Amazon.com.',req:null,response:{},state:''},{name:'biblio',fullname:'Biblio.com',url:'http://www.biblio.com/',affiliateurl:'http://www.biblio.com/',description:'Biblio.com offers over 50 million used and rare books from over 5000 bookstores and booksellers worldwide.',req:null,response:{},state:''},{name:'findbook',fullname:'findbook',url:'http://www.find-a-book.com/',affiliateurl:'http://www.find-a-book.com/',description:'This website contains a database of antiquarian books, maps and prints offered by the worlds leading booksellers.',req:null,response:{},state:''},{name:'choosebooks',fullname:'ChooseBooks.com',url:'http://www.choosebooks.com/',affiliateurl:'http://www.choosebooks.com/',description:'ChooseBooks.com/ZVAB.com is a worldwide marketplace for used, rare, antiquarian and out-of-print books, listing over 25 million items from over 4100 booksellers worldwide.',req:null,response:{},state:''},{name:'antiqbook',fullname:'Antiqbook',url:'http://www.antiqbook.nl/',affiliateurl:'http://www.antiqbook.nl/',description:'A European antiquarian booksite offering 7,5 million books from more than 800 independent booksellers from all over the world.',req:null,response:{},state:''},{name:'antikvariatnet',fullname:'Antikvariat.net',url:'http://www.antikvariat.net/',affiliateurl:'http://www.antikvariat.net/',description:'www.antikvariat.net is a collective books database of Scandinavian members of the ILAB, offering over 1,400,000 titles from 98 booksellers.',req:null,response:{},state:''},{name:'livrerarebook',fullname:'Livre Rare Book',url:'http://www.livre-rare-book.com/',affiliateurl:'http://www.livre-rare-book.com/',description:'livre-rare-book.com is a collective books database of mainly French booksellers, offering over 3 million titles from 600 booksellers.',req:null,response:{},state:''},{name:'pbfa',fullname:'PBFA',url:'http://www.booksatpbfa.com/',affiliateurl:'http://www.booksatpbfa.com/',description:'Over 1 million books offered by the members of the Provincial Booksellers Fairs Association, a UK based association founded in 1974.',req:null,response:{},state:''},{name:'bibliophile',fullname:'Bibliophile Bookbase',url:'http://www.bookbasesearch.com/',affiliateurl:'http://www.bookbasesearch.com/',description:'Bibliophile Bookbase is a multi-dealer booklisting service that has been on-line since late 1999. Since then their books database has grown to over four million items.',req:null,response:{},state:''},{name:'powells',fullname:'Powell\'s Books',url:'http://www.powells.com/',affiliateurl:'http://www.powells.com/partner/33130/',description:'Powell\'s Books offers a large collection of new and used books and textbooks.',req:null,response:{},state:''}];function redirectLink(url){return('./goto.php?url='+encodeURIComponent(url))}function MBSInit(){rsEvents.add('menu_home','mouseup',function(){selectMenu('home')});rsEvents.add('menu_overview','mouseup',function(){selectMenu('overview')});rsEvents.add('menu_list','mouseup',function(){selectMenu('list')});rsEvents.add('menu_gallery','mouseup',function(){selectMenu('gallery')});rsEvents.add('menu_help','mouseup',function(){selectMenu('help')});var wi=0;var length=0;var srchbxs='';var tlx=0;var tly=0;for(wi=0,length=g_WebDatabases.length;wi<length;wi++){tlx=10;tly=10+(40*wi);srchbxs+='<div style="position: absolute; left: '+tlx+'px; top: '+tly+'px; width: 264px; height: 27px; margin: 0; padding: 0; border: 0;">'+'<div style="position: absolute; left: 0px; top: 0px; width: 30px; height: 23px; margin: 0; padding: 0; padding-top: 4px;">'+'<input type="checkbox" id="enable_'+g_WebDatabases[wi].name+'" name="enable_'+g_WebDatabases[wi].name+'" value="1" checked=checked/>'+'</div>'+'<div style="position: absolute; left: 30px; top: 0px; width: 234px; height: 27px; margin: 0; padding: 0; border: 1px solid black;">'+'<a href="'+redirectLink(g_WebDatabases[wi].affiliateurl)+'" target="_blank" title="'+g_WebDatabases[wi].fullname+' - click to visit '+g_WebDatabases[wi].url+'"><img src="./img/logo'+g_WebDatabases[wi].name+'.png" border="0"/></a>'+'</div>'+'</div>'}tly=10+(40*wi);srchbxs+='<div style="position: absolute; left: '+tlx+'px; top: '+tly+'px; width: 264px; height: 27px; margin: 0; padding: 0; border: 0;">'+'<a href="" onclick="javascript:{'+'for(var wi = 0, length = g_WebDatabases.length; wi < length; wi++) {'+'rsElements.get(\'enable_\' + g_WebDatabases[wi].name).checked = true;'+'} return false;}">Select all</a>'+'&nbsp;&nbsp;/&nbsp;&nbsp;'+'<a href="" onclick="javascript:{'+'for(var wi = 0, length = g_WebDatabases.length; wi < length; wi++) {'+'rsElements.get(\'enable_\' + g_WebDatabases[wi].name).checked = false;'+'} return false;}">Unselect all</a>'+'</div>';rsElements.setContent(rsElements.get('screen_home_right'),srchbxs);tly=tly+40;rsElements.setStyles('screen_home_right',{height:tly+'px'});emptyHeaderBox();initScreenOverview();emptyScreenListTable();emptyScreenGallery()}var g_SelectedMenu='home';var g_AllResults=[];var g_SearchHistory=[];var g_ListSortField='sortprice';var g_AutoSwitchScreens=0;var g_FirstSearch=1;var g_GalleryPageBuilt=1;var g_GotAllResults=0;var g_SearchCriteria={};var g_SelectedHistoryIndex=-1;var g_GoogleBooksAvailabilityResult={};var g_GoogleBooksISBNBookIdsList=[];var g_WaitingForGoogle=0;var g_supportCancelSearch=1;function sortList(a,b){if(a[g_ListSortField]>b[g_ListSortField]){return 1}else if(a[g_ListSortField]<b[g_ListSortField]){return-1}else{return 0}}function getWebDatabaseIndexByName(aName){var res=-1;for(var wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].name==aName){res=wi;break}}return res}function MBSDebug(){rsAjax.sendRequest('./search.php?s_site=debug',function(req){var res={};try{res=eval('('+req.responseText+')')}catch(e){}rsElements.setContent('screen_help',res.response);alert(req.responseText)})}function MBSearch(){var s_author=rsElements.get('s_author').value;var s_title=rsElements.get('s_title').value;var s_keywords=rsElements.get('s_keywords').value;var s_isbn=rsElements.get('s_isbn').value;s_isbn=s_isbn.replace(/[^xX0123456789]/g,"").toUpperCase();var s_year1=rsElements.get('s_year1').value;var s_year2=rsElements.get('s_year2').value;var s_currency=rsElements.get('s_currency').value;var s_pmin=rsElements.get('s_pmin').value;var s_pmax=rsElements.get('s_pmax').value;var s_neworused='';var wi=0;var length=0;var allexcluded=0;var srchurl='';var sitelistpar='';if(rsElements.get('s_neworused_new').checked){s_neworused='new'}else if(rsElements.get('s_neworused_used').checked){s_neworused='used'}for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].req!==null){try{g_WebDatabases[wi].req.abort()}catch(e){}g_WebDatabases[wi].req=null}g_WebDatabases[wi].state='';g_WebDatabases[wi].response={}}updateSearchHistoryBeforeSearch();g_SearchCriteria={cs_author:s_author,cs_title:s_title,cs_keywords:s_keywords,cs_isbn:s_isbn,cs_year1:s_year1,cs_year2:s_year2,cs_currency:s_currency,cs_pmin:s_pmin,cs_pmax:s_pmax,cs_neworused:s_neworused};g_AllResults=[];g_GotAllResults=0;g_GoogleBooksAvailabilityResult={};g_GoogleBooksISBNBookIdsList=[];g_WaitingForGoogle=0;emptyScreenOverview();emptyHeaderBox();emptyScreenListTable();emptyScreenGallery();g_AutoSwitchScreens=0;if(((g_SelectedMenu!='overview')&&(g_SelectedMenu!='list')&&(g_SelectedMenu!='gallery'))||(g_FirstSearch==1)){g_AutoSwitchScreens=1}g_AutoSwitchScreens=1;allexcluded=1;for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(rsElements.get('enable_'+g_WebDatabases[wi].name).checked){allexcluded=0;break}}if((s_author==='')&&(s_title==='')&&(s_keywords==='')&&(s_isbn==='')){initScreenOverview();alert('Please enter at least an author, title, keyword or ISBN number.');rsElements.get('s_author').focus()}else if(allexcluded==1){selectMenu('home');alert('Please select at least one bookselling website.')}else{updateBeforeSearch();srchurl='./search.php?s_author='+encodeURIComponent(s_author)+'&s_title='+encodeURIComponent(s_title)+'&s_keywords='+encodeURIComponent(s_keywords)+'&s_isbn='+encodeURIComponent(s_isbn)+'&s_year1='+encodeURIComponent(s_year1)+'&s_year2='+encodeURIComponent(s_year2)+'&s_currency='+encodeURIComponent(s_currency)+'&s_pmin='+encodeURIComponent(s_pmin)+'&s_pmax='+encodeURIComponent(s_pmax)+'&s_neworused='+encodeURIComponent(s_neworused);sitelistpar='';for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(rsElements.get('enable_'+g_WebDatabases[wi].name).checked){if(sitelistpar!=''){sitelistpar+='%2C'}sitelistpar+=g_WebDatabases[wi].name;g_WebDatabases[wi].req=rsAjax.sendRequest(srchurl+'&s_site='+g_WebDatabases[wi].name,function(req){var res={};var wwi=0;var wlength=0;try{res=eval('('+req.responseText+')')}catch(e){res={}}if(res.result_flag=='1'){wwi=getWebDatabaseIndexByName(res.result_site);if(wwi>=0){g_WebDatabases[wwi].response=res;if(1==1){rsElements.setContent(rsElements.get('searchresults_'+res.result_site),res.result_html)}else{fillScreenSite(wwi)}g_AllResults=g_AllResults.concat(g_WebDatabases[wwi].response.result_list);g_WebDatabases[wwi].req=null}}else{for(wwi=0,wlength=g_WebDatabases.length;wwi<wlength;wwi++){if(g_WebDatabases[wwi].req==req){g_WebDatabases[wwi].response={};g_WebDatabases[wwi].req=null;rsElements.setContent(rsElements.get('searchresults_'+g_WebDatabases[wwi].name),'<span style="font-size: 12px;">'+g_WebDatabases[wwi].description+'</span>');break}}}updateAfterSearch()},function(req){var wwi=0;var wlength=0;for(wwi=0,wlength=g_WebDatabases.length;wwi<wlength;wwi++){if(g_WebDatabases[wwi].req==req){g_WebDatabases[wwi].response={};g_WebDatabases[wwi].req=null;rsElements.setContent(rsElements.get('searchresults_'+g_WebDatabases[wwi].name),'<span style="font-size: 12px;">'+g_WebDatabases[wwi].description+'</span>');break}}updateAfterSearch()})}}rsAjax.sendRequest(srchurl+'&s_site=common&s_sitelist='+sitelistpar,function(req){},function(req){})}return false}function showThrobber(aShow){if(aShow){rsElements.setStyles('throbber',{visibility:'visible'})}else{rsElements.setStyles('throbber',{visibility:'hidden'})}}function updateBeforeSearch(){var srchbxs='';var tly=0;var wi=0;var length=0;showThrobber(true);for(wi=0,length=g_WebDatabases.length;wi<length;wi++){tly=10+(348*parseInt(wi/3,10));rsElements.setStyles('searchbox_'+g_WebDatabases[wi].name,{top:tly+'px'});rsElements.setStyles('searchresults_'+g_WebDatabases[wi].name,{height:'300px'});if(rsElements.get('enable_'+g_WebDatabases[wi].name).checked){rsElements.setContent(rsElements.get('searchresults_'+g_WebDatabases[wi].name),'<div align="center"><br /><br /><br /><img src="./img/throbber.gif" border="0"><br />'+'<br />Retrieving results...<br /><br />'+(g_supportCancelSearch==1?'<button onclick="cancelSearch(\''+g_WebDatabases[wi].name+'\');">Cancel</button>':'')+'<br />'+'</div>')}else{g_WebDatabases[wi].state='excluded';rsElements.setContent(rsElements.get('searchresults_'+g_WebDatabases[wi].name),'&nbsp;<br />excluded from search<hr /><br />&nbsp;</div>')}}tly=tly+348;rsElements.setStyles('screen_overview',{height:tly+'px'});fillHeaderBoxDuringSearch(0);fillScreenListHeaderDuringSearch(0);fillScreenGalleryDuringSearch(0);if(g_AutoSwitchScreens==1){selectMenu('overview');rsCommon.scrollToTop()}}function updateAfterSearch(){var alldone=1;if(g_GotAllResults!=1){for(var wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].req!==null){alldone=0;break}}if(alldone===0){fillHeaderBoxDuringSearch(1);fillScreenListHeaderDuringSearch(1);fillScreenGalleryDuringSearch(1)}else{g_GotAllResults=1;fillHeaderBoxDuringSearch(2);fillScreenListHeaderDuringSearch(2);g_AllResults.sort(sortList);fillScreenListTable();if(g_SelectedMenu=='gallery'){fillScreenGalleryDuringSearch(2)}postCollectGoogleBooks();if(g_AutoSwitchScreens==1){selectMenu('list');rsCommon.scrollToTop()}updateSearchHistoryBoxAfterSearch();showThrobber(false);g_FirstSearch=0}}}function selectMenu(aMenuName){if(aMenuName!=g_SelectedMenu){rsElements.setStyles('menu_'+g_SelectedMenu,{top:'2px',height:'15px',backgroundColor:'#aaaaaa',fontSize:'12px'});rsElements.setStyles('screen_'+g_SelectedMenu,{display:'none'});g_SelectedMenu=aMenuName;rsElements.setStyles('menu_'+g_SelectedMenu,{top:'0px',height:'18px',backgroundColor:'#000000',fontSize:'13px'});rsElements.setStyles('screen_'+g_SelectedMenu,{display:'block'});if((g_SelectedMenu=='gallery')&&(g_GotAllResults==1)&&(g_GalleryPageBuilt===0)){rsElements.setContent(rsElements.get('screen_gallery_header'),'&nbsp;<br/><br/>compiling gallery...');showThrobber(true);setTimeout(function(){fillScreenGalleryDuringSearch(2);showThrobber(false)},10)}}}function initScreenOverview(){var srchbxs='';var tlx=0;var tly=0;for(var wi=0,length=g_WebDatabases.length;wi<length;wi++){tlx=10+(290*(wi%3));tly=10+(198*parseInt(wi/3,10));srchbxs=srchbxs+'<div id="searchbox_'+g_WebDatabases[wi].name+'" style="position: absolute; left: '+tlx+'px; top: '+tly+'px; width: 280px; margin: 0; padding: 0; border: 1px solid black;">'+'  <div id="logo_'+g_WebDatabases[wi].name+'" style="width: 280px; height: 27px; margin: 0; padding: 0; border: 0; border-bottom: 1px solid black; text-align: center;"><a href="'+redirectLink(g_WebDatabases[wi].affiliateurl)+'" target="_blank" title="'+g_WebDatabases[wi].fullname+' - click to visit '+g_WebDatabases[wi].url+'"><img src="./img/logo'+g_WebDatabases[wi].name+'.png" border="0"/></a></div>'+'  <div class="siteboxcontent" id="searchresults_'+g_WebDatabases[wi].name+'" style="width: 272px; height: 150px; margin: 0; padding: 4px; border: 0; overflow: scroll;">'+'<span style="font-size: 12px;">'+g_WebDatabases[wi].description+'</span>'+'  </div>'+'</div>'}rsElements.setContent(rsElements.get('screen_overview'),srchbxs);tly=tly+198;rsElements.setStyles('screen_overview',{height:tly+'px'})}function emptyScreenOverview(){var tly=0;for(var wi=0,length=g_WebDatabases.length;wi<length;wi++){tly=10+(348*parseInt(wi/3,10));rsElements.setStyles('searchbox_'+g_WebDatabases[wi].name,{top:tly+'px'});rsElements.setStyles('searchresults_'+g_WebDatabases[wi].name,{height:'300px'});rsElements.setContent(rsElements.get('searchresults_'+g_WebDatabases[wi].name),'<span style="font-size: 12px;">'+g_WebDatabases[wi].description+'</span>')}tly=tly+348;rsElements.setStyles('screen_overview',{height:tly+'px'})}function fillScreenSite(wi){var sc=new TStringCat();var content='';var nrresults=g_WebDatabases[wi].response.result_nritems;var rec={};var contentrow='';sc.push(g_WebDatabases[wi].response.result_totalnritems+' items found.');if(g_WebDatabases[wi].response.result_totalnritems>nrresults){sc.push(' Showing items 1-'+nrresults+':')}sc.push('<br />');if(nrresults>=1){sc.push('<a href="'+g_WebDatabases[wi].response.result_resultsurl+'" target="_blank">Click here</a> to view all results at '+g_WebDatabases[wi].fullname+'.<br />')}sc.push('<hr />');for(var li=0;li<nrresults;li++){contentrow='';rec=g_WebDatabases[wi].response.result_list[li];if(rec.imgurl!==''){contentrow+='<span style="float: left; margin: 3px 3px 0 0; width: auto; clear: none;">';if(rec.link!==''){contentrow+='<a href="'+rec.link+'" target="_blank" title="Click here to view full description and/or to order">';if(rec.imgurl.indexOf('.gif')>=0){contentrow+='<img src="'+rec.imgurl+'" width="40" border="0" />'}else{contentrow+='<img src="./thumbnail.php?img='+encodeURIComponent(rec.imgurl)+'&amp;maxwidth=40&amp;maxheight=80" border="0" />'}contentrow+='</a>'}else{if(rec.imgurl.indexOf('.gif')>=0){contentrow+='<img src="'+rec.imgurl+'" width="40" border="0" />'}else{contentrow+='<img src="./thumbnail.php?img='+encodeURIComponent(rec.imgurl)+'&amp;maxwidth=40&amp;maxheight=80" border="0" />'}}contentrow+='</span>'}contentrow+='<p style="margin: 0; padding: 0;">';if(rec.author.length>50){contentrow+='<b>'+rec.author.substr(0,47)+'...</b> '}else if(rec.author!==''){contentrow+='<b>'+rec.author+'</b> '}if(rec.title.length>50){if(rec.link!==''){contentrow+='<a href="'+rec.link+'" target="_blank" title="Click here to view full description and/or to order">'+rec.title.substr(0,47)+'...</a> '}else{contentrow+='<b>'+rec.title.substr(0,47)+'...</b> '}}else if(rec.title!==''){if(rec.link!==''){contentrow+='<a href="'+rec.link+'" target="_blank" title="Click here to view full description and/or to order">'+rec.title+'...</a> '}else{contentrow+='<b>'+rec.title+'</b> '}}contentrow+='<br />';if(rec.description!==''){if(rec.description.length>80){contentrow+=rec.description.substr(0,77)+'...'}else{contentrow+=rec.description}if(rec.link!==''){contentrow+=' [<a href="'+rec.link+'" target="_blank" title="Click here to view full description and/or to order">more...</a>]'}contentrow+='<br />'}if(rec.price!==''){contentrow+='<b>'+rec.price+'</b><br />'}if(rec.dealername!==''){contentrow+='offered by: '+rec.dealername;if(rec.country!==''){contentrow+=' ('+rec.country+')'}contentrow+='<br />'}contentrow+='</p><hr style="clear: both;" />';sc.push(contentrow)}if(nrresults>=1){sc.push('<a href="'+g_WebDatabases[wi].response.result_resultsurl+'" target="_blank">Click here</a> to view all results at '+g_WebDatabases[wi].fullname+'.<br />')}content=sc.toString();rsElements.setContent(rsElements.get('searchresults_'+g_WebDatabases[wi].name),content)}function emptyHeaderBox(){var lstres;lstres='Enter your search criteria in the search form and click the <i>search!</i> button. '+'Once the results are retrieved you can view the results within the '+'<a href="" onclick="javascript:{selectMenu(\'overview\'); return false;}">overview</a>, '+'<a href="" onclick="javascript:{selectMenu(\'list\'); return false;}">list</a> or '+'<a href="" onclick="javascript:{selectMenu(\'gallery\'); return false;}">gallery</a> pages.<span id="headerboxextra"></span><br />';rsElements.setContent(rsElements.get('headerbox'),lstres)}function emptyScreenListTable(){var lstr='';rsEvents.removeByHandler(onClickSortList_author);rsEvents.removeByHandler(onClickSortList_title);rsEvents.removeByHandler(onClickSortList_description);rsEvents.removeByHandler(onClickSortList_year);rsEvents.removeByHandler(onClickSortList_price);rsEvents.removeByHandler(onClickSortList_source);lstr='&nbsp;<br />'+'<table width="500" cellspacing="0" cellpadding="0"><tr><td width="0" align="left" valing="top">'+'Once the search results are retrieved and displayed in the table below '+'you can sort the results by any field by clicking one of the '+'corresponding column headers.'+'</td></tr></table>'+'<br />&nbsp;';rsElements.setContent(rsElements.get('screen_list_header'),lstr);lstr='<table class="screen_list_table">'+'<tr class="screen_list_table_headerrow">'+'<td width="194" style="padding: 0;"><div style="width: 190px; margin: 0; padding: 0; border: 0;"><div class="screen_list_table_headerrowdivhalfleft" id="screen_list_table_header_author"'+(g_ListSortField=='sortauthor'?' style="background-color: #000000;"':'')+' title="sort by author"><b>author</b></div>'+'<div class="screen_list_table_headerrowdivhalfright" id="screen_list_table_header_title"'+(g_ListSortField=='sorttitle'?' style="background-color: #000000;"':'')+' title="sort by title"><b>title</b></div></div></td>'+'<td width="435" style="padding: 0;"><div style="width: 431px; margin: 0; padding: 0; border: 0;"><div class="screen_list_table_headerrowdivhalfleft" id="screen_list_table_header_description"'+(g_ListSortField=='sortdescription'?' style="background-color: #000000;"':'')+' title="sort by description"><b>description</b></div>'+'<div class="screen_list_table_headerrowdivhalfrightwide" id="screen_list_table_header_year"'+(g_ListSortField=='sortyear'?' style="background-color: #000000;"':'')+' title="sort by year of publication"><b>year</b></div></div></td>'+'<td width="95"'+(g_ListSortField=='sortprice'?' style="background-color: #000000;"':'')+'><div class="screen_list_table_headerrowdiv" id="screen_list_table_header_price" title="sort by price"><b>price</b></div></td>'+'<td width="135"'+(g_ListSortField=='source'?' style="background-color: #000000;"':'')+'><div class="screen_list_table_headerrowdiv" id="screen_list_table_header_source" title="sort by website / book seller"><b>offered by</b></div></td>'+'</tr>'+'</table>'+'&nbsp;<br /><br /><br /><br />&nbsp;';rsElements.setContent(rsElements.get('screen_list_content'),lstr);rsEvents.add('screen_list_table_header_author','mousedown',onClickSortList_author);rsEvents.add('screen_list_table_header_title','mousedown',onClickSortList_title);rsEvents.add('screen_list_table_header_description','mousedown',onClickSortList_description);rsEvents.add('screen_list_table_header_year','mousedown',onClickSortList_year);rsEvents.add('screen_list_table_header_price','mousedown',onClickSortList_price);rsEvents.add('screen_list_table_header_source','mousedown',onClickSortList_source)}function emptyScreenGallery(){var lstr='';lstr='&nbsp;<br />'+'<table width="500" cellspacing="0" cellpadding="0"><tr><td width="0" align="left" valing="top">'+'Once the search results are retrieved you will see a collection of results '+'with images appear here.'+'</td></tr></table>'+'<br />&nbsp;';rsElements.setContent(rsElements.get('screen_gallery_header'),lstr);rsElements.setContent(rsElements.get('screen_gallery_content'),'');g_GalleryPageBuilt=0}function fillHeaderBoxDuringSearch(aEnumBeforeDuringAfter){var lstres='';var ldonesearch='';var lwaitingfor='';var lsearched='';var lexcluded='';var lcancelled='';var ltimedout='';var totalnrresults=0;var wi=0;var length=0;if(aEnumBeforeDuringAfter===0){for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].state!='excluded'){lwaitingfor+=(lwaitingfor!==''?', ':'')+g_WebDatabases[wi].fullname}}lstres='searching: '+lwaitingfor+'<div style="position: absolute; left: 0px; top: 88px; width: 270px; height: 30px; overflow: hidden; margin: 0; padding: 0; border: 0;"><img src="./img/throbber.gif" border="0"></div>'}else if(aEnumBeforeDuringAfter==1){for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].req!==null){lwaitingfor+=(lwaitingfor!==''?', ':'')+g_WebDatabases[wi].fullname}else{ldonesearch+=(ldonesearch!==''?', ':'')+g_WebDatabases[wi].fullname}}lstres='waiting for: '+lwaitingfor+'<div style="position: absolute; left: 0px; top: 88px; width: 270px; height: 30px; overflow: hidden; margin: 0; padding: 0; border: 0;">'+'<img src="./img/throbber.gif" border="0">&nbsp;&nbsp;'+(g_supportCancelSearch==1?'<button onclick="cancelSearch(\'\');">Cancel remaining results</button>':'')+'</div>'}else{totalnrresults=g_AllResults.length;if(totalnrresults===0){if(lstres!==''){lstres+='<br />'}lstres+='No matches found.<br /><br />'}else{if(lstres!==''){lstres+='<br />'}lstres+='Retrieved a total of <b>'+totalnrresults+' results.</b> '+'View results as <a href="" onclick="javascript:{selectMenu(\'overview\'); return false;}">overview</a>, '+'<a href="" onclick="javascript:{selectMenu(\'list\'); return false;}">list</a> or '+'<a href="" onclick="javascript:{selectMenu(\'gallery\'); return false;}">gallery</a>.'}}rsElements.setContent(rsElements.get('headerbox'),lstres+' <span id="headerboxextra"></span>')}function postCollectGoogleBooks(){if(g_GotAllResults==1){var lisbnlist="";var lisbn="";var totalnrresults=g_AllResults.length;var rec={};g_GoogleBooksISBNBookIdsList=[];if(g_SearchCriteria.cs_isbn!==""){lisbnlist=g_SearchCriteria.cs_isbn;for(var li=0;li<totalnrresults;li++){rec=g_AllResults[li];lisbn=rec.isbn;lisbn=lisbn.replace(/[^xX0123456789]/g,"").toUpperCase();if(lisbn==g_SearchCriteria.cs_isbn){if(!(g_GoogleBooksISBNBookIdsList[lisbn])){g_GoogleBooksISBNBookIdsList[lisbn]=[]}g_GoogleBooksISBNBookIdsList[lisbn][g_GoogleBooksISBNBookIdsList[lisbn].length]={recidx:li,recbid:rec.id}}}}else{for(var li=0;li<totalnrresults;li++){rec=g_AllResults[li];lisbn=rec.isbn;lisbn=lisbn.replace(/[^xX0123456789]/g,"").toUpperCase();if((lisbn!="")&&(lisbn.length>=10)&&(lisbn.length<=13)){if(lisbnlist.indexOf(lisbn)<0){if(lisbnlist.length>1800){lisbn=""}else{if(lisbnlist!=""){lisbnlist+="%2C"}lisbnlist+=lisbn}}if(lisbn!=""){if(!(g_GoogleBooksISBNBookIdsList[lisbn])){g_GoogleBooksISBNBookIdsList[lisbn]=[]}g_GoogleBooksISBNBookIdsList[lisbn][g_GoogleBooksISBNBookIdsList[lisbn].length]={recidx:li,recbid:rec.id}}}}}if(lisbnlist!=''){g_WaitingForGoogle=1;rsAjax.sendRequest('search_functions.php?s_action=checkgooglebooksviewability&s_isbnlist='+lisbnlist,function(req){g_GoogleBooksAvailabilityResult={};var res={};try{res=eval('('+req.responseText+')')}catch(e){res={}}if(res.result_flag=='1'){g_GoogleBooksAvailabilityResult=eval('('+res.result_response+')');showPostGoogleBooks();g_WaitingForGoogle=0}},function(req){g_GoogleBooksAvailabilityResult={};g_WaitingForGoogle=0})}}}function showPostGoogleBooks(){var res='';var gbook={};var bcnt=0;var bi;var bidx=0;var bil=0;var bid="";var part="";var tcidx1=0;var tcidx2=0;var rec={};var estr="";if(g_GotAllResults==1){bcnt=0;for(bi in g_GoogleBooksAvailabilityResult){gbook=g_GoogleBooksAvailabilityResult[bi];if((gbook.preview!="noview")&&(gbook.preview_url!="")){part='contents';if(gbook.preview=="full"){part='full contents'}else if(gbook.preview=="partial"){part='partial contents'}if(bcnt===0){res='&nbsp;<br />';if(gbook.thumbnail_url!=""){res+='<span style="float: left; padding-right: 10px; width: auto; clear: none;"><a href="'+gbook.preview_url+'" target="_blank" title="Click here to view '+part+' of this book (ISBN '+gbook.bib_key+') at Google Book Search."><img src="'+gbook.thumbnail_url+'" border="0"></a></span>'}res+='<p style=\"margin: 0; padding: 0;\">Tip: <a href="'+gbook.preview_url+'" target="_blank">Click here</a> to view '+part+' of this book (ISBN '+gbook.bib_key+') at Google Book Search.</p>';rsElements.setContent(rsElements.get('headerboxextra'),res)}if(g_SearchCriteria.cs_isbn!==""){break}else{if((gbook.bib_key!="")&&(g_GoogleBooksISBNBookIdsList[gbook.bib_key])){for(bidx=0,bil=g_GoogleBooksISBNBookIdsList[gbook.bib_key].length;bidx<bil;bidx++){bid=g_GoogleBooksISBNBookIdsList[gbook.bib_key][bidx].recbid;if(bid!=""){res='<div style=\"width: 430px; margin: 0; padding: 0; border: 0; border-bottom: 1px solid black; clear: both;\"></div>';res+='<p style=\"margin: 0; padding: 0;\">&nbsp;<br/>';if(gbook.thumbnail_url!=""){res+='<span style="float: left; padding-right: 10px; width: auto; clear: none;"><a href="'+gbook.preview_url+'" target="_blank" title="Click here to view '+part+' of this book (ISBN '+gbook.bib_key+') at Google Book Search."><img src="'+gbook.thumbnail_url+'" border="0"></a></span>'}res+='<span style=\"float: left; margin: 3px 3px 0 0; width: auto; clear: none;\">'+'<a href="'+gbook.preview_url+'" target="_blank" title="Click here to view '+part+' of this book (ISBN '+gbook.bib_key+') at Google Book Search."><img src="./img/googlebooksearch.png" border="0" /></a>'+'</span>'+'<a href="'+gbook.preview_url+'" target="_blank">Click here</a> to view '+part+' of this book (ISBN '+gbook.bib_key+') at Google Book Search. '+'Please note that the contents shown may be of a different edition/printing than the book offered here.</p>';rsElements.setContent(rsElements.get('extra_'+bid),res);rec=g_AllResults[g_GoogleBooksISBNBookIdsList[gbook.bib_key][bidx].recidx];estr='<div id="extra_'+bid+'">';tcidx1=rec.tablerow.indexOf(estr);if(tcidx1>=0){tcidx2=rec.tablerow.indexOf('</div>',tcidx1);if(tcidx2>=0){rec.tablerow=rec.tablerow.substring(0,tcidx1)+estr+res+rec.tablerow.substring(tcidx2)}}}}}}bcnt++}}}}function fillScreenListHeaderDuringSearch(aEnumBeforeDuringAfter){var lstres='';var ldonesearch='';var lwaitingfor='';var lsearched='';var lexcluded='';var lcancelled='';var ltimedout='';var totalnrresults=g_AllResults.length;var wi=0;var length=0;if(aEnumBeforeDuringAfter===0){for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].state!='excluded'){lwaitingfor+=(lwaitingfor!==''?', ':'')+g_WebDatabases[wi].fullname}}lstres='searching: '+lwaitingfor+'<br />'+'<br /><div align="center"><img src="./img/throbber.gif" border="0"></div>'}else if(aEnumBeforeDuringAfter==1){for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].req!==null){lwaitingfor+=(lwaitingfor!==''?', ':'')+g_WebDatabases[wi].fullname}else{ldonesearch+=(ldonesearch!==''?', ':'')+g_WebDatabases[wi].fullname}}lstres='waiting for: '+lwaitingfor+'<br />'+(ldonesearch!==''?'done: '+ldonesearch:'')+'<br /><div align="center"><img src="./img/throbber.gif" border="0"><br />'+(g_supportCancelSearch==1?'<button onclick="cancelSearch(\'\');">Cancel remaining search results</button>':'')+'</div>'}else{for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].state=='cancelled'){if(lcancelled!==''){lcancelled+=', '}lcancelled=lcancelled+g_WebDatabases[wi].fullname}else if(g_WebDatabases[wi].state=='excluded'){if(lexcluded!==''){lexcluded+=', '}lexcluded=lexcluded+g_WebDatabases[wi].fullname}else if(g_WebDatabases[wi].response.result_error=='1'){if(ltimedout!==''){ltimedout+=', '}ltimedout+=g_WebDatabases[wi].fullname}else{if(lsearched!==''){lsearched+=', '}lsearched+=g_WebDatabases[wi].fullname}}lstres='';if(lsearched!==''){if(lstres!==''){lstres+='<br />'}lstres+='searched: '+lsearched}if((1===0)&&(lexcluded!=='')){if(lstres!==''){lstres+='<br />'}lstres+='excluded: '+lexcluded}if(lcancelled!==''){if(lstres!==''){lstres+='<br />'}lstres+='cancelled: '+lcancelled}if(ltimedout!==''){if(lstres!==''){lstres+='<br />'}lstres+='error: '+ltimedout}if(totalnrresults===0){if(lstres!==''){lstres+='<br />'}lstres+='No matches found.'}else{if(lstres!==''){lstres+='<br />'}lstres+='Retrieved a total of <b>'+totalnrresults+' results</b>.<br />'+'Tip: sort the results by any field by clicking one of the corresponding column headers of the table below:'}}rsElements.setContent(rsElements.get('screen_list_header'),lstres+'<br />&nbsp;')}function fillScreenListTable(){var sc=new TStringCat();sc.push('<table class="screen_list_table">');sc.push('<tr class="screen_list_table_headerrow">'+'<td width="194" style="padding: 0;"><div style="width: 190px; margin: 0; padding: 0; border: 0;"><div class="screen_list_table_headerrowdivhalfleft" id="screen_list_table_header_author"'+(g_ListSortField=='sortauthor'?' style="background-color: #000000;"':'')+' title="sort by author"><b>author</b></div>'+'<div class="screen_list_table_headerrowdivhalfright" id="screen_list_table_header_title"'+(g_ListSortField=='sorttitle'?' style="background-color: #000000;"':'')+' title="sort by title"><b>title</b></div></div></td>'+'<td width="435" style="padding: 0;"><div style="width: 431px; margin: 0; padding: 0; border: 0;"><div class="screen_list_table_headerrowdivhalfleft" id="screen_list_table_header_description"'+(g_ListSortField=='sortdescription'?' style="background-color: #000000;"':'')+' title="sort by description"><b>description</b></div>'+'<div class="screen_list_table_headerrowdivhalfrightwide" id="screen_list_table_header_year"'+(g_ListSortField=='sortyear'?' style="background-color: #000000;"':'')+' title="sort by year of publication"><b>year</b></div></div></td>'+'<td width="95"'+(g_ListSortField=='sortprice'?' style="background-color: #000000;"':'')+'><div class="screen_list_table_headerrowdiv" id="screen_list_table_header_price" title="sort by price"><b>price</b></div></td>'+'<td width="135"'+(g_ListSortField=='source'?' style="background-color: #000000;"':'')+'><div class="screen_list_table_headerrowdiv" id="screen_list_table_header_source" title="sort by website / book seller"><b>offered by</b></div></td>'+'</tr>');var desc='';var src='';var rec={};var totalnrresults=g_AllResults.length;for(var li=0;li<totalnrresults;li++){rec=g_AllResults[li];if(1==1){sc.push(rec.tablerow)}else{src='';var wwi=getWebDatabaseIndexByName(rec.source);if(wwi>=0){src=g_WebDatabases[wwi].fullname}if((src!=='')&&(rec.link!=='')){src='<a href="'+rec.link+'" target="_blank">'+src+'</a>'}if(rec.dealername!==''){if(src!==''){src+='<br>'}src+=rec.dealername;if(rec.country!==''){src+=' ('+rec.country+')'}}desc='';if(rec.imgurl!==''){desc+='<span style="float: left; margin: 3px 3px 0 0; width: auto; clear: none;">';if(rec.link!==''){desc+='<a href="'+rec.link+'" target="_blank" title="Click here to view full description and/or to order">';if(rec.imgurl.indexOf('.gif')>=0){desc+='<img src="'+rec.imgurl+'" width="80" border="0" />'}else{desc+='<img src="./thumbnail.php?img='+encodeURIComponent(rec.imgurl)+'&amp;maxwidth=80&amp;maxheight=120" border="0" />'}desc+='</a>'}else{if(rec.imgurl.indexOf('.gif')>=0){desc+='<img src="'+rec.imgurl+'" width="80" border="0" />'}else{desc+='<img src="./thumbnail.php?img='+encodeURIComponent(rec.imgurl)+'&amp;maxwidth=80&amp;maxheight=120" border="0" />'}}desc+='</span>'}desc+='<p style="margin: 0; padding: 0;">'+rec.description+' '+rec.price+'</p>';sc.push('<tr>'+'<td>'+rec.author+(rec.author!==''?'<br />':'')+(rec.link!==''?'<a href="'+rec.link+'" target="_blank">'+rec.title+'</a>':'<b>'+rec.title+'</b>')+'</td>'+'<td>'+desc+'</td>'+'<td style="text-align: right;">US$ '+rec.dollarprice+(rec.link!==''?'<br><a href="'+rec.link+'" target="_blank">info/purchase</a>':'')+'</td>'+'<td>'+src+'</td>'+'</tr>')}}sc.push('</table>');if(totalnrresults===0){sc.push('&nbsp;<br /><br /><br /><br />&nbsp;')}rsEvents.removeByHandler(onClickSortList_author);rsEvents.removeByHandler(onClickSortList_title);rsEvents.removeByHandler(onClickSortList_description);rsEvents.removeByHandler(onClickSortList_year);rsEvents.removeByHandler(onClickSortList_price);rsEvents.removeByHandler(onClickSortList_source);rsElements.setContent(rsElements.get('screen_list_content'),sc.toString());rsEvents.add('screen_list_table_header_author','mousedown',onClickSortList_author);rsEvents.add('screen_list_table_header_title','mousedown',onClickSortList_title);rsEvents.add('screen_list_table_header_description','mousedown',onClickSortList_description);rsEvents.add('screen_list_table_header_year','mousedown',onClickSortList_year);rsEvents.add('screen_list_table_header_price','mousedown',onClickSortList_price);rsEvents.add('screen_list_table_header_source','mousedown',onClickSortList_source)}function fillScreenGalleryDuringSearch(aEnumBeforeDuringAfter){var lstres='';var lgallery='';var ldonesearch='';var lwaitingfor='';var wi=0;var length=0;var rec={};var totalnrresults=0;var imgbx='';var sc=new TStringCat();var tlx=0;var tly=0;var imgi=0;var src='';if(aEnumBeforeDuringAfter===0){for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].state!='excluded'){lwaitingfor+=(lwaitingfor!==''?', ':'')+g_WebDatabases[wi].fullname}}lstres='searching: '+lwaitingfor+'<br />'+'<br /><div align="center"><img src="./img/throbber.gif" border="0"></div>'}else if(aEnumBeforeDuringAfter==1){for(wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].req!==null){lwaitingfor+=(lwaitingfor!==''?', ':'')+g_WebDatabases[wi].fullname}else{ldonesearch+=(ldonesearch!==''?', ':'')+g_WebDatabases[wi].fullname}}lstres='waiting for: '+lwaitingfor+'<br />'+(ldonesearch!==''?'done: '+ldonesearch:'')+'<br /><div align="center"><img src="./img/throbber.gif" border="0"><br />'+(g_supportCancelSearch==1?'<button onclick="cancelSearch(\'\');">Cancel remaining search results</button>':'')+'</div>'}else{totalnrresults=g_AllResults.length;imgi=0;for(var li=0;li<totalnrresults;li++){rec=g_AllResults[li];if(rec.imgurl!==''){tlx=10+(145*(imgi%6));tly=10+(250*parseInt(imgi/6,10));src='';var wwi=getWebDatabaseIndexByName(rec.source);if(wwi>=0){src=g_WebDatabases[wwi].fullname}imgbx='';imgbx+='<div style="position: absolute; left: '+tlx+'px; top: '+tly+'px; width: 135px; height: 240px; overflow: hidden; margin: 0; padding: 0; border: 1px solid #cccccc;">';imgbx+='<div style="position: absolute; left: 10px; top: 10px; width: 115px; height: 230px; overflow: hidden; margin: 0; padding: 0; border: 0;">';imgbx+='<div align="center">';if(1==1){imgbx+='<div style="width: 115px; height: 150px; overflow: hidden; margin: 0; padding: 0; border: 0;">';if(rec.link!==''){imgbx+='<a href="'+rec.link+'" target="_blank" title="Click here to view full description and/or to order at '+src+'">'}imgbx+='<img src="'+rec.imgurl+'" width="115" border="0" />';if(rec.link!==''){imgbx+='</a>'}imgbx+='</div>'}else{if(rec.link!==''){imgbx+='<a href="'+rec.link+'" target="_blank" title="Click here to view full description and/or to order at '+src+'">'}if(rec.imgurl.indexOf('.gif')>=0){imgbx+='<img src="'+rec.imgurl+'" width="115" border="0" />'}else{imgbx+='<img src="./thumbnail.php?img='+encodeURIComponent(rec.imgurl)+'&amp;maxwidth=115&amp;maxheight=170" border="0" />'}if(rec.link!==''){imgbx+='</a>'}}imgbx+='<br />';if(rec.author!==''){imgbx+='<div style="width: 115px; height: 18px; overflow: hidden;">'+rec.author+'</div>'}if(rec.title!==''){imgbx+='<div style="width: 115px; height: 18px; overflow: hidden;">'+(rec.link!==''?'<a href="'+rec.link+'" target="_blank">'+rec.title+'</a>':'<b>'+rec.title+'</b>')+'</div>'}imgbx+='<div style="width: 115px; height: 18px; overflow: hidden;">'+rsElements.get('s_currency').value+' '+rec.selectedcurrencyprice+'</div>';imgbx+='</div>';imgbx+='</div>';imgbx+='</div>';sc.push(imgbx);imgi++}}if(imgi===0){if(totalnrresults===0){lstres='No matches found.'}else{lstres='No items found with images. <a href="" onclick="javascript:{selectMenu(\'list\'); return false;}">Click here</a> to view all items.'}}else{lstres='Displaying '+imgi+' items with images. <a href="" onclick="javascript:{selectMenu(\'list\'); return false;}">Click here</a> to view all items.';tly+=260;lgallery='<div style="position: relative; left: 0; top: 0; width: 880px; height: '+tly+'px; overflow: hidden; margin: 0; padding: 0; border: 0;">'+sc.toString()+'</div>'}g_GalleryPageBuilt=1}rsElements.setContent(rsElements.get('screen_gallery_header'),lstres);rsElements.setContent(rsElements.get('screen_gallery_content'),lgallery)}function cancelSearch(webdbname){var alldone=1;for(var wi=0,length=g_WebDatabases.length;wi<length;wi++){if(g_WebDatabases[wi].req!=null){if((webdbname==='')||(g_WebDatabases[wi].name==webdbname)){try{g_WebDatabases[wi].req.abort()}catch(e){}g_WebDatabases[wi].req=null;g_WebDatabases[wi].state='cancelled';rsElements.setContent(rsElements.get('searchresults_'+g_WebDatabases[wi].name),'&nbsp;<br />cancelled<hr /><br />&nbsp;</div>');if(webdbname!==''){break}}else{alldone=0}}}if(alldone==1){updateAfterSearch()}}function onClickSortList(fn){if((fn!=='')&&(g_ListSortField!=fn)){if(g_WaitingForGoogle==1){setTimeout(function(){onClickSortList(fn)},500)}else{showThrobber(true);setTimeout(function(){g_ListSortField=fn;g_AllResults.sort(sortList);fillScreenListTable();showThrobber(false)},10)}}}function onClickSortList_author(e){onClickSortList('sortauthor')}function onClickSortList_title(e){onClickSortList('sorttitle')}function onClickSortList_description(e){onClickSortList('sortdescription')}function onClickSortList_year(e){onClickSortList('sortyear')}function onClickSortList_price(e){onClickSortList('sortprice')}function onClickSortList_source(e){onClickSortList('source')}function updateSearchHistoryBeforeSearch(){if((g_GotAllResults==1)&&(g_SelectedHistoryIndex<0)){if(g_SearchHistory.length>=5){g_SearchHistory.splice(0,1)}g_SearchHistory[g_SearchHistory.length]={h_SearchCriteria:g_SearchCriteria,h_WebDatabases:g_WebDatabases,h_AllResults:g_AllResults}}}function updateSearchHistoryBoxAfterSearch(){}function selectPreviousSearchResult(hidx){if(hidx<g_SearchHistory.length){var histobj=g_SearchHistory[hidx]}}function openLoginWindow(){if(!(rsElements.get('modallayer'))){rsElements.append('bodycontainer','modallayer','');rsElements.setStyles('modallayer',{position:'absolute',top:'5px',left:0,width:'882px',height:'100%',backgroundColor:'#000000',opacity:'.5',filter:'alpha(opacity=50)',zIndex:'1'});rsElements.append('bodycontainer','loginwindow','');rsElements.setStyles('loginwindow',{position:'absolute',top:'100px',left:'240px',width:'402px',height:'302px',border:'1px solid black',backgroundColor:'#ffffff',zIndex:'2'});var domh=rsEvents.add('loginwindow','mouseup',function(){rsEvents.removeByHandler(domh);closeLoginWindow()})}}function closeLoginWindow(){rsElements.remove('modallayer');rsElements.remove('loginwindow')}