$(document).ready(function($) {
  
  
$(".group1").colorbox({rel:'group1'});
$(".group_last").colorbox({rel:'group_last'});

  
// Slider
$("div#controller").jFlow({
	slides: "#slides",
	width: "878px",
	height: "270px",
	duration: 400
});
    
// Menu
	
var timeout         = 500000;
var closetimer		= 0;
var ddmenuitem      = 0;

function jsddm_open()
{	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}

function jsddm_close()
{	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{	closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;}}

$('#jsddm > li').bind('mouseover', jsddm_open);
$('#jsddm > li').bind('mouseout',  jsddm_timer);

document.onclick = jsddm_close;


Galleria.loadTheme('/extension/ecogarden/design/ecogarden/javascript/galleria.classic.min.js');

	// Initialize Galleria
	$('#galleria').galleria({


    extend: function(options) {

        Galleria.log(this) // the gallery instance
        Galleria.log(options) // the gallery options

        // listen to when an image is shown
        this.bind('image', function(e) {

            Galleria.log(e) // the event object may contain custom objects, in this case the main image
            Galleria.log(e.imageTarget) // the current image

            // lets make galleria open a lightbox when clicking the main image:
            $(e.imageTarget).click(this.proxy(function() {
               this.openLightbox();
            }));
        });
    }
});

						   
});

var latest_article_id;
function show_article(that, id){
    $('.services-middle-r').children(':first-child').removeClass('row-selected');
    $('.services-right').hide();
    $('#article_'+id).show();
    $('#leftarticle_'+latest_article_id).parent().removeClass('row-selected');
    $(that).parent().addClass('row-selected');
    latest_article_id = id;
    
}
