function toggleCatDropImage() {
    var div_id = 'ic_search_dropdown_layer';
    var div_id2 = 'ic_video_select';
    var btn_id = 'ic_search_dropdown';

    if($(div_id).style.display == 'none') {
        $(btn_id).setStyle({backgroundPosition: 'right bottom'});

        new Effect.SlideDown(div_id, {duration:0.3});
        new Effect.SlideUp(div_id2, {duration:0.6});

    } else {
        $(btn_id).setStyle({backgroundPosition: 'right top'});

        Effect.SlideUp(div_id, {duration:0.3});
        Effect.SlideDown(div_id2, {duration:0.6, delay:0.5});
    }
    return false;
}

function sendImageLink(galID, imgID, to, title, imgTitle) {
    //alert('/image/sendlink/galID/' + galID + '/imgID/' + imgID + '/to/' + to + '/title/' + title + '/imgtitle/' + imgTitle);
    if(to && !(to == error_msg)) {
        document.getElementById("message_layer").style.display = "block";
        //new Effect.toggle('message_layer');
        new Ajax.Updater('message_layer_content', '/image/sendlink/galID/' + galID + '/imgID/' + imgID + '/to/' + to + '/title/' + title + '/imgtitle/' + imgTitle);
    } else {
        var item = 'mail_add';
        $(item).setStyle({ color:'#db0000' });
        $(item).setStyle({ border:'#db0000 1px solid' });
        $(item).value = error_msg;
        new Effect.Pulsate($(item).id);
    }
}

function reset_input(item) {
	if(item.value === error_msg) {
		$(item).setStyle({color:'#646464'});
                $(item).setStyle({ border:'#dbdbdb 1px solid' });
		$(item).value = '';
	}
}

function updateLargeImage(pos, galID, imgID, size) {

    new Effect.Fade($('imagelarge'), { duration: 0.05, to: 0.001 });
    //setTimeout("updateLargeImageTimeout(" + galID + ", " + pos + ", '" + size + "')", 200);

    new Ajax.Updater('imagelarge','/image/imagelarge/galleryID/' + galID + '/pos/' + pos + '/size/' + size, {onComplete:function() {
            new Effect.Appear($('imagelarge'), { duration: 0.3, delay:0.7 });
        }
    });

    document.send_img.img_link.value = 'http://'+ window.location.host +'/image/galerie/ID/' + galID + '/img/' + imgID;
    document.send_img.imgID.value = imgID;
}

function updateLargeImageTimeout( galID, pos, size) {
    new Ajax.Updater('imagelarge','/image/imagelarge/galleryID/' + galID + '/pos/' + pos + '/size/' + size);
    new Effect.Appear($('imagelarge'), { duration: 0.3, delay:0.7 });
}
