  img_temp1 = new Image();
  img_temp1.src = "/gfx/menu_onas2.png";
  img_temp2 = new Image();
  img_temp2.src = "/gfx/menu_oferta2.png";
  img_temp3 = new Image();
  img_temp3.src = "/gfx/menu_dodaj2.png";
  img_temp4 = new Image();
  img_temp4.src = "/gfx/menu_reklama2.png";
  img_temp5 = new Image();
  img_temp5.src = "/gfx/menu_kontakt2.png";




  function zaglosuj()
  {
    wybrany = -1;
    for (i=0; i<document.sonda.ans.length; i++) {
      if (document.sonda.ans[i].checked)
	  {
        wybrany = i;
		break;
      }
    }
    if (wybrany > -1)
	  document.sonda.submit();
	else
	  alert('Proszę wybrać jedną z odpowiedzi.');

  }


  function search_clear(id)
  {
    if (id == 1)
	{
	  document.szukaj.branza.value = "";
	  document.szukaj.keyword.value = "";
	}
	else if (id == 2)
	{
	  document.szukaj.nazwa.value = "";
	  document.szukaj.keyword.value = "";
	}
	else if (id == 3)
	{
	  document.szukaj.branza.value = "";
	  document.szukaj.nazwa.value = "";
	}  
  }

  function wizytowka_powieksz(mode,filename,descr)
  {
    if (mode == "show")
	{
	    document.powiekszenie_zdjecia.src = filename;
		document.powiekszenie_opis.opis.value = descr;
	
	    if (document.body.scrollTop!= null)
		  offset = document.body.scrollTop;
		if (window.pageYOffset!= null)
		  offset = window.pageYOffset;
		if (typeof( window.innerWidth ) == 'number')
		{
		  document.getElementById("wizytowka_powiekszenie").style.top = offset + Math.round((innerHeight-400)/2) + "px";
		  document.getElementById("wizytowka_powiekszenie").style.left = Math.round((innerWidth-500)/2) + "px";
		}
		else
		{
	      document.getElementById("wizytowka_powiekszenie").style.top = offset + Math.round((document.body.clientHeight-400)/2) + "px";
		  document.getElementById("wizytowka_powiekszenie").style.left = Math.round((document.body.clientWidth-500)/2) + "px";
		}
        document.getElementById("wizytowka_powiekszenie").style.display = "inline";
	}
	else
	{
	  document.getElementById("wizytowka_powiekszenie").style.display = "none";
	  document.powiekszenie_zdjecia.src = '/gfx/loading.gif';
	}
  }
  
  function gm_pokaz(wspolrzedne)
  {
	var mapa = window.open("http://www.naszetychy.com/gm_pokaz.php?wsp="+wspolrzedne, 'gm', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width=540,height=400');
  }


  function powiekszenie(id)
  {
	day = new Date();
	wid = day.getTime();
	eval("page" + wid + " = window.open('/php/enlarge.php?id=" + id + "', '" + wid + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width=420,height=400');");
  }
  
  function powiekszenie_kalendarz(id)
  {
	day = new Date();
	wid = day.getTime();
	eval("page" + wid + " = window.open('/php/enlarge_cal.php?id=" + id + "', '" + wid + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width=420,height=400');");
  }
  
  function powiekszenie3(id,width)
  {
	day = new Date();
	wid = day.getTime();
	widthex = Math.round(width) + 20;
	eval("page" + wid + " = window.open('/php/enlarge3.php?id=" + id + "&width=" + width +"', '" + wid + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width="+widthex+",height=400');");
  }
  
  
  function powiekszenie2(id,cat)
  {
	day = new Date();
	wid = day.getTime();
	eval("page" + wid + " = window.open('/php/enlarge2.php?id=" + id + "&cat=" + cat + "', '" + wid + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=420,height=400');");
  }

  function tyskie_powiekszenie(id, width, height)
  {
	day = new Date();
	wid = day.getTime();
	eval("page" + wid + " = window.open('/php/tyskie_enlarge.php?id=" + id + "', '" + wid + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + "');");
  }

  
  function szukanie()
  {
    var szuk1 = Trim(document.szukaj.nazwa.value);
	var szuk2 = Trim(document.szukaj.branza.value);
	var szuk3 = Trim(document.szukaj.keyword.value);
	var szuk4 = Trim(document.szukaj.ulica.value);
    if (((szuk1.length > 0) && (szuk1.length < 3)) || ((szuk2.length > 0) && (szuk2.length < 3)) || ((szuk3.length > 0) && (szuk3.length < 3)) || ((szuk4.length > 0) && (szuk4.length < 3)) || ((szuk1.length == 0) && (szuk2.length == 0) && (szuk3.length == 0)))
	{
	  alert('Szukany ciąg musi się składać z co najmniej trzech znaków. Szukanie jedynie na podstawie ulicy nie jest możliwe.');
	}
	else
	  document.szukaj.submit();
  }
  


  
 function calendarshow(number)
  {
    if (number == 1)
	{
	  document.getElementById("calendar_container1").style.display = "block";
	  document.getElementById("calendar_container2").style.display = "none";
	  document.getElementById("calendar_container3").style.display = "none";
	}
    else if (number == 2)
	{
	  document.getElementById("calendar_container1").style.display = "none";
	  document.getElementById("calendar_container2").style.display = "block";
	  document.getElementById("calendar_container3").style.display = "none";
	}
	else
	{
	  document.getElementById("calendar_container1").style.display = "none";
	  document.getElementById("calendar_container2").style.display = "none";
	  document.getElementById("calendar_container3").style.display = "block";
	}

  }


  
  
	function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
	return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
	return "";
	}
	else{
	return TRIM_VALUE;
	}
	} //End Function
	
	function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
	return"";
	}
	var iTemp = v_length -1;
	
	while(iTemp > -1){
	if(VALUE.charAt(iTemp) == w_space){
	}
	else{
	strTemp = VALUE.substring(0,iTemp +1);
	break;
	}
	iTemp = iTemp-1;
	
	} //End While
	return strTemp;
	
	} //End Function
	
	function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
	return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	
	var iTemp = 0;
	
	while(iTemp < v_length){
	if(VALUE.charAt(iTemp) == w_space){
	}
	else{
	strTemp = VALUE.substring(iTemp,v_length);
	break;
	}
	iTemp = iTemp + 1;
	} //End While
	return strTemp;
	} //End Function



