function confirmLink_Text(theLink, text){
  qs = confirm(text);
  if(qs)
    {
      window.location=theLink;
    }
}

function OpenWindow(theURL,winName,w,h,scroll){
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',noresizable'
  window.open(theURL,winName,settings);
}

function OpenFormatWindow(theURL,winName,w,h,scroll){
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',';
  pop = window.open(theURL,winName,settings);
  pop.document.write('<html><head><title>GALERIA</title>')
  pop.document.write('</head><body bgcolor="white" topmargin="0" leftmargin="0"><center>');
  pop.document.write('<a href="javascript:window.close();"><img src="'+theURL+'" border="0"></a></center>');
  pop.document.write('</body></html>');
}

function textCounter(field, countfield, maxlimit){
  if (field.value.length > maxlimit)
   field.value = field.value.substring(0, maxlimit);
  else
   countfield.value = maxlimit - field.value.length;
}

function trim(t){
  return t.replace(/^\s+/g,'').replace(/\s+$/g,'')
}

function sprawdz(wart){
  if (isNaN(wart.value) || trim(wart.value)=="" || trim(wart.value)<=0)
  {
    alert("Uwaga! \r\n"+wart.value+" nie jest dozwolon wartoci.");
    wart.value="";
  }
  return true;
}

function Ulubione(){
  var url="http://esbe.pl";
  var title=" --= ESBE.pl =--";
  window.external.AddFavorite(url,title);
}

function write_it(status_text){
  window.status=status_text;
}

function selecturl(s){
  var gourl = s.options[s.selectedIndex].value;	
  window.self.location.href = gourl;
}
