

function showThumbs( tagId , startIdx, divId ){
	new Ajax.Updater( $(divId),'/fotoarkivet/ajax_thumbs.jsp',{parameters:{'tagid':tagId,'sidx':startIdx,'divId':divId}} );
}


function showThumbs( tagId , startIdx ){
	new Ajax.Updater( $('theThumbs'),'/fotoarkivet/ajax_thumbs.jsp?tagid='+tagId+"&sidx="+startIdx );
}

function thumbsByTag( tagId , divId ){
	new Ajax.Updater( $(divId),'/ajax/thumbs_by_tag.jsp',{parameters:{'tagid':tagId}} );
}


function loadForm( divId, args ) {
	new Ajax.Updater( $(divId), "/commentform.jsp"+ args );
}


var masterCounter = 0;


function getObj( name ) {
	return $(name);
}


function showSotComments() {
	var div = $('commentList');

	if ( div.style.display == 'block' ) {
		div.style.display = 'none';
	}
	else {
		div.style.display = 'block';
	}
}

function loadComments( dateKey, seqId ) {
	setTimeout("new Ajax.Updater( 'commentsContainer','commentlist.jsp?dateKey=" + dateKey + "&seqId=" + seqId + "')", 1000);
}

function showCommentForm( dateKey, seqId ) {
	showSotComments();
	new Ajax.Updater('commentForm', 'commentform.jsp?dateKey=' + dateKey + '&seqId=' + seqId, {method:'get'});
}

function showNav( id ) {
	$(id).style.display = 'block';
}

function hideNav( id ) {
	$(id).style.display = 'none';
}

function ifEmpty( input, value ) {
	if ( input.value == '' ) {
		input.value = value;
	}
}

function ifEqualClear( input, value ) {
	if ( input.value == value ) {
		input.value = '';
	}
}


function showFrontPageComments( aid ) {
	$('comments_'+aid).addClassName('active');
	new Ajax.Updater( $('comments_' + aid), 'frontpage_commentlist.jsp?aid='+aid+'&show=true' );
}

function cancelFrontPageComments( aid ){
	new Ajax.Updater( $('comments_' + aid), 'frontpage_commentlist.jsp?aid='+aid );
	$('comments_'+aid).removeClassName('active');
}

function saveFrontPageComments( aid ){
	new Ajax.Updater( $('comments_' + aid), 'frontpage_commentlist.jsp?aid='+aid+'&show=true' );
}



    var currentArticleId = 0;

    function showComments( articleId ) {
        currentArticleId = articleId;
        new Ajax.Updater($('commentsfor_' + articleId), '/comments/theform.jsp', {
            parameters:{'articleid':articleId},
            onComplete:function() {
                new Effect.ScrollTo('theFirm_' + currentArticleId, {'offset':-100,
                    afterFinish:
                            function() {
                                $('name_' + currentArticleId).focus();
                                currentArticleId = 0;
                            }});
            }
        });
    }

    function showSavedComment( articleId ) {
        new Ajax.Updater($('commentsfor_' + articleId), '/comments/theform.jsp', {parameters:{'articleid':articleId},
            onComplete:function() {
                new Effect.ScrollTo('lastcomment_' + articleId);
                new Effect.Pulsate('lastcomment_' + articleId, {pulses:2});
            }
        });
    }

    function submitZeForm( articleId ) {
        $('theFirm_' + articleId).request();
    }

    function clientSave( key ) {
        new Ajax.Request('/comments/savecomment.jsp', { parameters:{ 'key':key } });
    }

    function showFeedback( event ){
        debugger;
        var containerDiv = this.ancestors()[0];
        containerDiv.morph({height:this.getHeight()+'px'});
        
    }