/*
--------------------------------------------------------------------------------------------------------
This library was written to manipulate with visibility of CSS div tags (layers)
Copyright (C) 2005-2006 Damijan Kocuvan

Licensed under the terms of the GNU Lesser General Public License:
--------------------------------------------------------------------------------------------------------
	This library is free software; you can redistribute it and/or modify it under the terms
	of the GNU Lesser General Public License as published by the Free Software Foundation; 
	either version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful, but WITHOUT ANY
	WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
	PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License along with
	this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
	Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------------------------------------
For further information visit: http://www.opensource.org/licenses/lgpl-license.php
--------------------------------------------------------------------------------------------------------
File Name:	section.js

Description:
	Search form navigation/manipulation library

File Authors:
	Damijan kocuvan <kocuvan at simail dot org>
*/

// Detect browser type
function getBrowserType(){
	var browserType;

	if (document.layers) {browserType = "nn4"}
	if (document.all) {browserType = "ie"}
	if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}

	return browserType;
}

// Hide layer (div tag) contents
function Hide(element) {
	ShowHide(element,'none');
}

// Show layer (div tag) contents
function Show(element) {
	ShowHide(element,'inline');
}

// Detect current layer's (div tag's) visibility setting
function getVisibility(element) {
	var browserType=getBrowserType();
	var visibility='none';

	if (browserType == "gecko" ) document.poppedLayer = eval('document.getElementById(element)');
	else if (browserType == "ie") document.poppedLayer = eval('document.all[element]');
	else document.poppedLayer = eval('document.layers[element]');

	if (document.poppedLayer) visibility = document.poppedLayer.style.display;
	return visibility;
}

// Swap visibility of a given layer (div tag): visible to hidden and viceversa
function swap(element) {
	var visibility=getVisibility(element);
	if (visibility == 'none') ShowHide(element,'inline');
	if (visibility == 'inline') ShowHide(element,'none');
}

// Show or hide layer (div tag) contents
function ShowHide(element,action) {
	var browserType=getBrowserType();

	if (browserType == "gecko" ) document.poppedLayer = eval('document.getElementById(element)');
	else if (browserType == "ie") document.poppedLayer = eval('document.all[element]');
	else document.poppedLayer = eval('document.layers[element]');
	if (document.poppedLayer) {
		document.poppedLayer.style.display = action;
		//if (action == "visible") document.poppedLayer.style.height = "auto";
		//if (action == "hidden") document.poppedLayer.style.height = "0px";
	}
}