';
if( Categories != undefined ) {
var Cats = ShowSearchCategories( Categories ) ;
if( Cats )
Content += Cats ;
}
if( Autor ) {
Content += '
Książki autora:
' + NoFilterSearchPhrase + '
' ;
} else {
Content += '
Wyniki wyszukiwania dla:
' + NoFilterSearchPhrase + '
' ;
}
Content += '
| |
' ;
var iter = 0 ;
var ClassRow ;
var Clouds = new Array() ;
for( i in Products ){
var p = Products[i] ;
p.ShortDesc = Products[i].ShortDesc.substr( 0, 150 ) ;
if( Products[i].Reviews > 0 ) {
p.AvgReviews = "Średnia ocen:" + Math.ceil( Products[i].Reviews * 10 ) / 10 ;
} else {
p.AvgReviews = "Brak ocen." ;
}
p.Reviews = 15 * Products[i].Reviews ;
p.Price = RoundPrice( Products[i].Price ) ;
if( p.Title.split( " - " ).length > 1 ){
p.Title = p.Title.split( " - " )
p.Title.pop();
p.Title = p.Title.join( " - " ) ;
}
if( p.Autor == undefined ) p.Autor = '' ;
if( p.Autor ) {
var Autors = p.AutorUrl.split( "%2C" ) ;
var AutorsTxt= p.Autor.split( "," ) ;
p.Autor = "" ;
for( i in Autors ) {
p.Autor += '' + AutorsTxt[i] + '' ;
}
}
if( iter++ % 2 == 0 ){
ClassRow = 'RowResultsWhite' ;
} else {
ClassRow = 'RowResultsBrown' ;
}
p.Url = p.Url + ( ( p.Url.split('?').length > 1 ) ? "&" : "?" ) + "spos=" + iter ;
Content += '  ' ;
if( p.PromoOn ) {
Content += ' ' ;
Clouds[i] = '' ;
}
Clouds[201] = ' | | | | Kliknij aby zobaczyć książki tego autora. | | | | | ' ;
Content += ' | ' ;
Content += ' ' + p.ShortDesc + '... ' ;
Content += '' ;
var IterStars = 300 + iter ;
Clouds[ IterStars ] = '' ;
if( p.RokWydania ){
p.Name = 'Rok wydania' ;
p.Value = p.RokWydania ;
Content += '' ;
}
if( p.Oprawa ){
p.Name = 'Oprawa' ;
p.Value = p.Oprawa ;
Content += '' ;
}
if( p.Material ){
p.Name = 'Materiał' ;
p.Value = p.Material ;
Content += '' ;
}
if( p.Wysokosc ){
p.Name = 'Wysokość' ;
p.Value = p.Wysokosc ;
Content += '' ;
}
if( p.Szerkosc ){
p.Name = 'Szerkość' ;
p.Value = p.Szerkosc ;
Content += '' ;
}
if( p.Nosnik ){
p.Name = 'Nośnik' ;
p.Value = p.Nosnik ;
Content += '' ;
}
if( p.RodzajGry ){
p.Name = 'Rodzaj gry' ;
p.Value = p.RodzajGry ;
Content += '' ;
}
if( p.QtyOnMag > 0 ) {
Content += ' ';
Clouds[200] = ' | | | | Towar na magazynie. Wysyłka w przeciągu 24 godzin. | | | | | ' ;
} else {
p.Value = p.AvailabName ;
Content += '' ;
}
Content += ' | Nasza cena: ' + p.Price + 'zł' ;
if( p.HighPrice > 0.1 ) Content += ' Cena rynkowa: ' + p.HighPrice + ' zł' ;
Content += ' |
' ;
}
if( !Products.length ) {
Content += ' | Brak wyników. |
' ;
}
Content += '
' ;
document.getElementsByTagName('body')[0].innerHTML += Clouds.join('') ;
return Content ;
}
function ShowSearchCategories( Categories ) {
if( Categories.length ) {
var Content = '
' ;
for( i in Categories ) {
var c = Categories[i] ;
Content += '
' + c.Title + ' ' ;
}
Content += '
' ;
return Content ;
}
return false ;
}
function ShowSuggestProducts( Products, SuggestPhrase ) {
var ClassRow ;
var Content = '';
var CountProd = 0;
var SuggestPhraseUrl = window.location.href.replace(/q-(.*)\/pc/, "q-" + encodeURI( Trim(SuggestPhrase).replace( / /gi, "_" ) ) + "/pc") ;
var Clouds = new Array() ;
Content += '
| Nazwa / Opis | Cena |
' ;
var iter = 0 ;
for( i in Products ){
var p = Products[i] ;
p.ShortDesc = Products[i].ShortDesc.substr( 0, 150 ) ;
if( Products[i].Reviews > 0 ) {
p.AvgReviews = "Średnia ocen:" + Math.ceil( Products[i].Reviews * 10 ) / 10 ;
} else {
p.AvgReviews = "Brak ocen." ;
}
p.Reviews = 15 * Products[i].Reviews ;
p.Price = RoundPrice( Products[i].Price ) ;
if( p.Title.split( " - " ).length > 1 ){
p.Title = p.Title.split( " - " )
p.Title.pop();
p.Title = p.Title.join( " - " ) ;
}
if( p.Autor == undefined ) p.Autor = '' ;
var AutorsTxt= p.Autor.split( "," ) ;
if( p.Autor ) {
var Autors = p.AutorUrl.split( "%2C" ) ;
p.Autor = "" ;
for( i in Autors ) {
p.Autor += '' + AutorsTxt[i] + '' ;
}
}
if( iter++ % 2 == 0 ){
ClassRow = 'RowResultsWhite' ;
} else {
ClassRow = 'RowResultsBrown' ;
}
p.Url = p.Url + ( ( p.Url.split('?').length > 1 ) ? "&" : "?" ) + "spos=" + iter ;
Content += '  ' ;
if( p.PromoOn ) {
Content += ' ' ;
Clouds[i] = '' ;
}
Clouds[201] = ' | | | | Kliknij aby zobaczyć książki tego autora. | | | | | ' ;
Content += ' | ' ;
Content += ' ' + p.ShortDesc + '... ' ;
Content += '' ;
var IterStars = 300 + iter ;
Clouds[ IterStars ] = '' ;
if( p.RokWydania ){
p.Name = 'Rok wydania' ;
p.Value = p.RokWydania ;
Content += '' ;
}
if( p.Oprawa ){
p.Name = 'Oprawa' ;
p.Value = p.Oprawa ;
Content += '' ;
}
if( p.Material ){
p.Name = 'Materiał' ;
p.Value = p.Material ;
Content += '' ;
}
if( p.Wysokosc ){
p.Name = 'Wysokość' ;
p.Value = p.Wysokosc ;
Content += '' ;
}
if( p.Szerkosc ){
p.Name = 'Szerkość' ;
p.Value = p.Szerkosc ;
Content += '' ;
}
if( p.Nosnik ){
p.Name = 'Nośnik' ;
p.Value = p.Nosnik ;
Content += '' ;
}
if( p.RodzajGry ){
p.Name = 'Rodzaj gry' ;
p.Value = p.RodzajGry ;
Content += '' ;
}
if( p.QtyOnMag > 0 ) {
Content += ' ';
Clouds[200] = ' | | | | Towar na magazynie. Wysyłka w przeciągu 24 godzin. | | | | | ' ;
} else {
p.Value = p.AvailabName ;
Content += '' ;
}
Content += ' | Nasza cena: ' + p.Price + 'zł' ;
if( Products[i] != undefined && Products[i].HighPrice > 0.1 ) Content += ' Cena rynkowa: ' + p.HighPrice + ' zł' ;
Content += ' |
' ;
CountProd++;
}
if( CountProd == 0 && ActualLimitFrom == 0 ) {
Content += ' | Brak wyników. |
' ;
} else if( CountProd == 0 ) {
Content += 'Koniec wyników.
' ;
NoMoreProducts = true ;
}
if( Products.length > 0 )
Content += '
';
document.getElementsByTagName('body')[0].innerHTML += Clouds.join('') ;
return Content ;
}
function ShowMoreSearchProducts( Products ) {
var ClassRow ;
var Content = '';
var CountProd = 0;
var Clouds = new Array() ;
if( Products == undefined ) Products = new Array();
if( Products.length > 0 ) {
Content += '
';
}
var iter = 0 ;
for( i in Products ){
var p = Products[i] ;
p.ShortDesc = Products[i].ShortDesc.substr( 0, 150 ) ;
if( Products[i].Reviews > 0 ) {
p.AvgReviews = "Średnia ocen:" + Math.ceil( Products[i].Reviews * 10 ) / 10 ;
} else {
p.AvgReviews = "Brak ocen." ;
}
p.Reviews = 15 * Products[i].Reviews ;
p.Price = RoundPrice( Products[i].Price ) ;
if( p.Title.split( " - " ).length > 1 ){
p.Title = p.Title.split( " - " )
p.Title.pop();
p.Title = p.Title.join( " - " ) ;
}
if( p.Autor == undefined ) p.Autor = '' ;
if( p.Autor ) {
var Autors = p.AutorUrl.split( "%2C" ) ;
var AutorsTxt= p.Autor.split( "," ) ;
p.Autor = "" ;
for( i in Autors ) {
p.Autor += '' + AutorsTxt[i] + '' ;
}
}
if( iter++ % 2 == 0 ){
ClassRow = 'RowResultsWhite' ;
} else {
ClassRow = 'RowResultsBrown' ;
}
p.Url = p.Url + ( ( p.Url.split('?').length > 1 ) ? "&" : "?" ) + "spos=" + ( iter + ( 15 * ActualLimitFrom ) ) ;
Content += '  ' ;
if( p.PromoOn ) {
Content += ' ' ;
Clouds[i] = '' ;
}
Clouds[201] = ' | | | | Kliknij aby zobaczyć książki tego autora. | | | | | ' ;
Content += ' | ' ;
Content += ' ' + p.ShortDesc + '... ' ;
Content += '' ;
var IterStars = 300 + iter ;
Clouds[ IterStars ] = '' ;
if( p.RokWydania ){
p.Name = 'Rok wydania' ;
p.Value = p.RokWydania ;
Content += '' ;
}
if( p.Oprawa ){
p.Name = 'Oprawa' ;
p.Value = p.Oprawa ;
Content += '' ;
}
if( p.Material ){
p.Name = 'Materiał' ;
p.Value = p.Material ;
Content += '' ;
}
if( p.Wysokosc ){
p.Name = 'Wysokość' ;
p.Value = p.Wysokosc ;
Content += '' ;
}
if( p.Szerkosc ){
p.Name = 'Szerkość' ;
p.Value = p.Szerkosc ;
Content += '' ;
}
if( p.Nosnik ){
p.Name = 'Nośnik' ;
p.Value = p.Nosnik ;
Content += '' ;
}
if( p.RodzajGry ){
p.Name = 'Rodzaj gry' ;
p.Value = p.RodzajGry ;
Content += '' ;
}
if( p.QtyOnMag > 0 ) {
Content += ' ';
Clouds[200] = ' | | | | Towar na magazynie. Wysyłka w przeciągu 24 godzin. | | | | | ' ;
} else {
p.Value = p.AvailabName ;
Content += '' ;
}
Content += ' | Nasza cena: ' + p.Price + 'zł' ;
if( Products[i] != undefined && Products[i].HighPrice > 0.1 ) Content += ' Cena rynkowa: ' + p.HighPrice + ' zł' ;
Content += ' |
' ;
CountProd++;
}
if( CountProd == 0 && ActualLimitFrom == 0 ) {
Content += ' | Brak wyników. |
' ;
} else if( CountProd == 0 ) {
Content += 'Koniec wyników.
' ;
NoMoreProducts = true ;
}
if( Products.length > 0 )
Content += '
';
document.getElementById('CloudsKontener').innerHTML += Clouds.join('') ;
return Content ;
}
// Wyswietalnie Tagów .
var MatchedFound = false ;
function SortTab( A, B ){
var ALength = A['Key1'].length + A['Key2'].length + A['Key3'].length + A['Rest'].length ;
var BLength = B['Key1'].length + B['Key2'].length + B['Key3'].length + B['Rest'].length ;
if( ALength > BLength ) return 1 ;
if( ALength < BLength ) return -1 ;
return 0 ;
}
function SortMatchedLettersTab( A, B ){
if( A[1] > B[1] ) return -1 ;
if( A[1] < B[1] ) return 1 ;
return 0 ;
}
function ShowHints( Hints, ShowProd, ReturnBestHint ) {
var SearchDiv = document.getElementById('SearchHints') ;
var Content = "
" ;
var TmpContent = "" ;
var TmpContentArr = new Array();
var Phrase = Trim( SearchPhrase ).split( " " ) ;
var Matched = new Array( Hints.length );
var From = 0;
var Count = 0 ;
var HintsLength = new Array();
var TmpHints = new Array() ;
Hints.sort( SortTab );
var MatchedLettersAll = new Array() ;
for( i in Hints ){
Matched[i] = new Array(4) ;
var UsedKey1 = false;
var UsedKey2 = false;
var UsedKey3 = false;
var UsedKey4 = false;
for( j in Phrase ){
var MatchedLetters = 0 ;
var SubStr = 0 ;
do{
var ShortPhrase = FilterPolishChars( Trim( Phrase[j].substr( 0, Phrase[j].length - SubStr ) ) );
var Filtered = FilterPolishChars( Hints[i]['Key1'] ) ;
if( Filtered.indexOf( ShortPhrase ) != -1 && !UsedKey1 ){
Matched[i][1] = true ;
Hints[i]['Key1'] = MatchPhrases( Filtered, ShortPhrase, Hints[i], 'Key1') ;
MatchedLetters = ShortPhrase.length ;
UsedKey1 = true ;
}
Filtered = FilterPolishChars( Hints[i]['Key2'] ) ;
if( Filtered.indexOf( ShortPhrase ) != -1 && !MatchedFound && !UsedKey2 ){
Matched[i][2] = true ;
Hints[i]['Key2'] = MatchPhrases( Filtered, ShortPhrase, Hints[i], 'Key2') ;
MatchedLetters = ShortPhrase.length ;
UsedKey2 = true ;
}
Filtered = FilterPolishChars( Hints[i]['Key3'] ) ;
if( Filtered.indexOf( ShortPhrase ) != -1 && !MatchedFound && !UsedKey3 ){
Matched[i][3] = true ;
Hints[i]['Key3'] = MatchPhrases( Filtered, ShortPhrase, Hints[i], 'Key3') ;
MatchedLetters = ShortPhrase.length ;
UsedKey3 = true ;
}
Filtered = FilterPolishChars( Hints[i]['Rest'] ) ;
if( Filtered.indexOf( ShortPhrase ) != -1 && !MatchedFound && !UsedKey4 ){
Matched[i][4] = true ;
Hints[i]['Rest'] = MatchPhrases( Filtered, ShortPhrase, Hints[i], 'Rest') ;
MatchedLetters = ShortPhrase.length ;
UsedKey4 = true ;
}
SubStr++;
if( MatchedLetters ) MatchedFound = true ;
if( MatchedLettersAll[i] ){
MatchedLettersAll[i] += MatchedLetters ;
} else MatchedLettersAll[i] = MatchedLetters ;
}while( !MatchedFound && ( ( Phrase[j].length - SubStr ) > 2 ) );
MatchedFound = false ;
}
if( Matched[i][1] ){From = 1}
else if( Matched[i][2] ){From = 2}
else if( Matched[i][3] ){From = 3}
else if( Matched[i][4] ){From = 4}
Hints[i]['Key4'] = Hints[i]['Rest'] ;
var CountWordsInPhrase = SearchPhrase.split(' ').length ;
if( Hints[i]['CountOrders'] < 10 && CountWordsInPhrase == 1 ){ Count = 1 }
else if( Hints[i]['CountOrders'] < 10 && CountWordsInPhrase < 3 ){Count = 3}
else if( Hints[i]['CountOrders'] >= 10 && Hints[i]['CountOrders'] < 30 ){Count = 3}
else { Count = 4 }
TmpContent = "" ;
if( From != 1 && Count > 1 ) TmpContent += Hints[i]['Key' + ( From - 1 ) ] + " " ;
TmpContent += Hints[i]['Key' + ( From ) ] + " " ;
if( From != 4 && Count > 1 ) TmpContent += Hints[i]['Key' + ( From + 1 ) ] + " " ;
if( From == 1 && Count == 3 ) TmpContent += Hints[i]['Key3'] ;
if( Count == 4 && From == 1 ) TmpContent += Hints[i]['Key3'] + " " + Hints[i]['Key4'] ;
if( Count == 4 && From == 2 ) TmpContent += Hints[i]['Key4'] ;
if( Count == 4 && From == 3 ) TmpContent = Hints[i]['Key1'] + " " + TmpContent ;
From = 0 ;
TmpContent = TmpContent.replace( /undefined/gi, '' ) ;
if( Trim( SearchPhrase ) != Trim( TmpContent.replace(//gi, '').replace(/<\/b>/gi, '') ) ) {
TmpContentArr[i] = [ TmpContent, MatchedLettersAll[i] ] ;
}
}
TmpContentArr.sort( SortMatchedLettersTab );
if( ReturnBestHint == 1 && TmpContentArr[0] ) return TmpContentArr[0][0].replace(//gi, '').replace(/<\/b>/gi, '') ;
else if( ReturnBestHint == 1 ) return '' ;
var IterList = 0 ;
for( i in TmpContentArr ){
TmpContent = TmpContentArr[i][0] ;
if( Content.indexOf( TmpContent + "" ) == -1 ){ // żeby identyczne frazy się nie powtarzały .
var CleanPhrase = TmpContent.replace(/<.*?>/g, "") ;
Content += "- ";
Content += TmpContent + "
" ;
IterList++ ;
}
}
if( !ShowProd ){
if( Hints.length > 0 ){ SearchDiv.style.display = 'block' ;
}else{ SearchDiv.style.display = 'none' ; }
}
SearchDiv.innerHTML = Content + "
" ;
}
function MatchPhrases( Filtered, Phrase, NoFilter, Name ){
var Key = NoFilter[Name].substr(0, Filtered.indexOf( Phrase ) ) + "
";
Key += NoFilter[Name].substr( Filtered.indexOf( Phrase ), Phrase.length ) + "";
Key += NoFilter[Name].substr( Filtered.indexOf( Phrase ) + Phrase.length ) ;
MatchedFound = true ;
return Key ;
}