// JavaScript Document

function ylib_Browser()
{
	d=document;
	this.agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom=(d.getElementById)?1:0;
	this.ns=(d.layers);
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.dom&&navigator.appName=="Netscape");
	this.op=(window.opera? 1:0);
	this.ie=(d.all);
	this.ie4=(d.all&&!this.dom)?1:0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
};

var oBw = new ylib_Browser();

function DisplayElement ( elt, displayValue ) {
	if ( typeof elt == "string" )
		elt = document.getElementById( elt );
	if ( elt == null ) return;

	//alert(elt.tagName);

	if ( oBw && oBw.ns6 ) {
		// OTW table formatting will be lost:
		if ( displayValue == "block" && elt.tagName == "TR" )
			displayValue = "table-row";
		else if ( displayValue == "inline" && elt.tagName == "TR" )
			displayValue = "table-cell";
		else if ( displayValue == "block" && elt.tagName == "TBODY" )
			displayValue = "table-row-group";
	}

	elt.style.display = displayValue;
}

//
// The variable rows_per_page has to be set (e.g. by Smarty Template Engine)!
//
function DisplayAllElements (thisid, field, displayValue, count_result_rows ) {
	if ( oBw ) {
		// OTW table formatting will be lost:
		for (i = 0; i < count_result_rows; i++) {
		
			elt = document.getElementById( thisid+[i] );

			this_displayValue = displayValue;

			//alert(this_displayValue);

			if (oBw.ns6)
			{
				if ( displayValue == "block" && elt.tagName == "TR" )
				{
					this_displayValue = "table-row";
				}
				else if ( displayValue == "inline" && elt.tagName == "TR" )
				{
					this_displayValue = "table-cell";
				}
				else if ( displayValue == "block" && elt.tagName == "TBODY" )
				{
					this_displayValue = "table-row-group";
				}
			}
			elt.style.display = this_displayValue;
		}
	}
}