var Browser_IE		= document.all					? true : false;
var Browser_DOM	= document.getElementById	? true : false;
var DropdownDelay	= 30;					//--- Delay in seconds before box is automatically hidden
var DropdownTime 	= DropdownDelay;	//--- Countdown seconds before automatically hiding the box
var HashCatcher	= 0; 					//--- Utility variable used for setInterval and setTimeout
var DropdownTop	= 100;				//--- Starting Top position (in px) of box
var DropdownStep	= 10;					//--- Size (in px) of box movement increment
var DropdownFreq	= "JustOnce";		//--- Frequency of box dropdown: "EachTime" = Each time page loads, "JustOnce" = Once per browser session
var DD_Div, DD_Blurb, DD_TimeLeft, PN_Div, PB_Div, PB_Title, PB_Text, PB_Source, PB_Content = "";
var DD_Cover, PN_Blurb, PB_Area = null;

function Start_Dropdown ()
	{
	if (((DropdownFreq == "JustOnce") && (Get_SessionCookie("ctdropdown") == "")) || (DropdownFreq == "EachTime"))
		{
		if (Browser_DOM || Browser_IE)
			Layout_Dropdown();
		if (DropdownFreq == "JustOnce")
			document.cookie = "ctdropdown=yes";
		}
	}

function Show_Dropdown ()
	{
	DropdownTime 	= DropdownDelay;
	DropdownFreq	= "EachTime";
	Layout_Dropdown();
	}

function Layout_Dropdown ()
	{
	if (!Browser_DOM && !Browser_IE)
		return;
	if ((PN_Blurb != "") && (PN_Blurb != null))
		{
		PN_Blurb	= (Browser_DOM) ? document.getElementById("PopNote_Blurb") : document.all.PopNote_Blurb;
		if (PN_Blurb.style.display == "block")
			PN_Blurb.style.display = "none";
		}
	if ((PB_Area != "") && (PB_Area != null))
		{
		PB_Area	= (Browser_DOM) ? document.getElementById("PlaybackArea") : document.all.PlaybackArea;
		if (PB_Area.style.display == "block")
			StopVideo();
		}
	Create_Dropdown();
	DD_Cover							= (Browser_DOM) ? document.getElementById("Dropdown_Cover")		: document.all.Dropdown_Cover;
	DD_Blurb							= (Browser_DOM) ? document.getElementById("Dropdown_Blurb")		: document.all.Dropdown_Blurb;
	DD_TimeLeft						= (Browser_DOM) ? document.getElementById("Dropdown_TimeLeft")	: document.all.Dropdown_TimeLeft;
	DD_TimeLeft.innerHTML 		= DropdownTime;
	DD_Blurb.height				= DD_Blurb.offsetHeight;
	DD_Blurb.style.top			= DD_Blurb.height * (-1) 		+ "px";
	DD_Cover.style.height		= parseInt(DD_Blurb.height)	+ "px";
	DD_Cover.style.left			= ((document.body.clientWidth - DD_Cover.offsetWidth) / 2) + 120 + "px";
	DD_Cover.style.top			= DropdownTop 						+ "px";
	DD_Cover.style.visibility	= (Browser_DOM || Browser_IE) ? "visible" : "show";
	HashCatcher						= setInterval("Move_Dropdown()",20);
	}

function Move_Dropdown ()
	{
	if (parseInt(DD_Blurb.style.top) < 0)
		{
		DD_Blurb.style.top = parseInt(DD_Blurb.style.top)	+ DropdownStep	+ "px";
		}
	else
		{
		clearInterval(HashCatcher);
		DD_Blurb.style.top = 0;
		Show_Countdown();
		}
	}

function Show_Countdown ()
	{
	if (DropdownTime <= 0)
		{
		Hide_Dropdown();
		return;
		}
	DD_TimeLeft.innerHTML = DropdownTime;
	DropdownTime--;
	HashCatcher = setTimeout("Show_Countdown()", 1000);
	}

function Hide_Dropdown ()
	{
	clearTimeout(HashCatcher);
	DD_Cover.style.visibility = "hidden";
	}
	
function Get_SessionCookie (CookieName) 
	{
	var CookieDataBeg, CookieDataEnd = 0;
	var CookieDataKey		= CookieName + "=";
	var CookieDataValue	= "";
	if (document.cookie.length > 0) 
		{
		CookieDataBeg = document.cookie.indexOf(CookieDataKey);
		if (CookieDataBeg != -1) 
			{
			CookieDataBeg  += CookieDataKey.length;
			CookieDataEnd 	 = document.cookie.indexOf(";", CookieDataBeg);
			if (CookieDataEnd == -1)
				CookieDataEnd = document.cookie.length;
			CookieDataValue = unescape(document.cookie.substring(CookieDataBeg, CookieDataEnd));
			}
		}
	return CookieDataValue;
	}

function Create_Dropdown ()
	{
	DD_Div				= (Browser_DOM) ? document.getElementById("Dropdown_Div") : document.all.Dropdown_Div;
	DD_Div.innerHTML	= '<div id="Dropdown_Cover">'
		+ '	<div id="Dropdown_Blurb" onclick="Hide_Dropdown();return false">'
		+ '		<div style="text-align:center">'
		+ '			<b>Creative Thinkering</b><br>Now available!<br><b>Learn How to Think Like a Genius</b><br>'
		+ '			<img src="images/CreativeThinkering_T.jpg" border="0" width="120" height="150" style="border:1px solid #a0a0a0;" alt="CreativeThinkering">'
		+ '		</div>'
		+ '		<div style="text-align:justify">'
		+ '			This book emphasizes the importance of conceptual blending in creative thinking in your business and personal '
		+ '			lives.  Conceptual blending of dissimilar subjects and ideas and concepts is the most important factor in '
		+ '			creative thinking.<br> '
		+ '			<br>'
		+ '			According to Jeffrey Gitomer, author of <em>The Little Red Book of Selling</em>, &quot;Michael Michalko alters thinking, '
		+ '			and his books alter actions.  <em>Creative Thinkering</em> is amazing in three ways:  it&lsquo;s easy to read, '
		+ '			easy to understand, and easy to apply the minute you read it.  Every time I read a chapter in a Michael Michalko '
		+ '			book I learn something so new, I say, 	&lsquo;aha!&rsquo;  So will you. '
		+ '			<br><br>'
		+ '			<div id="Dropdown_TimeText">'
		+ '				This display will automatically disappear in <b id="Dropdown_TimeLeft">??</b> seconds.<br>'
		+ '				<b>OR</b>&nbsp; You may click anywhere on this display to hide it immediately.'
		+ '			</div>'
		+ '		</div>'
		+ '	</div>'
		+ '</div>';
	}

function Create_PopNote ()
	{
	PN_Div				= (Browser_DOM) ? document.getElementById("PopNote_Div") : document.all.PopNote_Div;
	PN_Div.innerHTML	= '<div id="PopNote_Blurb" style="width:450px;" onclick="Hide_PopNote();return false">'
		+ '	<div style="text-align:center">'
		+ '		<b>THINKERTOYS</b><br>One of the <b>Top 100 Best Books for Managers, Leaders & Humans</b><br>'
		+ '		<img src="images/Pic_Cover_ThinkerToys2_T.jpg" border="0" width="120" height="150" style="border:1px solid #a0a0a0;" alt="THINKERTOYS">'
		+ '	</div>'
		+ '	<div style="text-align:justify">'
		+ '		Jurgen Appelo, whose <a style="text-decoration:none;" href="http://www.noop.nl">NOOP.NL</a> website contains a wide variety of articles, '
		+ '		created his list of "Top 100 Best Books for Managers, Leaders & Humans" by considering each book\'s number of Amazon reviews, its average Amazon rating, '
		+ '		and its number of Google hits.&nbsp; Thinkertoys is ranked among the list\'s top 30 books.'
		+ '		<br>'
		+ '		<br>'
		+ '		According to Jurgen Appelo, "This list can be of great help if you want to improve your skills as a manager, a leader, or as a human being who just wants to become a more interesting colleague.&quot;'
		+ '		<br><br>'
		+ '	</div>'
		+ '	<div style="text-align:center;color:#A00000;">'
		+ '		Click anywhere on this display to hide it.'
		+ '	</div>'
		+ '</div>';
	PN_Blurb					= (Browser_DOM) ? document.getElementById("PopNote_Blurb") : document.all.PopNote_Blurb;
	PN_Blurb.style.left	= ((document.body.clientWidth - parseInt(PN_Blurb.style.width)) / 2) + 105 + "px";
	}

function Show_PopNote ()
	{
	if ((PB_Area != "") && (PB_Area != null))
		{
		PB_Area	= (Browser_DOM) ? document.getElementById("PlaybackArea") : document.all.PlaybackArea;
		if (PB_Area.style.display == "block")
			StopVideo();
		}
	if ((DD_Cover != "") && (DD_Cover != null))
		{
		DD_Cover	= (Browser_DOM) ? document.getElementById("Dropdown_Cover")	: document.all.Dropdown_Cover;
		if ((DD_Cover.style.visibility == "visible") || (DD_Cover.style.visibility == "show"))
			Hide_Dropdown();
		}
	PN_Blurb.style.display = "block";
	}

function Hide_PopNote ()
	{
	PN_Blurb.style.display = "none";
	}

function PlayVideo (TheVideo)
	{
	if ((PN_Blurb != "") && (PN_Blurb != null))
		{
		PN_Blurb	= (Browser_DOM) ? document.getElementById("PopNote_Blurb") : document.all.PopNote_Blurb;
		if (PN_Blurb.style.display == "block")
			PN_Blurb.style.display = "none";
		}
	if ((DD_Cover != "") && (DD_Cover != null))
		{
		DD_Cover	= (Browser_DOM) ? document.getElementById("Dropdown_Cover")	: document.all.Dropdown_Cover;
		if ((DD_Cover.style.visibility == "visible") || (DD_Cover.style.visibility == "show"))
			Hide_Dropdown();
		}
	if (PB_Content == "")
		{
		PB_Div				= (Browser_DOM) ? document.getElementById("Playback_Div") : document.all.Playback_Div;
		PB_Div.innerHTML	= "<div id='PlaybackArea' style='width:400px;' onclick='StopVideo()'></div>";
		if (TheVideo == "Collin")
			{
			PB_Title		= "Consider this the bible of creative thinking!";
			PB_Text		= "A useful and insightful tool for anyone working with creative<br>people or wanting to think more creatively. --- Nigel Collin";
			PB_Source	= "images/VIDEO_NigelCollinOnThinkertoys.swf";
			}
		if (TheVideo == "Wolff")
			{
			PB_Title		= "This is the one to keep by your side!";
			PB_Text		= "This cookbook of creativity and thinking techniques is one<br>to keep handy for when challenges arise. --- Jurgen Wolff";
			PB_Source	= "images/VIDEO_JurgenWolffOnThinkertoys.swf";
			}
		PB_Content 	= "<div class='PlaybackTitle'>" + PB_Title + "</div>"
						+ "<div class='PlaybackText'>" + PB_Text + "</div>"
						+ "<object width='400' height='300' id='PlaybackObj' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' align='center' hspace='0'>"
						+ "	<embed width='400' height='300' src='" + PB_Source + "' quality='High' bgcolor='#000000' wmode='opaque' menu='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' loop='false' salign='t' name='PlaybackObj'></embed>"
						+ "	<param name='movie' value='" + PB_Source + "'><param name='quality' value='High'><param name='bgcolor' value='#000000'><param name='wmode' value='opague'><param name='menu' value='true'><param name='loop' value='false'>"
						+ "</object>";
		PB_Content 			  += "<br><div class='PlaybackText'>Click on any text area to close this display.</div>";
		PB_Area					= (Browser_DOM) ? document.getElementById("PlaybackArea") : document.all.PlaybackArea;
		PB_Area.style.left	= ((document.body.clientWidth - parseInt(PB_Area.style.width)) / 2) + 95 + "px";
		}
	PB_Area.innerHTML 		= PB_Content;
	PB_Area.style.display	= "block";
	PB_Content					= "";
	}

function StopVideo ()
	{
	PB_Area.innerHTML 		= "";
	PB_Area.style.display	= "none";
	}

