// ------------------------------------------
function showPhoto(obrazek){
  noweOknoFoto=window.open('showPhoto.php?obrazek='+obrazek,'windowFotoCamaro','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=100,height=100');
}

// ------------------------------------------
function showPopupWindow(link,width,height){
  noweOknoPopup=window.open(link,'windowPopupCamaro','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width='+width+',height='+height);
}

// ------------------------------------------
function pokazKontakt(){
var kontakt=document.getElementById('kontaktDIV');
//  if (document.all){
    if (kontakt.style.visibility=='visible')
      kontakt.style.visibility='hidden';
    else
      kontakt.style.visibility='visible';
}

//-----------------------------------
function sprawdzPole(pole,komunikat){
  pole=document.getElementById(pole).value;
  if(!pole || pole=='' || pole==undefined)
    return komunikat;
  else
    return '';
}

//---------------------------------
function checkFormSzukaj(){
var szukaj = document.getElementById('szukaj');

  if (szukaj.value.length<3 || szukaj.value=="szukaj w serwisie"){
    alert("Wpisz poszukiwaną frazę (min. 3 znaki).");
    if (szukaj.value=="szukaj w serwisie"){
      szukaj.value="";
      szukaj.focus();
    }
    return false;
  }

  return true;
}

//---------------------------------
function checkFormPorady(){
var email = document.getElementById('pX[email]').value ;
var emailPat=/^(.+)@(.+)\.(.+)$/ ;
var matchArray=email.match(emailPat);
var komunikat='';

  komunikat+=sprawdzPole('pX[pytanie]',"* pytanie\n");
  komunikat+=sprawdzPole('pX[email]',"* adres email\n");

 	if (email!='' && matchArray==null)
		komunikat+='* podany adres e-mail jest niewłaściwy';

  if(komunikat!=''){
    alert("Wypełnij pola wymagane:\n\n"+komunikat);
    return false;
  }
  else{
    return true;
  }
}//function

//---------------------------------
function replace(s, t, u) {
// s  string
// t  zamien co
// u  zamien  na
  i = s.indexOf(t);
  r = "";
  if (i == -1) return s;
  r += s.substring(0,i) + u;
  if ( i + t.length < s.length)
    r += replace(s.substring(i + t.length, s.length), t, u);
  return r;
}//function

