/*
 * functions
 * for rennie.com
 * by burnkit.com
 */
// <![CDATA[
// total pixel height of the top and bottom divs
var topAndBottom = 62;
var minHeight = 500;
var newHeight = 0;
$(window).resize(function() {
	// resize when the user resizes
	newHeight = $(window).height() - topAndBottom;
	if (newHeight < minHeight) {
		newHeight = minHeight;
	}
	$("#flashcontent").height(newHeight);
});
$(document).ready(function() {
	// replace logo and nav bg for ie6
	if ($.browser.msie && $.browser.version=="6.0") {
		$("#logo").html('<div id="logo"><a href="index.php"><img src="img/logo.gif" width="106" height="101" alt="Rennie Marketing Systems" border="0"></a></div>');
		$("#topdrop").height(31);
	}
	// resize on load
	$("#leftnav").height($(window).height() - topAndBottom);
	$("#content").height($(window).height() - topAndBottom);
	$("#content").width($(window).width() - 199);
	//$("#overlay").css("margin-top",($(window).height() - topAndBottom - ) / 2);
	if (window.location.href.search("#") > -1) $("#overlay").hide();
	$(".overlay_link").click(function() {	
		$("#overlay").hide();
		swfobject.embedSWF("main.swf", "flashcontent", "100%", newHeight, "9.0.0","expressInstall.swf", flashvars, params, attributes);
	});
	var flashvars = {};
	var params = {
	  menu: "false",
	  allowfullscreen: "true",
	  allowscriptaccess: "always",
	  bgcolor: "#000000",
	  wmode: "transparent"
	};
	var attributes = {};
	newHeight = $(window).height() - topAndBottom;
	if (newHeight < minHeight) {
		newHeight = minHeight;
	}
	swfobject.embedSWF("main.swf", "flashcontent", "100%", newHeight, "9.0.0","expressInstall.swf", flashvars, params, attributes);
	
	// nav rollover - some (crappy) browsers don't do background-position hover states on absolute divs
	/*
	var p;
	$('#top a').hover(function() {
		
		p = $(this).css('background-position');
		if (typeof(p) === 'undefined') p = $(this).css('background-position-x') + ' ' + $(this).css('background-position-y');
		p = p.split(" 0px",1) + ' -94px';
		$(this).css({backgroundPosition: p});						
	}, function() {
		p = p.split(" -94px",1) + ' 0px';
		$(this).css({backgroundPosition: p});
	});
	*/
	
});
// ]]>
