/*
NOOKKIN.JS

Contains various functions used on the site.

Copyright(c) 2008-10 Lyosha Blinnikov (Nookkin). All rights
reserved.
*/

function initializepage()
{
	
	//Superfish menu
	$(document).ready(function()
	{ 
		$("ul.menubar").supersubs({
			minWidth: 200,
			maxWidth: 500,
			extraWidth: 10
		}).superfish({
			delay: '0',
			speed: 'slow',
			animation: {opacity:'show', height:'show'},
			easing: 'swing',
			autoArrows: false
		});
	});

	//Backwards-compatible Suckerfish menu
	HoverMenu = function()
	{
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() 
			{
				if(this.className=="top")
				{
					this.className+=" top_hover";
				}
				else
				{
					this.className+=" menu_hover";
				}
			};
			sfEls[i].onmouseout=function()
			{
				this.className=this.className.replace(new RegExp(" menu_hover\\b"), "");
				this.className=this.className.replace(new RegExp(" top_hover\\b"), "");
			};
		}
	};
	if(window.attachEvent){ window.attachEvent("onload", HoverMenu); }

	
}

function infobarhide()
{
	//Hides information bar
	$("#infobar").animate({"opacity":"0.5", "top":"-2em"}, 600);
	
}
function infobarshow()
{
	document.getElementById('infobar').style.top = "-2em";
	//document.getElementById('infobar').style.opacity = '0';
	//$("#infobar").css("opacity", ".5");
	//$("#infobar").animate({"opacity:":"0.0", "top":"-2em"}, 1);
	$("#infobar").animate({"opacity:":"1", "top":"0px"}, 600);
}

function removeHTMLTags(inCode)
{
 	var strInputCode = inCode;
	
	//strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
	//	return (p1 == "lt")? "<" : ">";
	//});
	var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
	strTagStrippedText = strTagStrippedText.replace("&lt;", "<");
	strTagStrippedText = strTagStrippedText.replace("&gt;", ">");
	
	return strTagStrippedText;	
}
