//var domain_server = "http://www.bip.is.rzeszow.jb";
//var domain_server = "http://www.bip.is.rzeszow.pl";
var domain_server = "http://bip.is.proart.pl";

//Utworzenie obiektu, który będzie zbierał zdarzenia od kliknięć myszki
//Element ten będzie poza bubble, więc będzie go można wykorzystać w otwieraj±cym się okienku
//aby można było dowiedzieć się, z jakiego elementu pochodzi zdarzenie
//np. window.opener.elementClicked.title
window.elementClicked = null;
function mDown(){
  window.elementClicked = event.srcElement;
}
document.onmousedown = new Function("mDown()");

//*************************************************************************
function rekom()
{
	window.open(domain_server+"/linki.php","linki","width=560,height=400,toolbar=no,menubar=no,scrollbars=yes");
}
//*************************************************************************
function home(h)
{
	if (h.style) {
		h.style.behavior="url(#default#homepage)"; 
		h.setHomePage(domain_server);
	}
}
//*************************************************************************
function znajomy()
{
	window.open(domain_server+"/znajomy.php","znajomy","width=300,height=400,toolbar=no,menubar=no,scrollbars=yes");
}
//*************************************************************************
function go(f)
{
	//window.open(f.options[f.options.selectedIndex].value,"","");
	window.open(document.getElementById(f).value,"","");
}
//*************************************************************************
function rest(c)
{
	if (c.value.length==0)
		c.value = "Szukany tekst";
}
//*************************************************************************
function test_srch(c)
{
	if (c.value.length==0 || c.value=="Szukany tekst") {
		alert("Nie wprowadzono szukanego tekstu");
		return false;
	}
	else
		return true;
}
//*************************************************************************
function karta(param)
{
	var x = (screen.width-640)/2;
	var y = (screen.height-520)/2;
	var s = domain_server + "/karta.php?" + param;
	var opt = ",left="+x+",top="+y;
	window.open(s,"Karta","toolbar=no,statusbar-no,menubar=no,scrollbars=yes,width=640,height=520"+opt);
}
//*************************************************************************
function mapan()
{
	var x = (screen.width-760)/2;
	var y = (screen.height-550)/2;
	var opt = ",left="+x+",top="+y;
	window.open(domain_server+"/mapa.html","mapa_nadl","width=660,height=550,scrollbars=no,menubar=no"+opt);
}


//**************************************************************************************
function validateListaAk(){
  var ret=true;
  if (lista_ak.przetarg_od.value.length>0)
	ret&=validateDate(lista_ak.przetarg_od.value);
  if (lista_ak.przetarg_do.value.length>0)
	ret&=validateDate(lista_ak.przetarg_do.value);
  return ret;
}
function validateDate(strValue){
  var objRegExp = /^\d{4}(\-)\d{1,2}(\-)\d{1,2}$/
  if(!objRegExp.test(strValue)){
    alert("Niepoprawny format daty '"+strValue+"'\nPrawidłowy format daty to RRRR-MM-DD np. 1997-08-12");
    return false; //doesn't match pattern, bad date
  }
  else
  	return true;
}
//**************************************************************************************
function hide_obj(obj){
		document.getElementById(obj).style.display='none';		
}
function download_file(hddFile, orgFile)
{
	if (hddFile=="" || orgFile==""){
		alert("Plik nie został odnaleziony na serwerze.");
		return false;
	}
	if (orgFile=="")
		orgFile=hddFile;
	
	var dx = screen.width;
	var dy = screen.height;
	var szer = dx/2;
	var wys = dy/2;
	//var s = "/edytorek/download_file.php?hddFile="+hddFile+"&orgFile="+orgFile;
	var s = "download_file.php?hddFile="+hddFile+"&orgFile="+orgFile;
	var okno_down = window.open(s,'DownloadFile','width='+ szer +' ,height='+ wys +' , left=0 ,top=0, scrollbar=yes, toolbar=no, resizable=yes, status=no, directories=no, menubar=no, fullscreen=no');
}
