﻿// JScript File
function GetForm()
{
	var theForm;
	theForm = document.forms[0];
	if (!theForm)		
		theForm = document.forms['aspnetForm'];
	if (!theForm) {
    theForm = document.aspnetForm;
   }   	
  return theForm;
}

function SetAction(action, args) {
 	SetFieldValue("hiddenaction", action);
 	SetFieldValue("hiddenargs", args); 	 	
}

function SetActionSubmit(action, args) {
	SetAction(action, args);
	var form = document.forms[0];
	if (form)
		form.submit();	
}

function SetActionSubmitVal(action, args) {
  var valid = true;
  if (typeof(Page_ClientValidate) == 'function')
    valid = Page_ClientValidate();
     
  if (valid)
     SetActionSubmit(action, args);
}

function SetFieldValue(fieldName, value) {
 	var item = GetField(fieldName);
	if (item != null) {
		item.value = value;		
	}
}

function GetFieldValue(fieldName) 
{
 	var item = GetField(fieldName);
	if (item != null) 
		return item.value;		
  else
    return '';	
}


function GetField(fieldName)
{
  var items;
	items = window.document.getElementsByName(fieldName);
  if (items.length == 1) 
		return items.item(0);
	else
	  return window.document.getElementById(fieldName);;			
}


function novo_okno_tiskanje(URL) {
  var scrnwdth = 0;
  var scrnhght = 0;
  var wdth = 640;
  var hght = 450;
  var lft;
  var tp;
  var strQueryString;
  if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
  if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
  if(scrnhght != 0) tp = (scrnhght - hght)/2;
  var prn = null;
  strQueryString = URL;
  prn = window.open('../sys/tiskanjeframe.aspx?' + strQueryString, 'prnwnd', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes');
  if (prn.blur) prn.focus();
}

function openLayer(link)
{
	link.childNodes[0].src = "../imgcms/slo/button_napredno_iskanje_zapri.gif";
	link.onclick = new Function("closeLayer(this);");
	document.getElementById("search").style.display = "block";
}

function closeLayer(link)
{
	link.childNodes[0].src = "../imgcms/slo/button-napredno-iskanje.png";
	link.onclick = new Function("openLayer(this);");
	document.getElementById("search").style.display = "none";
}

