/*****************************************************************************
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 objects pointing to the location of the Flash movies on your web server.

var noalight = {
	src: 'scripts/sifr/noalight.swf'
	,ratios: [6,1.41,9,1.35,15,1.29,21,1.25,22,1.22,27,1.24,29,1.21,34,1.22,41,1.21,45,1.2,46,1.21,59,1.2,68,1.19,69,1.2,96,1.19,97,1.18,102,1.19,103,1.18,107,1.19,108,1.18,112,1.19,114,1.18,116,1.19,120,1.18,121,1.19,1.18]
};

var noabold = {
	src: 'scripts/sifr/noabold.swf'
	,ratios: [6,1.41,9,1.35,15,1.29,21,1.25,22,1.22,27,1.24,29,1.21,34,1.22,41,1.21,45,1.2,46,1.21,59,1.2,68,1.19,69,1.2,96,1.19,97,1.18,102,1.19,103,1.18,107,1.19,108,1.18,112,1.19,114,1.18,116,1.19,120,1.18,121,1.19,1.18]
};

// 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.domains = ['novemberborn.net'] // Don't check for domains in this demo
sIFR.useStyleCheck = true;
sIFR.activate(noalight, noabold);

// 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 likee.
// 
// The first argument to `sIFR.replace` is the 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.
// Read more about styling at <http://wiki.novemberborn.net/sifr3/Styling>.
/*
sIFR.replace(rockwell, {
	selector: 'h1'
	,css: [
		'.sIFR-root { font-weight: bold; }'
	]
});
*/


sIFR.replace(noalight, {
	selector: 'h1#pageTitle',
	css: [
		'.sIFR-root { color: #ffffff; background-color: #7a7a8b }'
	],
	transparent: true
});

sIFR.replace(noabold, {
	selector: 'h2#strapline',
	css: [
		'.sIFR-root { color: #8d9de5; text-align: center; background-color: #1117c2; letter-spacing: 4; }'
	],
	transparent: true
});

sIFR.replace(noalight, {
	selector: 'p.preQuote',
	css: [
		'.sIFR-root { color: #ffffff; background-color: #000062; }'
	],
	transparent: true
});

sIFR.replace(noabold, {
	selector: 'h2#profileName',
	css: [
		'.sIFR-root { color: #1117c2; background-color: #ffffff; }'
	],
	transparent: true
});


//jQuery section
//--------------------------------------------------------------------------
// Using jQuery to detect the body Id and change quote colour accordingly

$(document).ready(function(){

  bodyTag = document.getElementsByTagName('body')[0];
	bodyId = bodyTag.id;

	
	switch (bodyId)
	{
		case 'commercialProperty': fontColor = '#68bad8'; break;
		case 'criminalDefence': fontColor = '#ff7dff'; break;
		case 'disputeResolution': fontColor = '#d38c73'; break;
		case 'employmentLaw': fontColor = '#ff8680'; break;
		case 'familyLaw': fontColor = '#b9d61a'; break;
		case 'personalInjury': fontColor = '#ff9944'; break;
		case 'residentialConveyancing': fontColor = '#e8c846'; break;
		case 'willsAndProbate': fontColor = '#cdbda6'; break;
		default: fontColor = '#ff9900'; 
	}
	
	sIFR.replace(noabold, {
		selector: 'p.quote',
		css: [
			'.sIFR-root { color: ' + fontColor + '; leading: 9px; background-color: #000062; }'
		],
		transparent: true
	});
	
});