$(document).ready(function() {

	/* ------------------------------------------------------------ */
	/* set up nav items */
	$('#PreloadImages').html('<img src="/images/navExtelSelected.gif" /><img src="/images/navLipperSelected.gif" /><img src="/images/navStarMineSelected.gif" />');

	$('#NavExtel').hover(
		function () {$(this).find('img').attr('src', '/images/navExtelSelected.gif');}, 
		function () {$(this).find('img').attr('src', '/images/navExtel.gif');} 
	);

	$('#NavLipper').hover(
		function () {$(this).find('img').attr('src', '/images/navLipperSelected.gif');}, 
		function () {$(this).find('img').attr('src', '/images/navLipper.gif');} 
	);

	$('#NavStarMine').hover(
		function () {$(this).find('img').attr('src', '/images/navStarMineSelected.gif');}, 
		function () {$(this).find('img').attr('src', '/images/navStarMine.gif');} 
	);

	/* ------------------------------------------------------------ */
	/* set up nav search box */

	$('#search').focus(function() {
		if (this.value == 'Search...') {
		this.value = '';
		}
	}).blur(function() {
		if (!this.value.length) {
		this.value = 'Search...';
		}
	});

	$('#search').keydown(function(event) {
		if (event.keyCode == 13) {
			$('#btnSearch').click();
			return false;
		}
	});

});

/* ------------------------------------------------------------ */
/* inline flash font replacement */

var KnowledgeLight = {
	src: sifrKnowledgeLight
};
sIFR.activate(KnowledgeLight);

var KnowledgeMedium = {
	src: sifrKnowledgeMedium
};
sIFR.activate(KnowledgeMedium);

sIFR.replace(KnowledgeLight, {
	selector: 'h1', 
	transparent: true, 
	fixFocus: true, 
	forceSingleLine: true,  
	css: [
		'.sIFR-root { color: #555555; background-color: transparent; text-align: left; text-transform: uppercase; }', 
		'a { color: #555555; text-decoration: none; }', 
		'a:link { color: 555555; }', 
		'a:hover { color: #555555; }'
	]
});

sIFR.replace(KnowledgeLight, {
	selector: '.ContentMainExtel #ContentDetails #ExtelWinnersIntro h2, .ContentMainLipper #ContentDetails #LipperWinnersIntro h2, .ContentMainStarMine #ContentDetails #StarMineWinnersIntro h2', 
	transparent: true, 
	fixFocus: true, 
	forceSingleLine: true,  
	css: [
		'.sIFR-root { color: #ffffff; background-color: transparent; text-align: left; text-transform: none; }', 
		'a { color: #ffffff; text-decoration: none; }', 
		'a:link { color: #ffffff; }', 
		'a:hover { color: #ffffff; }'
	]
});

sIFR.replace(KnowledgeLight, {
	selector: '.ContentMainExtel #ContentDetails #ExtelWinnersYearHeader h2, .ContentMainLipper #ContentDetails #LipperWinnersYearHeader h2, .ContentMainStarMine #ContentDetails #StarMineAnalystWinnersYearHeader h2, .ContentMainStarMine #ContentDetails #StarMineBrokerWinnersYearHeader h2', 
	transparent: true, 
	fixFocus: true, 
	forceSingleLine: true,  
	css: [
		'.sIFR-root { color: #ffffff; background-color: transparent; text-align: left; text-transform: uppercase; }', 
		'a { color: #ffffff; text-decoration: none; }', 
		'a:link { color: #ffffff; }', 
		'a:hover { color: #ffffff; }'
	]
});

sIFR.replace(KnowledgeLight, {
	selector: 'h2#ExtelTrophiesHeader', 
	transparent: true, 
	fixFocus: true, 
	forceSingleLine: true,  
	css: [
		'.sIFR-root { color: #a00000; background-color: transparent; text-align: left; text-transform: uppercase; }', 
		'a { color: #a00000; text-decoration: none; }', 
		'a:link { color: #a00000; }', 
		'a:hover { color: #a00000; }'
	]
});

sIFR.replace(KnowledgeLight, {
	selector: 'h2#LipperTrophiesHeader', 
	transparent: true, 
	fixFocus: true, 
	forceSingleLine: true,  
	css: [
		'.sIFR-root { color: #ff9100; background-color: transparent; text-align: left; text-transform: uppercase; }', 
		'a { color: #ff9100; text-decoration: none; }', 
		'a:link { color: #ff9100; }', 
		'a:hover { color: #ff9100; }'
	]
});

sIFR.replace(KnowledgeLight, {
	selector: 'h2#StarMineTrophiesHeader', 
	transparent: true, 
	fixFocus: true, 
	forceSingleLine: true,  
	css: [
		'.sIFR-root { color: #005a84; background-color: transparent; text-align: left; text-transform: uppercase; }', 
		'a { color: #005a84; text-decoration: none; }', 
		'a:link { color: #005a84; }', 
		'a:hover { color: #005a84; }'
	]
});
