var W3CDOM = (document.createElement && document.getElementsByTagName);

function init() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='pix/button_select.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].getAttribute('noscript')) continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		if (x[i].value)
			x[i].onchange();
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
	}
}


function sprawdz(){
  with(document.forms['newsletter']){
    // sprawdzenie adresu e-mail przy pomocy
    // wyrażenia regularnego
    if(!/^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$/i.test(
      email.value)){
      alert('Format adresu email jest nieprawidłowy!');
      return false;
    }

  }
}

function form1check(){
  with(document.forms['books']){
    f = search.value;
    if(f.length<3)
    {
      alert('Wyrażenie zbyt krótkie!');
      return false;
    }
  }
}





