function toggle_comment_form(id){
    var cform = $('#comment_form_' + id);
    if(cform.hasClass('hidden')) {
        cform.prev().text("Stop Replying to This Post");
        cform.slideDown();
    }
    else {
        cform.prev().text("Reply to This Post");
        cform.slideUp();
    }
    cform.toggleClass('hidden');
}


function previewImport(id, url, container){
    $('#'+container)[0].innerHTML = "<div class='loading'>loading</div>";
    var importUrl = $('#'+id)[0].value;
    $('#'+container).load(url, {url:importUrl});
}


var descriptions = [
    "Schmiede is a festival and community for producers. Once a year we gather in Hallein for 10 days to work, experiment, present and network.",
    "Schmiede is a playground where ideas are nurtured and come to life. Playfully we learn to realize our ideas and projects, work in teams and network.",
    "Schmiede is about meeting real people, our ideas, building trust and how we can learn to make it all work together.",
    "Schmiede is about work in progress, not the product but development is our target. There are no teachers at Schmiede, just around 140 people like you, both experts and students in their professions and spheres of interest.",
    "At Schmiede you'll find like-minded friends and associates to push your work to another level.",
    "Schmiede is an annual temporary collective process, initiated in 2003, where 140 people with diverse backgrounds gather, experiment, produce, present and network.",
    "The Schmiede network revolves around digital media but is comprised of much more. Over the years we have hosted smiths from all sorts of backgrounds: audio, programming, visual arts, djing, culinary, real-time cinema, performance, architecture, guerrilla marketing, philosophy, engineering, youth culture, law, history, to name just a few. "
];
var descriptionsIndex = 0;
var descriptionIntverval = null;
var descriptionIntervalTime = 1000*10;
function startDescriptionRotation(){
    nextDescription();
    descriptionIntverval = window.setInterval(_nextDescription, descriptionIntervalTime);
}

function nextDescription(){
    //reset the interval...so it does not jump to the next too fast
    window.clearInterval(descriptionIntverval);
    _nextDescription();
    descriptionInverval = window.setInterval(_nextDescription, descriptionIntervalTime);
}

function _nextDescription(){
    $("#schmiedeDescription").fadeOut('slow', function() {
        if(descriptionsIndex+1>=descriptions.length){
           descriptionsIndex = 0;
        }
        $("#schmiedeDescription")[0].innerHTML = descriptions[descriptionsIndex];
        descriptionsIndex++;
        $("#schmiedeDescription").fadeIn('slow', function(){});
    });
}
