﻿/*function showUsers() {
	var pageId = document.usrForm.map.value;
	var url = "index.php?n=kat&k="+pageId;
	//alert (url);
	window.location.replace(url);
}
*/
function show(what) {
	var active;
	var elem = document.getElementById(what);
	if (elem.active == true) {
	elem.style.display = 'none';
	elem.active = false;
	}
	else {
	if (navigator.appName=='Netscape') {elem.style.display = 'table-cell';}
	else  {elem.style.display ='block';}
	elem.active = true;
	}
	
}

function submitSearch() {
	var f = document.getElementById('searchform');
	if ((f.nazwa.value=='-nazwa-')||(f.nazwa.value=='-название-'))
		f.nazwa.value = '';
	if ((f.opis.value=='-opis-')||(f.opis.value=='-описание-'))
		f.opis.value = '';
	f.submit;
}

function openwindow(target){
		window.open(target, "menu", "toolbar=yes, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=700, height=600");
}
function openimg(imagename){
<!-- 
	nw = window.open("about:blank","",'left=100, top=100, location=no, directories=no, width=540, height=360, resizable=0, scrollbars=no, menubar=no')
	doc = nw.document;
	doc.open('text/html');
	doc.write('<html><head><title>Iurista<\/title>');
	doc.write('<style type="text/css">body {background: #f0f0f0 url(imgs/back.gif) left top repeat;height:400px;padding-top:10px;}img {border:0px;}.big_img {border:0}a {color : #ffffff;text-decoration : none;}</style>');
	doc.write('<\/head><body><table width="520" height="330" valign="middle" border="0"><tr><td><center>');
	doc.write('<a href=# onclick=self.close()><img src=' + imagename + ' alt="Zamknij okno" class="big_img" style="vertical-align:middle;"><\/a><\/center><\/td><\/tr><\/table>');
	doc.write('<\/body><\/html>');
	doc.close();
}
function show(id){
	var e = document.getElementById(id);
	e.style.display='';
	
}
function hide(id){
	var e = document.getElementById(id);
	e.style.display='none';
	
}

function scolor(id,color){
	var e = document.getElementById(id);
	e.style.color = color;
	e.style.backgroundColor='cornsilk';
}
function bcolor(id,color){
	var e = document.getElementById(id);
	e.style.backgroundColor=color;
}
function remborder(id,add){
	var e = document.getElementById(id);
	if(add)
		e.style.borderBottomWidth='1';
	else
		e.style.borderBottomWidth='0';
}

function on(div_id){
	if(div_id=='div1'){
		//scolor('one','red');
		bcolor('one','ivory');
		//remborder('one',false);
		//scolor('two','blue');
		bcolor('two','#E8D6BB');
		hide('div2');
		show('div1');
	}else{
		//scolor('one','blue');
		bcolor('one','#E8D6BB');
		//scolor('two','red');
		bcolor('two','ivory');
		hide('div1');
		show('div2');
	}
}

function showGallery(id, lang) 
{ 
	var htmlContent = '<div id="flash_gallery" style="position:absolute;z-index:9999;width:100%;height:100%;"></div>';
	showLayer(htmlContent, 'gallery_layer', '0', '0');
	var so = new SWFObject("gallery.swf?gallery_id="+id+"&lang="+lang+"", "movie", "100%", "100%", "8", "#ffffff", true);
		so.addParam("scale", "noscale");		
		so.addParam("align", "top");
		so.addParam("wmode", "transparent");
		so.addParam("z-index", "9999");
		so.write("flash_gallery");
}

function showLayer(htmlContent, layerId, width, height) {
	var width = width;
	var height = screen.height;

	var left = ((screen.width/2) - (width/2));
	var top = ((screen.height/2) - (height/2));
	var layerStyle = 'z-index:100;margin:0; position:absolute; left:0px; top:124px; width:100%; height:95%;';
	var layerId = layerId;
	
	if(document.body.insertAdjacentHTML)
	{
		var layer = '<div id="'+layerId+'" style="'+layerStyle+'">' +
					'<div style="z-index:101" class="transparent_layer"></div>' +
					'<div style="z-index:102;margin:0;padding:0;"><img src="imgs/pop_close.gif" style="position:absolute;right:20px;top:20px;z-index:105;" alt="" onclick="deleteLayer(\''+layerId+'\')"/></div>' +
					'<div style="position:absolute;z-index:104;width:100%;height:95%;margin:0;">' +
					htmlContent +
					'<div></div>';
		document.body.insertAdjacentHTML("BeforeEnd",layer);
	}
	else 
	{
		var newLayer = document.createElement('div');
			newLayer.setAttribute('style', layerStyle);
			newLayer.setAttribute('id',layerId);
			//newLayer.setAttribute('onclick','deleteLayer(\''+layerId+'\')');
			newLayer.innerHTML ='<div style="z-index:101" class="transparent_layer"></div>' +
								'<div style="z-index:102;margin:0;padding:0;"><img src="imgs/pop_close.gif" style="position:absolute;right:20px;top:20px;z-index:105;" alt="" onclick="deleteLayer(\''+layerId+'\')"/></div>' +
								'<div style="position:absolute;z-index:104;width:100%;height:95%;margin:0;">' +
								htmlContent +
								'</div>';
		document.body.appendChild(newLayer);
	}
}

function updateLayer(htmlContent, layerId) {
	var layer = document.getElementById(''+layerId+'');
	layer.innerHTML ='<div style="margin:0;padding:0;position:relative;"><img src="imgs/pop_close.gif" style="position:absolute;right:-20px;top:-20px;z-index:100000;" alt="" onclick="deleteLayer(\''+layerId+'\')"/></div>' +
						'<div style="padding:20px;margin:0;background:#ffffff; border:1px solid #E8E8E8">' +
						htmlContent +
						'</div>';
}

function deleteLayer(id) {
	if (document.getElementById && document.getElementById(id)) {
		var theNode = document.getElementById(id);
		theNode.parentNode.removeChild(theNode);
	}
	else if (document.all && document.all[id]) {
		document.all[id].innerHTML='';
		document.all[id].outerHTML='';
	}
	// OBSOLETE CODE FOR NETSCAPE 4 
	else if (document.layers && document.layers[id]) {
		document.layers[id].visibility='hide';
		delete document.layers[id];
	}
}
