var xIE = (document.all) ? 1 : 0;
var xDOM = 0; 
if (parseInt(navigator.appVersion) >=5) {xDOM=1};

var lastHeader;
var currShow;

function changeCont(tgt1, tgt2, header) {
				//	 14, tab14

	var tgt = tgt1 + tgt2;
	target=('T' +tgt);
	
	// sprememba css-a on the fly (barva headerjev in barva teksta headerjev)
	ChangeCss('TR.Header', 'backgroundColor', tab_on[tgt2]);
	ChangeCss('TR.SubHeader', 'color', tab_on[tgt2]);

	if (xDOM) {
		// Hide the last one, and flip the tab color back.
		currShow.style.visibility="hidden";
		if ( lastHeader ) {
			lastHeader.style.background = tab_off;
			lastHeader.style.fontWeight="normal";
		}
	
		// Show this one, and make the tab silver
		var flipOn = document.getElementById(target);
		flipOn.style.visibility="visible";

		var thisTab = document.getElementById(header); // tab
		var thisRow1 = document.getElementById('tr1'); // zgornji zavihki
		var thisRow2 = document.getElementById('tr2'); // spodnji zavihki
		thisTab.style.background = tab_on[tgt2];
		thisRow1.style.background = tab_on[tgt2];
		thisRow2.style.background = tab_on[tgt2];

		// Save for next go'round
		currShow=document.getElementById(target);
		lastHeader = document.getElementById(header);

		var HeightOfContent = document.getElementById(target).scrollHeight;
		document.getElementById("pricelist-anc").style.height = HeightOfContent;

		return false;
	}

	else if (xIE) {
		// Hide the last one, and flip the tab color back.
		currShow.style.visibility = 'hidden';
		if (lastHeader) {
			lastHeader.style.background = tab_off;
			lastHeader.style.fontWeight="normal";
		}

		// Show this one, and make the tab silver
		document.all[target].style.visibility = 'visible';
		document.all[header].style.background = tab_on[tgt2]; // tab
		document.all['tr1'].style.background = tab_on[tgt2]; // zgornji zavihki
		document.all['tr2'].style.background = tab_on[tgt2]; // spodnji zavihki

		// Save for next go'round
		currShow=document.all[target];
		lastHeader=document.all[header];

		var HeightOfContent = document.all(target).scrollHeight;
		document.all("pricelist-anc").style.height = HeightOfContent;

		return false;
	}

	// && (version >=4)
	else {
		window.location=('#A' +target);
		return true;
	}
}

function DrawTabs() {
	var output = '';

	for ( var x = 1; x <= num_rows; x++ ) {
		if( x > 1 ) {
		}

		output += '<div id="tabstop" style="position: relative; ';
		output += ' z-index:1;';
		output += '">\n';
		output += '<table border="0" cellpadding="0" cellspacing="0">\n';
		output += '<tr valign="top">\n';

		for ( var z = 1; z < rows[x].length; z++ ) {
			var tid = "tab" + x + z;
			output += '<td id="' + tid +'" class="tab-button"><nobr><img src="../filelib/pricelist/left_1.gif" align="absmiddle"><a href="#" onClick="changeCont(\'' + x + '\', \'' +  z + '\', \'' + tid + '\'); return false;" onFocus="if(this.blur)this.blur()" class="tab-button">' + rows[x][z] + '</a><img src="../filelib/pricelist/right_1.gif" align="absmiddle"></nobr></td>\n';
		}

		output += '</tr>\n';
		output += '</table>\n';
		output += '</div>\n\n';
	}
	self.document.write(output);
}

function ChangeCss(theClass,element,value) {
	var cssRules;
	if (document.all) {
		cssRules = 'rules';
	} else if (document.getElementById) {
		cssRules = 'cssRules';
	}
	for (var S = 0; S < document.styleSheets.length; S++) {
		for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
			if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
				document.styleSheets[S][cssRules][R].style[element] = value;
			}
		}
	}
}
