/* TICKER FUNCTION */ function tickerBox (trackId,size,direction,tag,duration,wait) { var ticker_children = $(trackId).getChildren(tag); var array_length = parseInt(ticker_children.length)-1; var firstBorn = ticker_children[0]; var lastBorn = ticker_children[array_length]; // only animate if the items are bigger than the container if (direction=='h') { var containerSize = $(trackId).getParent().getStyle('width'); } else { var containerSize = $(trackId).getParent().getStyle('height'); } containerSize = containerSize.replace("px", ""); containerSize = parseInt(containerSize); //alert('dir:' + direction + '\n container size:' + containerSize + '\n track size: ' + array_length*size + '(' + (array_length+1) + 'x' + size + ')'); if (containerSize>0 && (array_length+1)*size<=containerSize) { //alert(array_length + ' = ' +containerSize + ' | ' + (array_length+1)*size); return false; } // animate the transition var myEffect = new Fx.Morph(firstBorn, {duration: duration}); if (direction=='h') { myEffect.start({ 'opacity': [1, 0], 'margin-left': [0, -size] }); } else { myEffect.start({ 'opacity': [1, 0], 'margin-top': [0, -size] }); } // clone the element to the end (function() { var cloneBorn = firstBorn.clone().injectAfter(lastBorn); cloneBorn.setStyle('opacity',1); if (direction=='h') { cloneBorn.setStyle('margin-left',0); } else { cloneBorn.setStyle('margin-top',0); } firstBorn.dispose(); }).delay(duration); // set off again (function() {tickerBox(trackId,size,direction,tag,duration,wait)}).delay(wait); } function tickerBoxInit (trackId,size,direction,tag,duration,wait,initialWait) { if (!direction) { var direction = 'h'; } if (!tag) { var tag = 'a'; } if (!duration) { var duration = 500; } if (!wait) { var wait = 7000; } if (!initialWait) { var initialWait = wait; } (function() {tickerBox(trackId,size,direction,tag,duration,wait)}).delay(initialWait); } /* OFFSITE LINKS */ function offsite () { var agree=confirm("You are about to leave the Suzuki website.\nDo you wish to continue?"); if (agree) { return true; } else { return false; } } /* CLICK ON POSTCODE */ function clickon (form,field,label) { var thisform = document.forms[form]; var fieldvalue = thisform.elements[field].value; if (fieldvalue==label) { thisform.elements[field].value = ''; } else if (fieldvalue=='') { thisform.elements[field].value = label; } } /* LANGUAGE NAVI MENU */ window.addEvent('domready', function() { var lang_height = $('nav_lang').getSize().y; $('nav_lang').setStyle('height','30px'); $('nav_lang').addEvents({ 'mouseleave' : function() { var blindUp = new Fx.Morph($('nav_lang'),{ 'duration':'200' }); blindUp.start({ 'height':30 }); }, 'mouseenter' : function() { var blindDwn = new Fx.Morph($('nav_lang'),{ 'duration':'200' }); blindDwn.start({ 'height':lang_height }); } }); }) /*IMAGE POP-UP SCRIPT */ function photoListInit() { $each($$('.photo_child'), function(el) { el.addEvents({ 'mouseenter' : function() { $$('.photo_child_pop').dispose(); var coords = el.getCoordinates(); var clone = el.clone(); clone.setProperties({ 'id':'imagePop', 'class':'photo_child_pop' }) clone.setStyles({ 'float':'none', 'position':'absolute', 'top':coords.top-15, 'left':coords.left-((160-coords.width)/2)-15, 'padding-top':'15px', 'padding-bottom':'10px', 'z-index':1000, 'opacity':0 }); clone.injectAfter($('container1')); var fadeInFx = new Fx.Tween(clone,{duration:200}); fadeInFx.start('opacity', 0, 0.95); Mediabox.scanPage(); clone.addEvents({ 'mouseleave' : function() { clone.dispose(); } }) $$('.imagepop_close').addEvents({ 'click' : function(evt) { new Event(evt).stop(); clone.dispose(); } }) } }); }) } window.addEvent('domready', function() { if ($$('.photo_child').length<1) { return false; } photoListInit(); })