var interstil = {

	mediumFont: {
		src: '/Templates/default/sifr/medium.swf',
		wmode: 'transparent'
	},

	thinFont: {
		src: '/Templates/default/sifr/thin.swf',
		wmode: 'transparent'
	},

	initialize: function() {
		this.prepare();
		this.replaceLanguage();
		this.replaceMenu();
		this.replaceHeaders();
		this.replaceFooter();
	},

	prepare: function() {
		sIFR.activate(this.mediumFont, this.thinFont);
	},

	onReplace: function(flash) {
		var object = flash.getFlashElement();
		object.onmouseup = function(event) {
			if (!event) {
				event = window.event;
			}

			var f = ['preventBubble', 'preventCapture', 'preventDefault', 'stopPropagation'];
			var href = this.parentNode.getAttribute('href');
			if (href)
				window.location.href = href;
			for (var i = 0; i < f.length; i++) {
				if (event[f[i]]) {
					event[f[i]]();
				}
			}
			return false;
		};
	},

	replaceLanguage: function() {
		sIFR.replace(this.thinFont, {
			selector: '#nav_language li.selected a',
			selectable: false,
			onReplacement: this.onReplace,
			css: {
				'.sIFR-root': {
					'text-transform': 'uppercase',
					cursor: 'pointer',
					color: '#F43F3F'
				}
			}
		});
		sIFR.replace(this.thinFont, {
			selector: '#nav_language li a',
			selectable: false,
			onReplacement: this.onReplace,
			onRollOver: function(flash) {
				flash.changeCSS({
					'.sIFR-root': {
						color: '#F43F3F'
					}
				});
			},
			onRollOut: function(flash) {
				flash.changeCSS({
					'.sIFR-root': {
						color: '#000000'
					}
				});
			},
			css: {
				'.sIFR-root': {
					'text-transform': 'uppercase'
				}
			}
		});
		sIFR.replace(this.thinFont, {
			selector: '#nav_language p',
			selectable: false,
			css: {
				'.sIFR-root': {
					'text-transform': 'uppercase'
				}
			}
		});
	},

	replaceMenu: function() {
		sIFR.replace(this.mediumFont, {
			selector: '#menuSection li li.selected a',
			selectable: false,
			onReplacement: this.onReplace,
			onRollOver: function(flash) {
				flash.changeCSS({
					'.sIFR-root': {
						color: '#FFFFFF'
					}
				});
			},
			onRollOut: function(flash) {
				var timeout;
				var li = flash.getFlashElement().parentNode.parentNode;
				timeout = setInterval(function() {
					if (li.className.indexOf('hover') == -1) {
						flash.changeCSS({
							'.sIFR-root': {
								color: '#F43F3F'
							}
						});
						clearInterval(timeout);
					}
				}, 50);
			},
			css: {
				'.sIFR-root': {
					color: '#F43F3F',
					'text-transform': 'uppercase'
				}
			}
		});
		sIFR.replace(this.mediumFont, { // sub menu
			selector: '#menuSection li li a',
			selectable: false,
			onReplacement: this.onReplace,
			onRollOver: function(flash) {
				flash.changeCSS({
					'.sIFR-root': {
						color: '#FFFFFF'
					}
				});
			},
			onRollOut: function(flash) {
				var timeout;
				var li = flash.getFlashElement().parentNode.parentNode;
				timeout = setInterval(function() {
					if (li.className.indexOf('hover') == -1) {
						flash.changeCSS({
							'.sIFR-root': {
								color: '#000000'
							}
						});
						clearInterval(timeout);
					}
				}, 50);
			},
			css: {
				'.sIFR-root': {
					'text-transform': 'uppercase',
					color: '#000000'
				}
			}
		});
		sIFR.replace(this.mediumFont, { // top menu
			selector: '#menuSection li.parent.selected a',
			selectable: false,
			preventWrap: true,
			onReplacement: this.onReplace,
			onRollOver: function(flash) {
				flash.changeCSS({
					'.sIFR-root': {
						color: '#000000'
					}
				});
			},
			onRollOut: function(flash) {
				var timeout;
				var li = flash.getFlashElement().parentNode.parentNode;
				timeout = setInterval(function() {
					if (li.className.indexOf('hover') == -1) {
						flash.changeCSS({
							'.sIFR-root': {
								color: '#F43F3F'
							}
						});
						clearInterval(timeout);
					}
				}, 50);
			},
			css: {
				'.sIFR-root': {
					'text-transform': 'uppercase',
					color: '#F43F3F'
				}
			}
		});
		sIFR.replace(this.mediumFont, { // top menu
			selector: '#menuSection li.parent a',
			selectable: false,
			preventWrap: true,
			onReplacement: this.onReplace,
			onRollOver: function(flash) {
				flash.changeCSS({
					'.sIFR-root': {
						color: '#000000'
					}
				});
			},
			onRollOut: function(flash) {
				var timeout;
				var li = flash.getFlashElement().parentNode.parentNode;
				timeout = setInterval(function() {
					if (li.className.indexOf('hover') == -1) {
						flash.changeCSS({
							'.sIFR-root': {
								color: '#FFFFFF'
							}
						});
						clearInterval(timeout);
					}
				}, 50);
			},
			css: {
				'.sIFR-root': {
					'text-transform': 'uppercase',
					color: '#FFFFFF'
				}
			}
		});
		sIFR.replace(this.mediumFont, {
			selector: '#menuSection li.selected a',
			selectable: false,
			preventWrap: true,
			onReplacement: this.onReplace,
			css: {
				'.sIFR-root': {
					color: '#F43F3F',
					'text-transform': 'uppercase'
				}
			}
		});
		sIFR.replace(this.mediumFont, { // top menu
			selector: '#menuSection li a',
			selectable: false,
			preventWrap: true,
			onReplacement: this.onReplace,
			onRollOver: function(flash) {
				flash.changeCSS({
					'.sIFR-root': {
						color: '#F43F3F'
					}
				});
			},
			onRollOut: function(flash) {
				var timeout;
				var li = flash.getFlashElement().parentNode.parentNode;
				timeout = setInterval(function() {
					if (li.className.indexOf('hover') == -1) {
						flash.changeCSS({
							'.sIFR-root': {
								color: '#FFFFFF'
							}
						});
						clearInterval(timeout);
					}
				}, 50);
			},
			css: {
				'.sIFR-root': {
					'text-transform': 'uppercase',
					color: '#FFFFFF'
				}
			}
		});
	},

	replaceHeaders: function() {
		sIFR.replace(this.thinFont, {
			selector: '#overview h1',
			css: {
				'.sIFR-root': {
					leading: -10,
					color: '#000000',
					'text-transform': 'uppercase'
				},
				'a,a:hover': {
					color: '#F43F3F'
				}
			}
		});
		sIFR.replace(this.mediumFont, {
			selector: '#spots h2',
			css: {
				'.sIFR-root': {
					leading: -4,
					color: '#F43F3F',
					'text-transform': 'uppercase'
				},
				"a,a:hover": {
					color: '#F43F3F'
				}
			}
		});
	},


	replaceFooter: function() {
		sIFR.replace(this.mediumFont, {
			selector: '#footer h3,#footer .content',
			css: {
				'.sIFR-root': {
					color: '#000000',
					'text-transform': 'uppercase'
				},
				a: {
					color: '#000000',
					'text-decoration': 'none'
				},
				'a:hover': {
					color: '#000000',
					'text-decoration': 'underline'
				}
			}
		});
	}
};

if (!window.core) {
//	lightCore.registerInit(interstil);
	interstil.initialize();
}
