// namespace
toolbox = {
	createinstance:		function(language) {
							return new this.oel(language);
						}
}

// constructor
toolbox.oel = function (language) {
	this.language = language;
}

// prototype
toolbox.oel.prototype = {
	LINK_ADD_2_DOWNLOAD:	"/system/php/service.php",
	
	setPrintIanctive:		function() {
								if (this.language == 'russian') {
									$('#toolbox_print_page').html('<img src="/img/icons/print_page_inactive.gif" width="35" height="35" border="0"><div>Печать страницы</div>');
								} else {
									$('#toolbox_print_page').html('<img src="/img/icons/print_page_inactive.gif" width="35" height="35" border="0"><div>Print <br> this page</div>');
								}
							},
	setPDFInactive:			function() {
								if (this.language == 'russian') {
									$('#toolbox_pdf').html('<img src="/img/icons/see_pdf_inactive.gif" width="35" height="35" border="0"><div>Посмотреть<br>PDF</div>');
								} else {
									$('#toolbox_pdf').html('<img src="/img/icons/see_pdf_inactive.gif" width="35" height="35" border="0"><div>See PDF</div>');
								}	
							},
	
	add2download:			function(documentId, file_name) {
								
								self0 		= this;
								
								$.ajax({
									type: 		"POST",
									url: 		self0.LINK_ADD_2_DOWNLOAD,
									data: 		"_module=downloadlibrary&_action=add&documentId="+documentId+"&file_name="+file_name,
									dataType: 	"text",
									success: 	function(text){
													switch(text) {
														case 'alreadyadded': 
															if (self0.language == 'russian') {
																alert('Файл уже помечен для скачивания');
															} else {
																alert('You already have this file in your Download Library');
															} 
															break;
														case 'notexists':
															if (self0.language == 'russian') {															
																alert('Такого файла нет');
															} else {
																alert('File not exists.');
															}
															break;
														case 'success': 
															if (self0.language == 'russian') {
																alert('Файл помечен для скачивания');
															} else {
																alert('File succesfully added to your Download Library.');
															}
															break;
													}
												}
								});

							}
}
