/************************************************************************ 
Books Widget 2.5 [10/01/08]
Created by: Alex Campbell [webmaster@boyira.org]
-------------------------------------------------------------------------
this is the JS companion for the books widget html. Supports multiple 
stores per single book. 
*************************************************************************/

// add last slash
var VPATH_DL 	 = "/books/";
var VPATH_IMG	 = "/img/";

/************************************************************************/ 
var IX_ITEMS 	 = 3;   		 // start pos. of books items in books array. 
var IX_LOCALE 	 = 2;   		 // start pos. of locale items in books array. 

// image array preloader
var imgs = ['amazon_buy_en.gif', 'amazon_buy_fr.gif', 'amazon_buy_de.gif', 'iris_buy_bg.gif'];

/******************************************************
 REMEMBER TO STRIP *T*ERMINAL COMMAS!
 (or will get wrong array sizes /JS errors in IE/Opera)  
*******************************************************/ 
// http://developer.mozilla.org/en/docs/Sandbox:Javascript_Object_Literals
var books = [
/* dummy entry for chooser text */
['', '', [null], {0:[null]}],

/* <lang name>, <qty e-books>, [<lang code>, <locale tooltip>, <locale tooltip> */
['Bulgarian',  ' (6)', ['BG', 'Електронната книга на български е в наличност. Кликнете за да я източите', 'Кликнете за да купите тази книга на български'],
{
/* <book id>, <pdf filename>, <icon id>, <cover filename>, <more info>, <store URL> */
1: 		[null,  												3, '01-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
2: 		[null,  												3, '02-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
3: 		['[03-BG].Bo.Yin.Ra.-.Kniga.za.otvadnia.sviat.pdf',  	3, '03-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
4: 		['[04-BG].Bo.Yin.Ra.-.Kniga.za.choveka.pdf', 			3, '04-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
5: 		['[05-BG].Bo.Yin.Ra.-.Kniga.za.shtastieto.pdf', 		3, '05-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
6: 		[null,  												3, '06-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
7: 		[null,  												3, '07-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
8: 		[null,  												3, '08-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
9: 		[null,  												3, '09-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
10:		[null,  												3, '10-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
11:		[null,  												3, '11-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
12:		[null,  												3, '12-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
13:		[null,  												3, '13-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
14:		[null,  												3, '14-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
15: 	['[15-BG].Bo.Yin.Ra.-.Misteriata.na.Golgota.pdf', 		3, '15-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
16:		[null,  												3, '16-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
17:		[null,  												3, '17-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
18:		[null,  												3, '18-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
19:		[null,  												3, '19-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
20:		[null,  												3, '20-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
21:		[null,  												3, '21-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
22:		[null,  												3, '22-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
23:		[null,  												3, '23-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
24:		[null,  												3, '24-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
25:		[null,  												3, '25-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
26:		[null,  												3, '26-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
27:		[null,  												3, '27-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
28:		[null,  												3, '28-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
29:		[null,  												3, '29-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
30:		[null,  												3, '30-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
31:		[null,  												3, '31-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
32:		[null,  												3, '32-BG.jpg',   true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1923:	[null,  												3, '1923-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1927:	[null, 													3, '1927-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
19271:	[null, 													3, '19271-BG.jpg',true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1930:	[null,  												3, '1930-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
19301:	[null,  												3, '19301-BG.jpg',true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1932:	[null, 													3, '1932-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
19321:	['[19321-BG].Bo.Yin.Ra.-.Za.moite.knigi.pdf',			3, '19321-BG.jpg',true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1933:	[null,  												3, '1933-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1935:	[null,  												3, '1935-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1937:	[null,  												3, '1937-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1938:	[null,  												3, '1938-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1939:	[null,  												3, '1939-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
19391:	[null,  												3, '19391-BG.jpg',true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
19392:	[null,  												3, '19392-BG.jpg',true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1954:	[null,  												3, '1954-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1965:	['[1965-BG].Rudolf.Schott.-.Maksimi.pdf', 				3, '1965-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1990:	[null, 													3, '1990-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
19901:	[null, 													3, '19901-BG.jpg',true, 'javascript:extWj("За поръчки", "/bg/sellers/")'], 
1994:	[null, 													3, '1994-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'],
1999:	[null, 													3, '1999-BG.jpg', true, 'javascript:extWj("За поръчки", "/bg/sellers/")'] /*T*/
}], /*T*/

['Dutch', ' (3)', ['NL', 'The e-book in Dutch is available. Click to download', 'Click to purchase this book in Dutch'],
{
2:	['[02-NL].Bo.Yin.Ra.-.Het.Boek.Van.De.Levende.God.pdf',			null, null, null,  null],
3:	['[03-NL].Bo.Yin.Ra.-.Het.Boek.Van.Gene.Zijde.pdf',				null, null, null,  null],
24:	['[24-NL].Bo.Yin.Ra.-.Het.Gebet.pdf', 							null, null, null,  null] /*T*/
}],

['English', ' (1)', ['EN', 'The e-book in English is available. Click to download', 'Click to purchase this book in English'],
{
1: 		[null, 0, '01-EN.jpg', 	 null, 'http://www.amazon.com/Book-Royal-Art-Bo-Yin/dp/0915034131/'],
2: 		['[02-EN].Bo.Yin.Ra.-.The.Book.On.The.Living.God.pdf', 0, '02-EN.jpg', null, 'http://www.amazon.com/Book-Living-God-Bo-Yin/dp/0915034034/'],
3: 		[null, 0, '03-EN.jpg', 	 null, 'http://www.amazon.com/Book-Life-Beyond-Bo-Yin/dp/0915034115/'],
4: 		[null, 0, '04-EN.jpg', 	 null, 'http://www.amazon.com/Book-Human-Nature-Bo-Yin/dp/0915034077/'],
5: 		[null, 0, '05-EN.jpg', 	 null, 'http://www.amazon.com/Bo-Yin-Ra-Book-Happiness/dp/B000KPHRK6/'],
6: 		[null, 0, '06-EN.jpg', 	 null, 'http://www.amazon.com/Path-God-Bo-Yin-Ra/dp/0915034158/'],
7: 		[null, 0, '07-EN.jpg', 	 null, 'http://www.amazon.com/Book-Love-Bo-Yin-Ra/dp/0915034123/'],
8: 		[null, 0, '08-EN.jpg', 	 null, 'http://www.amazon.com/Book-Solace-B-Reichenbach/dp/0915034050/'],
9: 		[null, 0, '09-EN.jpg', 	 null, 'http://www.amazon.com/dp/091503414X/'],
11: 	[null, 0, '11-EN.jpg', 	 null, 'http://www.amazon.com/Wisdom-St-John-Bo-Yin/dp/0915034018/'],
17: 	[null, 0, '17-EN.jpg', 	 null, 'http://www.amazon.com/Meaning-This-Life-Bo-Yin/dp/0915034069/'],
20: 	[null, 0, '20-EN.jpg', 	 null, 'http://www.amazon.com/Resurrection-Bo-Yin-Ra/dp/0915034166/'],
21: 	[null, 0, '21-EN.jpg', 	 null, 'http://www.amazon.com/Worlds-Spirit-Bo-Yin-Ra/dp/0915034093/'],
25: 	[null, 0, '25-EN.jpg', 	 null, 'http://www.amazon.com/Spirit-Form-Bo-Yin-Ra/dp/0915034085/'],
2004:  	[null, 0, '2004-EN.jpg', null, 'http://www.amazon.com/Bo-Yin-Ra-Introduction-Works/dp/0915034107/', null, 'http://www.amazon.com/About-Books-Concerning-Other-Texts/dp/091503400X/'] /*T*/
}],

['Esperanto', ' (15)', ['EO', 'The e-book in Esperanto is available. Click to download', 'Click to purchase this book in Esperanto'],
{
1: 		['[01-EO].Bo.Yin.Ra.-.La.Libro.de.la.Reg.a.Arto.pdf', 	null, null, null, null],
2: 		['[02-EO].Bo.Yin.Ra.-.La.libro.pri.la.vivanta.Dio.pdf', null, null, null, null],
3: 		['[03-EO].Bo.Yin.Ra.-.Transa.Mondo.pdf', 				null, null, null, null],
4: 		['[04-EO].Bo.Yin.Ra.-.La.Libro.pri.la.Homo.pdf', 		null, null, null, null],
5: 		['[05-EO].Bo.Yin.Ra.-.La.Libro.pri.la.Felico.pdf', 		null, null, null, null],
6: 		['[06-EO].Bo.Yin.Ra.-.La.Vojo.al.Dio.pdf', 				null, null, null, null],
7: 		['[07-EO].Bo.Yin.Ra.-.La.Libro.de.la.Amo.pdf', 			null, null, null, null],
9: 		['[09-EO].Bo.Yin.Ra.-.La.Libro.de.Interparoloj.pdf', 	null, null, null, null],
10: 	['[10-EO].Bo.Yin.Ra.-.La.sekreto.pdf',  				null, null, null, null],
15: 	['[15-EO].Bo.Yin.Ra.-.Mistero.de.Golgota.pdf', 			null, null, null, null],
17: 	['[17-EO].Bo.Yin.Ra.-.La.Senco.de.la.Vivo.pdf', 		null, null, null, null],
19: 	['[19-EO].Bo.Yin.Ra.-.La.Alta.Celo.pdf', 				null, null, null, null],
20: 	['[20-EO].Bo.Yin.Ra.-.Relevigo.pdf', 					null, null, null, null],
21: 	['[21-EO].Bo.Yin.Ra.-.Mondoj.pdf', 						null, null, null, null],
27: 	['[27-EO].Bo.Yin.Ra.-.Vortoj.De.Vivo.pdf', 				null, null, null, null] /*T*/
}],

['French',  ' (1)', ['FR', 'The e-book in French is available. Click to download', 'Click to purchase this book in French'],
{
1: 		[null, 1, null, null,  ['http://www.amazon.fr/livre-lart-royal-Yin-Ra/dp/B0000DMAF9/', 'http://www.amazon.fr/livre-lart-royal-Bo-Yin/dp/2913967000/']],
2: 		[null, 1, null, null,  ['http://www.amazon.fr/livre-du-dieu-vivant/dp/B0000DM24W/', 'http://www.amazon.fr/livre-du-Dieu-vivant/dp/2913967027/']],
3: 		['[03-FR].Bo.Yin.Ra.-.Le.Livre.De.Lau.Dela.pdf', 1, null, null,  ['http://www.amazon.fr/livre-lau-del%C3%A0-Bo-Yin-Ra/dp/2853270114/', 'http://www.amazon.fr/livre-lau-del%C3%A0-editions-balance-villemonble/dp/B0000DPMAF/']],
4: 		[null, 1, null, null,  ['http://www.amazon.fr/Livre-lhomme-Bo-Yin-Ra/dp/285327022X/', 'http://www.amazon.fr/livre-lhomme-Bo-Yin-Ra/dp/B0000DM2ZZ/']],
5: 		[null, 1, null, null,  ['http://www.amazon.fr/livre-du-bonheur-Bo-Yin/dp/B0000DOLP8/', 'http://www.amazon.fr/livre-du-bonheur-Bo-Yin/dp/B0000DONYT/', 'http://www.amazon.fr/livre-du-bonheur-Bo-Yin/dp/2913967280/']],
12: 	[null, 1, null, null,  ['http://www.amazon.fr/Jalons-Bo-Yin-Ra/dp/B0000DM25F/', 'http://www.amazon.fr/Jalons-Bo-Yin-Ra/dp/2913967116/']],
13: 	[null, 1, null, null,   'http://www.amazon.fr/fant%C3%B4me-liberte-Bo-Yin-Ra/dp/2913967213/'],
15: 	[null, 1, null, null,   'http://www.amazon.fr/mystere-golgotha-Bo-Yin-Ra/dp/2853270017/'],
16: 	[null, 1, null, null,   'http://www.amazon.fr/Magie-du-culte-mythe-Yin/dp/2913967175/'],
17: 	[null, 1, null, null,  ['http://www.amazon.fr/sens-vie-terrestre-Bo-Yin/dp/B0000DONX8/', 'http://www.amazon.fr/sens-vie-terrestre-Bo-Yin/dp/2853270300/']],
20: 	[null, 1, null, null,  ['http://www.amazon.fr/R%C3%A9surrection-Bo-Yin-Ra/dp/B0000DOAKE/', 'http://www.amazon.fr/R%C3%A9surrection-Bo-Yin-Ra/dp/2853270319/']],
23: 	[null, 1, null, null,  ['http://www.amazon.fr/Mariage-Bo-Yin-Ra/dp/2853270270/', 'http://www.amazon.fr/mariage-Bo-Yin-Ra/dp/2913967140/']],
25: 	[null, 1, null, null,   'http://www.amazon.fr/Esprit-forme-Bo-Yin-Ra/dp/285327005X/'],
27: 	[null, 1, null, null,  ['http://www.amazon.fr/Paroles-vie-Bo-Yin-Ra/dp/B0000DONY5/', 'http://www.amazon.fr/Paroles-vie-Bo-Yin-Ra/dp/2853270343/']] /*T*/
}],

['German',  ' (42)', ['DE', 'The e-book in German is available. Click to download', 'Click to purchase this book in German'],
{
1: 		['[01-DE].Bo.Yin.Ra.-.Das.Buch.der.koeniglichen.Kunst.pdf',	2,  '01-DE.jpg',   null, 'http://www.amazon.de/Das-Buch-k%C3%B6niglichen-Kunst-Yin/dp/385767007X/'],
2: 		['[02-DE].Bo.Yin.Ra.-.Das.Buch.vom.Lebendigen.Gott.pdf', 	2,  '02-DE.jpg',   null,['http://www.amazon.de/Das-Buch-vom-lebendigen-Gott/dp/3857670738/', 'http://www.amazon.de/Das-Buch-vom-lebendigen-Gott/dp/385767072X/']],
3: 		['[03-DE].Bo.Yin.Ra.-.Das.Buch.vom.Jenseits.pdf', 			2,  '03-DE.jpg',   null, 'http://www.amazon.de/Das-Buch-vom-Jenseits-Yin/dp/3857670991/'],
4: 		['[04-DE].Bo.Yin.Ra.-.Das.Buch.vom.Menschen.pdf', 			2,  '04-DE.jpg',   null, 'http://www.amazon.de/Das-Buch-vom-Menschen-Yin/dp/3857670134/'],
5: 		['[05-DE].Bo.Yin.Ra.-.Das.Buch.vom.Glueck.pdf', 			2,  '05-DE.jpg',   null, 'http://www.amazon.de/Das-Buch-vom-Gl%C3%BCck-Yin/dp/3857670681/'],
6: 		['[06-DE].Bo.Yin.Ra.-.Der.Weg.zu.Gott.pdf', 				null, null, 	   null, null],
7: 		['[07-DE].Bo.Yin.Ra.-.Das.Buch.der.Liebe.pdf', 				2,  '07-DE.jpg',   null, 'http://www.amazon.de/Das-Buch-Liebe-Bo-Yin/dp/3857670088/'],
8: 		['[08-DE].Bo.Yin.Ra.-.Das.Buch.des.Trostes.pdf', 			null, null, 	   null, null],
9: 		['[09-DE].Bo.Yin.Ra.-.Das.Buch.der.Gespraeche.pdf', 		2,    null,		   null, 'http://www.amazon.de/Das-Buch-Gespr%C3%A4che-B%C3%B4-Yin/dp/B0000BGRA5/'],
10: 	['[10-DE].Bo.Yin.Ra.-.Das.Geheimnis.pdf', 					2,  '10-DE.jpg',   null, 'http://www.amazon.de/Das-Geheimnis-Bo-Yin-Ra/dp/386059561X/'],
11: 	['[11-DE].Bo.Yin.Ra.-.Die.Weisheit.des.Johannes.pdf', 		null, null, 	   null, null],
12: 	['[12-DE].Bo.Yin.Ra.-.Wegweiser.pdf', 						null, null, 	   null, null],
13: 	['[13-DE].Bo.Yin.Ra.-.Das.Gespenst.der.Freiheit.pdf', 		2,  '13-DE.jpg',   null, 'http://www.amazon.de/Das-Gespenst-Freiheit-B%C3%B4-Yin/dp/3857670231/'],
14: 	['[14-DE].Bo.Yin.Ra.-.Der.Weg.meiner.Schueler.pdf', 		2,  '14-DE.jpg',   null, 'http://www.amazon.de/Weg-meiner-Sch%C3%BCler-B%C3%B4-Yin/dp/3857670509/'],
15: 	['[15-DE].Bo.Yin.Ra.-.Das.Mysterium.von.Golgatha.pdf', 		2,    null,		   null, 'http://www.amazon.de/Das-Mysterium-von-Golgatha-Yin/dp/B0000BGRAF/'],
16: 	['[16-DE].Bo.Yin.Ra.-.Kultmagie.und.Mythos.pdf', 			2,    null,		   null, 'http://www.amazon.de/Kultmagie-Mythos-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAE/'],
17: 	['[17-DE].Bo.Yin.Ra.-.Der.Sinn.des.Daseins.pdf', 			2,    null,		   null, 'http://www.amazon.de/Sinn-Daseins-B%C3%B4-Yin-R%C3%A2/dp/3857670711/'],
18: 	['[18-DE].Bo.Yin.Ra.-.Mehr.Licht.pdf', 						2,  '18-DE.jpg',   null, 'http://www.amazon.de/Mehr-Licht-B%C3%B4-Yin-R%C3%A2/dp/3857670363/'],
19: 	['[19-DE].Bo.Yin.Ra.-.Das.Hohe.Ziel.pdf', 					2,  '19-DE.jpg',   null, 'http://www.amazon.de/Das-hohe-Ziel-B%C3%B4-Yin/dp/3857670258/'],
20: 	['[20-DE].Bo.Yin.Ra.-.Auferstehung.pdf', 					null, null, 	   null, null],
21: 	['[21-DE].Bo.Yin.Ra.-.Welten.pdf', 							2,    null,   	   null, 'http://www.amazon.de/Welten-B%C3%B4-Yin-R%C3%A2/dp/3857670886/'],
22: 	['[22-DE].Bo.Yin.Ra.-.Psalmen.pdf', 						null, null, 	   null, null],
23: 	['[23-DE].Bo.Yin.Ra.-.Die.Ehe.pdf', 						2,  '23-DE.jpg',   null, 'http://www.amazon.de/Die-Ehe-Bo-Yin-Ra/dp/3857671009/'],
24: 	['[24-DE].Bo.Yin.Ra.-.Das.Gebet.pdf', 						2,    null,		   null, 'http://www.amazon.de/Das-Gebet-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAB/'],
25: 	['[25-DE].Bo.Yin.Ra.-.Geist.und.Form.pdf', 					null, null, 	   null, null],
26: 	['[26-DE].Bo.Yin.Ra.-.Funken.Mantra.Praxis.pdf', 			null, null,        null, null],
27: 	['[27-DE].Bo.Yin.Ra.-.Worte.des.Lebens.pdf', 				2,    null,		   null, 'http://www.amazon.de/Worte-Lebens-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAL/'],
28: 	['[28-DE].Bo.Yin.Ra.-.Ueber.dem.Alltag.pdf', 				null, null, 	   null, null],
29: 	['[29-DE].Bo.Yin.Ra.-.Ewige.Wirklichkeit.pdf', 				null, null, 	   null, null],
30: 	['[30-DE].Bo.Yin.Ra.-.Leben.im.Licht.pdf', 					null, null, 	   null, null],
31: 	['[31-DE].Bo.Yin.Ra.-.Briefe.an.Einen.und.Viele.pdf', 		null, null, 	   null, null],
32: 	['[32-DE].Bo.Yin.Ra.-.Hortus.Conclusus.pdf', 				null, null, 	   null, null],
1923:  	['[1923-DE].Bo.Yin.Ra.-.Okkulte.Raetsel.pdf', 				2,    null,		   null,['http://www.amazon.de/Okkulte-R%C3%A4tsel-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAG/', 'http://www.amazon.de/Okkulte-R%C3%A4tsel-B%C3%B4-Yin-R%C3%A2/dp/3857670932/']],
1932: 	['[1932-DE].Bo.Yin.Ra.-.Das.Reich.der.Kunst.pdf', 			null, null, 	   null, null],
1933:  	['[1933-DE].Bo.Yin.Ra.-.Aus.meiner.Malerwerkstatt', 		2,    null,		   null, 'http://www.amazon.de/Das-Reich-Kunst-B%C3%B4-Yin/dp/3857670436/'],
1937: 	['[1937-DE].Bo.Yin.Ra.-.Kodizill.zu.meinem.geistigen.Lehrwerk.pdf',null,null,  null, null],
1938:  	['[1938-DE].Bo.Yin.Ra.-.Marginalien.pdf', 							2,  null,  null, 'http://www.amazon.de/Marginalien-B%C3%B4-Yin-R%C3%A2/dp/3857670355/'],
1939: 	['[1939-DE].Bo.Yin.Ra.-.Ueber.die.Gottlosigkeit.pdf', 		null, null, null,  null],
19391:	['[19391-DE].Bo.Yin.Ra.-.Geistige.Relationen.pdf', 			null, null, null,  null],
19392:	['[19392-DE].Bo.Yin.Ra.-.Mancherlei.pdf', 					null, null, null,  null],
1990:	['[1990-DE].Bo.Yin.Ra.-.Nachlese.I.pdf', 					null, null, null,  null],
19901: 	['[19901-DE].Bo.Yin.Ra.-.Nachlese.II.pdf', 					null, null, null,  null] /*T*/
}],

['Polish',  ' (1)', ['PO', 'The e-book in Polish is available. Click to download', 'Click to purchase this book in Polish'],
{
1: 		['[01-PO].Bo.Yin.Ra.-.Ksiega.sztuki.krolewskiej.pdf', 		null, null, null,  null] /*T*/
}] /*T*/

];

function initWj(mode, ix_lang) {
	// get all lists obj on page 
	var arrLists = document.getElementsByTagName('select');
	// iterate to populate language lists
	for (var i=0; i<arrLists.length; i++)
		if (arrLists[i].getAttribute('id').toLowerCase().indexOf('wj_')==0) {
			var ix_book = arrLists[i].getAttribute('id').split('wj_')[1];
			if (mode==null) {		// build
				 arrLists[i].options[0].value = 0; //chooser-text must be 0
				_buildLangs(arrLists[i], ix_book, ix_lang);
  				_imgsPreloader(); 	// preload buy buttons
			}else { 	  			// set
				for (var j=0; j<arrLists[i].options.length; j++)
					if (arrLists[i].options[j].value   == ix_lang) {
						arrLists[i].options[j].selected = true;
						arrLists[i].disabled = false;
						break;
					}	else arrLists[i].options[0].selected = true; //chooser-text default
			}	
			// set subparts
			if (ix_book!='0') setWj(ix_book, ix_lang);
		}	
}

function setWj(ix_book, ix_lang) {
	// update widget subparts
	_setReadButton 	  (document.getElementById("wj.pdf_"+ix_book), ix_book, ix_lang);
	_buildStoreButtons(document.getElementById("wj.buy_"+ix_book), ix_book, ix_lang);		
	_setCovers		  (document.getElementById("wj.cov_"+ix_book), ix_book, ix_lang);	
	_setInfo		  (document.getElementById("wj.nfo_"+ix_book), ix_book, ix_lang);	
}	

function nfoWj(ix_book) {
	var nfo   = document.getElementById("wj.nfo_"+ix_book);
	var cov   = document.getElementById("wj.cov_"+ix_book);
	// extract current language code from hacked CSS
	var lang  = nfo.attributes['class'].value.split(' ')[1];
	var title = cov.attributes['title'].value;
	// jquery thickbox integration
	tb_show(title,'/books.notes.asp?n='+ix_book+'|'+lang+'&KeepThis=true&TB_iframe=true&height=400&width=600');
}

function extWj(title, url) {
	var p
	if (url.indexOf('?') != -1) p='&'; else p='?';
	// jquery thickbox integration
	tb_show(title,url+p+'KeepThis=true&TB_iframe=true&height=400&width=620');
}


/*** private ***/

// images preloader
function _imgsPreloader() {
	for (var i=0; i<imgs.length; i++) {
		var objImage = new Image();
		objImage.src = VPATH_IMG+imgs[i];
	}
}


function _buildLangs(obj, ix_book, ix_lang) {
	// add languages to the list, but only if there's e-book/links for this item
	for (var i=1; i<books.length; i++) {
		if ((eval('books[i][IX_ITEMS][ix_book]')  != undefined 		/* book exists    */
		&& 		  (books[i][IX_ITEMS][ix_book][0] != null 	 		/* <pdf filename> */
		||  	   books[i][IX_ITEMS][ix_book][4] != null))			/* <store URL>    */
		||							 (ix_book      == 0))  			/* bypass checks for book selector */
		{   
			obj.options[obj.options.length] = new Option((ix_book==0)?(books[i][0]+books[i][1]):books[i][0], i, false, (ix_lang==i)?true:false);
		}	
	}
	obj.parentNode.attributes['class'].value = 'wje'; 				// enable <span> text 
	obj.disabled = false; 
}	

function _setReadButton(obj, ix_book, ix_lang) {
	obj.parentNode.attributes['class'].value = 'wj';
	obj.disabled = true;
	obj.attributes['class'].value = 'wj';  // IE
	obj.attributes['title'].value = 'N/A'; // IE
	if (eval('books[ix_lang][IX_ITEMS][ix_book]')  != undefined 	/* book exists    */
	&& 		  books[ix_lang][IX_ITEMS][ix_book][0] != null) {  		/* <pdf filename> */
		obj.onclick	= function() {window.open(VPATH_DL+books[ix_lang][IX_ITEMS][ix_book][0],'pdfBook','width=400,height=200,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')};
		obj.attributes['title'].value = books[ix_lang][IX_LOCALE][1]; 
		obj.attributes['class'].value = 'wje';
		obj.disabled = false;
		obj.parentNode.attributes['class'].value = 'wje';
	}
}

function _buildStoreButtons(obj, ix_book, ix_lang) {
	obj.parentNode.attributes['class'].value = 'wj';
	var storeFound = false;
	obj.innerHTML  = '';
	if (eval ('books[ix_lang][IX_ITEMS][ix_book]')  != undefined 	/* book exists */
	&&		   books[ix_lang][IX_ITEMS][ix_book][1] != null	    	/* <icon id>   */
	&&    	   books[ix_lang][IX_ITEMS][ix_book][4] != null) {  	/* <store URL> */
		var storeUrl = 
	  toArray_(books[ix_lang][IX_ITEMS][ix_book][4]);			
		for (j=0; j<storeUrl.length; j++) {    						// multiple store links supported
				// add target param only to non-js links
				var ptarget=''; if (storeUrl[j].toLowerCase().indexOf('javascript:')!=0) ptarget='target="_blank"';
				var buyButton = '<a href=\''	+storeUrl[j]+'\''+ptarget+'>'
					  	  	  + '<img class=wj alt="" title="' +books[ix_lang][IX_LOCALE][2]+ '"'
					  	  	  + ' src="'+VPATH_IMG+imgs[books[ix_lang][IX_ITEMS][ix_book][1]]+ '">'
					  	  	  + '</a>';
				// display of multiple store links per book
				if (obj.innerHTML != '') buyButton  = '<br />' + buyButton;
	 			obj.innerHTML += buyButton;
				storeFound     = true;
		}	
	}
	// if no store found displays grayed button
	if (!storeFound) obj.innerHTML = '<img border="0" alt="" title="N/A" src="'+VPATH_IMG+'buy_disabled.gif" />\n';
	else obj.parentNode.attributes['class'].value = 'wje';
}

function _setCovers(obj, ix_book, ix_lang) {
	obj.attributes['class'].value = 'wjcov';
	obj.src = VPATH_IMG+'nobook.gif';
	if (eval('books[ix_lang][IX_ITEMS][ix_book]')  != undefined 	/* book exists    */
	&& 		  books[ix_lang][IX_ITEMS][ix_book][2] != null) {  		/* <cover filename> */
		obj.src = VPATH_IMG+
			  books[ix_lang][IX_ITEMS][ix_book][2];
		obj.attributes['class'].value = 'wjcove';
	}
}

function _setInfo(obj, ix_book, ix_lang) {
	obj.attributes['class'].value = 'wjnfo';
	if (eval('books[ix_lang][IX_ITEMS][ix_book]')  != undefined 	/* book exists */
	&& 		  books[ix_lang][IX_ITEMS][ix_book][3] != null) {  		/* <more info> */
		// hack to store current language code as a CSS style
		obj.attributes['class'].value = 'wjnfoe '+books[ix_lang][IX_LOCALE][0];  
	}
}


// convert string to single item array
function toArray_(obj) {
	if  (obj.constructor.toString().indexOf("Array") == -1) return new Array(obj);
	else return obj;
}

/*** Books Widget END ***/
