var menu_category = undefined;
var geo 		  = undefined;
var foreign       = undefined;
var search = undefined;

$(document).ready(function(){
	
	//new book page select change //////////////////////////////////////////////////////
	
	$('#publishers').bind('change', function(){
		publisher = $(this).val();
		$.ajax({
			  cache: false,
			  type: "POST",
			  url: "ajaxian.php",
			  dataType: 'html',
			  data: "publisher="+publisher,
			  success: function(data){
				  $('#new-book-content').html(data);
			  }
		}).done(function(){
			if ($.cookie('black') == null){
				$(this).css('color', 'black');
			} else {
				$(this).css('color', 'white');
			}
		});		
		
	});
	
	
	
	/////////////////////////////////////////////////////////////////////////////////////
	//$('#a').addClass("active");
	if ($.cookie('black') == null) {
		$('#a').attr({src:"/bitrix/templates/HomePage/images/alphabet/a_red.gif"});
	} else {
		$('#a').attr({src:"/bitrix/templates/HomePage/images/alphabet/a_red_black.gif"});
	}
	// alfabeth characters functionality //////////////////////////////////////////////////////////
	$('.character').bind('click', function(){
		
		active_el = $('.active').attr('id');
		if ($.cookie('black') == null) {
		
			$('#'+active_el).attr({src:"/bitrix/templates/HomePage/images/alphabet/" + active_el + ".gif"})
			$('#'+active_el).removeClass('active');
			
			imgid = $(this).attr('id');
			$(this).attr({src:"/bitrix/templates/HomePage/images/alphabet/" + imgid + "_red.gif"});
			$(this).addClass('active');
		} else {

			$('#'+active_el).attr({src:"/bitrix/templates/HomePage/images/alphabet/" + active_el + "_black.gif"})
			$('#'+active_el).removeClass('active');
			
			imgid = $(this).attr('id');
			$(this).attr({src:"/bitrix/templates/HomePage/images/alphabet/" + imgid + "_red_black.gif"});
			$(this).addClass('active');
			
		}
		if (search == undefined) {
			character = $(this).attr('rel');
			href = $('a.active').attr('href');
			category = $.getUrlVar('category');
			
			if (geo == undefined) {
				geo = false;
			}
			
			if (foreign == undefined) {
				foreign = false;
			}
			
			if (foreign == true && geo== true) {
				geo = undefined;
				foreign = undefined;
			}
			
			
	
			 $.ajax({
				//contentType: 'text/html; charset=UTF-8', 
				//async: false,
				//cache: false,
				type: "POST",
				url: 'ajaxian.php',
			    dataType: 'html', 
				data: 'character='+character+"&category="+category+"&foreign="+foreign+"&geo="+geo,
			    success: function(data){
			    	$('#authors').html(data);
			    }
			 }).done(function(){
					if ($.cookie('black') == 'on'){
						//switchVersions(true);
						$('.author_name').css('color', '#ffffff');
					} else {
						$('.author_name').css('color', '#000000');
					}				 
			 });
		}
	/*	$('#authors').ajaxStop(function(){
			if ($.cookie('black') == 'on') {
				$('.author_name').css('color', '#ffffff');
			} else {
				$('.author_name').css('color', '#000000');
			}
		});*/
	});
	////////////////////////////////////////////////////////////////////////////////////////////////
	
	//// book open ////////////////////////////////////////////////////////////////////////////////
	
	$('.ganre-text').click(function(){
			
			id = $(this).attr('id');
			id_len = 5 - id.length;
			for (i=1; i<=id_len; i++) {
				id = '0' + id;
			}
			$.cookie('book', id , { expires: 1 } );
			rel = $(this).attr("rel");
			var params = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no"
			window.open("/mybook/index.php?book="+id+"&rel="+rel, "", params);
		});
	
	
	///////////////////////////////////////////////////////////////////////////////////////////////
	
	// authors page functionality /////////////////////////////////////////////////////////////////
	/*if (authors != undefined && authors){
		category = $.getUrlVar('category');
		
		$.ajax({
			
			 // contentType: 'text/html; charset=UTF-8', 
			  async: false,
			  cache: false,
			  type: "POST",
			  url: "ajaxian.php",
			  dataType: 'html',
			// data: "page=1&character=ა&category="+category,
			  data: "page=1&category="+category,
			  success: function(data){
				  
				  $('#authors').html(data);
			  }
		});

	}*/
	
	$('#all-lable').bind('click', function(){
		if (authors != undefined && authors){
			category = $.getUrlVar('category');
			id = $('.active').attr('id');
			$('.active').attr('src', '/bitrix/templates/HomePage/images/alphabet/'+id+'.gif');
			$('.character').removeClass('active');
			
			if (geo == undefined) {
				geo = false;
			}
			
			if (foreign == undefined) {
				foreign = false;
			}
			
			if (foreign == true && geo== true) {
				geo = undefined;
				foreign = undefined;
			}
			
			
			$.ajax({
				
				 // contentType: 'text/html; charset=UTF-8', 
				  async: false,
				  cache: false,
				  type: "POST",
				  url: "ajaxian.php",
				  dataType: 'html',
				// data: "page=1&character=ა&category="+category,
				  data: "page=1&category="+category+'&foreign ='+foreign+'&geo='+geo,
				  success: function(data){
					  
					  $('#authors').html(data);
				  }
			}).done(function(){
				if ($.cookie('black') == 'on'){
					switchVersions(true);
				} else {
					switchVersions(false);
				}
			});

		}		
	});
	
	///////////////////////////////////////////////////////////////////////////////////////////////
	
	
	//first page book category font resize/////////////////////////
	$('#bookTypeContainerh ul li a').live('mouseover', function(){
		if ($(this).attr('class') != 'punct_1' && $(this).attr('class') != 'punct_3') {										
			$(this).animate({fontSize: '20px'}, { duration: 200, queue: false });
		}
	});


	$('#bookTypeContainerh ul li a').live('mouseout', function(){
		if ($(this).attr('class') != 'puforeignnct_1' && $(this).attr('class') != 'punct_3') {													   
			$(this).animate({fontSize: '16px'}, { duration: 200, queue: false });
		}
	});
	/////////////////////////////////////////////////////////////////
	
	//set black version cookies ///////////////////////////////////////

	
	$('#black-version').bind('click', function(){
		if ($.cookie('black') == 'on') {
			
			$.cookie('black', null);
			switchVersions(false);
		} else {
			$.cookie('black', 'on', { expires: 7 } );
			switchVersions(true);
		}
	});
	
	$('#add-book').bind('mouseover', function(){
		if ($.cookie('black') == null) {
			$('#add-book').attr('src', '/bitrix/templates/HomePage/images/gantavseba_over.gif');
		} else {
				
		    $('#add-book').attr('src', '/bitrix/templates/HomePage/images/gantavseba_black_over.gif');	
		
			}
	});
	
	$('#add-book').bind('mouseout', function(){
		if ($.cookie('black') == null) {	
			$('#add-book').attr('src', '/bitrix/templates/HomePage/images/gantavseba.gif');
		}else {
				
		    $('#add-book').attr('src', '/bitrix/templates/HomePage/images/gantavseba-back.gif');	
		
			}
	});
	
	$('#newbook-label').bind('mouseover', function(){
		if ($.cookie('black') == null) {
			$('#newbook-label').attr('src', '/bitrix/templates/HomePage/images/newbook_over.gif');
		}else {
			
			$('#newbook-label').attr('src', '/bitrix/templates/HomePage/images/newbook_over_black.gif');	
		
			}
	});
	
	$('#newbook-label').bind('mouseout', function(){
		if ($.cookie('black') == null) {	
			$('#newbook-label').attr('src', '/bitrix/templates/HomePage/images/newbook.gif');
		}else {
			$('#newbook-label').attr('src', '/bitrix/templates/HomePage/images/newbook-black.gif');	
		
			}
	});
	
	$('#events-label').bind('mouseover', function(){
		if ($.cookie('black') == null) {
			$('#events-label').attr('src', '/bitrix/templates/HomePage/images/events_over.gif');
		}else{
			$('#events-label').attr('src', '/bitrix/templates/HomePage/images/events_black_over.gif');
		}
	});
	
	
	$('#events-label').bind('mouseout', function(){
		if ($.cookie('black') == null) {
			$('#events-label').attr('src', '/bitrix/templates/HomePage/images/events.gif');
		}else{
			$('#events-label').attr('src', '/bitrix/templates/HomePage/images/events-black.gif');
		}
	});
	
	$('#most-popul-label').bind('mouseover', function(){
		if ($.cookie('black') == null) {
			$('#most-popul-label').attr('src', '/bitrix/templates/HomePage/images/yvelaze_popularuli_over.gif');
		}else{
			$('#most-popul-label').attr('src', '/bitrix/templates/HomePage/images/yvelaze_popularuli_black_over.gif');
		}
	});
	$('#most-popul-label').bind('mouseout', function(){
		if ($.cookie('black') == null) {	
			$('#most-popul-label').attr('src', '/bitrix/templates/HomePage/images/yvelaze_popularuli.gif');
		}else{
			$('#most-popul-label').attr('src', '/bitrix/templates/HomePage/images/yvelaze_popularuli-black.gif');
		}
	});
	
	$('#new-works-label').bind('mouseover', function(){
			if ($.cookie('black') == null) {	
				$('#new-works-label').attr('src', '/bitrix/templates/HomePage/images/new_works_over.gif');
			}else{
				$('#new-works-label').attr('src', '/bitrix/templates/HomePage/images/new_works_black_over.gif');
			}
		});
		
		$('#new-works-label').bind('mouseout', function(){
			if ($.cookie('black') == null) {	
				$('#new-works-label').attr('src', '/bitrix/templates/HomePage/images/new_works.gif');
			}else{
				$('#new-works-label').attr('src', '/bitrix/templates/HomePage/images/new_works-black.gif');
			}
		});
		
		$('#all-lable').bind('mouseover', function(){
			if ($.cookie('black') == null) {	
				$('#all-lable').attr('src', '/bitrix/templates/HomePage/images/all_over.gif');
			}else{
				$('#all-lable').attr('src', '/bitrix/templates/HomePage/images/all_black_over.gif');
			}
		});
		$('#all-lable').bind('mouseout', function(){
			if ($.cookie('black') == null) {	
				$('#all-lable').attr('src', '/bitrix/templates/HomePage/images/all.gif');
			}else{
				$('#all-lable').attr('src', '/bitrix/templates/HomePage/images/all_black.gif');
			}
		  });
		
		
		
		$('#popular-lable').bind('mouseout', function(){
			if ($.cookie('black') == null) {	
				$('#popular-lable').attr('src', '/bitrix/templates/HomePage/images/popular.gif');
			}else{
				$('#popular-lable').attr('src', '/bitrix/templates/HomePage/images/popular_black.gif');
			}
		});
		
		$('#popular-lable').bind('mouseover', function(){
			if ($.cookie('black') == null) {	
				$('#popular-lable').attr('src', '/bitrix/templates/HomePage/images/popular_over.gif');
			}else{
				$('#popular-lable').attr('src', '/bitrix/templates/HomePage/images/popular_black_over.gif');
			}
		});
	
		$('#new-lable').bind('mouseout', function(){
			if ($.cookie('black') == null) {	
				$('#new-lable').attr('src', '/bitrix/templates/HomePage/images/new.gif');
			}else{
				$('#new-lable').attr('src', '/bitrix/templates/HomePage/images/new_black.gif');
			}
		});
		
		$('#new-lable').bind('mouseover', function(){
			if ($.cookie('black') == null) {	
				$('#new-lable').attr('src', '/bitrix/templates/HomePage/images/new_over.gif');
			}else{
				$('#new-lable').attr('src', '/bitrix/templates/HomePage/images/new_black_over.gif');
			}
		});
		
		///Select inputs switch to authors /////////////////////////////////////////////////////////////////////////////////
		
		

		$(':checkbox').click(function(){
			
			/*if ($(this).is(':checked')) {
				character = $(this).attr('rel');
				lang = $(this).attr('id');
				
				if (lang == 'georgian'){
					geo = true
				} else {
					geo = false;
				}
				if (lang == 'foreign') {
					foreign = true
				} else {
					foreign = false;
				}*/
			character = $('.active').attr('rel');
			if ($(this).attr('id') == 'georgian'){
				geo = $(this).is(':checked');
				if ($('#foreign').is(':checked')){
					foreign = true;
				}
			}
			
			if ($(this).attr('id') == 'foreign'){
				foreign = $(this).is(':checked');
				if ($('#georgian').is(':checked')){
					geo = true;
				}
			}
			
			if (geo == undefined) {
				geo = false;
			}
			
			if (foreign == undefined) {
				foreign = false;
			}
			
			if (foreign == true && geo== true) {
				geo = undefined;
				foreign = undefined;
			}
				
			category = $.getUrlVar('category');
				$.ajax({
					//contentType: 'text/html; charset=UTF-8', 
					//async: false,
					//cache: false,
					type: "POST",
					url: 'ajaxian.php',
				    dataType: 'html', 
					data: 'character='+character+'&geo='+geo+'&foreign=' + foreign+'&category='+category,
				    success: function(data){
				    	$('#authors').html(data);
				    }
				 }).done(function(){
						if ($.cookie('black') == 'on'){
							switchVersions(true);
						} else {
							switchVersions(false);
						}
					});
				
				//alert($.getUrlVar('category'));
		
		});
		
		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		$(".sub_title").click(function(){
			
			id = this.id;
			
			$("#hopen2block" + id).attr({width: '935px'});
			$("#hopen2block" + id).toggle('fast');
			
			count = $("#myCount").val();
			for (i=1; i<=count; i++) {
				if (i != id) {
					$("#hopen2block" + i).hide('hide');
				}
			}
			
		});
		
		itemp = $.getUrlVar('item');
		
		ind = 1;
		if (itemp != undefined){
			$(".sub_title").each(function(){
				if (ind == itemp){
					$(this).click();
					return false;
				}
				ind++;
			});
		}
		
		
		$('#search-button').click(function(){
				
				myBook = document.getElementById("book").value;
				authorName =  document.getElementById("firstname").value;
				janreName = $("#janre option:selected").val();
				lang =  $("#language option:selected").val();
				character = $('.active').attr('rel');
			
				/*lang =  $("#language option:selected").val();
				character = $('.active').attr('rel');
				//name1 = $('#firstname').val();
				
				/*name2 = $('#secondname').val();
				janre = $("#janre option:selected").val();
				lang =  $("#language option:selected").val();
				character = $('.active').attr('rel');*/
				
				$.ajax({
					type: "POST",
					url: 'ajaxian.php',
				    dataType: 'html', 
					data: 'character='+character+'&name1='+authorName+'&category='+janreName+'&lang='+lang+'&type=custom_search&book='+myBook,
				    success: function(data){

				    	$('#search-result').html(data);
				    }
				 }).done(function(){
					 if ($.cookie('black') == 'on'){
						 $('.ganre-text').css("color", '#ffffff');
						 $('.author_name').css("color", '#ffffff');
						 $('.ganre-title').css("color", '#ffffff');
						
						
					 } else {
						 $('.ganre-text').css("color", '#000000');
						 $('.author_name').css("color", '#000000');
						 $('.ganre-title').css("color", '#000000');
						  
					 }
						$('.ganre-text').click(function(){
							
							id = $(this).attr('id');
							id_len = 5 - id.length;
							for (i=1; i<=id_len; i++) {
								id = '0' + id;
							}
							$.cookie('book', id , { expires: 1 } );
							rel = $(this).attr("rel");
							var params = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes"
							window.open("/mybook/index.php?book="+id+"&rel="+rel, "", params);
						});					 
				 });		
		
		});
		
////////////////// breadcrumb ////////////////////////////////////////////////////////////////////////////////////////////////////
		
	category = $.getUrlVar('category');
	if (category != undefined){
		c_text = getCategory(category);
		
		$.cookie('category', category , { expires: 1 } );
		if (lit_cat == true){
		//alert(category);
			bread_text = '<li><a title="მთავარი" href="/" class="string style" style="color: rgb(0, 0, 0);">მთავარი</a></li><li><span>&nbsp;&gt;&nbsp;</span></li><li>'+c_text+'</li>';
			
			$('ul.breadcrumb-navigation').css({'padding':'0', 'margin':'0','padding-top':'4px', 'list-style':'none', 'font-size':'13px'}).html(bread_text);
			$('ul.breadcrumb-navigation li').css({'display':'inline'});
			$('ul.breadcrumb-navigation a').css({'text-decoration':'underline'});
		} 
	}
	
		//alert(lit_books);
		if (lit_books != undefined && $.cookie('category')) {
			
			c_text = getCategory($.cookie('category'));
			bread_text = '<li><a title="მთავარი" href="/" class="string style" style="color: rgb(0, 0, 0);">მთავარი</a>';
			bread_text = bread_text + '</li><li><span>&nbsp;&gt;&nbsp;</span></li><li><a href="/authors.php?category='+$.cookie('category')+'">'+c_text+'</a></li>';
			author_name =  $('#authorname').text();
			bread_text = bread_text +'<li><span>&nbsp;&gt;&nbsp;</span></li><li>'+author_name+'</li>';
			$('ul.breadcrumb-navigation').css({'padding':'0', 'margin':'0','padding-top':'4px', 'list-style':'none', 'font-size':'13px'}).html(bread_text);
			$('ul.breadcrumb-navigation li').css({'display':'inline'});
			$('ul.breadcrumb-navigation a').css({'text-decoration':'underline'});
		}
		/*
		if (event != undefined) {
			bread_text = '<li><a title="მთავარი" href="/" class="string style" style="color: rgb(0, 0, 0);">მთავარი</a></li><li><span>&nbsp;&gt;&nbsp;</span></li><li>მოვლენები</li>';
			$('ul.breadcrumb-navigation').css({'padding':'0', 'margin':'0','padding-top':'4px', 'list-style':'none', 'font-size':'13px'}).html(bread_text);
			$('ul.breadcrumb-navigation li').css({'display':'inline'});
			$('ul.breadcrumb-navigation a').css({'text-decoration':'underline'});
			
		}*/
		
		
		if ($.cookie('black') == 'on'){
			switchVersions(true);
		} else {
			switchVersions(false);
		}	
		
		
});

function getCategory(category){
	switch (category){
	case '900':
		return c_text = "საბავშვო";
		break
	case '100':
		return c_text = "ფოლკლორი";
		break
	case '200':
		return c_text = "პროზა";
		break
	case '800':
		return c_text = "ინტერვიუ";
		break
	case '700':
		return c_text = "სამეცნიერო";
		break
	case '300':
		return c_text = "ესსე";
		break
	case '950':
		return c_text = "ეპისტოლარული მემკვიდრეობა";
		break
	case '600':
		return c_text = "ისტორია";
		break
	case '400':
		return c_text = "დრამატურგია";
		break
	case '955':
		return c_text = "სამართალი";
		break
	case '500':
		return c_text = "პოეზია";
		break			
	case '11':
		return c_text = "პერიოდიკა";
		break	
	case '12':
		return c_text = "ლექსიკონები";
		break
	case '13':
		return c_text = "აუდიო-ლიტერატურა";
		break
	case '14':
		return c_text = "ნათარგმნები";
		break
	}
}

function switchVersions(switchOn){
	if (switchOn) {
		$('body').css('background-color', '#0d0d0d');
		$('.author_name').css('color','#ffffff');
		$('a').css('color', '#ffffff');
		$('#lib img').attr('src', '/bitrix/templates/HomePage/images/library-black.gif');
		$('#soon').attr('src', '/bitrix/templates/HomePage/images/soon-black.gif');
		$('#signin').attr('src', '/bitrix/templates/HomePage/images/shesvla-black.gif');
		$('#logohome').css('background-image', 'url(/bitrix/templates/HomePage/images/xxx-black.gif)');
		$('#logohome').css('width', '116px');
		$('#search').css('background-image',  'url(/bitrix/templates/HomePage/images/search_bg-black.gif)');
		$('#search').css('color', '#ffffff');
		$('#newbook').css('color', '#ffffff');
		$('#search-label').attr('src', '/bitrix/templates/HomePage/images/dzebna-black.gif');
		$('#add-book').attr('src', '/bitrix/templates/HomePage/images/gantavseba-back.gif');
		$('#newbook-label').attr('src', '/bitrix/templates/HomePage/images/newbook-black.gif');
		$('.infoLabel li').css('list-style-image', 'url(/bitrix/templates/HomePage/images/arrow-black.gif)');
		$('#new-works-label').attr('src', '/bitrix/templates/HomePage/images/new_works-black.gif');
		$('#banner').attr('src', '/bitrix/templates/HomePage/images/banner-black.gif');
		$('#events-label').attr('src', '/bitrix/templates/HomePage/images/events-black.gif');
		$('.event_title').css('color', '#ffffff');
		//$('.day').css('color', '#ffffff');
		$('.monthyear').css('color', '#ffffff');
		$('#most-popul-label').attr('src', '/bitrix/templates/HomePage/images/yvelaze_popularuli-black.gif');
		$('#all-lable').attr('src', '/bitrix/templates/HomePage/images/all_black.gif');
		$('#popular-lable').attr('src', '/bitrix/templates/HomePage/images/popular_black.gif');
		$('#new-lable').attr('src', '/bitrix/templates/HomePage/images/new_black.gif');
		$('#georgian-lable').attr('src', '/bitrix/templates/HomePage/images/georgian_black.gif');
		$('#foreigne-lable').attr('src', '/bitrix/templates/HomePage/images/foreigne_black.gif');
		$('#nbooks-lable').attr('src', '/bitrix/templates/HomePage/images/nbooks-black.gif');
		$('#nb_all-lable').attr('src', '/bitrix/templates/HomePage/images/nb_all-black.gif');
		$('#publishnb-lable').attr('src', '/bitrix/templates/HomePage/images/publishnb-black.gif');
		$('#authorname').css('color', '#ffffff');
		$('.ganre-text').css('color', '#ffffff');
		$('.ganre-title').css('color', '#ffffff');
		$('.sub_title, .text_event').css('color', '#ffffff');
		$('#search_bg').css('background-image', 'url(/bitrix/templates/HomePage/images/dzebna-black.gif)');
		$('#registration').css('background-image',  'url(/bitrix/templates/HomePage/images/registration-black.gif)');
		$('ul.breadcrumb-navigation li').css('color', '#ffffff');
		$("#alphabet .character").each(function(){
			id = $(this).attr('id');
			$(this).attr({src:"/bitrix/templates/HomePage/images/alphabet/" + id + "_black.gif"})
		});
	} else {
		$('body').css('background-color', '#ffffff');
		$('.author_name').css('color','#000000');
		$('a').css('color', '#000000');	
		$('#lib img').attr('src', '/bitrix/templates/HomePage/images/library.gif');
		$('#search_bg').css('background-image', 'url(/bitrix/templates/HomePage/images/dzebna.gif)')
		$('#registration').css('background-image',  'url(/bitrix/templates/HomePage/images/registration.gif)');
		$('#soon').attr('src', '/bitrix/templates/HomePage/images/soon.gif');
		$('#signin').attr('src', '/bitrix/templates/HomePage/images/shesvla.gif');
		$('#logohome').css('background-image', 'url(/bitrix/templates/HomePage/images/xxx.png)');
		$('#logohome').css('width', '118px');
		$('#search').css('background-image', 'url(/bitrix/templates/HomePage/images/search_bg.gif)');
		$('#search').css('color', '#000000');
		$('#newbook').css('color', '#000000');
		$('#search-label').attr('src', '/bitrix/templates/HomePage/images/dzebna.gif');
		$('#add-book').attr('src', '/bitrix/templates/HomePage/images/gantavseba.gif');
		$('#newbook-label').attr('src', '/bitrix/templates/HomePage/images/newbook.gif');
		$('.infoLabel li').css('list-style-image', 'url(/bitrix/templates/HomePage/images/arrow.gif)');
		$('#new-works-label').attr('src', '/bitrix/templates/HomePage/images/new_works.gif');
		$('#banner').attr('src', '/bitrix/templates/HomePage/images/banner.gif');
		$('#events-label').attr('src', '/bitrix/templates/HomePage/images/events.gif');
		$('.event_title').css('color', '#000000');
		//$('.day').css('color', '#000000');
		$('.monthyear').css('color', '#000000');
		$('#most-popul-label').attr('src', '/bitrix/templates/HomePage/images/yvelaze_popularuli.gif');
		
		$('#all-lable').attr('src', '/bitrix/templates/HomePage/images/all.gif');
		$('#popular-lable').attr('src', '/bitrix/templates/HomePage/images/popular.gif');
		$('#new-lable').attr('src', '/bitrix/templates/HomePage/images/new.gif');
		$('#georgian-lable').attr('src', '/bitrix/templates/HomePage/images/georgian.gif');
		$('#foreigne-lable').attr('src', '/bitrix/templates/HomePage/images/foreigne.gif');
		$('#nbooks-lable').attr('src', '/bitrix/templates/HomePage/images/nbooks.gif');
		$('#nb_all-lable').attr('src', '/bitrix/templates/HomePage/images/nb_all.gif');
		$('#publishnb-lable').attr('src', '/bitrix/templates/HomePage/images/publishnb.gif');
		$('#authorname').css('color', '#000000');
		$('.ganre-text').css('color', '#000000');
		$('.ganre-title').css('color', '#000000');
		$('.sub_title, .text_event').css('color', '#000000');
		$('ul.breadcrumb-navigation li').css('color', '#000000');
		$("#alphabet .character").each(function(){
			id = $(this).attr('id');
			$(this).attr({src:"/bitrix/templates/HomePage/images/alphabet/" + id + ".gif"})
		});
	}
}



// first page vbook panelk scrollable ////////////////////////////////
$(function() {
	$(".scrollable").scrollable({
		clickable: false
	});

});
/////////////////////////////////////////////////////////////////////

//reading URL //////////////////////////////////////////////////////


$.extend({
	  getUrlVars: function(){
	    var vars = [], hash;
	    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	    for(var i = 0; i < hashes.length; i++)
	    {
	      hash = hashes[i].split('=');
	      vars.push(hash[0]);
	      vars[hash[0]] = hash[1];
	    }
	    return vars;
	  },
	  getUrlVar: function(name){
	    return $.getUrlVars()[name];
	  }
	});

