$(document).ready(

	function()
	{
		initHeader();
		initNews();
		initScroller();
  	}	

);

function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function initHeader() 
{
	var id = "flash-header";
	var flv = "/static/flash/header.flv";
	
	if ( document.getElementById(id) )
	{ 
		if ( document.getElementById("smoke") )
		{
			flv = document.getElementById("smoke").innerHTML;			
		}	
		var flashvars = { laterVisit: readCookie("topnotchVisit"), flvPath: flv };
		var params = { wmode: "transparent" };
		var attributes = {};
					
		swfobject.embedSWF("/static/flash/header.swf", id, "980", "139", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
	}

}

function initNews()
{
	var id = "flash-news";
	
	if ( document.getElementById(id) )
	{ 
		var flashvars = { dataUrl: "/page/carousel/" };
		var params = { wmode: "transparent" };
		var attributes = {};
					
		swfobject.embedSWF("/static/flash/news.swf", id, "780", "320", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
	}
	
}

function initScroller()
{
	var id = "flash-scroller";
	
	if ( document.getElementById(id) )
	{ 
		var flashvars = { dataUrl: "/page/scroller/" };
		var params = { wmode: "transparent" };
		var attributes = {};
					
		swfobject.embedSWF("/static/flash/scroller.swf", id, "980", "115", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
	}
	
}


