

/************************************************************************ 
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', 'kobo_buy_en.gif', 'amazon_kindle_buy_en.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>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
1: 		['01-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
2: 		['02-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
3: 		['03-BG.jpg',    '[03-BG].Bo.Yin.Ra.-.Kniga.za.otvadnia.sviat.pdf',  	true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
4: 		['04-BG.jpg',    '[04-BG].Bo.Yin.Ra.-.Kniga.za.choveka.pdf', 			true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
5: 		['05-BG.jpg',    '[05-BG].Bo.Yin.Ra.-.Kniga.za.shtastieto.pdf', 		true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
6: 		['06-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
7: 		['07-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
8: 		['08-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
9: 		['09-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
10:		['10-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
11:		['11-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
12:		['12-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
13:		['13-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
14:		['14-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
15: 	['15-BG.jpg',    '[15-BG].Bo.Yin.Ra.-.Misteriata.na.Golgota.pdf', 		true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
16:		['16-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
17:		['17-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
18:		['18-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
19:		['19-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
20:		['20-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
21:		['21-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
22:		['22-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
23:		['23-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
24:		['24-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
25:		['25-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
26:		['26-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
27:		['27-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
28:		['28-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
29:		['29-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
30:		['30-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
31:		['31-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
32:		['32-BG.jpg',    null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1923:	['1923-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1927:	['1927-BG.jpg',  null, 													true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
19271:	['19271-BG.jpg', null, 													true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1930:	['1930-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
19301:	['19301-BG.jpg', null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1932:	['1932-BG.jpg',  null, 													true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
19321:	['19321-BG.jpg', '[19321-BG].Bo.Yin.Ra.-.Za.moite.knigi.pdf',			true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1933:	['1933-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1935:	['1935-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1937:	['1937-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1938:	['1938-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1939:	['1939-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
19391:	['19391-BG.jpg', null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
19392:	['19392-BG.jpg', null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1954:	['1954-BG.jpg',  null,  												true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1965:	['1965-BG.jpg',  '[1965-BG].Rudolf.Schott.-.Maksimi.pdf', 				true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1990:	['1990-BG.jpg',  null, 													true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
19901:	['19901-BG.jpg', null, 													true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']], 
1994:	['1994-BG.jpg',  null, 													true, [3, 'javascript:extWj("За поръчки", "/bg/sellers/")']],
1999:	['1999-BG.jpg',  null, 													true, [3, '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'],
{
/* <book id>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
2:	[null, '[02-NL].Bo.Yin.Ra.-.Het.Boek.Van.De.Levende.God.pdf',	null, null],
3:	[null, '[03-NL].Bo.Yin.Ra.-.Het.Boek.Van.Gene.Zijde.pdf',		null, null],
24:	[null, '[24-NL].Bo.Yin.Ra.-.Het.Gebet.pdf', 					null, null] /*T*/
}],

['English', ' (1)', ['EN', 'The e-book in English is available. Click to download', 'Click to purchase this book in English'],
{
/* <book id>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
1: 		['01-EN.jpg',   null, null, [0, 'http://www.amazon.com/Book-Royal-Art-Bo-Yin/dp/0915034131/',
									 5, 'http://www.amazon.com/Book-Royal-Art-ebook/dp/B006NYYZ3K/',
									 4, 'https://secure.kobobooks.com/auth?id=FmdIr70XukmAUf8mTi0CQQ&ctype=5&LoginType=3']],
2: 		['02-EN.jpg', '[02-EN].Bo.Yin.Ra.-.The.Book.On.The.Living.God.pdf', null, 
									[0, 'http://www.amazon.com/Book-Living-God-Bo-Yin/dp/0915034034/',
									 5, 'http://www.amazon.com/Book-Living-God-ebook/dp/B005VMD4SC/']],
3: 		['03-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Book-Life-Beyond-Bo-Yin/dp/0915034115/',
									 5, 'http://www.amazon.com/Book-Life-Beyond-ebook/dp/B006RENAS2/']],
4: 		['04-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Book-Human-Nature-Bo-Yin/dp/0915034077/',
									 5, 'http://www.amazon.com/Book-Human-Nature-ebook/dp/B0069ZOB28/']],
5: 		['05-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Bo-Yin-Ra-Book-Happiness/dp/B000KPHRK6/',
									 5, 'http://www.amazon.com/The-Book-On-Happiness-ebook/dp/B0070TFWNY/']],
6: 		['06-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Path-God-Bo-Yin-Ra/dp/0915034158/',
									 5, 'http://www.amazon.com/The-Path-To-God-ebook/dp/B006KE2YRC/',
									 4, 'https://secure.kobobooks.com/auth?id=UKNFlVWVbUKfwRCgJ6FRjg&ctype=5&LoginType=3']],
7: 		['07-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Book-Love-Bo-Yin-Ra/dp/0915034123/',
									 5, 'http://www.amazon.com/THE-BOOK-ON-LOVE-ebook/dp/B004TAWUZK',
									 4, 'https://secure.kobobooks.com/auth?id=SQknsfAuq0aIDKNSlriDDQ&ctype=5&LoginType=3']],
8: 		['08-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Book-Solace-B-Reichenbach/dp/0915034050/',
									 5, 'http://www.amazon.com/The-Book-On-Solace-ebook/dp/B0071R3LR4/']],
9: 		['09-EN.jpg', 	null, null, [0, 'http://www.amazon.com/dp/091503414X/',
									 5, 'http://www.amazon.com/The-Book-Of-Dialogues-ebook/dp/B0070SZC1W/',
									 4, 'https://secure.kobobooks.com/auth?id=TReZ5Wln3EGAKTpkMhSt9g&ctype=5&LoginType=3']],
11: 	['11-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Wisdom-St-John-Bo-Yin/dp/0915034018/',
									 5, 'http://www.amazon.com/Wisdom-St-John-ebook/dp/B006Y4Z1WS/']],
15: 	['15-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Mystery-Golgotha-Bô-Yin-Râ/dp/0915034182/',
									 5,	'http://www.amazon.com/The-Mystery-Of-Golgotha-ebook/dp/B006UZHM50/']],
17: 	['17-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Meaning-This-Life-Bo-Yin/dp/0915034069/',
									 5, 'http://www.amazon.com/Meaning-This-Life-ebook/dp/B0071IJ7RQ/']],
20: 	['20-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Resurrection-Bo-Yin-Ra/dp/0915034166/',
									 5, 'http://www.amazon.com/Resurrection-ebook/dp/B006Z1PQB6/',
									 4, 'https://secure.kobobooks.com/auth?id=e3CdEH1pNEa2t4C_8l9vBw&ctype=5&LoginType=3']],
21: 	['21-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Worlds-Spirit-Bo-Yin-Ra/dp/0915034093/',
									 5, 'http://www.amazon.com/WORLDS-OF-SPIRIT-ebook/dp/B0058OWUW4/']],
24: 	['24-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Prayer-Bo-Yin-Ra/dp/0915034174/',
									 5, 'http://www.amazon.com/On-Prayer-ebook/dp/B005KLSCAY/']],
25: 	['25-EN.jpg', 	null, null, [0, 'http://www.amazon.com/Spirit-Form-Bo-Yin-Ra/dp/0915034085/',
									 5, 'http://www.amazon.com/Spirit-And-Form-ebook/dp/B006ZMR7OY/']],
2004:  	['2004-EN.jpg', null, null, [0, 'http://www.amazon.com/Bo-Yin-Ra-Introduction-Works/dp/0915034107/', 
									 0, 'http://www.amazon.com/About-Books-Concerning-Other-Texts/dp/091503400X/',
									 5, 'http://www.amazon.com/B%C3%B4-Yin-R%C3%A2-Introduction-ebook/dp/B006PPFIOC/']] /*T*/
}],

['Esperanto', ' (15)', ['EO', 'The e-book in Esperanto is available. Click to download', 'Click to purchase this book in Esperanto'],
{
/* <book id>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
1: 		[null, '[01-EO].Bo.Yin.Ra.-.La.Libro.de.la.Reg.a.Arto.pdf', 	null, null],
2: 		[null, '[02-EO].Bo.Yin.Ra.-.La.libro.pri.la.vivanta.Dio.pdf', 	null, null],
3: 		[null, '[03-EO].Bo.Yin.Ra.-.Transa.Mondo.pdf', 					null, null],
4: 		[null, '[04-EO].Bo.Yin.Ra.-.La.Libro.pri.la.Homo.pdf', 			null, null],
5: 		[null, '[05-EO].Bo.Yin.Ra.-.La.Libro.pri.la.Felico.pdf', 		null, null],
6: 		[null, '[06-EO].Bo.Yin.Ra.-.La.Vojo.al.Dio.pdf', 				null, null],
7: 		[null, '[07-EO].Bo.Yin.Ra.-.La.Libro.de.la.Amo.pdf', 			null, null],
9: 		[null, '[09-EO].Bo.Yin.Ra.-.La.Libro.de.Interparoloj.pdf', 		null, null],
10: 	[null, '[10-EO].Bo.Yin.Ra.-.La.sekreto.pdf',  					null, null],
15: 	[null, '[15-EO].Bo.Yin.Ra.-.Mistero.de.Golgota.pdf', 			null, null],
17: 	[null, '[17-EO].Bo.Yin.Ra.-.La.Senco.de.la.Vivo.pdf', 			null, null],
19: 	[null, '[19-EO].Bo.Yin.Ra.-.La.Alta.Celo.pdf', 					null, null],
20: 	[null, '[20-EO].Bo.Yin.Ra.-.Relevigo.pdf', 						null, null],
21: 	[null, '[21-EO].Bo.Yin.Ra.-.Mondoj.pdf', 						null, null],
27: 	[null, '[27-EO].Bo.Yin.Ra.-.Vortoj.De.Vivo.pdf', 				null, null] /*T*/
}],

['French',  ' (1)', ['FR', 'The e-book in French is available. Click to download', 'Click to purchase this book in French'],
{
/* <book id>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
1: 		[null, null, null, [1, 'http://www.amazon.fr/livre-lart-royal-Yin-Ra/dp/B0000DMAF9/', 		
							1, 'http://www.amazon.fr/livre-lart-royal-Bo-Yin/dp/2913967000/']],
2: 		[null, null, null, [1, 'http://www.amazon.fr/livre-du-dieu-vivant/dp/B0000DM24W/', 			
							1, 'http://www.amazon.fr/livre-du-Dieu-vivant/dp/2913967027/']],
3: 		[null, '[03-FR].Bo.Yin.Ra.-.Le.Livre.De.Lau.Dela.pdf', null,
						   [1, 'http://www.amazon.fr/livre-lau-del%C3%A0-Bo-Yin-Ra/dp/2853270114/', 
							1, 'http://www.amazon.fr/livre-lau-del%C3%A0-editions-balance-villemonble/dp/B0000DPMAF/']],
4: 		[null, null, null, [1, 'http://www.amazon.fr/Livre-lhomme-Bo-Yin-Ra/dp/285327022X/', 		
							1, 'http://www.amazon.fr/livre-lhomme-Bo-Yin-Ra/dp/B0000DM2ZZ/']],
5: 		[null, null, null, [1, 'http://www.amazon.fr/livre-du-bonheur-Bo-Yin/dp/B0000DOLP8/', 		
							1, 'http://www.amazon.fr/livre-du-bonheur-Bo-Yin/dp/B0000DONYT/', 
							1, 'http://www.amazon.fr/livre-du-bonheur-Bo-Yin/dp/2913967280/']],
12: 	[null, null, null, [1, 'http://www.amazon.fr/Jalons-Bo-Yin-Ra/dp/B0000DM25F/', 				
							1, 'http://www.amazon.fr/Jalons-Bo-Yin-Ra/dp/2913967116/']],
13: 	[null, null, null, [1, 'http://www.amazon.fr/fant%C3%B4me-liberte-Bo-Yin-Ra/dp/2913967213/']],
15: 	[null, null, null, [1, 'http://www.amazon.fr/mystere-golgotha-Bo-Yin-Ra/dp/2853270017/']],
16: 	[null, null, null, [1, 'http://www.amazon.fr/Magie-du-culte-mythe-Yin/dp/2913967175/']],
17: 	[null, null, null, [1, 'http://www.amazon.fr/sens-vie-terrestre-Bo-Yin/dp/B0000DONX8/', 	
							1, 'http://www.amazon.fr/sens-vie-terrestre-Bo-Yin/dp/2853270300/']],
20: 	[null, null, null, [1, 'http://www.amazon.fr/R%C3%A9surrection-Bo-Yin-Ra/dp/B0000DOAKE/', 	
							1, 'http://www.amazon.fr/R%C3%A9surrection-Bo-Yin-Ra/dp/2853270319/']],
23: 	[null, null, null, [1, 'http://www.amazon.fr/Mariage-Bo-Yin-Ra/dp/2853270270/', 			
							1, 'http://www.amazon.fr/mariage-Bo-Yin-Ra/dp/2913967140/']],
25: 	[null, null, null, [1, 'http://www.amazon.fr/Esprit-forme-Bo-Yin-Ra/dp/285327005X/']],
27: 	[null, null, null, [1, 'http://www.amazon.fr/Paroles-vie-Bo-Yin-Ra/dp/B0000DONY5/', 		
							1, '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'],
{
/* <book id>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
1: 		['01-DE.jpg',  	'[01-DE].Bo.Yin.Ra.-.Das.Buch.der.koeniglichen.Kunst.pdf',			null, [2, 'http://www.amazon.de/Das-Buch-k%C3%B6niglichen-Kunst-Yin/dp/385767007X/']],
2: 		['02-DE.jpg',  	'[02-DE].Bo.Yin.Ra.-.Das.Buch.vom.Lebendigen.Gott.pdf', 			null, [2, 'http://www.amazon.de/Das-Buch-vom-lebendigen-Gott/dp/3857670738/', 
																								   2, 'http://www.amazon.de/Das-Buch-vom-lebendigen-Gott/dp/385767072X/']],
3: 		['03-DE.jpg',  	'[03-DE].Bo.Yin.Ra.-.Das.Buch.vom.Jenseits.pdf', 						  [2, 'http://www.amazon.de/Das-Buch-vom-Jenseits-Yin/dp/3857670991/']],
4: 		['04-DE.jpg',  	'[04-DE].Bo.Yin.Ra.-.Das.Buch.vom.Menschen.pdf', 					null, [2, 'http://www.amazon.de/Das-Buch-vom-Menschen-Yin/dp/3857670134/']],
5: 		['05-DE.jpg',  	'[05-DE].Bo.Yin.Ra.-.Das.Buch.vom.Glueck.pdf', 						null, [2, 'http://www.amazon.de/Das-Buch-vom-Gl%C3%BCck-Yin/dp/3857670681/']],
6: 		[null, 	   	  	'[06-DE].Bo.Yin.Ra.-.Der.Weg.zu.Gott.pdf', 							null, null],
7: 		['07-DE.jpg',  	'[07-DE].Bo.Yin.Ra.-.Das.Buch.der.Liebe.pdf', 						null, [2, 'http://www.amazon.de/Das-Buch-Liebe-Bo-Yin/dp/3857670088/']],
8: 		[null, 	   	   	'[08-DE].Bo.Yin.Ra.-.Das.Buch.des.Trostes.pdf', 					null, null],
9: 		[null,		   	'[09-DE].Bo.Yin.Ra.-.Das.Buch.der.Gespraeche.pdf', 					null, [2, 'http://www.amazon.de/Das-Buch-Gespr%C3%A4che-B%C3%B4-Yin/dp/B0000BGRA5/']],
10: 	['10-DE.jpg',  	'[10-DE].Bo.Yin.Ra.-.Das.Geheimnis.pdf', 							null, [2, 'http://www.amazon.de/Das-Geheimnis-Bo-Yin-Ra/dp/386059561X/']],
11: 	[null, 	   		'[11-DE].Bo.Yin.Ra.-.Die.Weisheit.des.Johannes.pdf', 				null, null],
12: 	[null, 	   		'[12-DE].Bo.Yin.Ra.-.Wegweiser.pdf', 								null, null],
13: 	['13-DE.jpg',  	'[13-DE].Bo.Yin.Ra.-.Das.Gespenst.der.Freiheit.pdf', 				null, [2, 'http://www.amazon.de/Das-Gespenst-Freiheit-B%C3%B4-Yin/dp/3857670231/']],
14: 	['14-DE.jpg',  	'[14-DE].Bo.Yin.Ra.-.Der.Weg.meiner.Schueler.pdf', 					null, [2, 'http://www.amazon.de/Weg-meiner-Sch%C3%BCler-B%C3%B4-Yin/dp/3857670509/']],
15: 	[null,		   	'[15-DE].Bo.Yin.Ra.-.Das.Mysterium.von.Golgatha.pdf', 				null, [2, 'http://www.amazon.de/Das-Mysterium-von-Golgatha-Yin/dp/B0000BGRAF/']],
16: 	[null,		   	'[16-DE].Bo.Yin.Ra.-.Kultmagie.und.Mythos.pdf', 					null, [2, 'http://www.amazon.de/Kultmagie-Mythos-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAE/']],
17: 	[null,		   	'[17-DE].Bo.Yin.Ra.-.Der.Sinn.des.Daseins.pdf', 					null, [2, 'http://www.amazon.de/Sinn-Daseins-B%C3%B4-Yin-R%C3%A2/dp/3857670711/']],
18: 	['18-DE.jpg',  	'[18-DE].Bo.Yin.Ra.-.Mehr.Licht.pdf', 								null, [2, 'http://www.amazon.de/Mehr-Licht-B%C3%B4-Yin-R%C3%A2/dp/3857670363/']],
19: 	['19-DE.jpg',  	'[19-DE].Bo.Yin.Ra.-.Das.Hohe.Ziel.pdf', 							null, [2, 'http://www.amazon.de/Das-hohe-Ziel-B%C3%B4-Yin/dp/3857670258/']],
20: 	[null, 	   		'[20-DE].Bo.Yin.Ra.-.Auferstehung.pdf', 							null, null],
21: 	[null,   	   	'[21-DE].Bo.Yin.Ra.-.Welten.pdf', 									null, [2, 'http://www.amazon.de/Welten-B%C3%B4-Yin-R%C3%A2/dp/3857670886/']],
22: 	[null, 	   		'[22-DE].Bo.Yin.Ra.-.Psalmen.pdf', 									null, null],
23: 	['23-DE.jpg',  	'[23-DE].Bo.Yin.Ra.-.Die.Ehe.pdf', 									null, [2, 'http://www.amazon.de/Die-Ehe-Bo-Yin-Ra/dp/3857671009/']],
24: 	[null,		   	'[24-DE].Bo.Yin.Ra.-.Das.Gebet.pdf', 								null, [2, 'http://www.amazon.de/Das-Gebet-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAB/']],
25: 	[null, 	   		'[25-DE].Bo.Yin.Ra.-.Geist.und.Form.pdf', 							null, null],
26: 	[null,        	'[26-DE].Bo.Yin.Ra.-.Funken.Mantra.Praxis.pdf', 					null, null],
27: 	[null,		   	'[27-DE].Bo.Yin.Ra.-.Worte.des.Lebens.pdf', 						null, [2, 'http://www.amazon.de/Worte-Lebens-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAL/']],
28: 	[null, 	   		'[28-DE].Bo.Yin.Ra.-.Ueber.dem.Alltag.pdf', 						null, null],
29: 	[null, 	   		'[29-DE].Bo.Yin.Ra.-.Ewige.Wirklichkeit.pdf', 						null, null],
30: 	[null, 	   		'[30-DE].Bo.Yin.Ra.-.Leben.im.Licht.pdf', 							null, null],
31: 	[null, 	   		'[31-DE].Bo.Yin.Ra.-.Briefe.an.Einen.und.Viele.pdf', 				null, null],
32: 	[null, 	   		'[32-DE].Bo.Yin.Ra.-.Hortus.Conclusus.pdf', 						null, null],
1923:  	[null,		   	'[1923-DE].Bo.Yin.Ra.-.Okkulte.Raetsel.pdf', 						null, [2, 'http://www.amazon.de/Okkulte-R%C3%A4tsel-B%C3%B4-Yin-R%C3%A2/dp/B0000BGRAG/', 
																								   2, 'http://www.amazon.de/Okkulte-R%C3%A4tsel-B%C3%B4-Yin-R%C3%A2/dp/3857670932/']],
1932: 	[null, 	   		'[1932-DE].Bo.Yin.Ra.-.Das.Reich.der.Kunst.pdf', 					null, null],
1933:  	[null,		   	'[1933-DE].Bo.Yin.Ra.-.Aus.meiner.Malerwerkstatt', 					null, [2, 'http://www.amazon.de/Das-Reich-Kunst-B%C3%B4-Yin/dp/3857670436/']],
1937: 	[null,			'[1937-DE].Bo.Yin.Ra.-.Kodizill.zu.meinem.geistigen.Lehrwerk.pdf',	null, null],
1938:  	[null,  		'[1938-DE].Bo.Yin.Ra.-.Marginalien.pdf', 							null, [2, 'http://www.amazon.de/Marginalien-B%C3%B4-Yin-R%C3%A2/dp/3857670355/']],
1939: 	[null, 			'[1939-DE].Bo.Yin.Ra.-.Ueber.die.Gottlosigkeit.pdf', 				null, null],
19391:	[null, 			'[19391-DE].Bo.Yin.Ra.-.Geistige.Relationen.pdf', 					null, null],
19392:	[null, 			'[19392-DE].Bo.Yin.Ra.-.Mancherlei.pdf', 							null, null],
1990:	[null, 			'[1990-DE].Bo.Yin.Ra.-.Nachlese.I.pdf', 							null, null],
19901: 	[null, 			'[19901-DE].Bo.Yin.Ra.-.Nachlese.II.pdf', 							null, null] /*T*/
}],

['Polish',  ' (1)', ['PO', 'The e-book in Polish is available. Click to download', 'Click to purchase this book in Polish'],
{
/* <book id>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
1: 		[null, '[01-PO].Bo.Yin.Ra.-.Ksiega.sztuki.krolewskiej.pdf', null, null] /*T*/
}],

['Spanish',  ' (3)', ['ES', 'El e-book en español esta accesible. Haga click para bajar', 'Haga click para comprar este libro en español'],
{
/* <book id>: [<cover filename>, <pdf filename>, <more info>, [<icon id>, <store URL>]] */
2:		[null, 			'[02-ES].Bo.Yin.Ra.-.El.Libro.del.Dios.Viviente.pdf', 				null, null],
3:		[null, 			'[03-ES].Bo.Yin.Ra.-.El.Libro.del.Mas.Alla.pdf', 					null, null],
4: 		[null, 			'[04-ES].Bo.Yin.Ra.-.El.Libro.del.Ser.Humano.pdf', 					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.php?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];
	}
}

/* <book id>: <cover filename>, <pdf filename>, <more info>, <icon id>, <store URL> */

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][1] != null 	 		/* <pdf filename> */
		||  	   books[i][IX_ITEMS][ix_book][3] != 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][1] != null) {  		/* <pdf filename> */
		obj.onclick	= function() {window.open(VPATH_DL+books[ix_lang][IX_ITEMS][ix_book][1],'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][3] != null) {  	/* <store URL> */
		var storeUrl = 
		       books[ix_lang][IX_ITEMS][ix_book][3];			
		for (j=0; j<storeUrl.length; j+=2) {    						// multiple store links supported
				// add target param only to non-js links
				var ptarget=''; if (storeUrl[j+1].toLowerCase().indexOf('javascript:')!=0) ptarget='target="_blank"';
				var buyButton = '<a href=\''	+storeUrl[j+1]+'\''+ptarget+'>'
					  	  	  + '<img class=wj alt="" title="' +books[ix_lang][IX_LOCALE][2]+ '"'
					  	  	  + ' src="'+VPATH_IMG+imgs[storeUrl[j]]+ '">'
					  	  	  + '</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][0] != null) {  		/* <cover filename> */
		obj.src = VPATH_IMG+
			  books[ix_lang][IX_ITEMS][ix_book][0];
		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][2] != null) {  		/* <more info> */
		// hack to store current language code as a CSS style
		obj.attributes['class'].value = 'wjnfoe '+books[ix_lang][IX_LOCALE][0];  
	}
}

/*** Books Widget END ***/

