var cssmenuids=["cssmenu1"] //Enter id(s) of CSS Horizontal UL menus, separated by commas
var csssubmenuoffset=-3 //Offset of submenus from main menu. Default is 0 pixels.

function createcssmenu2(){
for (var i=0; i<cssmenuids.length; i++){
  var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
			ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px"
    	var spanref=document.createElement("span")
			spanref.className="arrowdiv"
			spanref.innerHTML=""
			ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
    	ultags[t].parentNode.onmouseover=function(){
					this.style.zIndex=100
    	this.getElementsByTagName("ul")[0].style.visibility="visible"
					this.getElementsByTagName("ul")[0].style.zIndex=0
    	}
    	ultags[t].parentNode.onmouseout=function(){
					this.style.zIndex=0
					this.getElementsByTagName("ul")[0].style.visibility="hidden"
					this.getElementsByTagName("ul")[0].style.zIndex=100
    	}
    }
  }
}

if (window.addEventListener)
window.addEventListener("load", createcssmenu2, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu2)

function drukuj_art(idx,idx2)
{
var xx=window.open('print.php?id='+idx+'&id2='+idx2,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');
return xx;
}

function validate(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = email;
   if(reg.test(address) == false)
		   return false;
			 else
			 return true;
		
}


function spr_mail()
{
var txt=document.getElementById('form_red').getElementsByTagName("textarea");
var inp=document.getElementById('form_red').getElementsByTagName("input");
if(inp[0].value.length==0)
	{
	alert('wpisz swój email')
	return false;
	}
	else
	{
	if(validate(inp[0].value))
		{
		if(inp[1].value.length==0)
			{
			alert('wpisz temat wiadomości')
			return false;
			}
			else
			{
			if(txt[0].value.length==0)
				{
				alert(txt[0].innerHTML.length)
				return false;
				}
			}
		}
		else
		{
		alert('zły adres email')
		return false;
		}
	}
}

function zmien_osobe(id)
{
var opis_u=document.getElementById('opis_usr');
advAJAX.get(
			{
			url: "user_info.php",
			id: id.value,
			onSuccess : function(obj) 
				{
				opis_u.innerHTML=obj.responseText;
				},
			onError : function(obj)
			  { 
				opis_u.innerHTML="Error: " + obj.status;
				}
			});
}