function getContent(category, page){
    
    $('content').style.display = 'none';
    Effect.Appear('loading');//'block';

    new Ajax.Request('./processors/contentProcessor.php', {method : 'post', parameters: { 'category':category, 'page':page }, onSuccess:showContent, onFailure:callProcessorError});
    
}

function showContent(e){
    
    $('content').innerHTML = e.responseText;
    
    Effect.Appear('content');
    
    
    $('loading').style.display = 'none';
}

function getTweets(){
    $('content').style.display = 'none';
    Effect.Appear('loading');
    
    new Ajax.Request('./processors/twitterProcessor.php', {method:'post', parameters: {}, onSuccess: showContent, onFailure:callProcessorError});
}


function trim (zeichenkette) {
  return zeichenkette.replace (/^\s+/, '').replace (/\s+$/, '');
}


function getPost(postID){
    $('content').style.display = 'none';
    Effect.Appear('loading');
    
    new Ajax.Request('./processors/contentProcessor.php', {method : 'post', parameters: { 'post':postID }, onSuccess:showContent, onFailure:callProcessorError});
}

function postComment(postID, randomText){
    var commentName = trim($('commentName').value);
    var commentText = trim($('commentText').value);
    var captcha = $('random').value;
    
    if(captcha != randomText) {
        callError('Please enter the correct Captcha.');
    } else {
        if(commentName != '' && commentText!= '' && commentName!= 'Name' && commentText != 'Comment') {
            $('content').style.display = 'none';
            $('loading').style.display = 'block';
            new Ajax.Request('./processors/contentProcessor.php', {method : 'post', parameters: { 'postComment':postID, 'post':postID, 'userName':commentName, 'text':commentText }, onSuccess:showContent, onFailure:callProcessorError});
        } else {
            callError('No Name/Comment given');
        }
    }
}

function showMiniPlayer(id, count) {
    for(i=1; i<=count; i++) {
        if(i != id){
            $('miniPlayer_'+i).style.display = 'none';
        }
    }
    if($('miniPlayer_'+id).style.display == 'none') {
        $('miniPlayer_'+id).style.display = 'block';
    } else {
        $('miniPlayer_'+id).style.display = 'none';
    }
}

function showImage(url, title){
    window = window.open(url, title);
    window.focus();
}

function callProcessorError(e){
    $('error').appear();
    $('error').innerHTML = 'Loading sequence aborted due to unknown exception.';
}

function callError(errorMessage){
    $('error').appear();
    $('error').innerHTML = errorMessage;
}

function hideError(){
    $('error').fade();
}