var lastImg = null;

function imgSwap(ev,imgName) {
if (imgName != 0) {
	lastImg = ev.src;
	ev.src = imgName;
	}	
	else
	{
	ev.src = lastImg;
	}
}
function checkFields(newForm) {
	if (newForm.title.value == '') {
		alert('Brak tytu?u');
		return ;
	} else if (newForm.body.value == '') {
		alert('Brak tre?ci');
		return ;
	}
	newForm.submit();
}

function checkFieldsNoEscape(newForm) {
	if (newForm.title.value == '') {
		alert('Brak tytu?u');
		return ;
	} else if (newForm.body.value == '' || newForm.body.value == ' ') {
		alert('Brak tre?ci');
		return ;
	} else if (newForm.nick.value == '') {
		alert('Brak autora');
		return;
	}
	newForm.submit();
}


function fullsize(pI,title,desc) {
        if(document.all){picId = "/_uTils/site/gallery.html?" + pI + "&title=" + encodeURIComponent(escape(title)) + "&desc=" + encodeURIComponent(escape(desc));}
        else{picId = "/_uTils/site/gallery.html?" + pI + "&title=" + escape(title) + "&desc=" + escape(desc);}
//picId = encodeURI(picId);
        Win = window.open(picId,'DispalyWindow','width=300, height=300, resizable=yes, scrollbars=auto menubar=no, location=no');
        return;
}
function isN(v,f,n) {
	if(v.length>0)if((v!=~~v)||(v<=0)){alert('Wymagana jest liczba ca?kowita dodatnia.');o=eval('document.'+f+"."+n);o.value="";}
}
function openInNewWindow(href){
	return window.open(href, null, '');
}

function openWindow(url,top,left,width,height) {
	var p = "";
	if (top>-1) p=",top="+top;
	if (left>-1) p=p+",left="+left;
	if (width>-1) p=p+",width="+width;
	if (height>-1) p=p+",height="+height;
	window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=0.scrollbars=0,resizable=0'+p);
}


function email_ver(str) {
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  var ok = !r1.test(str) && r2.test(str);
  if(ok == false) { 
	  alert("B??dny adres e-mail, prosz? poprawi?!"); 
	  return false;
  }
  else { return ok; }
}
function iframeHeight(){

	if(!(document.layers)){

		var doc=document,oe=doc.all?doc.all['ifra']:doc.getElementById('ifra');

		var cdoc=oe.all?document.ifra.document:oe.contentDocument;

		oe.height=cdoc.body.scrollHeight+30;

		cdoc.body.style.border='none';

	}
}

function sprRectangle(){
	if(document.getElementById('bmone2n-163.2.2.2')){
		var reklama = document.getElementById('bmone2n-163.2.2.2');
		var dzieci = reklama.getElementsByTagName('*');
		if(dzieci.length == 0){
			var elementy = document.getElementsByTagName('div');
			for(var i=0;elementy.length;i++){
				if(elementy[i].className=='middleBanner0'){
				elementy[i].style.display = 'none';
				}	
			}	
		}
	}
	if(document.getElementById('bmone2n-163.1.2.2')){
		var reklama = document.getElementById('bmone2n-163.1.2.2');
		var dzieci = reklama.getElementsByTagName('*');
		if(dzieci.length == 0){
			var elementy = document.getElementsByTagName('*');
			for(var i=0;elementy.length;i++){
				if(elementy[i].className=='middleBanner1'){
				elementy[i].style.display = 'none';
				}	
				if(elementy[i].className=='rectBann'){
				elementy[i].style.display = 'none';
				}
				if(elementy[i].className=='clr reklama'){
				elementy[i].style.display = 'none';
				}
				if(elementy[i].className=='linl reklama'){
				elementy[i].style.display = 'none';
				}
			}	
		}
	}
}

