/**
* Laurynas Karvelis, made.By
* http://www.by.lt
* 2009
*/

// this event fires as soon as DOM is loaded successfully, so it's fired faster than $(window).ready()
jQuery(function(){
	
});

// this event is triggered only when all DOM elements are downloaded and loaded
$(window).ready(function (){
	$('a.lessonType').hover(function() {
		var hoverImg = $(this).attr('rel');
		var normalImg = $('img', $(this)).attr('src');
		
		$('img', $(this)).attr('src', hoverImg);
		$(this).attr('rel', normalImg);
	}, function() {
		var hoverImg = $(this).attr('rel');
		var normalImg = $('img', $(this)).attr('src');
		
		$('img', $(this)).attr('src', hoverImg);
		$(this).attr('rel', normalImg);
	});
	
	$('table.price-list thead th:first-child').addClass('first');
	$('table.price-list thead th:last-child').addClass('last');
	
	$('table.price-list tbody tr:odd').addClass('odd');
	$('table.price-list tbody tr:last-child').addClass('bottom');
	$('table.price-list tbody td:last-child').addClass('last');
	$('table.price-list tbody td:first-child').addClass('first');
	
	$('table.lesson-list thead th:first-child').addClass('first');
	$('table.lesson-list thead th:last-child').addClass('last');
	
	$('table.lesson-list tbody tr:odd').addClass('odd');
	$('table.lesson-list tbody tr:last-child').addClass('bottom');
	$('table.lesson-list tbody td:last-child').addClass('last');
	$('table.lesson-list tbody td:first-child').addClass('first');
	
	$('table:not(.empty) tbody tr').hover(function() {
		$(this).addClass('hovered');
	}, function() {
		$(this).removeClass('hovered');
	});
	
	$('ul.gallery li').hover(function() {
		$(this).addClass('hovered');
	}, function() {
		$(this).removeClass('hovered');
	});
	
	$("a[rel='colorbox']").colorbox({ 
		onOpen: function() {
			$('#urgent-info-placeholder').hide();
		},
		
		onClosed: function() {
			$('#urgent-info-placeholder').show();
		},
		
		close: 'Uždaryti',
		previous: 'Ankstesnis',
		next: 'Sekantis',
		current: 'Pav. {current} iš {total}'
	});
	
	$('ul.faq a').click(function() {
		$(this).toggleClass('active');
		return false;
	});
});
