/// <reference path="jquery-1.3.2-vsdoc2.js" />
/// <reference path="swfobject-vsdoc.js" />
/// <reference path="sifr-vsdoc.js" />

$(document).ready(function() {

	/* 
		FADE OUT AND IN PAGE
		
		This script fades out and in new page when click on all links. It requires a div that lays over all content: 
		<div id="loader" style="position:fixed;top:0px;left:0px;width:100%;height:100%;background:#13191d;z-index:5000;display:none;">&#160;</div>		
	*/
	
	//	$('#loader').css({ display: "block" });
	//	setTimeout('$("#loader").fadeOut("400")', 500);

	//	/* loop through a tags on page */
	//	$('a').each(function(idx, item) {
	//		/* if it is not a mailto tag */
	//		if (item.href.indexOf("mailto") == -1) {
	//			var url = "javascript:delayedRedirect('" + item.href + "');"
	//			item.href = url;
	//		}
	//	});
	
	/*
		FLASH DETECTION  
		
		Uses jQuery for adding elements. Displays a modal dialog box over a semi-transparent background if 
		flash version too old. 
	
		Todo: Perhaps store in cookies that user has already pressed "ok" to avoid showing message on every load.
	*/
	if (!swfobject.hasFlashPlayerVersion("9.0.0")) {
		var message = "<b>Flash Player 9 required</b><br />This site requires flash player 9.0.0 or newer. Please <a href='http://www.adobe.com/products/flashplayer/'>download here</a><br/><br/><input type=\"button\" style=\"float:right\" onclick=\"JavaScript:$('#__flashversion').remove();\" value=\"OK\" />";
		var bgcolor = "#FFFFFF";    // color of background
		var msg_width = "200";      // pixels
		var msg_height = "80";      // pixels
		var opacity = 80;           // background per cent visible

		$("body").append("<div id='__flashversion'></div>");
		var flash = $("#__flashversion");
		flash.append("<div id='__flashversion_bg' style=\"position:absolute;background:" + bgcolor + ";-khtml-opacity:." + opacity + "; -moz-opacity:." + opacity + "; -ms-filter:'alpha(opacity=" + opacity + ")'; filter:alpha(opacity=" + opacity + "); opacity:." + opacity + ";left:0;top:0;width:100%;height:100%;\"></div>");
		flash.append("<div style='position:absolute;margin-left:-" + (msg_width / 2) + "px;margin-top:-" + (msg_height / 2) + "px;background:" + bgcolor + ";width:" + msg_width + "px;height:" + msg_height + "px;left:50%;top:50%;padding:20px;text-align:left;border:1px solid #aaaaaa;'>" + message + "</div>");
	}	
});