
//**************************** TABEL ROW HIGHLIGHT ****************************
//Specify highlight behavior. "TD" to highlight table cells, "TR" to highlight the entire row:
var highlightbehavior="TR"

var ns6=document.getElementById&&!document.all
var ie=document.all

function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TABLE")
return
while(source.tagName!=highlightbehavior && source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}


//*************************** FEREASTRA POP-UP
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=500,height=300,scrollbars=no');
return false;
}

// ************************** CONTOR CARACTERE INTRODUSE  INPUT
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
document.getElementById("count1").innerHTML = maxlimit - field.value.length;
}


// ************************** CONTOR CARACTERE INTRODUSE ID
function textCounter1(field,countID,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
document.getElementById(countID).innerHTML  = maxlimit - field.value.length;
}


//************************** PREVIEW TEXT ADD
function preview(id1, id2){
	document.getElementById(id2).innerHTML = id1;
}
//--------------------------- SELECTEAZA TOT TEXTUL-----------------------------
function select_all(text)
{
var text_val=eval(text);
text_val.focus();
text_val.select();
}

//------------------------------- SCROLLER -------------------------------------
var m = 160;  // pozitia de inceput
function scroll() {
  var speed = 20;  // viteza scroll
  var lungime = document.getElementById('scroller').offsetWidth;
  var l_container = document.getElementById('container').offsetWidth;
  document.getElementById('scroller').style.left=m+'px';
  m--;
if(m==-lungime) { m=l_container; }
t1 = setTimeout('scroll()',speed);
 } 
//------------------------------ AFISARE MESAJE --------------------------------
function HideMesaj(d) {
document.getElementById(d).style.display = "none";
}
function ShowMesaj(d) {
document.getElementById(d).style.display = "block";
document.getElementById("text_main").innerHTML = '<br><input type="button" value="Close" onClick="HideMesaj(\''+d+'\');">';
}
// mesaj cu time-out 
function msg_time(id,text_titlu,text_mesaj,delay) {
var mesaj = document.getElementById(id);
    mesaj.innerHTML = '<TABLE border="0" align="center" cellspacing="0" cellpadding="0" width="100%"><TBODY><TR><TH id="text_titlu">'+text_titlu+'</TH></TR><TR><TD id="text_main">'+text_mesaj+'</TD></TR><TR><TD align="center" id="butoane"></TD></TR></TBODY></TABLE>';
    mesaj.style.display = "block";
    setTimeout("HideMesaj('"+id+"');",delay); 
}
// mesaj cu buton close 
function msg_close(id,text_titlu,text_mesaj) {
var mesaj = document.getElementById(id);
    mesaj.innerHTML = '<TABLE border="0" align="center" cellspacing="0" cellpadding="0" width="100%"><TBODY><TR><TH id="text_titlu">'+text_titlu+'</TH></TR><TR><TD id="text_main">'+text_mesaj+'</TD></TR><TR><TD align="center" id="butoane"><input type="button" value="Close" onClick="HideMesaj(\''+id+'\');"></TD></TR></TBODY></TABLE>';
    mesaj.style.display = "block";
}
//-------------------------------- RSS ----------------------------------------
var delay=3000
var ie4=document.all
var curindex=0
var totalrss=0

function get_total(){
if (ie4){ while (eval("document.all.rss"+totalrss))
          totalrss++
        }
    else { while (document.getElementById("rss"+totalrss))
           totalrss++
         }
}

function contract_all(){
  for (y=0;y<totalrss;y++){
    if (ie4) eval("document.all.rss"+y).style.display="none"
        else document.getElementById("rss"+y).style.display="none"
  }
}

function expand_one(which){
contract_all()
if (ie4) eval("document.all.rss"+which).style.display=""
    else document.getElementById("rss"+which).style.display=""
}

function rotate_rss(){
get_total()
contract_all()
expand_one(curindex)
curindex=(curindex<totalrss-1)? curindex+1: 0
setTimeout("rotate_rss()",delay)
}

//--------------------------- RULEAZA LA INCARCARE ----------------------------
window.onload=function() { 
scroll(); 
rotate_rss();
}
//--------------------------------- END ---------------------------------------    
