function sFlash(w, h, path)
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'">'
+'<param name="movie" value="'+path+'" />'
+'<param name="quality" value="high" />'
+'<param name="wmode" value="transparent">'
+'<param name="menu" value="0" />'
+'<embed src="'+path+'" width="'+w+'" height="'+h+'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="0"></embed>'
+'</object>');
}
// tylko dla okna do moderacji
function displayPusty(url) {
        var Win =
window.open(url,"displayWindow",'width=350,height=320,left=200,top=170,resizable=0,scrollbars=no,menubar=no');}
//
function OpenNewWindowWH(mypage,w,h,myname){
var win_wh= null;
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no'
win_wh=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win_wh.window.focus();}
}
//
function validate()
{
	conf = confirm("Aby potwierdzić, kliknij na OK");
	if (conf)
		return true
	else
		return false;
}
//
function full(id){
window.open('full.php3?ig='+id, '', 'fullscreen=yes, scrollbars=no');
}
//============================
var PLATNE;
var ZNAKI_P=500;
var ZNAKI_B=500;
function pozostalo_znakow(f,tf,x){
	if (x==0)
		{
		if (PLATNE==1) { x=ZNAKI_P; } else { x=ZNAKI_B; }
		}
      	tf.value = x-f.value.length;
	tf.disabled=true;
}
//=============================
function check_dl(f,x){
	var t="Można wpisac tylko "+x+" znakow!";
	if (x==0)
		{
		if (PLATNE==1) { 
				x=ZNAKI_P; 				
                                t="W nagłówku ogłoszenia można wpisac tylko "+x+" znakow! Resztę proszę zamieścić poniżej w rubryce \"Szczegóły ogłoszenia\".";
				} else 
				{ 
				x=ZNAKI_B; 
				t="W treści ogłoszenia darmowego można wpisac tylko "+x+" znakow!";
				}
		}
  	if (f.value.length>x) {
   		alert(t);
   		f.value = f.value.substr(0,x)
//   f.disabled=true;
//document.write(x);
  		}
}
//===========================
function wyslijMaila(uzytkownik, serwer, r){
   if (r=="O"){
   		location.href = "mailto:" + uzytkownik + "@" + serwer + "?subject=Zapytanie dot. ogloszenia na portEl.pl";
		}
   if (r=="A"){
                location.href = "mailto:" + uzytkownik + "@" + serwer + "?subject=Kontakt poprzez portEl.pl";
                }
}
//------------------------
function setOpacity(ob,value) {
// value 0-10
	ob.style.opacity = value/10;
	ob.style.filter = 'alpha(opacity=' + value*10 + ')';
}
//
var prevfotoDiv;
function show_fotoDiv(n,l,id){
        var nagoglDiv = document.getElementById("nagoglDiv");
        var fotoDiv0 = document.getElementById("fotoDiv0");
	var fotoDiv = document.getElementById("fotoDiv");
	var overlayDiv = document.getElementById("overlayDiv");
        var nxt="";
	var pr;
	var nx;
	var cl;
	var start;
        n = parseInt(n);
	l = parseInt(l);
	if (n==0) { n=1; start = true; } else { start = false; }

	pr = n - 1; 
	if (pr<1) { pr=1; }	
	nx = n + 1;
	if (nx>l) { nx=l; }
	overlayDiv.style.display = "block";
        fotoDiv.style.display = "block";

//	fotoDiv.style.opacity = "1.0";
//	fotoDiv0.style.opacity = "1.0";

        var nag = "Zdjęcia do ogłoszenia nr " + id;
	var vs;
        if (l>1) {
                if (n>1) { vs = 'visible'; } else { vs = 'hidden'; }
                nxt = '<input type=\"button\" value=\"<<\" style=\"visibility: ' + vs + ';width:25px;cursor: pointer; cursor: hand; margin-left: 7px;\" onclick=\"show_fotoDiv('+pr+','+l+','+id+');\">';
                        
        for (var k = 1; k <= l; ++k) {

        if (k==n) { cl="color: red; font-weight: bold;" } else { cl=""; }
        nxt = nxt + "<input type=\"button\" value=\"" + k + "\" style=\"width:15px;cursor: pointer; cursor: hand; margin-left: 7px;" + cl + "\"  onclick=\"show_fotoDiv("+k+","+l+","+id+");\">";
                }

                if (n<l) { vs = 'visible'; } else { vs = 'hidden'; }
                nxt = nxt + '<input type=\"button\" value=\">>\" style=\"visibility: ' + vs + ';width:25px;cursor: pointer; cursor: hand; margin-left: 7px;\" onclick=\"show_fotoDiv('+nx+','+l+','+id+');\">';
                        

        nag = nag + ":  " + nxt;
                }
	
        nagoglDiv.innerHTML = nag + "<input type=\"button\" value=\"Zamknij\" style=\"width:55px;color: red; cursor: pointer; cursor: hand; margin-left: 27px;\"  onclick=\"close_fotoDiv();\">";
	nagoglDiv.style.display = "block";

	if (start){	
	var ih = "";
	var ds;
	prevfotoDiv = 1;

        for (var i = 1; i <= l; i++ )
                {
		if (i == 1) { ds = "block"; } else { ds = "none"; }	
                ih = ih + '<div id=\"fogl' + i + '\" style=\"display: ' + ds + ';\"><img src=' + '\"/oglimg/' + i + '/z' + id + '.jpg\" border=\"0\" /></div>';
                }

        fotoDiv0.innerHTML = ih;
	fotoDiv0.style.display = "block";
		}
	else
		{
                var af = 'fogl' + prevfotoDiv;
                var pfDiv = document.getElementById(af);
                pfDiv.style.display = "none";

		af = 'fogl' + n;
		var afDiv = document.getElementById(af);
//		setOpacity(afDiv,4);
		afDiv.style.display = "block";
		prevfotoDiv = n;

/*
 var odliczanie = 40;
 var opac = 4;
 var timer = setInterval(
      function(){
          odliczanie--;
	  opac = opac + 0.15;
	  setOpacity(afDiv,opac);
          if (!odliczanie) {clearInterval(timer);}
      }
      ,15);
*/
		}
		
return;
}
//---------------------
function close_fotoDiv(){
	var overlayDiv = document.getElementById("overlayDiv");
	var fotoDiv = document.getElementById("fotoDiv");
        fotoDiv.style.display = "none";
	overlayDiv.style.display = "none";
}
//
function dobra_data(data)
{
  // sprawdzenie prawidłowości daty
  var re = "^([2][0][0-1][0-9])[\\-](([0][1-9])|([1][0-2]))[\\-](([0][1-9])|([1-2][0-9])|([3][0-1]))$";
  re = new RegExp(re);
  var ck = re.exec(data);
  return ck;
}
