$(document).ready(init);

function init() {
	initHilights();
}


/*
var flashvars = {
			xmlPath: "video/runtime/data/data.xml",
			id:"VIDEOPLAYER",
			plyareSize: "S", //'L' || 'S' (L= 853px x 480px, S= 427px x 240px);
			autoPlay: "vid0" //Autoplay parameter starts video automatically
			
		};
		var params = {
			menu: "false",
			scale: "noScale",
			allowFullscreen: "true",
			allowScriptAccess: "always",
			bgcolor: "#000000",
			wmode: 'transparent'
		};
		var attributes = {
			id:"VIDEOPLAYER"
		}; */

function initHilights() {
	$(".hilights-link").click(
		function() {
			if( !$("#hilight-bg").length ) {
				$("body").append('<div id="hilight-bg"></div>');
			}
			
			$("#hilight-bg").click( hideHilights );
			
			var hlHeight = 576; //$("#hilights").outerHeight();
			var windowWidth = $(window).width();
			leftp = (windowWidth - 1024) / 2 - 15;
			var windowHeight = $(window).height();
			
			var sTop = window.scrollY ? window.scrollY : document.body.scrollTop;
			topp = (windowHeight - hlHeight) / 2 + sTop -15;
			$("#hilight-bg")
				.height( $(window).height() )
				.css({ opacity: 0, display: 'block' })
				.animate({ opacity: .8 }, 300, function() {
					$("#hilights").css({ left: leftp+'px', top: topp+'px' }).show();
					
					// tähän swfobject
					var params = {
		quality: "high",
		scale: "noscale",
		wmode: "window",
		allowscriptaccess: "always",
		bgcolor: "#FFFFFF"
	};
	var flashvars = {
		siteXML: "xml/site.xml"
	};
	var attributes = {
		id: "flashcontent",
		name: "flashcontent"
	};
	swfobject.embedSWF("main.swf", "flashContent", "1024", "576", "9", "expressInstall.swf", flashvars, params, attributes);
					
					}
				);
			
			
			return false;
		}
	);
	
	function hideHilights() {
		$("#hilight-bg").animate({ opacity: 0 }, 200, function() { $(this).hide(); });
		$("#hilights").hide();
		$("#flashWrapper").empty().append('<div id="flashContent"></div>');
	}
	
	$("#close-hilight").click( function() { hideHilights() } );
	
	$("#hilight-tabs a").click(
		function() {
			$("#hilight-tabs").find('li.active').removeClass('active');
			$(this).parent('li').addClass('active');
			$("#n8-hilights").hide();
			$("#n8-tech-specs").hide();
			$( $(this).attr('href') ).show();
			return false;
		}
	);
	
}
