﻿var doc = document;
var ie=doc.all;
var ns4=doc.layers;
var up5=doc.getElementById?doc.getElementsByTagName('div'):0;
ns6=up5&&!ie;
var ie5=false;
if(up5)ie5=true;
if(ns6)ie5=false;
var aktytul;//aktualny tytul na zakladce
var tmptytul;
var stan;
function fadeon(img) {
	if(ie5)document.images[img].filters.blendTrans.Apply();
		document.images[img].src = eval(img + "On.src");
	if(ie5)document.images[img].filters.blendTrans.Play();
}
function fadeoff(img) {
	if(ie5)document.images[img].filters.blendTrans.Apply();
		document.images[img].src = eval(img + "Off.src");
	if(ie5)document.images[img].filters.blendTrans.Play();
}

function popUp(url,windowName,windowTitle,closeOnClick,width,height,t){
	if(!url)return
	function readSize(){if(t.complete)showPopup(t.width,t.height);else setTimeout(readSize,1e2)}
	function showPopup(w,h){with(window.open('',windowName||'','width='+(width||w)+',height='+(height||h)).document){open();write('<html><head><title>'+(windowTitle||'')+'</title></head><body style="margin:0;padding:0"><img src="'+url+'" style="display:block'+(closeOnClick?';cursor: pointer" onclick="self.close()" title="Zamknij okno"':'"')+'></body></html>');close()}}
	if(!width||!height)t=new Image(),t.src=url,readSize()
	else showPopup(width,height)
}	

function tytul(znak){
if(znak!='wroc'){
	stan=1;
	if(ie5)document.zakladka.filters.blendTrans.Apply();
		document.zakladka.src = eval(znak + ".src");
		tmptytul=document.zakladka.src;
	if(ie5)document.zakladka.filters.blendTrans.Play();
	}
else{
	stan=0;
	if(ie5)document.zakladka.filters.blendTrans.Apply();
		document.zakladka.src = tmptytul;
	if(ie5)document.zakladka.filters.blendTrans.Play();
		setTimeout('optytul()',2000);
	}
}

function optytul(){	
if(stan==0){
	if(ie5)document.zakladka.filters.blendTrans.Apply();
		document.zakladka.src = aktytul;
	if(ie5)document.zakladka.filters.blendTrans.Play();
	}
}

function displayWindow(url, width, height,okno) {
        var Win = window.open(url,okno,'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no,left=300,top=50' );
}

function testForm(form) {
  if (form.klient.value == ""){
    alert("Wprowadzone dane do pola Imi� i nazwisko "+form.klient.value+" s� niepoprawne!");
  	document.rejestracja.klient.focus();
	return false;
	}
  
  if (form.ulica.value == ""){
    alert("Wprowadzone dane do pola Ulica "+form.ulica.value+" s� niepoprawne!");
  	document.rejestracja.ulica.focus();
	return false;
	}
 
  if (form.kod.value == ""){
    alert("Wprowadzone dane do pola Kod "+form.kod.value+" s� niepoprawne!");
  	document.rejestracja.kod.focus();
	return false;
	}
	
  if (form.miasto.value == ""){
    alert("Wprowadzone dane do pola Miasto "+form.miasto.value+" s� niepoprawne!");
  	document.rejestracja.miasto.focus();
	return false;
	}

  if (form.mail.value){
    Wzor=/^[0-9a-zA-Z.]+\@[0-9a-zA-Z]+\.[0-9a-zA-Z.]+$/;
	OK=(Wzor.test(document.rejestracja.mail.value)==true && document.rejestracja.mail.value.length!=0); 
	if(!OK) {
		alert("Wprowadzone dane do pola Adres e-mail "+form.mail.value+" s� niepoprawne!");
  		document.rejestracja.mail.focus();
		return false;
		}
	}
	
	
	
  return true;
}
