window.addEvent("load",function(){ $$(".gk_is_wrapper-template").each(function(el){ if(!el.hasClass('activated')) { el.addClass('activated'); var elID = el.getProperty("id"); var wrapper = $(elID); var $G = $Gavick[elID]; var slides = []; var contents = []; var loadedImages = false; var btns = false; var btns_fx = false; var show_btns = false; var hovers = false; var hovers_fx = false; if(window.webkit) wrapper.getElement('.gk_is_content').setStyles({"margin-left":0,"margin-right":0}); wrapper.getElements('.gk_is_content').setStyle('overflow',"hidden"); wrapper.getElement('.gk_is_content').setStyle('height',wrapper.getSize().size.y+"px"); wrapper.getElements('.gk_is_art').removeClass('gk_unvisible'); wrapper.getElements('.gk_is_art').setOpacity(0); wrapper.getElement('.gk_is_art').setOpacity(1); switch($G['anim_type']){ case 'opacity': break; case 'top': wrapper.getElements('.gk_is_art').setStyle('margin-top',(-1) * wrapper.getSize().size.y); wrapper.getElement('.gk_is_art').setStyle('margin-top',0); break; case 'bottom': wrapper.getElements('.gk_is_art').setStyle('margin-top', wrapper.getSize().size.y); wrapper.getElement('.gk_is_art').setStyle('margin-top', 0); break; } if(wrapper.getElement('.gk_is_prev')) { btns = [wrapper.getElement('.gk_is_prev'),wrapper.getElement('.gk_is_next')]; hovers = [wrapper.getElement('.gk_is_prev div'), wrapper.getElement('.gk_is_next div')]; btns_fx = [new Fx.Style(btns[0],'opacity',{duration:350}),new Fx.Style(btns[1],'opacity',{duration:350})]; hovers[0].setStyle("display","block"); hovers[1].setStyle("display","block"); hovers_fx = [new Fx.Style(hovers[0],'opacity',{duration:200}).set(0),new Fx.Style(hovers[1],'opacity',{duration:200}).set(0)]; btns[0].addEvent("mouseenter", function(){hovers_fx[0].start(1);}); btns[0].addEvent("mouseleave", function(){hovers_fx[0].start(0);}); btns[1].addEvent("mouseenter", function(){hovers_fx[1].start(1);}); btns[1].addEvent("mouseleave", function(){hovers_fx[1].start(0);}); if(window.getWidth() < wrapper.getSize().size.x + 80){ btns[0].setStyles({'left': '10px', 'z-index' : 100}); btns[1].setStyles({'right': '10px','z-index' : 100}); } } var imagesToLoad = []; if(btns && btns[0].hasClass('anim')){ btns_fx[0].set(0); btns_fx[1].set(0); wrapper.addEvent("mousemove",function(){ show_btns = true }); [wrapper.getElement('.gk_is_prev'), wrapper.getElement('.gk_is_next'), wrapper].each(function(el){ el.addEvent("mouseenter", function(){ show_btns = true; btns_fx[0].start(1); btns_fx[1].start(1); }); }); [wrapper.getElement('.gk_is_prev'), wrapper.getElement('.gk_is_next'), wrapper].each(function(el){ el.addEvent("mouseleave", function(){ show_btns = false; (function(){ if(show_btns == false){ btns_fx[0].start(0); btns_fx[1].start(0); } }).delay(1000); }); }); } wrapper.getElements('.gk_is_slide').each(function(el,i){ var newImg = new Element('img',{ "title":el.getProperty('title'), "class":el.getProperty('class'), "style":el.getProperty('style') }); newImg.setProperty("src",el.innerHTML.replace('&','&' ).replace('&','&' ).replace('&','&' )); imagesToLoad.push(newImg); newImg.injectAfter(el); el.remove(); }); var time = (function(){ var process = 0; imagesToLoad.each(function(el,i){ if(el.complete) process++; }); if(process == imagesToLoad.length){ $clear(time); loadedImages = process; (function(){new Fx.Style(wrapper.getElement('.gk_is_preloader'),'opacity').start(1,0);}).delay(400); } }).periodical(200); var time_main = (function(){ if(loadedImages){ $clear(time_main); wrapper.getElements(".gk_is_slide").each(function(elmt,i){ slides[i] = elmt; }); slides.each(function(el,i){ if(i != 0) el.setOpacity(0); }); $G['actual_slide'] = 0; if(wrapper.getElement('.gk_is_list')) wrapper.getElement('.gk_is_list ul li').setProperty("class", "active"); if($G['autoanimation']){ $G['actual_animation'] = (function(){ gk_is_style1_anim(wrapper, contents, slides, $G['actual_slide']+1, $G); }).periodical($G['anim_interval']+$G['anim_speed']); } if(btns){ btns[0].addEvent("click", function(){ $clear($G['actual_animation']); gk_is_style1_anim(wrapper, contents, slides, $G['actual_slide']-1, $G); if($G['autoanimation']){ $G['actual_animation'] = (function(){ gk_is_style1_anim(wrapper, contents, slides, $G['actual_slide']+1, $G); }).periodical($G['anim_interval']+$G['anim_speed']); } }); btns[1].addEvent("click", function(){ $clear($G['actual_animation']); gk_is_style1_anim(wrapper, contents, slides, $G['actual_slide']+1, $G); if($G['autoanimation']){ $G['actual_animation'] = (function(){ gk_is_style1_anim(wrapper, contents, slides, $G['actual_slide']+1, $G); }).periodical($G['anim_interval']+$G['anim_speed']); } }); } if(wrapper.getElement('.gk_is_list')){ wrapper.getElements('.gk_is_list li').each(function(el,i){ el.addEvent("click", function(){ $clear($G['actual_animation']); gk_is_style1_anim(wrapper, contents, slides, i, $G); if($G['autoanimation']){ $G['actual_animation'] = (function(){ gk_is_style1_anim(wrapper, contents, slides, $G['actual_slide']+1, $G); }).periodical($G['anim_interval']+$G['anim_speed']); } }); }); } } }).periodical(250); } }); }); function gk_is_style1_anim(wrapper, contents, slides, which, $G){ if(which != $G['actual_slide']){ var max = slides.length-1; if(which > max) which = 0; if(which < 0) which = max; var actual = $G['actual_slide']; $G['actual_slide'] = which; slides[$G['actual_slide']].setStyle("z-index",max+1); new Fx.Style(slides[actual],'opacity',{duration: $G['anim_speed']}).start(1,0); new Fx.Style(slides[which],'opacity',{duration: $G['anim_speed']}).start(0,1); var text_fx1 = new Fx.Style(wrapper.getElements('.gk_is_art')[actual],'opacity',{duration: $G['anim_speed'] / 2}); var text_fx2 = new Fx.Style(wrapper.getElements('.gk_is_art')[which],'opacity',{duration: $G['anim_speed'] / 2}); text_fx1.start(1,0); text_fx2.start(0,1); switch($G['anim_type']){ case 'opacity': break; case 'top': new Fx.Style(wrapper.getElements('.gk_is_art')[actual],'margin-top',{duration: 0.25 * $G['anim_speed'], transitions:Fx.Transitions.Circ.easeOut}).start(0, wrapper.getSize().size.y);break; case 'bottom': new Fx.Style(wrapper.getElements('.gk_is_art')[actual],'margin-top',{duration: 0.25 * $G['anim_speed'], transitions:Fx.Transitions.Circ.easeOut}).start(0, (-1) * wrapper.getSize().size.y);break; } switch($G['anim_type']){ case 'opacity': break; case 'top': new Fx.Style(wrapper.getElements('.gk_is_art')[which],'margin-top',{duration: 0.75 * ($G['anim_speed']), transitions:Fx.Transitions.Circ.easeOut}).start((-1)*wrapper.getSize().size.y,0);break; case 'bottom': new Fx.Style(wrapper.getElements('.gk_is_art')[which],'margin-top',{duration: 0.75 * ($G['anim_speed']), transitions:Fx.Transitions.Circ.easeOut}).start(wrapper.getSize().size.y,0);break; } text_fx1.start(0,1); if(wrapper.getElement('.gk_is_list')){ wrapper.getElements('.gk_is_list ul li').setProperty("class", ""); wrapper.getElements('.gk_is_list ul li')[which].setProperty("class", "active"); } (function(){slides[$G['actual_slide']].setStyle("z-index",$G['actual_slide']);}).delay($G['anim_speed']); } }