/*****************************************************************************
It is adviced to place the sIFR JavaScript calls in this file, keeping it
separate from the `sifr.js` file. That way, you can easily swap the `sifr.js`
file for a new version, while keeping the configuration.

You must load this file *after* loading `sifr.js`.

That said, you're of course free to merge the JavaScript files. Just make sure
the copyright statement in `sifr.js` is kept intact.
*****************************************************************************/

// Make an object pointing to the location of the Flash movie on your web server.
// Try using the font name as the variable name, makes it easy to remember which
// object you're using. As an example in this file, we'll use Futura.
// var futura = { src: '/path/to/futura.swf' };

// Now you can set some configuration settings.
// See also <http://wiki.novemberborn.net/sifr3/JavaScript+Configuration>.
// One setting you probably want to use is `sIFR.useStyleCheck`. Before you do that,
// read <http://wiki.novemberborn.net/sifr3/DetectingCSSLoad>.

// sIFR.useStyleCheck = true;

// Next, activate sIFR:
// sIFR.activate(futura);

// If you want, you can use multiple movies, like so:
//
//    var futura = { src: '/path/to/futura.swf' };
//    var garamond = { src '/path/to/garamond.swf' };
//    var rockwell = { src: '/path/to/rockwell.swf' };
//    
//    sIFR.activate(futura, garamond, rockwell);
//
// Remember, there must be *only one* `sIFR.activate()`!

// Now we can do the replacements. You can do as many as you like, but just
// as an example, we'll replace all `<h1>` elements with the Futura movie.
// 
// The first argument to `sIFR.replace` is the `futura` object we created earlier.
// The second argument is another object, on which you can specify a number of
// parameters or "keyword arguemnts". For the full list, see "Keyword arguments"
// under `replace(kwargs, mergeKwargs)` at 
// <http://wiki.novemberborn.net/sifr3/JavaScript+Methods>.
// 
// The first argument you see here is `selector`, which is a normal CSS selector.
// That means you can also do things like '#content h1' or 'h1.title'.
//
// The second argument determines what the Flash text looks like. The main text
// is styled via the `.sIFR-root` class. Here we've specified `background-color`
// of the entire Flash movie to be a light grey, and the `color` of the text to
// be red. Read more about styling at <http://wiki.novemberborn.net/sifr3/Styling>.
// sIFR.replace(futura, {
//   selector: 'h1',
//   css: '.sIFR-root { background-color: #F9F9F9; color: #FF0000; }'
// });

var gotham_light = { src: '/flash/gotham-light(3).swf' };

sIFR.domains = ['leiras.codesign.fi', 'leiras.fi', 'www.leiras.fi'];

sIFR.useStyleCheck = true;
sIFR.forceClear = true;
sIFR.activate(gotham_light);
sIFR.useDomLoaded = true;

sIFR.replace(gotham_light, {
  selector: 'div#Tyopaikka div#Tuote-haku-sivu h1'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '22px', 'line-height': '36px', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
});
sIFR.replace(gotham_light, {
  selector: 'div#Tuote-haku-sivu div#WrapperRightContentLeftTuote-Haku h1'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '30px', 'line-height': '36px', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
});
sIFR.replace(gotham_light, {
  selector: 'div#AjankohtaistaUutiset h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '22px', 'line-height': '36px', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#WrapperRightContentLeft div#Uusimmat_tiedotteet h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#tabs h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});

sIFR.replace(gotham_light, {
  selector: 'div#LeirasTiedottaa h1'
  ,css: { '.sIFR-root': { 'color':'#134b95', 'font-size': '30px', 'line-height': '36px', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
});
sIFR.replace(gotham_light, {
  selector: 'div#tabs div#kaikkilaakkeet h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
// Tuote Etusivu -->
sIFR.replace(gotham_light, {
  selector: 'div#RightContentTuoteEtusivu div#RightContentHeader h1'
  ,css: { '.sIFR-root': { 'color':'#144B96', 'font-size': '22px', 'line-height': '36px'}
  }
  ,wmode: 'transparent'
  ,offsetTop: 8 
});

sIFR.replace(gotham_light, {
  selector: 'div#RightContentTuoteEtusivu div#RightContent div#RightContentHeader p'
  ,css: { '.sIFR-root': { 'color':'#144B96', 'font-size': '17px', 'line-height': '28px', 'text-align':'left'}
  }
  ,wmode: 'transparent'
  ,offsetTop: 6
});
sIFR.replace(gotham_light, {
  selector: 'div#RightContentTuoteEtusivu div#RightContent div#RightContentLeft .Tuote-Etusivun-sisallonsisalto h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
// Tuote Etusivu <--

sIFR.replace(gotham_light, {
  selector: 'div#RightContentHeader h1, #RightContentHeader h2'
  ,css: { '.sIFR-root': { 'color':'#144B96', 'font-size': '16px', 'line-height': '36px', 'text-align':'center', 'height':'36px', 'text-transform':'uppercase', 'vertical-align':'middle'}
  }
  ,wmode: 'transparent'
  ,tuneHeight:36
});
sIFR.replace(gotham_light, {
  selector: 'div#RightContentHeader p'
  ,css: { '.sIFR-root': { 'color':'#144B96', 'font-size': '13px', 'line-height': '36px', 'text-align':'left', 'height':'36px'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
  ,tuneHeight:36
});
sIFR.replace(gotham_light, {
  selector: 'div#RightContentLeft div#Leiras-ajankohtaista h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#RightContentLeft div#Leiras-ajankohtaista h3'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '11px', 'line-height': '19px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#Tyopaikat div#RightContentLeft h3'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '11px', 'line-height': '19px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#Potilashuone div#WrapperRightContentLeft div#RightContentLeft h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
});
sIFR.replace(gotham_light, {
  selector: 'div#Potilashuone div#WrapperRightContentLeft ul#Tuote-Etusivu-Lista li h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
});
sIFR.replace(gotham_light, {
  selector: 'div#Tyopaikat div#RightContentLeft h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#RightContentLeft ul li h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#siteWrapper div#Yrityksena div#RightContent div#RightContetnRight h3.harmaa, div#siteWrapper div#Ajankohtaista div#RightContent div#RightContetnRight h3.harmaa, div#siteWrapper div#Tyopaikat div#RightContent div#RightContetnRight h3.harmaa'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#siteWrapper div#RightContentKategoriaEtusivu div#RightContent div#RightContetnRight h3#vihrea'
  ,css: { '.sIFR-root': { 'color':'#336600', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#Tyopaikat div#RightContentKategoriaEtusivu div#RightContent div#RightContetnRight h3.harmaa'
  ,css: { '.sIFR-root': { 'color':'#336600', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#siteWrapper div#Potilashuone div#RightContentTuoteEtusivu div#RightContent div#RightContetnRight h3'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#siteWrapper div#RightContentTuoteEtusivu div#RightContent div#RightContetnRight h3'
  ,css: { '.sIFR-root': { 'color':'#336600', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#siteWrapper div#RightContent div#RightContetnRight div#RightContentRight-Inner h3'
  ,css: { '.sIFR-root': { 'color':'#144B96', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#siteWrapper div#RightContent div#Tuotteet-kategoria div#RightContetnRight h3'
  ,css: { '.sIFR-root': { 'color':'#336600', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#siteWrapper div#RightContent div#RightContetnRight h3'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#Tuote-haku-laatikko h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '13px', 'line-height': '20px', 'text-align':'center', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#EnglishText div#WrapperRightContentLeft h1'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '22px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:15
});
sIFR.replace(gotham_light, {
  selector: 'div#WrapperRightContentLeft h1'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '22px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#EnglishText div#RightContentLeft h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
});
sIFR.replace(gotham_light, {
  selector: 'div#RightContentLeft h2, div#RightContentLeft h3'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '13px', 'line-height': '20px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: 'div#Tuotekortti h4'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '14px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,tuneHeight: 5
  ,offsetTop:10
});

sIFR.replace(gotham_light, {
  selector: 'legend'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,tuneHeight: 5
  ,forceSingleLine: true
  ,offsetTop:10
});
sIFR.replace(gotham_light, {
  selector: 'div#palautelomake div#welcome h2'
  ,css: { '.sIFR-root': { 'color':'#333333', 'font-size': '16px', 'line-height': '36px', 'text-align':'left', 'text-transform':'uppercase'}
  }
  ,wmode: 'transparent'
  ,offsetTop:5
});
sIFR.replace(gotham_light, {
  selector: '#siteWrapper .ui-tabs .ui-tabs-nav li.ui-state-default a#linkki-kaikkilaakkeet'
  ,css: ['.sIFR-root { color:#FFFFFF; font-size: 12px; line-height: 19px; text-align:left; text-transform:uppercase;}']
  ,wmode: 'transparent'
  ,tuneWidth: 5
  ,onRelease: function(fi) {
    $("div#tabs").tabs('select', 1);
    $("#AukeavaLayeri").fadeOut("fast");
    changeColor("#FFFFFF","#siteWrapper .ui-tabs .ui-tabs-nav li.ui-state-active a");
    changeColor("#144B96","#siteWrapper .ui-tabs .ui-tabs-nav li.ui-state-default a#linkki-kaikkilaakkeet");
  }
});

sIFR.replace(gotham_light, {
  selector: '#siteWrapper .ui-tabs .ui-tabs-nav li.ui-state-active a'
  ,css: ['.sIFR-root { color:#144B96; font-size: 12px; line-height: 19px; text-align:left; text-transform:uppercase;}']
  ,wmode: 'transparent'
  ,tuneWidth: 5
  ,onRelease: function(fi) {
    $("div#tabs").tabs('select', 0);
    $("#AukeavaLayeri").fadeIn("fast");
    changeColor("#FFFFFF","#siteWrapper .ui-tabs .ui-tabs-nav li.ui-state-default a#linkki-kaikkilaakkeet");
    changeColor("#144B96","#siteWrapper .ui-tabs .ui-tabs-nav li.ui-state-active a");
  }
});

function changeColor(hexValue,selector) {
  var css = '.sIFR-root { color: ' + hexValue + '; }';
  for (var i = 0; i < sIFR.replacements[selector].length; i++) {
    sIFR.replacements[selector][i].changeCSS(css);
  }
}

