
function tipsStart() {
	window.addEvent('domready', function(){
		var Tips2 = new Tips($$('.Tips'), {
			onShow: function(tip) {
				tip.fade('in');
			},
			onHide: function(tip) {
				tip.fade('out');
			}
		});
	}); 
}

function animateHoverOpacity(class_name){
    var miniesFx = new Array();
    $$(class_name).each(function(element,i){
        miniesFx[i] = new Fx.Morph(element, {
            duration:150,
            wait:false
        });

        element.addEvent('mouseenter', function(){
            miniesFx[i].start({
                'opacity': 0.6
            });
        });

        element.addEvent('mouseleave', function(){
            miniesFx[i].start({
                'opacity': 1
            });
        });
    });
}

/* animated gallery */

var scrollPro = new Array();
var counterPro = new Array();
var countPro = new Array();
var itemsPro = new Array();
var itemsDescPro = new Array();
var dotImgList = new Array();

var slideshowInterval;
var slideshowTime = 3000;

function initGallery( id ) {

    if ( $$('#'+ id +'_list .'+ id +'_list_item') == undefined ) return ;

    counterPro[id] = 0;
    itemsDescPro[id] = $$('#'+ id +'_list .'+ id +'_list_pos');

    scrollPro[id] = new Fx.Scroll(''+ id +'_list', {
    	transition:Fx.Transitions.Quad.easeOut,
    	duration:500,
        onStart: function(){
        },
        onComplete: function(){
            if ( itemsDescPro[id].length > 0 )
            itemsDescPro[id][counterPro[id]].setStyle( 'display', '' );
        }
    });

    countPro[id] = $$('#'+ id +'_list .'+ id +'_list_item').length-1;
    dotImgList[id] = $$('#'+ id +'_pos_list div');
    scrollPro[id].toElement(id+'_list_item_0');
}

function galleryNext( id ) {

    if ( itemsDescPro[id].length > 0 )
    	itemsDescPro[id][counterPro[id]].setStyle( 'display', 'none' );
    
    counterPro[id]++;

    if ( counterPro[id] > countPro[id]  )
        counterPro[id] = 0;


    if ( $$('#'+ id +'_pos_list .gallery_pos_list_active').length > 0 ) { 
    	$$('#'+ id +'_pos_list .gallery_pos_list_active')[0].className = 'gallery_pos_list_unactive';
    	dotImgList[id][counterPro[id]].className = 'gallery_pos_list_active';
    }

    scrollPro[id].toElement(id+'_list_item_'+counterPro[id]);
}

function galleryGoTo( id, index ) {

    counterPro[id] = index;
    
    if ( itemsDescPro[id].length > 0 )
    itemsDescPro[id][index].setStyle( 'display', 'none' );

    $$('#'+ id +'_pos_list .gallery_pos_list_active')[0].className = 'gallery_pos_list_unactive';
    dotImgList[id][index].className = 'gallery_pos_list_active';

    scrollPro[id].toElement(id+'_list_item_'+index);
}

function galleryPrev( id ) {

    if ( itemsDescPro[id].length > 0 )
    	itemsDescPro[id][counterPro[id]].setStyle( 'display', 'none' );
    
    counterPro[id]--;
    
    if ( counterPro[id] < 0 )
        counterPro[id] = countPro[id] ;

    if ( counterPro[id] < 0 )
        counterPro[id] = 0;

    if ( $$('#'+ id +'_pos_list .gallery_pos_list_active').length > 0 ) {
	    $$('#'+ id +'_pos_list .gallery_pos_list_active')[0].className = 'gallery_pos_list_unactive';
	    dotImgList[id][counterPro[id]].className = 'gallery_pos_list_active';
    }

    scrollPro[id].toElement(id+'_list_item_'+counterPro[id]);
}

function galleryInterval(){
	if( !isNaN(slideshowInterval) ) clearInterval( slideshowInterval );
	slideshowInterval = setInterval( galleryIntervalShow, slideshowTime );
}

function galleryIntervalShow(){
	galleryNext(  'gallery'  );
}


