function Full(file)
{
   window.open(file, "Peï¿½ny_obraz", "resizable=yes", "scrollbar=yes", "status=yes", "dependent=yes" )
}
function ShowHelp()
{
    help.style.visibility = "visible"
}
function HideHelp()
{
    help.style.visibility = "hidden"
}
function Search()
{
szybko.submit();
}
function SearchDeep()
{
szukaj.submit();
}

function PopUp(file)
{   
	okno = window.open(file,'Comes',"dependent,width=550,height=400,left=100,top=50,scrollbars=yes,resizable=yes");
	okno.close()
	okno = window.open(file,'Comes',"dependent,width=550,height=400,left=100,top=50,scrollbars=yes,resizable=yes");
	okno.ojciec=window.self
	if (window.focus) {
		okno.focus();
	}
}

function PopupPic(sPicURL) { 
	sPicURL = sPicURL.replace(/<p>/, '');
	sPicURL = sPicURL.replace(/<\/p>/, '');
	window.open("popup.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}

function PopupPic2(sPicURL) { 
	sPicURL = sPicURL.replace(/<p>/, '');
	sPicURL = sPicURL.replace(/<\/p>/, '');
	window.open("popup.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200,scrollbars=yes");
}

function PopupPic4(sPicURL) { 
	sPicURL = sPicURL.replace(/<p>/, '');
	sPicURL = sPicURL.replace(/<\/p>/, '');
	window.open("popup.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}

function PopupVideo(sPicURL) { 
	sPicURL = sPicURL.replace(/<p>/, '');
	sPicURL = sPicURL.replace(/<\/p>/, '');
	window.open("http://www.comes.com.pl/popupvideo.htm?"+sPicURL, "", "resizable=1,HEIGHT=360,WIDTH=670,scrollbars=no");
}

function popup_powiadom() {
	/* zeby zachowac link w oryginalnej postaci trzeba zamienic & na cos innego
	*/
	okienko("powiadom.php?link=" + location.href.replace(/&/, '_amp_'), 350, 300, "pow");
}


function okienko(file, dlug, wys, nazwa)
{   
	okno = window.open(file,nazwa,"dependent,width="+dlug+",height="+wys+",left=100,top=50,scrollbars=yes,resizable=yes");
	okno.ojciec=window.self
	if (window.focus) {
		okno.focus();
	}
}

function okienko_obr(file, dlug, wys, nazwa)
{   
	okno = window.open(file,nazwa,"dependent,width="+dlug+",height="+wys+",left=100,top=50,scrollbars=no,resizable=no");
	okno.ojciec=window.self
	if (window.focus) {
		okno.focus();
	}
}


function select_off(){	
	if(IE4){
		selecty = document.all.tags("select"); 
		for(var i = 0; i < selecty.length; i++){
			selecty[i].style.visibility = 'hidden';
		}
	}
}
function select_on(){
	if(IE4){
		selecty = document.all.tags("select");
		for(var i = 0; i < selecty.length; i++){
			selecty[i].style.visibility = 'visible';
		}
	}
}





  function MakeFiltr2(form_name, CondsArray) {
    if (typeof(CondsArray) == "undefined")
      CondsArray = [];
	  
//	  alert(document.forms[form_name].length);
	  
//	  for (i = 0; i<document.forms[form_name].length; i++)
//      	alert(document.forms[form_name][i].value+' --- '+i);
		  

    if ((document.forms[form_name]['s-11'].value) != "") {
      CondArray = [];
      CondArray[0] = 'pg';
      CondArray[1] = '==';
      CondArray[2] = document.forms[form_name]['s-11'].value;
      CondsArray[CondsArray.length] = CondArray;
    }

    if ((document.forms[form_name]['s-21'].value) != "%") {
      CondArray = [];
      CondArray[0] = 'p';
      CondArray[1] = '==';
      CondArray[2] = document.forms[form_name]['s-21'].value;
      CondsArray[CondsArray.length] = CondArray;
    }

   if ((document.forms[form_name]['s-31'].value)>0 && (document.forms[form_name]['s-32'].value)>0) {
      CondArray = [];
      CondArray[0] = 'cenab';
      CondArray[1] = '<=*<=';
      CondArray[2] = document.forms[form_name]['s-31'].value;
      CondArray[3] = document.forms[form_name]['s-32'].value;
      CondsArray[CondsArray.length] = CondArray;
   } else {
     if ((document.forms[form_name]['s-31'].value)>0) {
        CondArray = [];
        CondArray[0] = 'cenab';
        CondArray[1] = '>=';
        CondArray[2] = document.forms[form_name]['s-31'].value;
        CondsArray[CondsArray.length] = CondArray;
     }
     if ((document.forms[form_name]['s-32'].value)>0) {
        CondArray = [];
        CondArray[0] = 'cenab';
        CondArray[1] = '<=';
        CondArray[2] = document.forms[form_name]['s-32'].value;
        CondsArray[CondsArray.length] = CondArray;
     }
   }

   var i;
	  for (i = 11; i<document.forms[form_name].length; i+=3){
        CondArray = [];
		var j = (i+2);
		if(document.forms[form_name][i].value != 'ok'){
			if(document.forms[form_name][j].value != '%'){
		        CondArray[0] = document.forms[form_name][i].value;
	    	    CondArray[1] = 's';
		        CondArray[2] = document.forms[form_name][j].value;
		        CondsArray[CondsArray.length] = CondArray;
			}
		}
	  }



    window.location = CreateUrlConds('s', CondsArray);
  }


// ------ main stop ------------

 function check_isempty( id, deftxt ) {
    var o = document.getElementById(id);
	if (o.value != '' && o.value != deftxt && o.value != 'Wpisz coï¿½') {
        return true;
	} else {
		o.value = 'Wpisz co¶';
		return false;
	}
 }

 function main_search( id, deftxt, forma ) {
 	//alert("test");
    if (check_isempty( id, deftxt )) {
        forma.submit();
        return true;
    }
 }

  function gotoconfig(model){
    url = "konfig.php?s-ktm="+model+"&m-ktm="+model+"&d=12";
    window.location = url;   
  }
  
// timeout dla vabank 
  
  function liczCzas(){
  now = new Date();
  rok = now.getFullYear();
  miesiac = now.getMonth();
  dzien = now.getDate();
  
  to = new Date(2008,0,31,24,0,0);
  if(to.getTime() >= now.getTime()){
  ile = to.getTime() - now.getTime();
  miesiecy = Math.floor(ile / (1000 * 60 * 60 * 24 * 31));
  dni = Math.floor(ile / (1000 * 60 * 60 * 24)- miesiecy*31); // - 1 bylo
  godzin = Math.floor(ile / (1000 * 60 * 60)- miesiecy*31*24 - dni*24 - 1);
  minut = Math.floor( ile / (1000 * 60)- miesiecy*31*24*60 - dni*24*60 - godzin*60 - 60);
  sekund = Math.floor(ile / 1000 - miesiecy*31*24*60*60 - dni*24*60*60 - godzin*60*60 - minut*60-60*60);
  
  if (godzin < 0){
  	to = new Date(2008,0,31,24,0,0);
  	ile = to.getTime() - now.getTime();
  	miesiecy = Math.floor(ile / (1000 * 60 * 60 * 24 * 31));
  	dni = Math.floor(ile / (1000 * 60 * 60 * 24)- miesiecy*31); // - 1 bylo
  	godzin = Math.floor(ile / (1000 * 60 * 60)- miesiecy*31*24 - dni*24 - 1);
  	minut = Math.floor( ile / (1000 * 60)- miesiecy*31*24*60 - dni*24*60 - godzin*60 - 60);
  	sekund = Math.floor(ile / 1000 - miesiecy*31*24*60*60 - dni*24*60*60 - godzin*60*60 - minut*60-60*60);
  }
  
  if(miesiecy > 0){
  	var text_mie = miesiecy+" miesiï¿½ce, ";
  }else{
  	text_mie = "";
  }
  
  if(dni > 1){
  	var text_dni = dni+" dni, ";
  }else if(dni == 1){
  	text_dni = dni+" dzieï¿½, ";
  }else{
  	text_dni = "";
  }
  
  if(godzin > 21){
  	var text_godz = godzin+" godziny, ";
  }else if(godzin > 4){
  	text_godz = godzin+" godzin, ";
  }else if(godzin > 1){
  	text_godz = godzin+" godziny, ";
  }else if(godzin > 0){
  	text_godz = godzin+" godzine, ";
  }else{
  	text_godz = "";
  }
  
  if(minut > 4){
  	var text_min = minut+" minut, ";
  }else if(minut > 1){
  	text_min = minut+" minuty, ";
  }else if(minut > 0){
  	text_min = minut+" minute, ";
  }else{
  	text_min = "";
  }
  
  if(sekund > 4){
  	var text_sek = sekund+" sekund ";
  }else if(sekund > 1){
  	text_sek = sekund+" sekundy ";
  }else if(sekund > 0){
  	text_sek = sekund+" sekunde ";
  }else{
  	text_sek = "";
  }
  
  document.getElementById("time").innerHTML = text_mie+text_dni+text_godz+text_min+text_sek;
  }
}

function delrow(norow, nazwa){
	if(confirm('Kasowaæ wpis: '+ nazwa)){
		window.location="del.php?row="+ norow;
	}else{}
}

function datewoork(id, date, work, style) {
	now = new Date();
  	rok = now.getFullYear();
  	miesiac = now.getMonth();
  	dzien = now.getDate();
  	if(typeof(work) == "undefined") work = 'hidden';
  	
	if(work == 'hidden'){
		if(now.getTime() > date.getTime()){
			// Mozna wywolac funkcje ktora bedzie budowac w JavaScript DOM widziane drzewo kodu html, trzeba by zmienic znak wiekrzosci na '<'
			document.getElementById(id).style.display = (typeof(style) == "undefined" ? 'none' : style);
		}
	}else if(work == 'class'){
		if(now.getTime() < date.getTime()){
			document.getElementById(id).setAttribute("class", style);
			document.getElementById(id).className = style;
  		}
	}else{ 
		// Nic nei rob!
 	}
}

//Script hide end -->
