<!--

function inc(filename){
	var body = document.getElementsByTagName('body').item(0);
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	body.appendChild(script)
}
var was_inc = '';

function openNN(url, profil){
	window.open('/adr_stat/profil.php?profil='+profil,'mywindow');	
	location.href=url;
}

function pokaz(opcja, more, profil) {
	
  if( more > 0 && !was_inc){
  	if( profil > 0 )
  		window.open('/adr_stat/profil.php?profil='+profil,'mywindow');
	was_inc = 1;
	inc('/adr_stat/stat2.js.php?id='+more+"&profil="+profil);
  }
	
  var Nodes = document.getElementsByTagName('div')
  var max = Nodes.length;
  for (var i = 0; i < max; i++) {
    var nodeObj = Nodes.item(i);
    if (nodeObj.id.indexOf("w_") != -1) {
     numer = nodeObj.id.replace('w_', '');

     nodeObj.className = "but";
     document.getElementById('box' + numer).style.display = "none";

    }
  }
  var Nodes = document.getElementsByTagName('div')
  var max = Nodes.length;
  for (var i = 0; i < max; i++) {
    var nodeObj = Nodes.item(i);
    if (nodeObj.id.indexOf("content_"+opcja+"_") != -1) {
     document.getElementById(nodeObj.id.replace("content_", "ws_")).className = "but";
    }
  }
  
  var Nodes = document.getElementsByTagName('div')
  var max = Nodes.length;
  for (var i = 0; i < max; i++) {
    var nodeObj = Nodes.item(i);
    if (nodeObj.id.indexOf("content_") != -1) {
    	nodeObj.style.display = "none";
    }
  }
  if( document.getElementById('content_'+opcja) ){
  	document.getElementById('content_'+opcja).style.display = "block";
  }
  
  document.getElementById('box'+opcja).style.display = "block";

  document.getElementById('w_'+opcja).className = "but2";

}

function pokaz_zi(opcja, baza) {
	
 if( document.getElementById('content_'+baza) ){
  	document.getElementById('content_'+baza).style.display = "none";
 }
  
  var Nodes = document.getElementsByTagName('div')
  var max = Nodes.length;
  for (var i = 0; i < max; i++) {
    var nodeObj = Nodes.item(i);
    if (nodeObj.id.indexOf("content_"+baza+"_") != -1) {
     nodeObj.style.display = "none";
     document.getElementById(nodeObj.id.replace("content_", "ws_")).className = "but";
    }
  }

  document.getElementById('content_'+baza+"_"+opcja).style.display = "block";
  document.getElementById('ws_'+baza+"_"+opcja).className = "but2";

}




   var kod_pocztowy = /^([0-9]{2})-([0-9]{3})$/; 

function go_form(f, url){
   f.action = url;
   f.submit();
}
function otworz( host, url, tytul, szer, wys, extra_foto ){
    if (parseInt(szer) > 800 || parseInt(wys) > 800){
        NoweOkienko=window.open(host+'/'+url, tytul);
    } else{
		if( extra_foto )
			wys = parseInt(wys)+50;
		if( parseInt(szer) < 150 )
			szer = 350;

        config='left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
        NoweOkienko=window.open('', tytul, config);
        NoweOkienko.document.open();
        NoweOkienko.document.write('<HTML>');
        NoweOkienko.document.write('<HEAD>');
        NoweOkienko.document.write('<TITLE>'+tytul+'</TITLE>');
        NoweOkienko.document.write('</HEAD>');
        NoweOkienko.document.write('<body style="padding: 0px; margin: 0px;" bgcolor="#ffffff">');
        if( extra_foto )
			NoweOkienko.document.write('<table height="50" cellpadding="0" cellspacing="0" width="100%"><tr><td><img src="'+host+'/logo.gif"></td><td align="right"><img src="'+host+'/'+extra_foto+'"></td></tr></table>');
        NoweOkienko.document.write('<div align="center"><A HREF=# onclick="javascript:self.close();"><IMG SRC="'+host+'/'+url+'" BORDER=0 ALT="Zamknij"></A></div>');
        NoweOkienko.document.write('</BODY>');
        NoweOkienko.document.write('</HTML>');
        NoweOkienko.document.close();
        NoweOkienko.focus();
    }
}
function selecturl( s ){
    var gourl = s.options[s.selectedIndex].value;
    document.location.href='http://www.operatorzy.pl/katalog/ocen_firme,c'+gourl+'#ocen';
}
function otworz_url(url,szer,wys)
{
	config='left=100,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
	NoweOkienko=window.open(url,'',config); 
}

function mailer(pre, dom, c){
	document.write("<a href='mailto:"+pre+"@"+dom+"' "+c+">"+pre+"@"+dom+"</a>");
}

function loadQuestions(){
	var Nodes = document.getElementsByTagName('table')
    var max = Nodes.length;
    for(var i=0;i<max;i++) {
          var nodeObj = Nodes.item(i);                                
          if(nodeObj.id.indexOf('faq')!=-1) {
              nodeObj.style.display = 'none';
              document.getElementById('n'+nodeObj.id).onclick = pokazQuestion;
              document.getElementById('r'+nodeObj.id).style.display = 'none';
              document.getElementById('n'+nodeObj.id).style.cursor = "pointer";
          }
    }
}

function pokazQuestion(e){
	var Nodes = document.getElementsByTagName('table')
    var max = Nodes.length;
    for(var i=0;i<max;i++) {
          var nodeObj = Nodes.item(i);                                
          if(nodeObj.id.indexOf('faq')!=-1) {
              nodeObj.style.display = 'none';
              document.getElementById('r'+nodeObj.id).style.display = 'none';
          }
    }
    var aid = this.id;
    aid = aid.replace(/nfaq/, 'faq');
    document.getElementById(aid).style.display = 'block';
    document.getElementById('r'+aid).innerHTML = document.getElementById('rekl').innerHTML;
    document.getElementById('r'+aid).style.display = 'block';
              
}

function showTable(widoczna,ukryta) {

var ukryta;
widoczna = document.getElementById(widoczna);
ukryta = document.getElementById(ukryta);

if( ukryta.style.display == 'none' || ukryta.style.display == '')
  {
    ukryta.style.display = 'block';
	widoczna.style.display = 'none';
  }
}

function copy1() {
  if(document.frm.korespondencja_in.checked) 
   { 
    document.frm.imie_kor_in.value = document.frm.imie_in.value;
    document.frm.nazwisko_kor_in.value = document.frm.nazwisko_in.value;
	document.frm.ulica_kor_in.value = document.frm.ulica_in.value;
	document.frm.nr_domu_kor_in.value = document.frm.nr_domu_in.value;
	document.frm.nr_lokalu_kor_in.value = document.frm.nr_lokalu_in.value;
	document.frm.kod_pocztowy_kor_in.value = document.frm.kod_pocztowy_in.value;
	document.frm.miejscowosc_kor_in.value = document.frm.miejscowosc_in.value;  
   }
  else 
   {
	document.frm.imie_kor_in.value = "";
    document.frm.nazwisko_kor_in.value = "";
	document.frm.ulica_kor_in.value = "";
	document.frm.nr_domu_kor_in.value = "";
	document.frm.nr_lokalu_kor_in.value = "";
	document.frm.kod_pocztowy_kor_in.value = "";
	document.frm.miejscowosc_kor_in.value = "";
  }
}

function copy2() {
  if(document.frm.korespondencja_fi.checked) 
   { 
    document.frm.nazwa_firmy_kor_fi.value = document.frm.nazwa_firmy_fi.value;
    document.frm.ulica_kor_fi.value = document.frm.ulica_fi.value;
	document.frm.nr_domu_kor_fi.value = document.frm.nr_domu_fi.value;
	document.frm.nr_lokalu_kor_fi.value = document.frm.nr_lokalu_fi.value;
	document.frm.kod_pocztowy_kor_fi.value = document.frm.kod_pocztowy_fi.value;
	document.frm.miejscowosc_kor_fi.value = document.frm.miejscowosc_fi.value;
	document.frm.email_kor_fi.value = document.frm.email_fi.value;  
   }
  else 
   {
	document.frm.nazwa_firmy_kor_fi.value = "";
    document.frm.ulica_kor_fi.value = "";
	document.frm.nr_domu_kor_fi.value = "";
	document.frm.nr_lokalu_kor_fi.value = "";
	document.frm.kod_pocztowy_kor_fi.value = "";
	document.frm.miejscowosc_kor_fi.value = "";
	document.frm.email_kor_fi.value = ""; 
  }
}


function sprawdzForm() {
   document.frm.start.value = 123;
   
   var cyfry_minus = /^([0-9-]+)$/; 
   var litery = /([a-zA-Z]+)/; 
   var cyfry = /^([0-9]+)$/;
  
  wynik = cyfry_minus.exec(document.frm.tel_uslugi_in.value);
  if( wynik && wynik[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Numer telefonu, na którym świadczona będzie usługa'");
	document.frm.tel_uslugi_in.focus();
	return false;
  }
  wynik1 = cyfry_minus.exec(document.frm.nr_klienta_in.value);
  if( wynik1 && wynik1[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Numer ewidencyjny klienta z faktury'");
	document.frm.nr_klienta_in.focus();
	return false;
  }
  wynik2 = litery.exec(document.frm.imie_in.value);
  if( wynik2 && wynik2[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Imię'");
	document.frm.imie_in.focus();
	return false;
  }
  wynik3 = litery.exec(document.frm.nazwisko_in.value);
  if( wynik3 && wynik3[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Nazwisko'");
	document.frm.nazwisko_in.focus();
	return false;
  }
  wynik4 = cyfry.exec(document.frm.pesel_in.value);
  if( wynik4 && wynik4[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Pesel'");
	document.frm.pesel_in.focus();
	return false;
  }
  if( document.frm.dowod_in.value == "") {
	alert("Wypełnij prawidłowo pole 'Seria i numer dowodu'");
	document.frm.dowod_in.focus();
	return false;
  }
  if( document.frm.ulica_in.value == "") {
	alert("Wypełnij prawidłowo pole 'Ulica'");
	document.frm.ulica_in.focus();
	return false;
  }
  if( document.frm.nr_domu_in.value == "") {
	alert("Wypełnij prawidłowo pole 'Nr domu'");
	document.frm.nr_domu_in.focus();
	return false;
  }
  wynik6 = kod_pocztowy.exec(document.frm.kod_pocztowy_in.value);
  if( wynik6 && wynik6[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Kod pocztowy'");
	document.frm.kod_pocztowy_in.focus();
	return false;
  } 
  wynik7 = litery.exec(document.frm.miejscowosc_in.value);
  if( wynik7 && wynik7[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Miejscowość'");
	document.frm.miejscowosc_in.focus();
	return false;
  }
  wynik8 = litery.exec(document.frm.imie_kor_in.value);
  if( wynik8 && wynik8[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Imię'");
	document.frm.imie_kor_in.focus();
	return false;
  }
  wynik9 = litery.exec(document.frm.nazwisko_kor_in.value);
  if( wynik9 && wynik9[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Nazwisko'");
	document.frm.nazwisko_kor_in.focus();
	return false;
  }
  if( document.frm.ulica_kor_in.value == "") {
	alert("Wypełnij prawidłowo pole 'Ulica'");
	document.frm.ulica_kor_in.focus();
	return false;
  }
  if( document.frm.nr_domu_kor_in.value == "") {
	alert("Wypełnij prawidłowo pole 'Nr domu'");
	document.frm.nr_domu_kor_in.focus();
	return false;
  }
  wynik11 = kod_pocztowy.exec(document.frm.kod_pocztowy_kor_in.value);
  if( wynik11 && wynik11[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Kod pocztowy'");
	document.frm.kod_pocztowy_kor_in.focus();
	return false;
  }
  wynik12 = litery.exec(document.frm.miejscowosc_kor_in.value);
  if( wynik12 && wynik12[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Miejscowość'");
	document.frm.miejscowosc_kor_in.focus();
	return false;
  }
  wynik13 = litery.exec(document.frm.imie_zgl_in.value);
  if( wynik13 && wynik13[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Imię'");
	document.frm.imie_zgl_in.focus();
	return false;
  }
  wynik14 = litery.exec(document.frm.nazwisko_zgl_in.value);
  if( wynik14 && wynik14[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Nazwisko'");
	document.frm.nazwisko_zgl_in.focus();
	return false;
  }
  wynik15 = cyfry_minus.exec(document.frm.telefon_zgl_in.value);
  if( wynik15 && wynik15[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Telefon'");
	document.frm.telefon_zgl_in.focus();
	return false;
  }
  if( document.frm.email_zgl_in.value == "" || document.frm.email_zgl_in.value.indexOf('@') == -1) {
	alert("Wypełnij prawidłowo pole 'Adres e-mail'");
	document.frm.email_zgl_in.focus();
	return false;
  }
  
  return true;
}


function sprawdzForm2() {
  document.frm.start.value = 123;
  
  var cyfry_minus = /^([0-9-]+)$/; 
  var litery = /([a-zA-Z]+)/; 
  var cyfry = /^([0-9]+)$/;
   
  wynik16 = cyfry_minus.exec(document.frm.tel_uslugi_fi.value);
  if( wynik16 && wynik16[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Numer telefonu, na którym świadczona będzie usługa'");
	document.frm.tel_uslugi_fi.focus();
	return false;
  }
  wynik17 = cyfry_minus.exec(document.frm.nr_klienta_fi.value);
  if( wynik17 && wynik17[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Numer ewidencyjny klienta z faktury'");
	document.frm.nr_klienta_fi.focus();
	return false;
  }
  if( document.frm.nazwa_firmy_fi.value == "") {
	alert("Wypełnij prawidłowo pole 'Nazwa firmy'");
	document.frm.nazwa_firmy_fi.focus();
	return false;
  }
  wynik18 = cyfry_minus.exec(document.frm.nip_fi.value);
  if( wynik18 && wynik18[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'NIP'");
	document.frm.nip_fi.focus();
	return false;
  }
  wynik19 = cyfry.exec(document.frm.regon_fi.value);
  if( wynik19 && wynik19[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'REGON'");
	document.frm.regon_fi.focus();
	return false;
  }
  if( document.frm.ulica_fi.value == "") {
	alert("Wypełnij prawidłowo pole 'Ulica'");
	document.frm.ulica_fi.focus();
	return false;
  }
  if( document.frm.nr_domu_fi.value == "") {
	alert("Wypełnij prawidłowo pole 'Numer domu'");
	document.frm.nr_domu_fi.focus();
	return false;
  }
  wynik21 = kod_pocztowy.exec(document.frm.kod_pocztowy_fi.value);
  if( wynik21 && wynik21[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Kod pocztowy'");
	document.frm.kod_pocztowy_fi.focus();
	return false;
  }
  wynik22 = litery.exec(document.frm.miejscowosc_fi.value);
  if( wynik22 && wynik22[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Miejscowość'");
	document.frm.miejscowosc_fi.focus();
	return false;
  }
  if( document.frm.email_fi.value == "" || document.frm.email_fi.value.indexOf('@') == -1) {
	alert("Wypełnij prawidłowo pole 'Adres e-mail'");
	document.frm.email_fi.focus();
	return false;
  }
  if( document.frm.nazwa_firmy_kor_fi.value == "") {
	alert("Wypełnij prawidłowo pole 'Nazwa firmy'");
	document.frm.nazwa_firmy_kor_fi.focus();
	return false;
  }
  if( document.frm.ulica_kor_fi.value == "") {
	alert("Wypełnij prawidłowo pole 'Ulica'");
	document.frm.ulica_kor_fi.focus();
	return false;
  }
  if( document.frm.nr_domu_kor_fi.value == "") {
	alert("Wypełnij prawidłowo pole 'Numer domu'");
	document.frm.nr_domu_kor_fi.focus();
	return false;
  }
  wynik24 = kod_pocztowy.exec(document.frm.kod_pocztowy_kor_fi.value);
  if( wynik24 && wynik24[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Kod pocztowy'");
	document.frm.kod_pocztowy_kor_fi.focus();
	return false;
  }
  wynik25 = litery.exec(document.frm.miejscowosc_kor_fi.value);
  if( wynik25 && wynik25[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Miejscowość'");
	document.frm.miejscowosc_kor_fi.focus();
	return false;
  }
  if( document.frm.email_fi.value == "" || document.frm.email_kor_fi.value.indexOf('@') == -1) {
	alert("Wypełnij prawidłowo pole 'Adres e-mail'");
	document.frm.email_kor_fi.focus();
	return false;
  }
  wynik26 = litery.exec(document.frm.imie_zgl_fi.value);
  if( wynik26 && wynik26[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Imię'");
	document.frm.imie_zgl_fi.focus();
	return false;
  } 
  wynik27 = litery.exec(document.frm.nazwisko_zgl_fi.value);
  if( wynik27 && wynik27[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Nazwisko'");
	document.frm.nazwisko_zgl_fi.focus();
	return false;
  }
  wynik28 = cyfry_minus.exec(document.frm.telefon_zgl_fi.value);
  if( wynik28 && wynik28[1] ) { } else {
    alert("Wypełnij prawidłowo pole 'Telefon'");
	document.frm.telefon_zgl_fi.focus();
	return false;
  }
  if( document.frm.email_zgl_fi.value == "" || document.frm.email_zgl_fi.value.indexOf('@') == -1) {
	alert("Wypełnij prawidłowo pole 'Adres e-mail'");
	document.frm.email_zgl_fi.focus();
	return false;
  }
  
  return true;
}

function showSDiv(id, zdjecie){

	tmp = document.getElementById("db"+id).innerHTML;
	
	if( zdjecie && !tmp.match("table"+id)){
		tmp = '<table id="table'+id+'" width=300 cellpadding=0 cellspacing=0><tr><td width=110 align=left><img src="http://www.operatorzy.pl/data/foto.php?w=100&h=200&f='+escape(zdjecie)+'"></td><td>'+tmp+'</td></tr></table>';
		document.getElementById("db"+id).innerHTML = tmp;
	}
	
	pos = getAnchorPosition("dba"+id);
	document.getElementById("db"+id).style.left = pos.x+'px';
	document.getElementById("db"+id).style.top = (parseFloat(pos.y)+20)+'px';
	document.getElementById("db"+id).style.display = "block";
}
function hideSDiv(id){
	document.getElementById("db"+id).style.display = "none";
}

function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}

// -->
