
$(document).ready(function(){var s_databases=[{name:'abe',fullname:'Abebooks',url:'http://www.abebooks.de/',searchurl:'sucheabe.php',visible:true},{name:'ama',fullname:'Amazon',url:'http://www.amazon.de/',searchurl:'sucheama.php',visible:true},{name:'bun',fullname:'Buchfreund Neuware',url:'http://www.buchfreund.de/',searchurl:'suchebun.php',visible:true},{name:'buf',fullname:'Buchfreund',url:'http://www.buchfreund.de/',searchurl:'suchebuf.php',visible:true},{name:'zva',fullname:'ZVAB',url:'http://www.zvab.com/',searchurl:'suchezva.php',visible:true},{name:'bok',fullname:'Booklooker',url:'http://www.booklooker.de/',searchurl:'suchebok.php',visible:true}];var initContentHeight=$("#content").height();var initRightHeight=$("#rightNormal").height();var productClicked="";function resultsHeadClick(){$(this).next(".searchbox").slideToggle("slow");}
function clearResults(){$("#emptyProductBar").css("display","none");productClicked="";for(i=0;i<s_databases.length;i++){$("#"+s_databases[i].name+"Res.resultsHead").unbind('click');}
$(".productLink").die();$(".highlightOn").die();$("td.highlightOn").die();$("td.highlightOff").die();$(".highlightOn").addClass("highlightOff").removeClass("highlightOn");$(".productLinkOff").removeClass("productLinkOff").addClass("productLink");$("#content").css("min-height",initContentHeight);$("#rightNormal").css("min-height",initRightHeight);$("#productSearch").empty();$("#productSearch").hide();}
function restoreLayout(platform){$("#"+platform+"Res").removeClass("resultsHeadClosed");$("#"+platform+"Res").addClass("resultsHead");}
function clearBox(platform){$("#"+platform).empty();$("#"+platform).html('<div class="searchboxContent"></div>');$("#"+platform+"Res").removeClass("resultsHead");$("#"+platform+"Res").addClass("resultsHeadClosed");}
function trimStr(str,trenner){if(str==null) return "";str=str.replace(/&auml;/,"ä");str=str.replace(/&ouml;/,"ö");str=str.replace(/&uuml;/,"ü");str=str.replace(/&Auml;/,"Ä");str=str.replace(/&Ouml;/,"Ö");str=str.replace(/&Uuml;/,"Ü");str=str.replace(/&szlig;/,"ß");var returnStr="";var j=0;var laenge=str.length;for(i=0;i<laenge;i++){if(i<50){if(str[i]!=" "){j++;}else{j=0;}
if(j%trenner==0){returnStr+=" "+str.slice(i,i+1);}else{returnStr+=str.slice(i,i+1);}}else{returnStr+=str.slice(i,i+1);}}
returnStr=returnStr.replace(/ä/,"&auml;");returnStr=returnStr.replace(/ö/,"&ouml;");returnStr=returnStr.replace(/ü/,"&uuml;");returnStr=returnStr.replace(/Ä/,"&Auml;");returnStr=returnStr.replace(/Ö/,"&Ouml;");returnStr=returnStr.replace(/Ü/,"&Uuml;");returnStr=returnStr.replace(/ß/,"&szlig;");return returnStr;}
function beforeSearch(){$("#resultNavi").css("display","block");$("#navibar #portalView").click();clearResults();$(".searchboxContent").html('<p align="center"><img src="gfx/book-loader.gif" width="31" height="31" border="0" /></p>');for(i=0;i<s_databases.length;i++){$("#"+s_databases[i].name+"Load").empty();$("#"+s_databases[i].name+"Load").show();$("#"+s_databases[i].name+"Res.resultsHead").bind('click',resultsHeadClick);togglePlatform(s_databases[i].name);}}
function togglePlatform(platform){$("#"+platform+"Res.resultsHead").toggle(function(){for(i=0;i<s_databases.length;i++){if(s_databases[i].name==platform){if(s_databases[i].visible===true){$(this).removeClass("resultsHead");$(this).addClass("resultsHeadClosed");}else{$(this).removeClass("resultsHeadClosed");$(this).addClass("resultsHead");}
s_databases[i].visible=false;break;}}
$.post("settings.php",{"platform":platform,"action":"enable:0"},function(data){});},function(){for(i=0;i<s_databases.length;i++){if(s_databases[i].name==platform){if(s_databases[i].visible===false){$(this).removeClass("resultsHeadClosed");$(this).addClass("resultsHead");}else{$(this).removeClass("resultsHead");$(this).addClass("resultsHeadClosed");}
s_databases[i].visible=true;break;}}
renderList(allData,1);$.post("settings.php",{"platform":platform,"action":"enable:1"},function(data){});});}
function highlightOn(){$(this).removeClass("highlightOn");$(this).addClass("highlightOff");$(".productLinkOff").removeClass("productLinkOff").addClass("productLink");}
function hightlightOff(){$(".productLinkOff").removeClass("productLinkOff").addClass("productLink");$(".highlightOn").addClass("highlightOff").removeClass("highlightOn");$(this).removeClass("highlightOff");$(this).addClass("highlightOn");}
function afterSearch(){$("td.highlightOn").live("click",highlightOn);$("td.highlightOff").live("click",hightlightOff);var query="";var title=$("#sTitle").val();var autor=$("#sAuthor").val();var keyword=$("#sKeyword").val();var isbn=$("#sISBN").val();if(title!="")
query+=title+", ";if(autor!="")
query+=autor+", ";if(keyword!="")
query+=keyword+", ";if(isbn!="")
query+="ISBN: "+isbn;$("#query").html("Suche nach: "+query.substring(0,150));$(".productLink").live("click",function(){$("#searchboxContent").html('<p align="center"><img src="gfx/book-loader.gif" width="31" height="31" border="0" /></p>');$(".searchboxContent").html('<p align="center"><img src="gfx/book-loader.gif" width="31" height="31" border="0" /></p>');for(i=0;i<s_databases.length;i++){$("#"+s_databases[i].name+"Load").empty();$("#"+s_databases[i].name+"Load").show();}
$.post("getList.php",{ean:$(this).attr("href")},function(data){renderList(data,0);},"json");$(this).removeClass("productLink").addClass("productLinkOff");if(productClicked==$(this).attr("href").replace("#","")){productClicked="";}else{productClicked=$(this).attr("href").replace("#","");}});$(".highlightOn").live("click",function(){$("#searchboxContent").html('<p align="center"><img src="gfx/book-loader.gif" width="31" height="31" border="0" /></p>');$(".searchboxContent").html('<p align="center"><img src="gfx/book-loader.gif" width="31" height="31" border="0" /></p>');for(i=0;i<s_databases.length;i++){$("#"+s_databases[i].name+"Load").empty();$("#"+s_databases[i].name+"Load").show();}
$.post("getList.php",{ean:"all"},function(data){renderList(data,0);},"json");$(".productLinkOff").removeClass("productLinkOff").addClass("productLink");});}
function renderEmptyProducts(){$("#emptyProductBar").css("display","block");}
function renderProducts(arrData,page,cnt){var outputProductSearch='';page=parseInt(page);cnt=parseInt(cnt);var attachPrev="";var attachNext="";var prevAlternate='<td width="25">&nbsp;</td>';var nextAlternate='<td width="25">&nbsp;</td>';var prevButton='<td width="25"><div id="prevForm"><div><form class="yform" style="background: none; border: none; padding: 0; margin: 0;" id="productFormPrev"><input type="hidden" name="productBrowse" value="1" /><div id="prevPage"><input type="hidden" name="page" value="'+(page-1)+'"></div><div class="type-button"><input type="button" id="prevButton" value="&laquo;" style="font-size: 20px; padding: 5px 3px 8px 3px;"/></div></form></div></div></td>';var nextButton='<td width="25"><div id="nextForm"><div><form class="yform" style="background: none; border: none; padding: 0; margin: 0;" id="productFormNext"><input type="hidden" name="productBrowse" value="1" /><div id="nextPage"><input type="hidden" name="page" value="'+(page+1)+'"></div><div class="type-button"><input type="button" id="nextButton" value="&raquo;" style="font-size: 20px; padding: 5px 3px 8px 3px;" /></div></form></div></div></td>';var icon="";var iconHover="";var new_height,new_width;if(page==1){attachPrev+=prevAlternate;if(cnt>5){attachNext+=nextButton;}else{attachNext+=nextAlternate;}}else{attachPrev+=prevButton;if((page*5)+5<=cnt){attachNext+=nextButton;}else{attachNext+=nextAlternate;}}
if(arrData.length==0){$("#productBar").hide();}else{outputProductSearch+='<div style="position: relative; padding: 5px; background-color: #efefef; border: 1px dashed #CCCCCC;">';outputProductSearch+='<table cellspacing="0" cellpadding="0" border="0" class="full fixed"><tr>';outputProductSearch+=attachPrev;for(var i=0;i<arrData.length;i++){switch(arrData[i].binding){case"Gebundene Ausgabe":icon='<div><img src="gfx/icon_book_hc.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_book_hc.gif"></div> Buch / '+arrData[i].binding+' / Fester Einband / Hardcover<br style="clear: left;"/>';break;case"Taschenbuch":icon='<div><img src="gfx/icon_book.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_book.gif"></div> Buch / '+arrData[i].binding+' / Flexibler Einband / Softcover<br style="clear: left;"/>';break;case"Broschiert":icon='<div><img src="gfx/icon_book.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_book.gif"></div> Buch / '+arrData[i].binding+' / Flexibler Umschlag<br style="clear: left;"/>';break;case"CD":case"Audio CD":icon='<div><img src="gfx/icon_cd.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_cd.gif"></div> CD / '+arrData[i].binding+'<br style="clear: left;"/>';break;default:icon='<div><img src="gfx/icon_book.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_book.gif"></div> Buch / '+arrData[i].binding+'<br style="clear: left;"/>';}
outputProductSearch+='<span id="p'+i+'" style="display: none;">';outputProductSearch+=iconHover;outputProductSearch+='<p><b>'+arrData[i].title+'</b>';if(arrData[i].author!='')
outputProductSearch+='<br/>von '+arrData[i].author;if(arrData[i].publisher!='')
outputProductSearch+='<br/>Verlag: '+arrData[i].publisher;if(arrData[i].publicationDate!='')
outputProductSearch+=' '+arrData[i].publicationDate;if(arrData[i].ean!='')
outputProductSearch+='<br/>EAN: '+arrData[i].ean;outputProductSearch+='</p>';outputProductSearch+='</span>';if(productClicked==arrData[i].ean){outputProductSearch+='<td valign="top" width="140" class="highlightOn productLink" href="#'+arrData[i].ean+'" onmouseover="TagToTip(\'p'+i+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">';}else{outputProductSearch+='<td valign="top" width="140" class="highlightOff productLink" href="#'+arrData[i].ean+'" onmouseover="TagToTip(\'p'+i+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">';}
outputProductSearch+='<div style="width: 120px; padding: 10px;">';if(arrData[i].smallImageUrl!=""){imageUrl=arrData[i].smallImageUrl;var max=60;var width=arrData[i].smallImageWidth;var height=arrData[i].smallImageHeight;var xscale=width/max;var yscale=height/max;if(yscale>xscale){new_width=width*(1/yscale);new_height=height*(1/yscale);}
else{new_width=width*(1/xscale);new_height=height*(1/xscale);}}else{imageUrl='noimage.gif';new_width=40;new_height=60;}
outputProductSearch+='<div style="float: left; margin-right: 5px"><img src="'+imageUrl+'" width="'+new_width+'" height="'+new_height+'" /></div>';outputProductSearch+=icon+trimStr(arrData[i].title,12).substring(0,100)+' ...';outputProductSearch+='</div></div></td>';}
if(attachNext!=""){i++;}
for(i;i<5;i++){outputProductSearch+='<td>&nbsp;</td>';}
outputProductSearch+=attachNext;outputProductSearch+='</tr></table></div>';$("#productBar").show();$("#productSearch").html(outputProductSearch);$("#productSearch").show();}}
function renderItemsBoxes(platform,data,dataCnt,dataNeu){var outputHeader="",output="",hinweisNeu="";var imageUrl,new_width,new_height,min_used_price=0;if(dataCnt>0){$("#"+platform).css("overflow","scroll");$("#"+platform+"Load").empty();$("#"+platform+"Load").show();$("#"+platform+"Load").html(dataCnt+' gebrauchte B&uuml;cher gefunden');outputHeader+='<table cellspacing="0" cellpadding="0" border="0" width="100%">';for(var j=0;j<data.length;j++){if(j<(data.length-1)){output+='<tr><td width="100%" style="padding-bottom: 5px; padding-top: 5px; border-bottom: 1px dashed #CCC;"><div>';}else{output+='<tr><td width="100%" style="padding-bottom: 5px; padding-top: 5px;"><div>';}
if(data[j].shippingDE==" ")
data[j].shippingDE=0;var priceShip=parseFloat(data[j].price)+parseFloat(data[j].shippingDE);if(min_used_price==0)
min_used_price=priceShip;if(priceShip<min_used_price)
min_used_price=priceShip;if(dataNeu!=null){if(hinweisNeu==""){if(dataNeu.length==1){var priceShipNew=parseFloat(dataNeu[0].price)+parseFloat(dataNeu[0].shippingDE);if(min_used_price>(priceShipNew-priceShipNew/100*20)){priceShipNew=new NumberFormat(priceShipNew);priceShipNew.setSeparators(true,priceShipNew.PERIOD,priceShipNew.COMMA);hinweisNeu='<tr><td colspan="3" width="100%" style="padding-bottom: 5px; padding-top: 5px; text-align: center; font-weight: bold; font-size: 12px;"><span style="color: red;">BuchHai-Tip:</span> <a href="'+dataNeu[0].url+'" target="'+platform+'" style="color: red;">Neu bereits erh&auml;ltlich f&uuml;r <b>EUR '+priceShipNew.toFormatted()+'</b> inkl. Versand!</a></td></tr>';}}}}
var price=new NumberFormat(parseFloat(data[j].price));price.setSeparators(true,price.PERIOD,price.COMMA);var ship=new NumberFormat(parseFloat(data[j].shippingDE));ship.setSeparators(true,ship.PERIOD,ship.COMMA);priceShip=new NumberFormat(priceShip);priceShip.setSeparators(true,priceShip.PERIOD,priceShip.COMMA);output+='<div style="float: right; margin-left: 30px; text-align: right;">Preis '+price.toFormatted()+'<br/>Versand '+ship.toFormatted()+'<div class="price" style="margin-top: 3px;">EUR '+priceShip.toFormatted()+'</div><a href="'+data[j].url+'" target="'+platform+'">Jetzt bestellen</a></div>';if(data[j].smallImageUrl!=""){imageUrl=data[j].smallImageUrl;var max=60;var width=data[j].smallImageWidth;var height=data[j].smallImageHeight;var xscale=width/max;var yscale=height/max;if(yscale>xscale){new_width=width*(1/yscale);new_height=height*(1/yscale);}
else{new_width=width*(1/xscale);new_height=height*(1/xscale);}}else{imageUrl='noimage.gif';new_width=40;new_height=60;}
output+='<div style="float: left; margin-left: 5px; margin-right: 5px;" onmouseover="TagToTip(\''+platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">';output+='<img src="'+imageUrl+'" width="'+new_width+'" height="'+new_height+'"/></div>';if(data[j].title!="")
output+='<a href="'+data[j].url+'" target="'+platform+'" class="title" onmouseover="TagToTip(\''+platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">'+((data[j].title==null ? 'buchtitel' : (data[j].title).substr(0,100))) +'</a>';output+='<br/>';if(data[j].author!="")
output+=' von '+data[j].author;if(data[j].publisher!="")
output+=' von '+data[j].publisher;if(data[j].isbn!="")
output+=' ISBN: '+data[j].isbn;if(data[j].ean!="")
output+=' EAN: '+data[j].ean;output+='<span id="'+platform+j+'" style="display: none;">';output+='<p><b>'+data[j].title+'</b>';if(data[j].author!='')
output+='<br/>von '+data[j].author;if(data[j].publisher!='')
output+='<br/>Verlag: '+data[j].publisher;if(data[j].publicationDate!=null){if(data[j].publicationDate!='')
output+=' '+data[j].publicationDate;}
if(data[j].isbn!=null&&data[j].isbn!='')
output+='<br/>ISBN: '+data[j].isbn;if(data[j].ean!=null&&data[j].ean!='')
output+='<br/>EAN: '+data[j].ean;if(data[j].description!='')
output+='<br/>'+data[j].description;output+='</p>';output+='</span>';if(data[j].description && data[j].description.length>80){output+=' '+data[j].description.substr(0,77)+' <a href="'+data[j].url+'" target="'+platform+'" onmouseover="TagToTip(\''+platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">mehr...</a>';}else{output+=' '+data[j].description+' <a href="'+data[j].url+'" target="'+platform+'" onmouseover="TagToTip(\''+platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">mehr...</a>';}
output+='</div></td></tr>';}
output=outputHeader+hinweisNeu+output;output+='</table>';for(i=0;i<s_databases.length;i++){if(s_databases[i].name==platform){if(s_databases[i].visible===true){$("#"+platform).html('<div class="searchboxContent">'+output+'</div>');}else{}}}}else{$("#"+platform+"Load").empty();$("#"+platform+"Load").show();$("#"+platform+"Load").html('Leider keine gebrauchten B&uuml;cher gefunden');if(dataNeu!=null){if(dataNeu.length==1){var priceShip=parseFloat(dataNeu[0].price)+parseFloat(dataNeu[0].shippingDE);priceShip=new NumberFormat(priceShip);priceShip.setSeparators(true,priceShip.PERIOD,priceShip.COMMA);$("#"+platform).css("overflow","hidden");$("#"+platform).html('<div class="searchboxContent">Es wurden leider keine gebrauchten B&uuml;cher gefunden.<br/><a href="'+dataNeu[0].url+'" target="'+platform+'">Sie k&ouml;nnen dieses Buch aber auch neu kaufen f&uuml;r nur <b>EUR '+priceShip.toFormatted()+'</b> inkl. Versand! Klicken Sie dazu hier!</a></div>');}else{$("#"+platform).css("overflow","hidden");$("#"+platform).html('<div class="searchboxContent">Es wurden leider keine gebrauchten B&uuml;cher gefunden.</div>');}}else{$("#"+platform).css("overflow","hidden");$("#"+platform).html('<div class="searchboxContent">Es wurden leider keine gebrauchten B&uuml;cher gefunden.</div>');}}}
function renderItemsBoxesBun(platform,data,dataCnt){var output="";var imageUrl,new_width,new_height;if(dataCnt>0){output+='<div style="height: 480px; width: 150px; overflow: auto; margin-top: 20px; padding-left: 10px;">';for(var j=0;j<data.length;j++){var priceShip=parseFloat(data[j].price)+parseFloat(data[j].shippingDE);priceShip=new NumberFormat(priceShip);priceShip.setSeparators(true,priceShip.PERIOD,priceShip.COMMA);if(data[j].smallImageUrl!=""){imageUrl=data[j].smallImageUrl;var max=80;var width=data[j].smallImageWidth;var height=data[j].smallImageHeight;var xscale=width/max;var yscale=height/max;if(yscale>xscale){new_width=width*(1/yscale);new_height=height*(1/yscale);}
else{new_width=width*(1/xscale);new_height=height*(1/xscale);}}else{imageUrl='noimage.gif';new_width=40;new_height=60;}
switch(data[j].binding){case"Gebundene Ausgabe":icon='<div><img src="gfx/icon_book_hc.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_book_hc.gif"></div> Buch / '+data[j].binding+' / Fester Einband / Hardcover<br style="clear: left;"/>';break;case"Broschiert":icon='<div><img src="gfx/icon_book.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_book.gif"></div> Buch / '+data[j].binding+' / Flexibler Einband / Softcover<br style="clear: left;"/>';break;case"CD":icon='<div><img src="gfx/icon_cd.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_cd.gif"></div> CD / '+data[j].binding+'<br style="clear: left;"/>';break;case"DVD":icon='<div><img src="gfx/icon_dvd.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_dvd.gif"></div> DVD / '+data[j].binding+'<br style="clear: left;"/>';break;default:icon='<div>'+data[j].binding+'<img src="gfx/icon_book.gif"></div>';iconHover='<div style="float: left; margin-right: 5px;"><img src="gfx/icon_book.gif"></div> Buch / '+data[j].binding+'<br style="clear: left;"/>';}
output+='<span id="'+platform+j+'" style="display: none;">';output+='<p><b>'+data[j].title+'</b>';if(data[j].author!='')
output+='<br/>von '+data[j].author;if(data[j].publisher!='')
output+='<br/>Verlag: '+data[j].publisher;if(data[j].publicationDate!=null){if(data[j].publicationDate!='')
output+=' '+data[j].publicationDate;}
if(data[j].isbn!=null&&data[j].isbn!='')
output+='<br/>ISBN: '+data[j].isbn;if(data[j].ean!=null&&data[j].ean!='')
output+='<br/>EAN: '+data[j].ean;if(data[j].description!='')
output+='<br/>'+data[j].description.substr(0,200);output+='</p>';output+='</span>';output+='<div style="float: left; margin-right: 5px" onmouseover="TagToTip(\''+platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">';output+='<a href="'+data[j].url+'" target="'+platform+'" class="title"><img src="'+imageUrl+'" width="'+new_width+'" height="'+new_height+'"/></a>';output+='</div>';output+=icon+'<a href="'+data[j].url+'" target="'+platform+'" class="title">'+trimStr(data[j].title,14).substring(0,100)+'</a>';output+='<div class="bunprice">inkl. Versand <span class="price2">EUR '+priceShip.toFormatted()+'</span><br/><a href="'+data[j].url+'" target="'+platform+'">Neu kaufen</a></div><br style="clear: right;"/><br/>';}
output+='</div>';$("#"+platform).html(output);}else{$("#"+platform).html('<div style="height: 480px; width: 150px; overflow: auto; margin-top: 20px; padding-left: 10px;"><div class="searchboxContent">Leider keine neuen B&uuml;cher gefunden.</div></div>');}}
$("#nextButton").live("click",function(){$.post("sucheama.php",$("#productFormNext").serialize(),function(data){if(data.result!==null){if(data.result.length>0){var arrProducts=new Array();for(var j=0;j<data.result.length;j++){arrProducts.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,publicationDate:data.result[j].publicationDate,ean:data.result[j].ean});}
renderProducts(arrProducts,data.page,data.cnt);}}},"json");});$("#prevButton").live("click",function(){$.post("sucheama.php",$("#productFormPrev").serialize(),function(data){if(data.result!==null){if(data.result.length>0){var arrProducts=new Array();for(var j=0;j<data.result.length;j++){arrProducts.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,publicationDate:data.result[j].publicationDate,ean:data.result[j].ean});}
renderProducts(arrProducts,data.page,data.cnt);}}},"json");});$("#sButton").click(function(){doSearch();});function __post(url,platform){$.ajax({type:"POST",timeout:15000,url:url,data:($("#searchForm").serialize()),dataType:"json",error:function(objAJAXRequest,strError){if(strError=="timeout")
$("#"+platform).html('<div class="searchboxContent">Sorry, die Plattform hat nicht schnell genug geantwortet.</div>');else
$("#"+platform).html('<div class="searchboxContent">'+strError+'</div>');},success:function(data){$("#"+data.name).empty();if(data.name=='ama'){if(data.result==null){renderEmptyProducts();$("#productRecommendation").hide();renderItemsBoxes(data.name,arrItems,0,null);}else{if(data.result.length>0){var arrProducts=new Array();var arrItems=new Array();var arrEans=new Array();cnt=0;cntProducts=0;for(var j=0;j<data.result.length;j++){if(data.result[j].condition==0){cnt++;arrItems.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});}
if(data.result[j].rank!="999999999"&&data.result[j].ean!=""){if(cntProducts<5){arrProducts.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,publicationDate:data.result[j].publicationDate,ean:data.result[j].ean});arrEans.push(data.result[j].ean);cntProducts++;}else{cntProducts++;}}}
if(arrProducts.length>0)
renderProducts(arrProducts,1,data.cnt);else
renderEmptyProducts();renderItemsBoxes(data.name,arrItems,cnt,null);}}}
if(data.name=='bok'){if(data.result==null){renderItemsBoxes(data.name,arrItems,0,null);}else{if(data.result.length>0){var arrItems=new Array();cnt=0;for(var j=0;j<data.result.length;j++){cnt++;arrItems.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});}
renderItemsBoxes(data.name,arrItems,cnt,null);}}}
if(data.name=='zva'){if(data.result==null){renderItemsBoxes(data.name,arrItems,0,null);}else{if(data.result.length>0){var arrItems=new Array();cnt=0;for(var j=0;j<data.result.length;j++){cnt++;arrItems.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});}
renderItemsBoxes(data.name,arrItems,cnt,null);}}}
if(data.name=='buf'){if(data.result==null){renderItemsBoxes(data.name,arrItems,0,null);}else{if(data.result.length>0){var arrItems=new Array();cnt=0;for(var j=0;j<data.result.length;j++){cnt++;arrItems.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});}
renderItemsBoxes(data.name,arrItems,cnt,null);}}}
if(data.name=='bun'){if(data.result==null){clearBox(data.name);}else{if(data.result.length>0){var arrItems=new Array();cnt=0;for(var j=0;j<data.result.length;j++){cnt++;arrItems.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});}
renderItemsBoxesBun(data.name,arrItems,cnt);}}}
if(data.name=='abe'){if(data.result==null){renderItemsBoxes(data.name,arrItems,0,null);}else{if(data.result.length>0){var arrItems=new Array();cnt=0;for(var j=0;j<data.result.length;j++){cnt++;arrItems.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});}
renderItemsBoxes(data.name,arrItems,cnt,null);}}}}});}
function doSearch(){beforeSearch();for(i=0;i<s_databases.length;i++){__post(s_databases[i].searchurl,s_databases[i].name);}
afterSearch();}
$("#searchForm").submit(function(){return false;});$("#formfSearch").submit(function(){doFulltextSearch();return false;});function doFulltextSearch(){$("#sTitle").val("");$("#sAuthor").val("");$("#sKeyword").val($("#sHeadKeyword").val());$("#sISBN").val("");doSearch();}
$("#fSearch").click(function(){doFulltextSearch();});var allData;function renderList(data,page){allData=data;if(page=="")page=1;var displayLimit=20;var maxDisplay=0;var cntDisplay=0;maxDisplay=(page*displayLimit);cntDisplay=(page*displayLimit)-displayLimit;var cntTotal=0;var cntPages=0;var new_width;var new_height;var cntAma=0;var arrItemsAma=new Array();var cntAbe=0;var arrItemsAbe=new Array();var cntBok=0;var arrItemsBok=new Array();var cntZva=0;var arrItemsZva=new Array();var cntBuf=0;var arrItemsBuf=new Array();var cntBun=0;var arrItemsBun=new Array();var output="";var hinweisNeu="";var min_used_price=0;var trenner=false;if(data.result.length>0){var outputHeader='<table cellspacing="0" cellpadding="0" border="0" width="100%">';for(var j=0;j<data.result.length;j++){if(data.result[j].condition==0){var priceShip=parseFloat(data.result[j].price)+parseFloat(data.result[j].shippingDE);if(data.result[j].ausgeschaltet==0){if(min_used_price==0)
min_used_price=priceShip;if(priceShip<min_used_price)
min_used_price=priceShip;}else{}
var price=new NumberFormat(parseFloat(data.result[j].price));price.setSeparators(true,price.PERIOD,price.COMMA);var ship=new NumberFormat(parseFloat(data.result[j].shippingDE));ship.setSeparators(true,ship.PERIOD,ship.COMMA);priceShip=new NumberFormat(priceShip);priceShip.setSeparators(true,priceShip.PERIOD,priceShip.COMMA);cntTotal++;if(cntTotal>=cntDisplay&&cntDisplay<maxDisplay){if(cntDisplay<(maxDisplay-1))
border='border-bottom: 1px dashed #CCC;';else
border='';if(data.result[j].ausgeschaltet==1&&trenner==false){output+='<tr><td colspan="3" align="center" style="padding-bottom: 5px; padding-top: 5px; '+border+'"> Ab hier kommen nur noch Titel, die Sie &uuml;ber die Portalansicht ausgeblendet haben.</td></tr>';trenner=true;}
if(data.result[j].ausgeschaltet==0){output+='<tr><td align="center" width="70" style="padding-bottom: 5px; padding-top: 5px; '+border+'" onmouseover="TagToTip(\''+data.result[j].platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">';if(data.result[j].smallImageUrl!=""){imageUrl=data.result[j].smallImageUrl;var max=60;var width=data.result[j].smallImageWidth;var height=data.result[j].smallImageHeight;var xscale=width/max;var yscale=height/max;if(yscale>xscale){new_width=width*(1/yscale);new_height=height*(1/yscale);}
else{new_width=width*(1/xscale);new_height=height*(1/xscale);}}else{imageUrl='noimage.gif';new_width=40;new_height=60;}
output+='<span id="'+data.result[j].platform+j+'" style="display: none;">';output+='<p><b>'+data.result[j].title+'</b>';if(data.result[j].author!='')
output+='<br/>von '+data.result[j].author;if(data.result[j].publisher!='')
output+='<br/>Verlag: '+data.result[j].publisher;if(data.result[j].publicationDate!=null){if(data.result[j].publicationDate!='')
output+=' '+data.result[j].publicationDate;}
if(data.result[j].isbn!=null&&data.result[j].isbn!='')
output+='<br/>ISBN: '+data.result[j].isbn;if(data.result[j].ean!=null&&data.result[j].ean!='')
output+='<br/>EAN: '+data.result[j].ean;if(data.result[j].description!='')
output+='<br/>'+data.result[j].description;output+='</p>';output+='</span>';output+='<img src="'+imageUrl+'" width="'+new_width+'" height="'+new_height+'"/></td><td valign="top" style="padding-bottom: 5px; padding-top: 5px; '+border+'"><div>';if(data.result[j].title!="")
output+='<a href="'+data.result[j].url+'" target="'+data.result[j].platform+'" class="productList" onmouseover="TagToTip(\''+data.result[j].platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">'+data.result[j].title+'</a>';output+='<br/>';if(data.result[j].author!="")
output+=' von '+data.result[j].author;if(data.result[j].publisher!="")
output+=' von '+data.result[j].publisher;if(data.result[j].isbn!="")
output+=', ISBN: '+data.result[j].isbn;if(data.result[j].ean!="")
output+=', EAN: '+data.result[j].ean;if(data.result[j].description.length>80){output+='<br/>'+data.result[j].description.substr(0,77)+' <a href="'+data.result[j].url+'" target="'+data.result[j].platform+'" onmouseover="TagToTip(\''+data.result[j].platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">mehr...</a>';}else{output+='<br/>'+data.result[j].description+' <a href="'+data.result[j].url+'" target="'+data.result[j].platform+'" onmouseover="TagToTip(\''+data.result[j].platform+j+'\', TITLE, false, CLICKSTICKY, false, CLICKCLOSE, false, CLOSEBTN, false, WIDTH, -400, BGCOLOR, \'#F9DC99\', BORDERCOLOR, \'#F0AE1C\')" onmouseout="UnTip()">mehr...</a>';}
output+='</div></td><td width="150" valign="top" align="right" style="padding-bottom: 5px; padding-top: 5px; '+border+'">';output+='<div style="float: right; margin-right: 5px; text-align: right;">Preis '+price.toFormatted()+'<br/>Versand '+ship.toFormatted()+'<div class="price" style="margin-top: 3px;">EUR '+priceShip.toFormatted()+'</div><a href="'+data.result[j].url+'" target="'+data.result[j].platform+'">';switch(data.result[j].platform){case"ama":output+='Bei Amazon kaufen</a>';break;case"buf":output+='Bei Buchfreund kaufen</a>';break;case"bok":output+='Bei Booklooker kaufen</a>';break;case"zva":output+='Beim ZVAB kaufen</a>';break;case"abe":output+='Bei Abebooks kaufen</a>';break;}
output+='</div>';output+='</div></td></tr>';}else{output+='<tr style="color: #BBB;"><td colspan="2" style="padding: 5px 5px; '+border+'">';output+='<div>';if(data.result[j].title!="")
output+='<a href="'+data.result[j].url+'" target="'+data.result[j].platform+'" class="productListOff">'+data.result[j].title+'</a>';output+='<br/>';if(data.result[j].author!="")
output+=' von '+data.result[j].author;if(data.result[j].publisher!="")
output+=' von '+data.result[j].publisher;if(data.result[j].isbn!="")
output+=', ISBN: '+data.result[j].isbn;if(data.result[j].ean!="")
output+=', EAN: '+data.result[j].ean;if(data.result[j].description.length>80){output+='<br/>'+data.result[j].description.substr(0,77)+' <a href="'+data.result[j].url+'" target="'+data.result[j].platform+'" class="productListOff">mehr...</a>';}else{output+='<br/>'+data.result[j].description+' <a href="'+data.result[j].url+'" target="'+data.result[j].platform+'" class="productListOff">mehr...</a>';}
output+='</div></td><td width="150" valign="top" align="right" style="padding-bottom: 5px; padding-top: 5px; '+border+'">';output+='<div style="float: right; margin-right: 5px; text-align: right;">Preis '+price.toFormatted()+'<br/>Versand '+ship.toFormatted()+'<div class="price" style="margin-top: 3px;">EUR '+priceShip.toFormatted()+'</div><a href="'+data.result[j].url+'" target="'+data.result[j].platform+'" class="productListOff">';switch(data.result[j].platform){case"ama":output+='Bei Amazon kaufen</a>';break;case"buf":output+='Bei Buchfreund kaufen</a>';break;case"bok":output+='Bei Booklooker kaufen</a>';break;case"zva":output+='Beim ZVAB kaufen</a>';break;case"abe":output+='Bei Abebooks kaufen</a>';break;}
output+='</div>';output+='</div></td></tr>';}
cntDisplay++;}}
switch(data.result[j].platform){case'ama':if(data.result[j].condition==0){cntAma++;arrItemsAma.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});}
break;case'abe':cntAbe++;arrItemsAbe.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});break;case'bok':cntBok++;arrItemsBok.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});break;case'zva':cntZva++;arrItemsZva.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});break;case'buf':cntBuf++;arrItemsBuf.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});break;case'bun':cntBun++;arrItemsBun.push({smallImageUrl:data.result[j].smallImageUrl,smallImageWidth:data.result[j].smallImageWidth,smallImageHeight:data.result[j].smallImageHeight,title:data.result[j].title,binding:data.result[j].binding,author:data.result[j].author,publisher:data.result[j].publisher,price:data.result[j].price,shippingDE:data.result[j].shippingDE,url:data.result[j].url,description:data.result[j].description,isbn:data.result[j].isbn,ean:data.result[j].ean});break;}}
if(cntBun==1){if(hinweisNeu==""){var priceShipNew=parseFloat(arrItemsBun[0].price)+parseFloat(arrItemsBun[0].shippingDE);if(min_used_price>(priceShipNew-priceShipNew/100*20)){priceShipNew=new NumberFormat(priceShipNew);priceShipNew.setSeparators(true,priceShipNew.PERIOD,priceShipNew.COMMA);hinweisNeu='<tr><td colspan="3" width="100%" style="padding-bottom: 5px; padding-top: 5px; text-align: center; font-weight: bold; font-size: 12px;"><span style="color: red;">BuchHai-Tip:</span> <a href="'+arrItemsBun[0].url+'" target="bun" style="color: red;">Neu bereits erh&auml;ltlich f&uuml;r <b>EUR '+priceShipNew.toFormatted()+'</b> inkl. Versand!</a></td></tr>';}}}
output=outputHeader+hinweisNeu+output;output+='</table>';displayPages(Math.ceil((cntAma+cntAbe+cntBok+cntZva+cntBuf)/displayLimit),page);}else{output='Sorry, keine Daten zum Anzeigen vorhanden.';}
renderItemsBoxes('zva',arrItemsZva,cntZva,arrItemsBun);renderItemsBoxes('buf',arrItemsBuf,cntBuf,arrItemsBun);renderItemsBoxes('bok',arrItemsBok,cntBok,arrItemsBun);renderItemsBoxes('abe',arrItemsAbe,cntAbe,arrItemsBun);renderItemsBoxes('ama',arrItemsAma,cntAma,arrItemsBun);renderItemsBoxesBun('bun',arrItemsBun,cntBun);$("#searchboxContent").html(output);}
function displayPages(cntTotal,current){var pages="";if(cntTotal>1){for(i=1;i<=cntTotal;i++){if(current==i)
pages+='<b>'+i+'</b>&nbsp;';else
pages+='<a href="#'+i+'" class="pager">'+i+'</a>&nbsp;';}}
$("#pages").html(pages);$("#pages2").html(pages);}
$(".pager").live("click",function(){var page=$(this).attr("href");page=page.replace("#","");$("#searchboxContent").html('<p align="center"><img src="gfx/book-loader.gif" width="31" height="31" border="0" /></p>');renderList(allData,page);});$("#searchView").click(function(){$("#searches").css("display","block");$("#productRecommendation").css("display","none");$("#listings").css("display","none");$(".sortBox").css("display","none");$("#portals").css("display","none");clearResults();});$("#listView").click(function(){$("#searches").css("display","none");$("#tabbed1_1").css("background-image","url('/gfx/navi-start-off.gif')");$("#tabbed1_2").css("background-image","url('/gfx/navi-middle-off.gif')");$("#tabbed1_3").css("background-image","url('/gfx/navi-right-off.gif')");$("#tabbed2_1").css("background-image","url('/gfx/navi-left-active.gif')");$("#tabbed2_2").css("background-image","url('/gfx/navi-middle.gif')");$("#tabbed2_3").css("background-image","url('/gfx/navi-right-active.gif')");$("#portalView").removeClass("naviLink").addClass("naviLinkOff");$("#listView").removeClass("naviLinkOff").addClass("naviLink");$("#productRecommendation").css("display","block");$("#listings").css("display","block");$(".sortBox").css("display","inline");$("#pages").css("display","block");$("#portals").css("display","none");$.post("getList.php",$("#changeSort").serialize(),function(data){renderList(data,0);},"json");});$("#portalView").click(function(){$("#searches").css("display","none");$("#tabbed1_1").css("background-image","url('/gfx/navi-start.gif')");$("#tabbed1_2").css("background-image","url('/gfx/navi-middle.gif')");$("#tabbed1_3").css("background-image","url('/gfx/navi-right.gif')");$("#tabbed2_1").css("background-image","url('/gfx/navi-left.gif')");$("#tabbed2_2").css("background-image","url('/gfx/navi-middle-off.gif')");$("#tabbed2_3").css("background-image","url('/gfx/navi-right-off.gif')");$("#listView").removeClass("naviLink").addClass("naviLinkOff");$("#portalView").removeClass("naviLinkOff").addClass("naviLink");$("#productRecommendation").css("display","block");$("#listings").css("display","none");$(".sortBox").css("display","none");$("#pages").css("display","none");$("#portals").css("display","block");});$("#sort").change(function(){if($("#sort").val()>0){$.post("getList.php",$("#changeSort").serialize(),function(data){renderList(data,0);},"json");}});if ($("#external").val()==1){$("#external").val("0");doSearch();}});function doHover(objektname,zustand){if(zustand==1){bild=document.getElementById(objektname+"_1").style.backgroundImage;document.getElementById(objektname+"_1").style.backgroundImage=bild.replace(/\./,'-hover.');bild=document.getElementById(objektname+"_2").style.backgroundImage;document.getElementById(objektname+"_2").style.backgroundImage=bild.replace(/\./,'-hover.');bild=document.getElementById(objektname+"_3").style.backgroundImage;document.getElementById(objektname+"_3").style.backgroundImage=bild.replace(/\./,'-hover.');}else{bild=document.getElementById(objektname+"_1").style.backgroundImage;document.getElementById(objektname+"_1").style.backgroundImage=bild.replace(/-hover\./,'.');bild=document.getElementById(objektname+"_2").style.backgroundImage;document.getElementById(objektname+"_2").style.backgroundImage=bild.replace(/-hover\./,'.');bild=document.getElementById(objektname+"_3").style.backgroundImage;document.getElementById(objektname+"_3").style.backgroundImage=bild.replace(/-hover\./,'.');}}
