
//-- Blog comments --//

function initCommentLinks(){
    $$('.viewAllCommentsLink').each( function(item){
        item.stopObserving('click');
        item.observe( 'click', handleViewAllCommentsLinkClick );
    });

    $$('.addCommentLink').each( function(item){
        item.stopObserving('click');
        item.observe( 'click', handleAddCommentLinkClick );
    });
}

function handleViewAllCommentsLinkClick( event ){
    var imageId = this.id;
    imageId = imageId.substring( imageId.lastIndexOf("_") +1 );
    new Ajax.Updater( $('imgCommentsContainer_'+imageId ), '/ajax/blogarticlephotocomments.jsp',{evalScripts:true,parameters:{'imageId':imageId}});
}

function handleAddCommentLinkClick( event ){
    var imageId = this.id;
    imageId = imageId.substring( imageId.lastIndexOf("_") +1 );
    new Ajax.Updater( $('commentForm_'+imageId), '/ajax/blogarticlephotocomment.jsp', {evalScripts:true,parameters:{'imageId':imageId}} );
}

/** blogimgnext-button **/

function bindLoadNextPhotosButton(){
    $('loadNextButton').observe('click',loadNextPhotos);
}

function loadNextPhotos(){
    var bid = window.blogArticleId;
	var s = window.startIndex;
    new Ajax.Updater($('blogArticleContainer'),'/ajax/blogarticle_images.jsp',{insertion:'bottom',evalScripts:true,parameters:{'s':s,'bid':bid}});
}