$(document).ready(function(){
  
  $("a[rel='colorbox']").colorbox({slideshow:false, slideshowSpeed: 10000});
  
  $("#accordion").accordion();
  
  $('#language ul').toggle('hide');
  $(".chooseLang").click(function () {
      $('#language ul').toggle('hide');
      return false;
  });

  
  
	$('#flickrGallery').jflickrfeed({
		limit: 12,
		qstrings: {
			id: '53504447@N07'
		},
		itemTemplate: '<div><a href="{{link}}" target="_blank" title="{{title}}"><img src="{{image_s}}" alt="{{title}}" /></a></div>'
	});
	
	var faqFirstElement = $('.faq p').first().html();
	$('#faqContent').html(faqFirstElement);
	$('.faq h2').click(function () {
	    var currElement = $(this).next('p').first().html();
	    $('#faqContent').fadeOut('slow', function(){
	        $('#faqContent').html(currElement);
	        $('#faqContent').fadeIn();
	    });
	    return false;
	});
	
	
	$('input[title],textarea[title]').each(function() {
		if($(this).val() === '') {
			$(this).val($(this).attr('title'));	
		}
		
		$(this).focus(function() {
			if($(this).val() == $(this).attr('title')) {
				$(this).val('').addClass('focused');	
			}
		});
		$(this).blur(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused');	
			}
		});
	});


});

$(window).bind("load", function() { 
    $("div#topic").slideView({autoScroll:1});
    $("div#gallery").slideView();
}); 

