//Dodaje zdarzenie do obiektu (w IE, FF, Opera)
//Przyk�ad zastosowania w funkcji showimg
function addEvent(obj, type, fn) { 
	//obj.attachEvent("on"+type, fn); 
	//return false;
	if (obj.addEventListener) { 
		obj.addEventListener(type, fn, false); 
	} else if (obj.attachEvent) { 
		obj["e"+type+fn] = fn; 
		obj[type+fn] = function() {obj["e"+type+fn](window.event); } 
		obj.attachEvent("on"+type, obj[type+fn]); 
	} 
}

// Correctly handle PNG transparency in Win IE 5.5 or higher.
// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004

function correctPNG()
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	
	if ((version >= 5.5) && (document.body.filters)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
	      var img = document.images[i]
	      var imgName = img.src.toUpperCase()
	      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	      {
	         var imgID = (img.id) ? "id='" + img.id + "' " : ""
	         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
	         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
	         var imgStyle = "display:inline-block;" + img.style.cssText 
	         if (img.align == "left") imgStyle = "float:left;" + imgStyle
	         if (img.align == "right") imgStyle = "float:right;" + imgStyle
	         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	         var strNewHTML = "<span " + imgID + imgClass + imgTitle
	         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
	         img.outerHTML = strNewHTML
	         i = i-1
	      }
	   }
	}
}

//	Funkcje do rozwi?zywania problemu z wy?wietlaniem ramki wok� obiekt�w Flash (pocz?tek)

window.onload = function()
{
	
	var objects = document.getElementsByTagName('noscript');
	for (var i = objects.length - 1; i >= 0 ; i--)
	{
		var html = objects[i].innerHTML;
		html = html.substring(12, html.length-12);
		objects[i].outerHTML = html;
	}
}

/*
window.onload = function(){
	var o,n,j,i,p,t,ob = new Array(),objs = document.getElementsByTagName('object');	
	for(i=0;i<objs.length;i++) if (!objs[i].className.match(/(^|\s)noninteractive($|\s)/)) ob.push(objs[i]);
	objs=null;
	for(i=0;i<ob.length;i++)
	{
		t='';
		for(j=0;j<ob[i].childNodes.length;j++)
		{
			if (ob[i].childNodes[j].tagName != 'OBJECT')
			t += ob[i].childNodes[j].outerHTML;
		}
		t = ob[i].outerHTML.replace("</OBJECT>",t + "</OBJECT>");
		
		n = ob[i].nextSibling;
		p = ob[i].parentNode;
		
		p.removeChild(ob[i]);
		ob[i] = null;
	
		o = document.createElement('span');
		o.innerHTML = t;
		o = o.firstChild;
	
		p.insertBefore(o,n);
	}
}
*/

/*
window.onload = function(){
	o=document.getElementsByTagName('object');l=o.length
	for(j=0;j<l;j++){
        a=p=A=P=''
		A=o[j].attributes; 
		P=o[j].parentNode.getElementsByTagName('param'); 
		for(i=0;i<A.length;i++){a+=A[i].name+'="'+A[i].value+'" '+"\n";}
		for(i=0;i<P.length;i++){p+='<param name="'+P[i].name+'" value="'+P[i].value+'"/>'+"\n"}
		o[j].outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+a+'>'+p+'</object>';
	}
}
*/
//	Funkcje do rozwi?zywania problemu z wy?wietlaniem ramki wok� obiekt�w Flash (koniec)


var nn4 = (document.layers) ? true:false; 
var ie4 = (document.all) ? true:false; 
var ie6nn6 = (document.getElementById) ? true:false; 

	//Utworzenie obiektu, kt�ry b�dzie zbiera� zdarzenia od klikni�� myszki
	//Element ten b�dzie poza bubble, wi�c b�dzie go mo�na wykorzysta� w otwieraj?cym si� okienku
	//aby mo�na by�o dowiedzie� si�, z jakiego elementu pochodzi zdarzenie
	//np. window.opener.elementClicked.title
	window.elementClicked = null;
	function mDown(){
	  window.elementClicked = event.srcElement;
	}
	document.onmousedown = new Function("mDown()");
	//



function ScrollText(text,seed)
{
	var msg = text;
	var out = " ";
	var c   = 1;
	if (seed > 100)
	{
		seed--;
		var cmd="ScrollText(\"" + msg + "\"," + seed + ")";
		timerTwo=window.setTimeout(cmd,100);
	}
	else if (seed <= 100 && seed > 0)
	{
		for (c=0 ; c < seed ; c++)
		{
			out+=" ";
		}
		out+=msg;
		seed--;
		var cmd="ScrollText(\"" + msg + "\"," + seed + ")";
		window.status=out;
		timerTwo=window.setTimeout(cmd,100);
	}
	else if (seed <= 0)
	{
		if (-seed < msg.length)
		{
			out+=msg.substring(-seed,msg.length);
			seed--;
			var cmd="ScrollText(\"" + msg + "\"," + seed + ")";
			window.status=out;
			timerTwo=window.setTimeout(cmd,100);
		}
		else
		{
			var cmd="ScrollText(\"" + msg + "\",100)";
			window.status=" ";
			timerTwo=window.setTimeout(cmd,75);
		}
	}
}

function obetnij_spacje(Str)
{
	dlugosc=Str.length;
	while (Str.slice(0,1) == " ")
	{
		 Str = Str.substr(1,dlugosc-1);
	 	 dlugosc = Str.length
	}
	while (Str.slice(dlugosc-1,dlugosc)== " ")
	{
	 	 Str = Str.substr(0,dlugosc-1);
	 	 dlugosc = Str.length
 	}
	return Str;
}

function blank(pole)
{
	return (pole=="");
}

function search()
{
	if (blank(obetnij_spacje(sz.search_txt.value)))
	{
		sz.search_txt.value='szukaj...';
		sz.op.value='';
	}
	else
		sz.op.value='o';
}

function test()
{
	ok = true;
	if ((!sz.op.value.length)||blank(obetnij_spacje(sz.search_txt.value)))
		ok=false; //szukana nazwa
	(ok==true)?sz.submit():alert("Wprowad� tekst, kt�ry chcesz wyszuka�.");
	return false;
}

function zmien(obiekt,numer,link_nr)
{
	aid=document.getElementById(link_nr)
	if(numer>0) {
		obiekt.bgColor = '#FFFFFF';
		aid.style.color='#004185';
	}
	else {
		obiekt.bgColor = '#004185';
		aid.style.color='#FFFFFF';
	}
	return true;
}

function showimg(imgPath,imgFile,imgWidth,imgHeight,imgDescription,imgScale)
{
//Pami�ta� o tym, aby wszystkie flash na stronie mia�y ustawione
//<param name="wmode" value="transparent" />
//oraz wszystkie inne warstwy ni� "wyskakuj�cego" obrazka mia�y z-index<50
//Style z ustawieniami do warstwy obrazka znajduj? si� w style.css
//Je?li opis podamy jaki tekst, to poka�e si� on bezpo?rednio
//Je?li opis b�dzie mia� wpisane 0 (zero), to b�dzie poszukiwany w tre?ci
//Je?li opis b�dzie mia� warto?� >0, to b�dzie warto?ci opisu z pola imgDesc{imgID} np. imgDesc1234
	
	document.images.imgImg.width=137;
	document.images.imgImg.height=12;
	document.images.imgImg.src='/edytorek/edytorimg/loading.gif';
	var MAX_MIN_WIDTH=800;
	var MAX_MIN_HEIGHT=500;
	var imgW=imgWidth;
	var imgH=imgHeight;
	var imgS=imgScale;
	var scrollX=0;
	var scrollY=0;
	
	/*
	if(document.body)
		scrollX=document.body.scrollLeft;//IE6, Opera
	else if (window.scrollX)
		scrollX=window.scrollX;//FF
	else if(document.documentElement)
		scrollX=document.documentElement.scrollLeft;//IE7, FF, Opera
	else
		scrollX=0;

	if(document.body)
		scrollY=document.body.scrollTop;//IE6, Opera
	else if(document.documentElement)
		scrollY=document.documentElement.scrollTop;//IE7, FF, Opera
	else if (window.scrollY)
		scrollY=window.scrollY;//FF
	else
		scrollY=0;
	*/
	
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	
	scrollX=document.all? iebody.scrollLeft : pageXOffset
	scrollY=document.all? iebody.scrollTop : pageYOffset
	

	if ((imgS>0) && (parseInt(imgWidth)>MAX_MIN_WIDTH || parseInt(imgHeight)>MAX_MIN_HEIGHT)) {
		dXY = Math.min(MAX_MIN_WIDTH/imgWidth,MAX_MIN_HEIGHT/imgHeight);
		imgW = parseInt(imgWidth*dXY);
		imgH = parseInt(imgHeight*dXY);
		//alert ("imgWidth="+imgWidth+", imgHeight="+imgHeight+"\nimgW="+imgW+", imgH="+imgH);
	}
	else
		imgS=0;

	//Odleg�o?� od lewej kraw�dzi
	if (imgW<iebody.clientWidth)
		document.getElementById("imgTable").style.left=(scrollX+((iebody.clientWidth)/2)-(imgW/2)-5)+"px";
	else
		document.getElementById("imgTable").style.left=(scrollX+5)+"px";

	//Odleg�o?� od g�ry
	if (imgH<iebody.clientHeight){
		document.getElementById("imgTable").style.top=(scrollY+((iebody.clientHeight)/2)-(imgH/2)-15)+"px";
	}
	else
		document.getElementById("imgTable").style.top=(scrollY+15)+"px";

	document.images.imgImg.width=imgW;
	document.images.imgImg.height=imgH;
	document.images.imgImg.src=imgPath+imgFile;
	document.getElementById("imgFooter").width=imgW+"px";
	document.getElementById("imgTable").style.visibility='visible';

	if (document.getElementById("imgMax")){
	//Nowa wersja
		if (imgS>0) {
			addEvent(document.getElementById("imgMax"), 'click', function(){showimg(imgPath,imgFile,imgWidth,imgHeight,imgDescription,0);});
			document.getElementById("imgMax").style.display="block";
		}
		else{
			document.getElementById("imgMax").style.display="none";
		}
		//document.getElementById("imgTitle").innerHTML='Ilustracja';
	}
	else{
	//Stara wersja
		document.getElementById("imgHeader").innerHTML='<img hspace=\"1\" vspace=\"1\" align=\"right\" src="/edytorek/edytorimg/close.gif" alt="zamknij" style="cursor:pointer" onclick="document.getElementById(\'imgTable\').style.visibility=\'hidden\';document.getElementById(\'imgTable2\').style.visibility=\'hidden\';document.images.imgImg.src=\'/edytorek/edytorimg/empty.gif\';hideIMG();" />';	
		if (imgS>0) {
			document.getElementById("imgHeader").innerHTML+='<img hspace=\"1\" vspace=\"1\" align=\"right\" src="/edytorek/edytorimg/max.gif" alt="Maksymalizuj" style="cursor:pointer" onclick="showimg(\''+imgPath+'\',\''+imgFile+'\',\''+imgWidth+'\',\''+imgHeight+'\',\''+imgDescription+'\',0);" />';
		}
		document.getElementById("imgHeader").innerHTML+='Ilustracja';
	}
	if (isNaN(imgDescription)){
		document.getElementById("imgFooter").innerHTML=imgDescription;
	}
	else if (imgDescription>0){
		document.getElementById("imgFooter").innerHTML=eval('imgDesc'+imgDescription+'.innerHTML');
	}
	else {
		//Komentarz z tre?ci dokumentu
		var str = document.body.innerHTML;
		var re1 = new RegExp('title=["?](.*?)["?](.*)'+imgFile+'(.*)', 'gi');//Je?li wielowyrazowe, to w cudzys�owach
		var re2 = new RegExp('title=([^ ]+)(.*)'+imgFile+'(.*)', 'gi');//Je?li jednowyrazowe, to bez cudzys�ow�w
		var a;
		if (!(a=re1.exec(str)))
			a=re2.exec(str);
		if (a) {
			document.getElementById("imgFooter").innerHTML=""+a[1].replace("powi�ksz zdj�cie ", "")+"";
		}
		else if (document.getElementById("txtGaleria").innerHTML){
			document.getElementById("imgFooter").innerHTML=document.getElementById("txtGaleria").innerHTML;
		}
		else {
			document.getElementById("imgFooter").innerHTML="";
		}
	}
	
	document.getElementById("imgTable2").style.left=(parseInt(document.getElementById("imgTable").style.left)-1)+"px";
	document.getElementById("imgTable2").style.top=(parseInt(document.getElementById("imgTable").style.top)-1)+"px";
	document.getElementById("imgTable2").style.width=(document.getElementById("imgTable").clientWidth+5)+"px";
	document.getElementById("imgTable2").style.height=(document.getElementById("imgTable").clientHeight+5)+"px";
	document.getElementById("imgTable2").style.visibility='visible';
}


function hideIMG()
{
	document.getElementById("imgTable2").style.left="0px";
	document.getElementById("imgTable2").style.width="0px";
	document.getElementById("imgTable").style.left="0px";
	document.images.imgImg.width="0px";
}

function rekom()
{
	var r_w = '';
	r_w = window.open("linki.php","linki","width=400,height=400,toolbar=no,menubar=no,scrollbars=yes");
	r_w.location.reload();
	r_w.focus();
//	window.open("/linki.php","linki","width=400,height=400,toolbar=no,menubar=no,scrollbars=yes");
}

function PokazUkryj(idObj, pokaz) 
{ 
nn6 = (document.getElementById) ? true:false; 
nn4 = (document.layers) ? true:false; 
ie4 = (document.all) ? true:false; 
//if ((nn6) && (ie4)) {nn6=null;} 
 
var attribV;
var attribD;
 if (nn6) {
  attribV = (pokaz) ? 'visible' : 'hidden';
  attribD = (pokaz) ? '' : 'none';
  document.getElementById(idObj).style.visibility=attribV; 
  document.getElementById(idObj).style.display=attribD;	
 } 
 else if (ie4){ 
    attribV = (pokaz) ? 'visible' : 'hidden';
	attribD = (pokaz) ? '' : 'none';
	document.all[idObj].style.visibility=attribV;
    document.all[idObj].style.display=attribD;	
 } 
 else if (nn4){ 
     attribV = (pokaz) ? 'show' : 'hide';
     document.layers[idObj].visibility = attribV;
 } 
} 

function popFrameLoad(plik, stan, opis, w, h){
//Funkcja s�u�?ca do �adowania do "wyskakuj?cego okienka" (ramki) dowolny plik, np. ankiet�.

//document.all.iFrameTable.style.left=50;
//document.getElementById("iFrameTable").style.top=150;
//document.getElementById("iFrameTable").style.left=150;
//document.getElementById("popIF").style.width=300;
//alert(document.body.scrollHeight);
//alert(document.body.clientHeight);
	
	var IFW=640;//Szeroko?� wyskakuj?cego "okienka"
	var IFH=480;//Wysoko?� wyskakuj?cego "okienka"
	if(parseInt(w)>0)	IFW=w;
	if(parseInt(h)>0)	IFH=h;
	var scrollX=0;
	var scrollY=0;

	if (window.scrollX)
		scrollX=window.scrollX;//FF
	else
		scrollX=document.body.scrollLeft;//IE, Opera

	if (window.scrollY)
		scrollY=window.scrollY;
	else
		scrollY=document.body.scrollTop;

if (plik){
		//if (ie6nn6 && ie4 || ie4)//Tylko IE
		/*
		if (ie4)//Tylko IE
			popIF.location.href=plik;
		else if (ie6nn6)//Tylko FF
		*/
			document.getElementById("popIF").contentWindow.location.href=plik;
	}
//		window.frames['popIF'].location.href=plik;

	if (opis)
		document.getElementById("tdIFhead").innerHTML="&nbsp;"+opis;


	//Odleg�o?� od lewej kraw�dzi
	if (IFW<document.body.clientWidth)
		document.getElementById("iFrameTable").style.left=(document.body.scrollLeft+((document.body.clientWidth)/2)-(IFW/2)-5)+"px";
	else
		document.getElementById("iFrameTable").left=(document.body.scrollLeft+5)+"px";

	//Odleg�o?� od g�ry
	if (IFH<document.body.clientHeight)
		document.getElementById("iFrameTable").style.top=(document.body.scrollTop+((document.body.clientHeight)/2)-(IFH/2)-15)+"px";
	else
		document.getElementById("iFrameTable").style.top=(document.body.scrollTop+15)+"px";

		document.getElementById("popIF").style.width=(IFW-2)+"px";
		document.getElementById("popIF").style.height=(IFH-20)+"px";

//document.getElementById("iFrameTable").style.top=150;
//document.getElementById("iFrameTable").style.left=150;

	if (stan>0){
		document.getElementById("iFrameTable").style.display="block";
		document.getElementById("iFrameTable").style.zIndex=254;
	}
	else{
		document.getElementById("iFrameTable").style.display="none";
		document.getElementById("iFrameTable").style.zIndex=100;
	}
}

function popFrameLoad2(plik, stan, opis, w, h){
	var okno = window.open("","","left=0, top=0, width=1024, height=738, scrollbars=no, toolbar=no,resizable=yes, status=no,directories=no,menubar=no,fullscreen=yes,channelmode=yes,location=no");
	var tresc= "<HTML><BODY style='padding:0px;margin:0px;overflow:hidden;'><iframe id='popIF' frameborder='0'  width='100%' height='100%' style='width:100%;height:100%;border:0px;' src='"+plik+"'></iframe></BODY></HTML>";
	//var tresc= "<HTML><BODY style='padding:0px;margin:0px;overflow:hidden;'><iframe id='popIF' frameborder='0'  width='100%' height='100%' style='width:100%;height:100%;border:0px;' src='about:blank'></iframe></BODY></HTML>";
	okno.document.write(tresc);
	//okno.document.getElementById("popIF").contentWindow.location.href=plik;
	return false;
}

function obj_visible(obj) {
	
//	var pozycje = Array('kategor','images','tables','references','links','sondy','ankiety');
	var pozycje = Array('kategor','images','tables','links','sondy','ankiety','formularze');
	for (x=0; x<pozycje.length; x++) 
	{ 
		if (document.getElementById(pozycje[x])){
			if(obj==pozycje[x]){ // selected element
				if (ie6nn6){
					var actual = eval("document.getElementById('"+pozycje[x]+"').style.display");
					if(actual=='none') eval("document.getElementById('"+pozycje[x]+"').style.display='';");
					else eval("document.getElementById('"+pozycje[x]+"').style.display='none';");
					var actual = eval("document.getElementById('"+pozycje[x]+"_roll').className");
					if(actual=='ed_roll') eval("document.getElementById('"+pozycje[x]+"_roll').className='ed_roll2'");
					else eval("document.getElementById('"+pozycje[x]+"_roll').className='ed_roll'");
				}
				else if (ie4) { // IE
					var actual = eval("document.all."+pozycje[x]+".style.display");
					if(actual=='none') eval("document.all."+pozycje[x]+".style.display='';");
					else eval("document.all."+pozycje[x]+".style.display='none';");
					var actual = eval("document.all."+pozycje[x]+"_roll.className");
					if(actual=='ed_roll') eval("document.all."+pozycje[x]+"_roll.className='ed_roll2'");
					else eval("document.all."+pozycje[x]+"_roll.className='ed_roll'");
				} 
				else if (nn4){ // NS
					var actual = eval("document.layers['"+pozycje[x]+"'].display");
					if(actual=='none') eval("document.layers['"+pozycje[x]+"'].display='';");
					else eval("document.layers['"+pozycje[x]+"'].display='none';");
				}
			}
			else{ // other elements
				if (ie6nn6){
					eval("document.getElementById('"+pozycje[x]+"').style.display='none';");
					eval("document.getElementById('"+pozycje[x]+"_roll').className='ed_roll'");
				}
				else if (ie4) { // IE
					eval("document.all."+pozycje[x]+".style.display='none';");
					eval("document.all."+pozycje[x]+"_roll.className='ed_roll'");
				} 
				else if (nn4){ // NS
					eval("document.layers['"+pozycje[x]+"'].display='none';");
				}
			}
		}
	} 
}

//Funkcje do efektownego wyszarzania obrazk�w
function high(which2)
{ theobject=which2
highlighting=setInterval("highlightit(theobject)",30)}
function low(which2)
{clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=50
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
/**
Obrazka doda� kod:
style="FILTER: alpha(opacity = 50); moz-opacity: 0.3; "
onmouseover="high(this)" 
onmouseout="low(this)"

czyli np:
<IMG SRC="adres_pliku" onmouseover="high(this)" style="FILTER: alpha(opacity = 50); moz-opacity: 0.3" onmouseout="low(this)">
*/
// sprawdzanie poprawno�ci emaila
function emailCheck (emailStr) {
var checkTLD=1; // sprawdzanie ko�c�wki
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
alert("Niepoprawny adres email (sprawd� po�o�enie @ oraz .)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Nazwa u�ytkownika zawiera niedozwolone znaki.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Nazwa domeny zawiera niedozwolone znaki.");
return false;
   }
}
if (user.match(userPat)==null) {
alert("Niepoprawna nazwa u�ytkownika.");
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Docelowy adres IP jest niepoprawny!");
return false;
   }
}
return true;
}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("Niepoprwana nazwa domeny.");
return false;
   }
}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Adres musi si� ko�czy� nazw� domeny lub dwuliterowej nazwy " + "kraju.");
return false;
}
if (len<2) {
alert("W adresie brakuje nazwy hosta!");
return false;
}
return true;
}

//Sprawdzenie ksi�gi go�ci
function test_ks_g(forma){
ok=true;

if(ok&&blank(obetnij_spacje(forma.elements['ks_g_imie'].value))) 
	{	forma.elements['ks_g_imie'].style.background = "#ff0000";	ok=false;} //nazwa firmy

if(!blank(forma.elements['ks_g_email'].value)){	
	if(ok&&!emailCheck(forma.elements['ks_g_email'].value))
		{	forma.elements['ks_g_email'].style.background = "#ff0000";	ok=false;} 			//email
}

if(ok&&blank(obetnij_spacje(forma.elements['ks_g_tresc'].value))) 
	{	forma.elements['ks_g_tresc'].style.background = "#ff0000";	ok=false;} //nazwa firmy


(ok==true)?forma.submit():alert("Wprowadzono niepoprawne dane!");
}

//Pokazanie okna z wpisem do ksi�gi go�ci
function kg_show_add() {
	menu = 'ksiega_dodaj';
	if (document.getElementById) { // IE NS6
		obj = document.getElementById(menu);
		actual = obj.style.display ;
		if(actual=='none') obj.style.display='';
		else obj.style.display='none';
	} 
	else { // NS4
		var actual = eval("document.layers['"+menu+"'].display");
		if(actual=='none') eval("document.layers['"+menu+"'].display='';");
		else eval("document.layers['"+menu+"'].display='none';");
	}
}

function download_file(hddFile, orgFile)
{
if (hddFile=="" || orgFile==""){
	alert("Plik nie zosta� odnaleziony na serwerze.");
	return false;
}
if (orgFile=="")
	orgFile=hddFile;

var dx = screen.width;
var dy = screen.height;
var szer = dx/2;
var wys = dy/2;
//var s = "/edytorek/download_file.php?hddFile="+hddFile+"&orgFile="+orgFile;
var s = "/download_file.php?hddFile="+hddFile+"&orgFile="+orgFile;
var okno_down = window.open(s,'DownloadFile','width='+ szer +' ,height='+ wys +' , left=0 ,top=0, scrollbar=yes, toolbar=no, resizable=yes, status=no, directories=no, menubar=no, fullscreen=no');
}

