<!--
// -----------------------------------------------------------------------------------------------------------
function redir_with_confirm(link, obj, msg)
{
 if (document.all[obj].value != "" )
    var result=confirm(msg);
 if (result == true) self.location = link;
}
function check_and_redir(link, obj)
{
  alert(document.all[obj].value);
 if (document.all[obj].value != "" ){
    self.location = link+document.all[obj].value;     }
}
// -----------------------------------------------------------------------------------------------------------
function trink_per_redira(obj, link, msg)
{
 if (document.all[obj].value != "" )
 var result=confirm(msg);
 if (result == true) self.location = link;
}
function add_news_mail()
{

}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function patvirtinti(text, linkas, linkas1)
{
   var result=confirm(text);
   if (result == true)
   {
     self.parent.location = linkas;
   }

   else
   {
     self.location = linkas1;
   }
}

/* Select and copy to clipboard */
var copytoclip=1
function HighlightAll(theField) {
var tempval=eval("document."+theField)
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",2400);
}
}
function confirmLink(theLink, theSqlQuery)
{
    // Confirmation is not required in the configuration file
    if (confirmMsg == '') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + ' :\n' + theSqlQuery);
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
} // end of the 'confirmLink()' function

function setPointer(theRow, thePointerColor)
{
    if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined') {
        return false;
    }

    var row_cells_cnt           = theRow.cells.length;
    for (var c = 0; c < row_cells_cnt; c++) {
        theRow.cells[c].bgColor = thePointerColor;
    }

    return true;
} // end of the 'setPointer()' function


var dir_set = "../../";

function news_medis(obj)
{
  //document.all.save.disabled = true;
  document.all.news_subject.value = "";
  document.all.n_text.value = "";
  del_pic();
  par = document.all[obj.sourceIndex];
  pic = document.all[obj.sourceIndex+2];
  next_obj = document.all[obj.sourceIndex+3];
  pic.src = (next_obj.style.display == "none")? dir_set+'images/icons/icon_minus.gif' : dir_set+'images/icons/icon_plus.gif';
  var parent_id = par.id;
  while (next_obj != null && next_obj.id == parent_id)
  {
    if (next_obj.id != "") next_obj.style.display = (next_obj.style.display == "none") ? "":"none";
    next_obj = document.all[next_obj.sourceIndex+3];
  }
}
function fill_all_fields(new_id)
{
  var new_obj = newsList[new_id];
// 0-subject; 1-data
 // document.all.save.disabled = false;
  document.all.n_group1.checked = true;
  document.all.p_curr_new.value = new_id; // naujienos id issaugojimas hidden objekte
  //alert(document.all.p_curr_new.value);
  document.all.news_subject.value = new_obj[0];  // subject
  var metai = new_obj[1].substr(0, 4);
  var menesis = new_obj[1].substr(5, 2);
  var diena = new_obj[1].substr(8, 2);
  var laikas = new_obj[1].substr(11, 8);
  document.all.n_laikas.value = laikas;
  for (x=0; x < document.all.n_metai.length; x++) {
    if (document.all.n_metai.item(x).value == metai)
    {
       document.all.n_metai.item(x).selected  = 'true';
       break;
    }
  }
  for (x=0; x < document.all.n_menuo.length; x++) {
    if (document.all.n_menuo.item(x).value == menesis)
    {
       document.all.n_menuo.item(x).selected  = 'true';
       break;
    }
  }
  for (x=0; x < document.all.n_diena.length; x++) {
    if (document.all.n_diena.item(x).value == diena)
    {
       document.all.n_diena.item(x).selected  = 'true';
       break;
    }
  }  /**/
     if (new_obj[2] == 1)
      document.all.n_status.item(0).selected  = 'true';
   else
      document.all.n_status.item(1).selected  = 'true';
/*  --------------------------------------------------------------  */
  for (x=0; x < document.all.n_group.length; x++)
  {
    if (document.all.n_group.item(x).value == new_obj[3])
    {
       document.all.n_group.item(x).selected  = 'true';
       break;
    }
  }
     if (new_obj[4] != "")
   {
     document.all['image_id'].style.display = 'inline';
     document.all['pic_TR'].style.display = 'inline';
     document.all['image_id'].src = dir_set+'images/icons/'+new_obj[4];;
     document.all['hidden_id'].value = dir_set+'images/icons/'+new_obj[4];;
   }
   else
   {
     del_pic()
   }
  document.all.n_text.value = document.all['news_item_'+new_id].value;
  //document.all['Tn_text'].document.body.innerHTML = "hjfdh";

}


function change_korta2(k, curr_k, obj)
{
  for (x=1; x<=k; x++)
  {
     document.getElementById(x).className  = (x == curr_k)?'tab-on':'tab-off';
  }
}
function patvirtinti(text, linkas, linkas1)
{
   var result=confirm(text);
   if (result == true)
   {
     self.location = linkas;
   }

   else
   {
     self.location = linkas1;
   }
}

function persokti(targ,selObj,restore)
{
   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function image_window(image,w,h,subject)
{

         var win = window.open("", "", "width="+w+",height="+h); // a window object
var doc = win.document;
doc.open("text/html", "replace");
doc.write("<HTML><HEAD><TITLE>"+subject+"</TITLE></HEAD><BODY topmargin='0' leftmargin='0'><img src='"+image+"' border='0' width='"+w+"' height='"+h+"'></BODY></HTML>");
doc.close();
}


//-->
