function openSendLinkPopup(docid, sendType)
{
  var options = "toolbar=no,scrollbars=yes,resizable=yes,width=500,height=550";
  var link = "/components/sba/send_link/send_link_form.jsp?docid="+docid+"&sendType="+sendType;
  popupwindow=window.open(link, "SendLink", options);
  if (window.focus)
    popupwindow.focus();
}

var inputValueColor = "#8a8a8a";
var inputValueColorize = "#8a8a8a";


function openSendLinkPopupMistakeML(docid, sendType)
{
  var options = "toolbar=no,scrollbars=yes,resizable=yes,width=500,height=550";
  var link = "/components/sba/mistake/send_link_form.jsp?docid="+docid+"&sendType="+sendType;
  popupwindow=window.open(link, "SendLink", options);
  if (window.focus)
    popupwindow.focus();
}

var inputValueColor = "#8a8a8a";
var inputValueColorize = "#8a8a8a";


function manageInputValue(field, action)
{
/* script by JK @ Interway
 * funkciu ovplyvnia globalne premenne definovane pred funkciou:
 * var omnitClearWords4%ID% = true/false; ...
 * var defaultText4%ID% = "Zadajte hodnotu...";
 * povinna je akcia "init"
*/
  var action = action;
  if (typeof(action) == "undefined")
    action = "";

  // referencia na pole
  var fieldTag;
  if (typeof(field) == "string")
    fieldTag = document.getElementById(field);
  else if (typeof(field) == "object")
    fieldTag = field;
  else
    return;

  // definicia value textu
  var useText = fieldTag.value;
  
  try
  {
    useText = eval("defaultText4"+fieldTag.id);
  }
  catch (e) {}

  // bude sa mazat value na focus/click? false = ano
  var omnitClearWords = false;
  
  try
  {
    omnitClearWords = eval("omnitClearWords4"+fieldTag.id);
  }
  catch (e) {}

  if (action == "init")
  {
    fieldTag.value = useText;
    fieldTag.style.color = inputValueColorize;
    return;
  }
  // operacie s textom
  if (fieldTag.value == useText) {
    if (!omnitClearWords)
      fieldTag.value = "";
    fieldTag.style.color = inputValueColor;
  }

  if (action == "check")
  {
    var temp = fieldTag.value;
    if (temp == "" || temp.search(/^\s{1,}$/) != -1) {
      fieldTag.value = useText;
      fieldTag.style.color = inputValueColorize;
    }
  }
}

/* common compliance */

function printPage()
{
  var options = "menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=630,height=460;"
  url = top.location.href;
  if (url.indexOf("#")>0) url = url.substring(0, url.indexOf("#"));
  if (url.indexOf("?")>0) url = url + "&print=yes";
  else url = url + "?print=yes";
  printWindow=window.open(url,"_blank",options);
}

function printPageEn()
{
  var options = "menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=630,height=460;"
  url = top.location.href;
  if (url.indexOf("#")>0) url = url.substring(0, url.indexOf("#"));
  if (url.indexOf("?")>0) url = url + "&print=yes&eng=yes";
  else url = url + "?print=yes&eng=yes";
  printWindow=window.open(url,"_blank",options);
}

function popup(url, width, height)
{
  var options = "toolbar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height+";"
  popupWindow=window.open(url,"_blank",options);
}

function wjPopup(url, width, height)
{
  var options = "toolbar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height+";"
  popupWindow=window.open(url,"_blank",options);
}

function getPageElement(name)
{
   var el = null;
   if (document.getElementById)
   {
      el = document.getElementById(name);
   }
   return(el);
}

function showHideElement(elementId, show)
{
   var rowEl = getPageElement(elementId);
   if (rowEl != null)
   {
	   if (show) rowEl.style.display="block";
	   else rowEl.style.display="none";
	}
}

var calElement;
calElement = "";
function calShow(element)
{
  if(calElement == "")
  {
    document.getElementById(element).style.display = "block";
    calElement = element;
  }
  else if(calElement != "")
  {
    document.getElementById(element).style.display = "none";
    calElement = "";
  }
}
