function searchClear(target, searchText)
{
  if (target.value == searchText)
  {
    target.value = '';
  }
}

function searchRestore(target, searchText)
{
  if (target.value == '')
  {
    target.value = searchText;
  }
}

function submitOnChange() {
  document.getElementById('hledej_dotace').submit();
}

function bar(url, title) {
	wasOpen = false;
	win     = window.open(url, title);    
	return (typeof(win) == 'object') ? true : false;
}

function myPopImage(imageURL,imageTitle,imageWidth,imageHeight) {

  PositionX = 30;
  PositionY = 30;
  
  ratio = imageWidth/imageHeight;
  maxHeight = screen.height - 105;
  maxWidth = maxHeight*ratio;
    
  var opt='width='+imageWidth+',height='+imageHeight+',left='+PositionX+',top='+PositionY+',status=no,toolbar=no,menubar=no,location=no';
  imgWin=window.open('about:blank','null',opt);
  with (imgWin.document) {
    writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
    writeln('<sc'+'ript>');
    writeln('function reSizeToImage(){');
    writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
    writeln('isNN=(navigator.appName=="Netscape")?1:0;');
    writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
    writeln('if (document.images[0].height > '+maxHeight+' || document.images[0].width > '+maxWidth+'){');
    writeln('if (isIE){');
    writeln('re = "MSIE 7.0";');
    writeln('if (navigator.appVersion.match(re)){');
    writeln('height = '+maxHeight+' + 71;}');
    writeln('else {');
    writeln('height = '+maxHeight+' + 29;}}');
    writeln('else {');
    writeln('height = '+maxHeight+';}');
    writeln('width = '+maxWidth+';');
    writeln('document.images[0].width = '+maxWidth+';');
    writeln('document.images[0].height = '+maxHeight+';');
    writeln('window.resizeTo(width,height);}');
    writeln('else {');
    writeln('if (isIE){');
    writeln('re = "MSIE 7.0";');
    writeln('if (navigator.appVersion.match(re)){');
    writeln('height = document.images[0].height + 71;}');
    writeln('else {');
    writeln('height = document.images[0].height + 29;}}');
    writeln('else {');
    writeln('height = document.images[0].height;}');
    writeln('width = document.images[0].width;');
    writeln('window.resizeTo(width,height);}}');
    writeln('function doTitle(){document.title="'+imageTitle+'";}');
    writeln('</sc'+'ript>');
    writeln('</head><body bgcolor="FFFFFF" onload="reSizeToImage();doTitle();self.focus()">');
    writeln('<img alt="'+imageTitle+'" title="'+imageTitle+'" src="'+imageURL+'" style="display:block" /></body></html>');
    close();
  }
}

function myPopWindow(windowURL, windowName, windowFeatures) {
  var defaultFeatures = {"status": 0, "toolbar": 0, "location": 0, "menubar": 0,
                         "directories": 0, "resizeable": 1, "scrollbars": 1,
                         "width": 640, "height": 480};
  var features = '';

  for (i in windowFeatures) { defaultFeatures[i] = windowFeatures[i]; }
  for (i in defaultFeatures) { features += i + '=' + defaultFeatures[i] + ','; }

  window.open(windowURL, windowName, features);
  return false;
}