function nothing()
{
}

function showImageIcons(obj)
{
	return;

	var obj2 = obj.firstChild;
	while (obj2.className != "imageIcons")
	{
		obj2 = obj2.nextSibling;
		if (obj2 == null) return;
	}
	obj2.style.visibility = "";
}

function hideImageIcons(obj)
{
	return;

	var obj2 = obj.firstChild;
	while (obj2.className != "imageIcons")
	{
		obj2 = obj2.nextSibling;
		if (obj2 == null) return;
	}
	obj2.style.visibility = "hidden";
}

function imageZoom(file, w, h)
{
	file = file.replace(/&/, "%26");
	var w2 = w;
	var h2 = h;
	var sc = "no";
	var wmax = screen.availWidth - 40;
	var hmax = screen.availHeight - 60;

	if (w > wmax) { w2 = wmax; h2 += 16; sc = "yes, resizable=yes"; }
	if (h > hmax) { h2 = hmax; w2 += 16; sc = "yes, resizable=yes"; }

	if (top.imgZoomWin && !top.imgZoomWin.closed) top.imgZoomWin.close();

	imgZoomWin = window.open(rel_lib_path + "imagezoom.php?file=" + file + "&w=" + w + "&h=" + h, "Zoom", "scrollbars=" + sc + ", width=" + w2 + ", height=" + h2 + "");
}

// Toggle visibility of an object
//
// in id = (string) Object's ID
// in state = (bool) true/false: Force to show/hide it [optional]
//
function toggleVisId(id, state)
{
	return toggleVisObj(document.getElementById(id), state);
}

// Toggle visibility of an object
//
// in obj = (object) Object
// in state = (bool) true/false: Force to show/hide it [optional]
//
function toggleVisObj(obj, state)
{
	if (obj == null) return;
	if (state == null)
	{
		if (obj.style.display == "") newstate = "none";
		else                         newstate = "";
	}
	else
	{
		if (state) newstate = "";
		else       newstate = "none";
	}
	obj.style.display = newstate;
	return (newstate == "" ? 1 : -1);
}

// scroll the window by the height of an item
//
function scrollDownId(id)
{
	scrollDownObj(document.getElementById(id));
}

function scrollDownObj(obj)
{
	window.scrollBy(0, obj.offsetHeight);
}

function scrollUpId(id)
{
	scrollUpObj(document.getElementById(id));
}

function scrollUpObj(obj)
{
	window.scrollBy(0, -obj.offsetHeight);
}

function toggleVisIdScroll(id)
{
	var obj = document.getElementById(id);
	if (obj == null) return;

	if (obj.style.display == "")
	{
		window.scrollBy(0, -obj.offsetHeight);
		newstate = "none";
		obj.style.display = newstate;
	}
	else
	{
		newstate = "";
		obj.style.display = newstate;
		window.scrollBy(0, obj.offsetHeight);
	}
	return (newstate == "" ? 1 : -1);
}

/*
function toggleVisIdScroll(id)
{
	if (toggleVisId(id) == 1)
		scrollDownId(id);
	else
		scrollUpId(id);
}
*/

var leftSideDefaultTop;
var lastScrollY;

function OnScroll(e)
{
	OnTimer();
}

function Init()
{
	if (window.pageYOffset != null)
	{
		leftSideDefaultTop = document.getElementById("leftSide").offsetTop;
		lastScrollY = 0;
		OnTimer();
		window.setInterval("OnTimer()", 50);
		
		//window.addEventListener("scroll", OnScroll, false);
	}
}

function OnTimer()
{
	if (window.pageYOffset != lastScrollY)
	{
		var leftSide = document.getElementById("leftSide");
		lastScrollY = window.pageYOffset;

		if (lastScrollY > leftSideDefaultTop - 23)
		{
			leftSide.style.position = "fixed";
			leftSide.style.top = "0px";
		}
		else
		{
			leftSide.style.position = "absolute";
			leftSide.style.top = "";
		}

		//var newtop = leftSideDefaultTop - /* #leftSide:margin-top */ 23 - lastScrollY;
		//if (newtop < 0) newtop = 0;
		//leftSide.style.top = newtop + "px";
	}
}

function HideNavigation()
{
	var leftSide = document.getElementById("leftSide");
	var showNavi = document.getElementById("showNavi");
	var leftSideExtra = document.getElementById("leftSideExtra");
	var content = document.getElementById("content");
	var footline = document.getElementById("footline");
	
	leftSideExtra.style.display = 'none';
	showNavi.style.display = '';
	//content.style.marginTop = '45px';
	content.style.marginLeft = '0px';
	footline.style.marginLeft = '0px';
	leftSide.className = 'minimised';
}

function ShowNavigation()
{
	var leftSide = document.getElementById("leftSide");
	var showNavi = document.getElementById("showNavi");
	var leftSideExtra = document.getElementById("leftSideExtra");
	var content = document.getElementById("content");
	var footline = document.getElementById("footline");
	
	leftSideExtra.style.display = '';
	showNavi.style.display = 'none';
	//content.style.marginTop = '';
	content.style.marginLeft = '';
	footline.style.marginLeft = '';
	leftSide.className = '';
}

// ---------- IE PNG hack ----------

// Correctly handle PNG transparency in Win IE 5.5 or higher.
// This hack is only applied to a list of files defined by the selected design.
//
function UnbCorrectPNGforIE()
{
	var imgStyle;

	for (var i = 0; i < document.images.length; i++)
	{
		var img = document.images[i];
		if (img.src.substring(img.src.length - 4) == ".png")
		{
			// NOTE: initially hidden images NEED a width&height specification!
			if (img.width > 0 || img.height > 0)
				var size = "width:" + img.width + "px; height:" + img.height + "px; ";
			img.outerHTML = "<span" +
				((img.id) ? " id=\"" + img.id + "\"" : "") +
				((img.className) ? " class=\"" + img.className + "\"" : "") +
				((img.title) ? " title=\"" + img.title + "\"" : "") +
				" style=\"" + size + "display:inline-block; line-height:1px; margin:0px; font-size:1px; padding:0px;" +
					((img.align == "left") ? " float:left;" : "") +
					((img.align == "right") ? " float:right;" : "") +
					((img.parentElement.href) ? " cursor:pointer;" : "") +
					img.style.cssText + "; " +
					"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.src + "', sizingMethod='scale');\"></span>";
			i--;
		}
	}
}

//if (navigator.appName == "Microsoft Internet Explorer")
if (document.all && document.all[0].style.filter != null)   // Opera-safe
{
	// This function enables the Internet Explorer work-around to display alpha-
	// transparent PNG images with their correct transparency. This uses the
	// filenames of all images to convert provided by each design definition.
	// The function itself works fine and does its job in a reasonable time,
	// however it breaks clickable smilies in the post editor. They're still
	// displayed correctly but clicking them leads to unpredictable behaviour.
	// If you prefer working smilies selectbox over correct transparency, and
	// you're using a full-transparency smilies set, you should disable the
	// following line.
	//
	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("MSIE 6") != -1)
		window.attachEvent("onload", UnbCorrectPNGforIE);
}

