var Shop = {
start : function(){
if($('sliderGallery')) Shop.makeScrollbar( $('sliderGallery'), $('slider'), $('handle'), true );
if($('browser')) Shop.loadBrowser();
if (!Browser.Engine.trident) {
if($('cartselect')) Shop.initPrice();
Shop.Tiptoes();
}
else {
if (!Browser.Engine.trident4) {
Shop.Tiptoes();
}
if($('cartselect') && $('country')){
dynSelect('country', 'itemid', 'specs');
}
}
Shop.setUpScrollAnchors();
if($('btn_buy')) Shop.buy();
//if($$('.cartdelete')) Shop.RemoveCartLine();
SqueezeBox.assign($$('a.squickboxed'), {
parse : 'rel'
});
},
initFlash : function(url, width, height) {
if (Browser.Plugins.Flash.version <8) {
$('checkFlash').set('html', 'Upgrade your flash player');
$('checkFlash').addClass('warn');
$('linkFlash').addEvent('click', function(e) {
e.stop();
$('checkFlash').setStyles({'font-size': '110%', 'color':'#fff'});
});
}
else {
SqueezeBox.assign($$('a.flashboxed'), {
parse : 'rel'
});
var so= new Swiff (url, {
id:'preflash',
width:width,
height:height,
container: $('previewer'),
params : {
wmode: 'transparent'
}
});
}
},
PlayFlash : function (url, width, height) {
if (Browser.Plugins.Flash.version <8) {
$('checkFlash').set('html', 'Upgrade your flash player');
$('checkFlash').addClass('warn');
$('linkFlash').addEvent('click', function(e) {
e.stop();
$('checkFlash').setStyles({'font-size': '110%', 'color':'#fff'});
});
}
else {
$('loadFlash').addEvent('click', function() {
var so2= new Swiff (url, {
id:'flashzoom',
width:width,
height:height,
container: $('viewer'),
params : {
wmode: 'transparent',
bgcolor:'#2b2c2b'
}
});
});
}
},
PlayQuick : function (url, width, height) {
$$('a.').addEvent('click', function() {
var so2= new sQuick (url, {
id:'quickzoom',
width:194,
height:515,
container: $('viewer'),
messenger: $('checkQuick'),
params : {
autostart: 'true',
src: url,
controller: 'true'
}
});
});
},
setUpScrollAnchors: function(){
$$('a.scroollers').each(function(lnk) {
if(lnk.href.test("#")) {
lnk.addEvent('click', function(){
this.scrollTo(lnk.href.split('#')[1]);
}.bind(this));
}
}, this);
},
Load: function() {
this.initialize();
this.element = $(el);
if (this.element && this.element.rel) options = $merge(options || {}, Json.evaluate(this.element.rel));
this.setOptions(this.presets, options);
this.assignOptions();
this.url = (this.element ? (this.options.url || this.element.href) : el) || '';
if (this.options.handler) {
var handler = this.options.handler;
return this.setContent(handler, this.parsers[handler].call(this, true));
}
var res = false;
for (var key in this.parsers) {
if ((res = this.parsers[key].call(this))) return this.setContent(key, res);
}
return this;
},
Tiptoes : function() {
var regExpressionNonObj= /;;/g;
$$('a.tipz').each(function(element,index) {
var content=element.get('title');
if(content) {
var content=content.replace(regExpressionNonObj, '
');
var content = content.split('::');
element.store('tip:title', content[0]);
element.store('tip:text', content[1]);
}
});
//create the tooltips
var tipz = new Tips('.tipz',{
className: 'tipz',
fixed: false,
offsets:{'x':10, 'y':-120},
hideDelay: 50,
showDelay: 50
});
tipz.addEvents({
'show': function(tip) {
tip.fade('in');
},
'hide': function(tip) {
tip.fade('out');
}
});
},
FadeAllFins :function() {
//init or if step 0
var fins = $$("#sliderGallery li img");
fins.each(function(el, i){
el.fade(.2);
}, this);
},
LightFins:function(position) {
//console.log(position)
var formulas = $$("#sliderGallery li img.formula");
var freeraces = $$("#sliderGallery li img.freerace");
var slaloms = $$("#sliderGallery li img.slalom");
var speeds = $$("#sliderGallery li img.speed");
var bumps = $$("#sliderGallery li img.bump");
var freestyles = $$("#sliderGallery li img.freestyle");
var waves = $$("#sliderGallery li img.wave");
var antiweeds = $$("#sliderGallery li img.antiweed");
// first fade all fins //
Shop.FadeAllFins();
// then light fins according to position
// formulas
if( position < 80) {
var thisformula=$$(".formula");
var fifties = $$("#sliderGallery li img.formula.freerace");
//console.log(fifties);
var freeraces = $$("#sliderGallery li img.freerace");
freeraces.each(function(el, i){
el.fade(0.3);
}, this);
formulas.each(function(el, i){
el.fade(1);
el.morph('.formula-hover');
}, this);
}
// freerace middle pos=253
if(position >= 80 && position < 255) {
formulas.each(function(el, i){
el.fade(0.3);
el.morph('.formula');
}, this);
freeraces.each(function(el, i){
el.fade(1);
el.morph('.freerace-hover');
}, this);
}
// slalom middle pos=667
if(position >= 255 && position < 480) {
formulas.each(function(el, i){
el.morph('.formula');
el.fade(.3);
}, this);
freeraces.each(function(el, i){
el.morph('.freerace');
el.fade(.3);
}, this);
speeds.each(function(el, i){
el.morph('.speed');
el.fade(.3);
}, this);
slaloms.each(function(el, i){
el.morph('.slalom-hover');
el.fade(1);
}, this);
}
// speed middle pos=970
if(position >= 480 && position < 720) {
formulas.each(function(el, i){
el.morph('.formula');
el.fade(.3);
}, this);
freeraces.each(function(el, i){
el.morph('.freerace');
el.fade(.3);
}, this);
slaloms.each(function(el, i){
el.morph('.slalom');
el.fade(.3);
}, this);
speeds.each(function(el, i){
el.morph('.speed-hover');
el.fade(1);
}, this);
}
// bump middle pos=1516
if(position>720 && position<=810 ) {
formulas.each(function(el, i){
el.morph('.formula');
el.fade(.3);
}, this);
freeraces.each(function(el, i){
el.morph('.freerace');
el.fade(.3);
}, this);
slaloms.each(function(el, i){
el.morph('.slalom');
el.fade(.3);
}, this);
speeds.each(function(el, i){
el.morph('.speed');
el.fade(.3);
}, this);
freestyles.each(function(el, i){
el.fade(.3);
el.morph('.freestyle');
}, this);
waves.each(function(el, i){
el.fade(.3);
el.morph('.wave');
}, this);
antiweeds.each(function(el, i){
el.fade(.3);
el.morph('.antiweed');
}, this);
bumps.each(function(el, i){
el.fade(1);
el.morph('.bump-hover');
}, this);
}
// freestyl middle pos=1734
if(position>810 && position<=980 ) {
formulas.each(function(el, i){
el.morph('.formula');
el.fade(.3);
}, this);
freeraces.each(function(el, i){
el.morph('.freerace');
el.fade(.3);
}, this);
slaloms.each(function(el, i){
el.morph('.slalom');
el.fade(.3);
}, this);
speeds.each(function(el, i){
el.morph('.speed');
el.fade(.3);
}, this);
bumps.each(function(el, i){
el.fade(.3);
el.morph('.bump');
}, this);
waves.each(function(el, i){
el.fade(.3);
el.morph('.wave');
}, this);
antiweeds.each(function(el, i){
el.fade(.3);
el.morph('.antiweed');
}, this);
freestyles.each(function(el, i){
el.fade(1);
el.morph('.freestyle-hover');
}, this);
}
// wave
if(position>980 && position<=1150 ) {
formulas.each(function(el, i){
el.morph('.formula');
el.fade(.3);
}, this);
freeraces.each(function(el, i){
el.morph('.freerace');
el.fade(.3);
}, this);
slaloms.each(function(el, i){
el.morph('.slalom');
el.fade(.3);
}, this);
speeds.each(function(el, i){
el.morph('.speed');
el.fade(.3);
}, this);
bumps.each(function(el, i){
el.fade(.3);
el.morph('.bump');
}, this);
freestyles.each(function(el, i){
el.fade(.3);
el.morph('.freestyle');
}, this);
waves.each(function(el, i){
el.fade(1);
el.morph('.wave-hover');
}, this);
antiweeds.each(function(el, i){
el.fade(.3);
el.morph('.antiweed');
}, this);
}
// wave
if(position>1150 ) {
formulas.each(function(el, i){
el.morph('.formula');
el.fade(.3);
}, this);
freeraces.each(function(el, i){
el.morph('.freerace');
el.fade(.3);
}, this);
slaloms.each(function(el, i){
el.morph('.slalom');
el.fade(.3);
}, this);
speeds.each(function(el, i){
el.morph('.speed');
el.fade(.3);
}, this);
bumps.each(function(el, i){
el.fade(.3);
el.morph('.bump');
}, this);
freestyles.each(function(el, i){
el.fade(.3);
el.morph('.freestyle');
}, this);
waves.each(function(el, i){
el.fade(.3);
el.morph('.wave-hover');
}, this);
antiweeds.each(function(el, i){
el.fade(1);
el.morph('.antiweed');
}, this);
}
/*
*/
},
makeScrollbar :function(content,scrollbar,handle,horizontal,ignoreMouse){
//var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
//var steps = getScrollSize($('sliderGallery ul')).x ;
//var steps = 1482 ;
// let's deal with this damned IE6
var steps = 1380 ;
//var steps = 2025 ;
var slider = new Slider(scrollbar, handle, {
steps: steps,
mode: (horizontal?'horizontal':'vertical'),
onChange: function(step){
// Scrolls the content element in x or y direction.
var x = (horizontal?step:0);
var y = (horizontal?0:step);
//console.log(x);
content.scrollTo(x,y);
if (!Browser.Engine.trident4) {
Shop.FadeAllFins();
Shop.LightFins(x);
}
}
}).set(0);
if( !(ignoreMouse) ){
// Scroll the content element when the mousewheel is used within the
// content or the scrollbar element.
$$(content, scrollbar).addEvent('mousewheel', function(e){
e = new Event(e).stop();
var step = slider.step - e.wheel * 30;
slider.set(step);
});
}
// Stops the handle dragging process when the mouse leaves the document body.
$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
var programs = $$("#slider span");
var autostep= 0;
var slideformula = new Fx.Tween($('slider-formula'));
var slidefreerace = new Fx.Tween($('slider-freerace'));
var slideslalom = new Fx.Tween($('slider-slalom'));
var slidespeed = new Fx.Tween($('slider-speed'));
var slidebump = new Fx.Tween($('slider-bump'));
var slidefreestyle = new Fx.Tween($('slider-freestyle'));
var slidewave = new Fx.Tween($('slider-wave'));
$('slider-formula').addEvent('click', function(e) {
// We change the background-color of the element
slideformula.start('color', '#003366');
slidefreerace.start('color', '#fff');
slideslalom.start('color', '#fff');
slidespeed.start('color', '#fff');
slidebump.start('color', '#fff');
slidefreestyle.start('color', '#fff');
slidewave.start('color', '#fff');
});
$('slider-freerace').addEvent('click', function(e) {
// We change the background-color of the element
slideformula.start('color', '#fff');
slidefreerace.start('color', '#0A284F');
slideslalom.start('color', '#fff');
slidespeed.start('color', '#fff');
slidebump.start('color', '#fff');
slidefreestyle.start('color', '#fff');
slidewave.start('color', '#fff');
});
$('slider-slalom').addEvent('click', function(e) {
// We change the background-color of the element
slideformula.start('color', '#fff');
slidefreerace.start('color', '#fff');
slideslalom.start('color', '#1555A1');
slidespeed.start('color', '#fff');
slidebump.start('color', '#fff');
slidefreestyle.start('color', '#fff');
slidewave.start('color', '#fff');
});
$('slider-speed').addEvent('click', function(e) {
// We change the background-color of the element
slideformula.start('color', '#fff');
slidefreerace.start('color', '#fff');
slideslalom.start('color', '#fff');
slidespeed.start('color', '#12155A');
slidebump.start('color', '#fff');
slidefreestyle.start('color', '#fff');
slidewave.start('color', '#fff');
});
$('slider-bump').addEvent('click', function(e) {
// We change the background-color of the element
slideformula.start('color', '#fff');
slidefreerace.start('color', '#fff');
slideslalom.start('color', '#fff');
slidespeed.start('color', '#fff');
slidebump.start('color', '#E56B12');
slidefreestyle.start('color', '#fff');
slidewave.start('color', '#fff');
});
$('slider-freestyle').addEvent('click', function(e) {
// We change the background-color of the element
slideformula.start('color', '#fff');
slidefreerace.start('color', '#fff');
slideslalom.start('color', '#fff');
slidespeed.start('color', '#fff');
slidebump.start('color', '#fff');
slidefreestyle.start('color', '#F3A416');
slidewave.start('color', '#fff');
});
$('slider-wave').addEvent('click', function(e) {
// We change the background-color of the element
slideformula.start('color', '#fff');
slidefreerace.start('color', '#fff');
slideslalom.start('color', '#fff');
slidespeed.start('color', '#fff');
slidebump.start('color', '#fff');
slidefreestyle.start('color', '#fff');
slidewave.start('color', '#FCD718');
});
/*
programs.each(function(el, i){
if (programs.hasClass('slider-formula'))
autostep=0;
if (programs.hasClass('slider-freerace'))
autostep=229;
if (programs.hasClass('slider-slalom'))
autostep=525;
if (programs.hasClass('slider-speed'))
autostep=682;
if (programs.hasClass('slider-sx'))
autostep=806;
if (programs.hasClass('slider-bump'))
autostep=942;
if (programs.hasClass('slider-freestyle'))
autostep=1152;
if (programs.hasClass('slider-wave'))
autostep=1352;
el.addEvent('click', function(e) {
slider.set(autostep);
});
}, this);
*/
},
CartAccept:function() {
var acceptlbl=$('accept');
var is_checked=$('acceptance').checked;
if(is_checked == false) {
alert('You should accept Terms and Conditions of Sale');
return false;
}
else {
$('lost').submit();
}
},
UpdatePrice : function(countryval, items, specs, itemoptions, specoptions) {
// let's write the php euro list
var expeuro = $('zoneuro'), expworld = $('zoneworld');
var listeuro = new Array('DE','AT','BE','ES','FI','FR','GR','IE','IT','LU','NL','PT','HU','PL','CY','CZ','DK','LV','GB','LT','SK','EE','SI','MT','SE','MC'); var i, j;
// let's init the list to the single first option
for(i=(itemoptions.length - 1); i>=1; i--){
items.remove(i);
}
for(j=(specoptions.length - 1); j>=1; j--){
specs.remove(j);
}
if(countryval==0) {
expeuro.setStyles({'display' : 'none', 'opacity': 0});
expworld.setStyles({'display' : 'none', 'opacity': 0});
for (var i = 0; i < itemoptions.length; i++) {
if (itemoptions[i].hasClass('select')) {
// Clone the option from the hidden option pool and append it to the dynamic select box
items.appendChild(itemoptions[i].cloneNode(true));
}
}
for (var j = 0; j < specoptions.length; j++) {
if (specoptions[j].hasClass('select')) {
// Clone the option from the hidden option pool and append it to the dynamic select box
specs.appendChild(specoptions[j].cloneNode(true));
}
}
}
else {
// let's inject according to country
if (new RegExp('^(' + listeuro.join('|') + ')$').test(countryval)) {
expworld.setStyles({'display' : 'none', 'opacity': 0});
expeuro.setStyles({'display' : 'block', 'opacity': 1});
for (var i = 0; i < itemoptions.length; i++) {
if (itemoptions[i].hasClass('euro')) {
// Clone the option from the hidden option pool and append it to the dynamic select box
items.appendChild(itemoptions[i].cloneNode(true));
}
}
for (var j = 0; j < specoptions.length; j++) {
if (specoptions[j].hasClass('euro')) {
// Clone the option from the hidden option pool and append it to the dynamic select box
specs.appendChild(specoptions[j].cloneNode(true));
}
}
// let's display the right notes about price
}
else {
expeuro.setStyles({'display' : 'none', 'opacity': 0});
expworld.setStyles({'display' : 'block', 'opacity': 1});
for (var i = 0; i < itemoptions.length; i++) {
if (itemoptions[i].hasClass('world')) {
// Clone the option from the hidden option pool and append it to the dynamic select box
items.appendChild(itemoptions[i].cloneNode(true));
}
}
for (var j = 0; j < specoptions.length; j++) {
if (specoptions[j].hasClass('world')) {
// Clone the option from the hidden option pool and append it to the dynamic select box
specs.appendChild(specoptions[j].cloneNode(true));
}
}
}
}
},
initPrice : function() {
var items = $('itemid'), specs = $('specs'), itemoptions=items.getElements('option'), specoptions=specs.getElements('option');
var selects = $('cartselect').getElements('select');
if(selects[0].id=='country') {
selects[0].addEvent('change', function(){
Shop.UpdatePrice(selects[0].value, items, specs, itemoptions, specoptions);
});
// let's init the function on domready
Shop.UpdatePrice(selects[0].value, items, specs, itemoptions, specoptions);
}
},
buy : function () {
// let's first hide the network stuff...
var formcart= $('formcart'), cartchooser=$('cartchooser'), buycontainer=$('buycontainer'), buys = $$(".buy");
var reduceblock = new Fx.Morph(buycontainer, {
duration: 1500,
link: 'chain'
});
var raisformcart = new Fx.Morph(formcart, {
duration: 500,
link: 'chain'
});
// change height value according to countrylist !
var selects = $('cartselect').getElements('select');
if(selects[0].id=='country') {
var raisheight=235;
var buyheight=210;
}
else {
var raisheight=135;
var buyheight=110;
}
var ShowCart = new Fx.Morph(buycontainer, {
duration: 750,
link: 'chain',
transition: 'quad:in',
onStart: function() {
buys.each(function(el, i){
el.fade(0);
}, this);
reduceblock.start({
opacity: [1, 0],
height: [buycontainer.getStyle('height'), buyheight]
});
},
onComplete: function() {
buycontainer.setStyles({'height': '0', 'display':'none'});
formcart.setStyles({'height': raisheight,'opacity': '0', 'display':'block'});
raisformcart.start({
height: ['150', raisheight],
opacity: [0, 1]
});
}
});
$('btn_buy').addEvent('click', function() {
ShowCart.start();
});
},
loadBrowser : function() {
var browsebutts = $$(".browslnk");
// let's get cart amount
var rangebro=$('browser');
browsebutts.each(function(el, i){
el.addEvent('click', function(e) {
e.stop();
var browuri=el.getProperty("href");
if (browuri.search('='))
browuri=browuri+'&ajax=true';
else
browuri=browuri+'?ajax=true';
var initfx= new Fx.Morph($('browser'), {
transition:Fx.Transitions.Quint.easeOut,
duration:1000,
link:'chain',
onStart: function() {
rangebro.addClass('loading');
rangebro.fade(0);
}
});
var playfx= new Fx.Morph($('browser'), {
transition:Fx.Transitions.Quint.easeOut,
duration:1000,
link:'chain',
onChainComplete: function() {
// set style to browser //
var divcont= new Element('div', {'id':'divcont', 'class':'browserange'});
var scrolleft= new Element('div', {'id':'scrolleft'});
var scrollright= new Element('div', {'id':'scrollright'});
rangebro.adopt(divcont);
var req= new Request.HTML({
method: 'get',
url : browuri,
data: '' ,
update: divcont,
evalScripts: true,
onRequest : function () {
rangebro.addClass('loading');
},
onComplete: function() {
rangebro.removeClass('loading');
var myScroller = new Scroller(divcont, {area: 75, velocity: 1});
divcont.addEvent('mouseover', myScroller.start.bind(myScroller));
divcont.addEvent('mouseout', myScroller.stop.bind(myScroller));
if (!Browser.Engine.trident4) {
Shop.Tiptoes();
}
}
}).send();
}
});
initfx.start({
'opacity' : [1,0],
'background-color': '#000'
}).chain(function() {
rangebro.empty();
playfx.start({
'opacity' : [0,1],
'height' : [25, 260]
});
});
});
}, this);
},
AddtoCart : function(kind) {
// we should build both product combo of prodid / itemid / combid /price
// and we need to check if all elements needed are ok...
if ($('prodid'))
var prodid = $('prodid').value;
if(kind=='fins') {
var prodid= $('prodid'), itemid = $('itemid'), specs = $('specs'), country = $('country');
var itemide = true;
var specse = true;
if(country==null) {
var countrye = true;
}
else {
countrye=true;
if(country.value==0) {
country.addClass('warn');
countrye=false;
}
else {
country.removeClass('warn');
countrye=true;
}
}
if(itemid.value==0) {
itemid.addClass('warn');
itemide=false;
}
else {
itemid.removeClass('warn');
var itemide = true;
}
if(specs.value==0) {
specs.addClass('warn');
specse=false;
}
else {
specs.removeClass('warn');
specse=true;
}
if(!itemide || !specse || !countrye ) {
return false;
}
else {
// let's build specs...
$('product').value=itemid.value+'/'+specs.value;
$('cartselect').submit();
}
}
},
RemoveCartLine : function () {
var rembutts = $$(".cartdelete");
var countitems=rembutts.length;
// let's get cart amount
rembutts.each(function(el, i){
el.addEvent('click', function(e) {
e.stop();
//cart contains a single line
if(countitems==1) {
var cartable=$("cartable"), cartinfo=$("cartinfo"), boxcontainer=$("boxcontainer");
var trid= 'itemrow'+el.id.substr(6);
boxsize=boxcontainer.getSize();
var hidetable = new Fx.Morph(boxcontainer, {
duration: 750,
link: 'chain',
onStart: function() {
// let's hide table
cartable.fade(0);
},
onComplete: function() {
cartable.empty();
}
});
//Empty the log and show the spinning indicator.
//var log = $('log_res').empty().addClass('ajax-loading');
$('frmdel0').set('send', {
onComplete: function(response) {
// let's hide the table -reduce box container and update the cartinfo
hidetable.start({
height: [boxsize.y, 250]
}).chain(function(){
cartinfo.fade(0);
$("checkinfo").fade(0);
cartinfo.set('html', 'There are currently no item in your shopping cart. Add an item browsing our fins.');
cartinfo.fade(1);
});
}
});
//Send the form.
$('frmdel0').send();
}
// multiple lines case
else {
// setting vars
var subtotal=$("subtotal"), total=$("total"), ship=$("ship"), itemtot = $$(".item rowtotal")
var subtotalhtml=subtotal.getProperty('html');
var shiphtml=ship.getProperty('html');
var totalhtml=total.getProperty('html');
// let's locate the right tr line...
var trid= 'itemrow'+el.id.substr(6);
var trvalue= 'itemtot'+el.id.substr(6);
var itemamount=$(trvalue).getProperty('html').substr(13).toInt();
var subtotalupdate = (subtotalhtml.substr(13)-itemamount);
//console.log(subtotalhtml+' ' +subtotalupdate);
var totalupdate = (totalhtml.substr(13)-itemamount);
var deletetr=$(trid);
var deleteform='frmdel'+el.id.substr(6)
// let's prepare the hightlights fx
var highlightTotal = new Fx.Morph(total, {
duration: 500,
link: 'cancel',
transition: 'quad:out'
});
var highlightSubTotal = new Fx.Morph(subtotal, {
duration: 500,
link: 'cancel',
transition: 'quad:out'
});
// let's reduce its height to 0 while fading it
var inCell= new Element('td', {
'id' :'emptycart',
'class' : 'head',
'colspan' : '4',
'text' : 'Your Cart is Empty',
'styles' : {
'text-align' : 'center'
}
});
var reducerow = new Fx.Morph(deletetr, {
duration: 750,
link: 'chain',
onComplete: function() {
highlightTotal.start({
backgroundColor: ['#fff36f', '#fff'],
opacity: [1, 0]
});
highlightSubTotal.start({
backgroundColor: ['#fff36f', '#fff'],
opacity: [1, 0]
});
subtotal.setProperty('html', '');
total.setProperty('html', '');
},
onChainComplete : function() {
// let's empty the row from cells and inject a empty cart row
deletetr.empty();
inCell.inject(deletetr, 'top');
subtotal.setProperty('html', ' € '+subtotalupdate);
total.setProperty('html', ' € '+totalupdate);
highlightSubTotal.start({
backgroundColor: ['#fff36f', '#fff'],
opacity: [0, 1]
});
highlightTotal.start({
backgroundColor: ['#fff36f', '#fff'],
opacity: [0, 1]
});
}
});
/*
reducerow.start({
opacity: [0, 1]
});
*/
// submit the form via ajax
$(deleteform).set('send', {
onComplete: function(response) {
// let's hide the table -reduce box container and update the cartinfo
reducerow.start({
opacity: [1, 0],
display: ['block', 'none']
}) ;
}
});
//Send the form.
$(deleteform).send();
// return the right params to update the cart
} // end else multiple cart lines
});
}, this);
}
};
window.addEvent('domready', function() {
Shop.start();
});
function dynSelect(id1, id2, id3) {
// based on bobby van der luis unobtrusive dynamic select boxes
// http://www.bobbyvanderluis.com
// Browser and feature tests to see if there is enough W3C DOM support
var agt = navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_mac = (agt.indexOf("mac") != -1);
if (!(is_ie && is_mac) && document.getElementById && document.getElementsByTagName) {
// Obtain references to select boxes
var sel1 = document.getElementById(id1);
var sel2 = document.getElementById(id2);
var sel3 = document.getElementById(id3);
// Clone the dynamic select box
var clone2 = sel2.cloneNode(true);
// Obtain references to all cloned options
var cloned2Options = clone2.getElementsByTagName("option");
var clone3 = sel3.cloneNode(true);
var cloned3Options = clone3.getElementsByTagName("option");
// Onload init: call a generic function to display the related options in the dynamic select box
refreshdynSelectOptions(sel1, sel2, sel3, cloned2Options, cloned3Options, "init");
// Onchange of the main select box: call a generic function to display the related options in the dynamic select box
sel1.onchange = function() {
refreshdynSelectOptions(sel1, sel2, sel3, cloned2Options, cloned3Options, "sel1");
};
}
}
function refreshdynSelectOptions(sel1, sel2, sel3, clonedOptions, cloned3Options, action) {
var expeuro = $('zoneuro'); var expworld = $('zoneworld');
while (sel2.options.length) {
sel2.remove(0);
}
while (sel3.options.length) {
sel3.remove(0);
}
var listeuroo = new Array('DE','AT','BE','ES','FI','FR','GR','IE','IT','LU','NL','PT','HU','PL','CY','CZ','DK','LV','GB','LT','SK','EE','SI','MT','SE','MC'); var pattern1 = /( |^)(select)( |$)/;
// Iterate through all cloned options
if(action=="init" || sel1.options[sel1.selectedIndex].value==0 ) {
expeuro.setStyles({'display' : 'none', 'opacity': 0});
expworld.setStyles({'display' : 'none', 'opacity': 0});
for (var i = 0; i < clonedOptions.length; i++) {
if (clonedOptions[i].className.match(pattern1) ) {
sel2.appendChild(clonedOptions[i].cloneNode(true));
}
}
for (var j = 0; j < cloned3Options.length; j++) {
if (cloned3Options[j].className.match(pattern1)) {
sel3.appendChild(cloned3Options[j].cloneNode(true));
}
}
}
else {
if (new RegExp('^(' + listeuroo.join('|') + ')$').test(sel1.options[sel1.selectedIndex].value)) {
expworld.setStyles({'display' : 'none', 'opacity': 0});
expeuro.setStyles({'display' : 'block', 'opacity': 1});
for (var i = 0; i < clonedOptions.length; i++) {
if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match('euro')) {
sel2.appendChild(clonedOptions[i].cloneNode(true));
}
}
for (var j = 0; j < cloned3Options.length; j++) {
if (cloned3Options[j].className.match(pattern1) || cloned3Options[j].className.match('euro')) {
sel3.appendChild(cloned3Options[j].cloneNode(true));
}
}
}
else {
expeuro.setStyles({'display' : 'none', 'opacity': 0});
expworld.setStyles({'display' : 'block', 'opacity': 1});
for (var i = 0; i < clonedOptions.length; i++) {
if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match('world')) {
sel2.appendChild(clonedOptions[i].cloneNode(true));
}
}
for (var j = 0; j < cloned3Options.length; j++) {
if (cloned3Options[j].className.match(pattern1) || cloned3Options[j].className.match('world')) {
sel3.appendChild(cloned3Options[j].cloneNode(true));
}
}
}
}
}
var Perfoom = new Class({
Implements: [Options, Events],
options: {
url: null,
leftMargin: 0,
barMargin: 2,
barWidth: 150,
delay:500,
start: 0
},
initialize: function(options) {
this.setOptions(options);
$$('.performer').each(function(el) {
el.wrapper = el.getElement('.wrapper');
el.wrapper.removeClass('loading');
el.fill = el.getElement('.perfFill');
el.widthFx = new Fx.Tween(el.fill, {property:'width', duration: 'short'});
this.fillBar(this.options.start, el);
}.bind(this));
this.animate.delay(this.options.delay, this);
},
animate: function() {
$$('.performer').each(function(el) {
el.id = el.getAttribute('id');
el.wrapper = el.getElement('.wrapper');
el.offset = el.getPosition().x;
el.fill = el.getElement('.perfFill');
el.percentid = el.fill.getAttribute('id');
el.percent = el.percentid.substr(1).toInt();
el.widthFx = new Fx.Tween(el.fill, {property:'width', duration: 'long'});
this.fillBar(el.percent, el);
}.bind(this));
},
fillBar: function(percent, el) {
el.newFill = (percent/100)*((this.options.barWidth+this.options.barMargin)) + this.options.leftMargin;
el.widthFx.start(el.newFill);
}
});
var sQuick = new Class({
Implements: [Options],
options: {
id: null,
height: 1,
width: 1,
container: null,
messenger:null,
properties: {},
params: {
autostart: 'false'
}
},
toElement: function(){
return this.object;
},
initialize: function(path, options){
var detector = getQueryParamValue('detectqt');
var container = $(options.container);
if(isQTInstalled() || detector=='false') {
this.instance = 'sQuick' + $time();
this.setOptions(options);
options = this.options;
var id = this.id = options.id || this.instance;
var params = options.params, vars = options.vars;
var properties = $extend({height: options.height, width: options.width}, options.properties);
var self = this;
if (Browser.Engine.trident || Browser.Engine.webkit){
properties.classid = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
//params.movie = path;
} else {
properties.type = 'video/quicktime';
properties.data = path;
}
var build = '';
this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
}
else {
this.setOptions(options);
options = this.options;
var messenger = $(options.messenger);
messenger.set('html', 'Quicktime not available');
}
},
replaces: function(element){
element = $(element, true);
element.parentNode.replaceChild(this.toElement(), element);
return this;
},
inject: function(element){
$(element, true).appendChild(this.toElement());
return this;
}
});
function isQTInstalled (element) {
var qtInstalled = false;
qtObj = false;
if (navigator.plugins && navigator.plugins.length) {
for (var i=0; i < navigator.plugins.length; i++ ) {
var plugin = navigator.plugins[i];
if (plugin.name.indexOf("QuickTime") > -1) {
qtInstalled = true;
}
}
} else {
execScript('on error resume next: qtObj = IsObject(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1"))','VBScript');
qtInstalled = qtObj;
}
return qtInstalled;
}
function getQueryParamValue (param) {
var q = document.location.search;
var detectIndex = q.indexOf(param);
var endIndex = (q.indexOf("&", detectIndex) != -1) ? q.indexOf("&", detectIndex) : q.length;
if(q.length > 1 && detectIndex != -1) {
return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
} else {
return "";
}
}