//$j=jQuery;
$('#slide_holder').ready(function(){
 // slideshow
 if($('#slide_holder').length>0)
 $('#slide_holder').agile_carousel({
    number: "1",
    first_last_buttons: "yes",
    hover_next_prev_buttons: "yes",
    next_prev_buttons: "yes",
    pause_button: "yes",
    slide_buttons: "yes",
    slide_doctype: "html",
    slide_number_display: "no",
    slide_timer_length: "15000",
    slide_timer_on: "yes",
  	transition_duration: 1000,
  	transition_easing: "swing",
    transition_type: "carousel"
	 });
  jQuery('a.listen').click(function(){
    var mp3=jQuery(this).attr('href');
    var alt=jQuery(this).attr('alt');
    jQuery('#listen').remove();
    jQuery('body').append('<div id="listen"><span>'+alt+'</span><br><audio src="'+mp3+'" autoplay="autoplay" preload="none" ></audio></div>');
    audiojs.createAll();
    return false;
  });
});

$(document).ready(function(){
  // switcher
  var s=0;
  if($(".switched"))
  $(".switched").each(function(){
    var i=1;  s++;
    $(this).find(".item").each(function(){$(this).addClass('item'+i); i++;});
    $(this).attr("id","switcher"+s);
    switcher("#switcher"+s,1);
    if($.browser.msie){
      var hei=$("#switcher"+s+" .item1").height();
      $("#switcher"+s).parent().css('height',hei+'px');
    }
  });
pageready();
});
function switcher(container,element){
    var itemsc=$(container+" .item").length;
    if(element==1) var hidel=itemsc;
    if(element>1)  var hidel=element-1;
    $(container+" .item"+hidel).hide();
    $(container+" .item"+element).show();  //     slideDown
    if(element==itemsc) element=0;
    if(itemsc > 1)
      setTimeout("switcher('"+container+"',"+(element+1)+")",10000);
}
function pageready(){
  $('a.inside').click(function(){
    var cpath=$(this).attr('href');
    set_content(cpath);
    return false;
  });
}
function set_content(cpath){$.get(cpath,{mode:'print'},function(data){
  $(".content").html(data);
  pageready();
  });}
VK.init({apiId: 2381315, onlyWidgets: true});

