$(document).ready(function() {
	// ollaanko videot sivulla
	if ($(".breadcrumbs a[href='./viewforum.php?f=25']").length) {
		$("#nav li").removeClass("active")
		$("#nav li.videot").addClass("active")
	}
	// pvm sidebar kuville
	$(".frontpageimg a").each(function() {
		$(this).attr('title', $(this).attr('title') + ' - ' + $(this).parent().parent().parent().find('div.info').find('span.date').find('span').text())
	})

	// lightbox
	options = {	current : "Kuva - {current}/{total}",
				previous : "Edellinen",
				next : "Seuraava",
				close : "Sulje",
				transition:"fade",
				photo:true, }
	$("a[rel='lightbox-sidebar']").colorbox(options);
	$("a[rel='lightbox-news']").colorbox(options);

	// vetovalikot
	$(".nojs").removeClass("nojs");
	
	$(".dropdown").removeAttr("href")
	$(".dropdown > a").removeAttr("href")
	
	$(".dropdown").click(function(e) {
		e.stopPropagation()
		
		if (!$(this).children('ul').hasClass("show")) {
			$(".dropdown ul").removeClass("show")
			$(this).children('ul').addClass("show")
		} else {
			$(".dropdown ul").removeClass("show")
		}
	})
	
	$(".dropdown input[type=text]").click(function(e) {
		e.stopPropagation()
	})
	
	$(document).click(function() {
		$(".dropdown ul").removeClass("show");
	})
	
	//PHPBB Poll
	$(".poll li input[type=checkbox]").change(function() {
		if ($(this).attr('checked')) {
			$(this).parent().parent().addClass('active')
		} else {
			$(this).parent().parent().removeClass('active')
		}
	})
	$(".poll li input[type=radio]").change(function() {
		$(".poll li").removeClass('active')
		$(this).parent().parent().addClass('active')
	})
});

