if (!document.layers&&!document.all&&!document.getElementById)
	event="test"
function showtip(current,e,text) {
	if (document.all||document.getElementById) {
		thetitle=text.split('<br>')
		if (thetitle.length>1){
			thetitles=''
		for (i=0;i<thetitle.length;i++)
			thetitles+=thetitle[i]
		current.title=thetitles
		}
		else
			current.title=text
	}
	else if (document.layers) {
		document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>')
		document.tooltip.document.close()
		document.tooltip.left=e.pageX+5
		document.tooltip.top=e.pageY+5
		document.tooltip.visibility="show"
	}
}
function hidetip() {
	if (document.layers)
		document.tooltip.visibility="hidden"
}

//Ajax functions
var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no)
var bustcacheparameter="";

function ajaxpage(url, containerid) {
  var page_request = false;
  if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest();
  else if (window.ActiveXObject) { // if IE
    try {
      page_request = new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch (e) {
      try{
        page_request = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e){}
    }
  }
  else
    return false; 
    
  page_request.onreadystatechange=function() {
    loadpage(page_request, containerid);
  }
  
  if (bustcachevar) //if bust caching of external page
    bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime();
  
  page_request.open('GET', url+bustcacheparameter, true);
  page_request.send(null);
}

function loadpage(page_request, containerid) {
  if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText;
}


//typewriter functions (for news)
function Typewriter(sName)
{	
  this.pauseBetweenChars = 80; // in milliseconds
	this.pauseBetweenNews=3000;
	this.pauseBetweenGroups=6000;
  this.stopAfter=3;
	
	this.counterChar = 0;
	this.name = sName;
	this.IDInterval = null;
	this.js_news = new Array();
	this.js_news_ids = new Array();
	this.printNextChar = PrintNextChar;
	this.resetInterval = ResetInterval;
	this.mySetInterval = MySetInterval;
	this.write = Write;
	this.news_cnt=0;
	this.runners=0;
	this.lastIntervalFunction="";
	this.lastIntervalDuration="";
  		
	function PrintNextChar()
	{	
	
    if (this.counterChar>this.js_news[this.news_cnt].length)
    {
      this.news_cnt++;this.counterChar=0;
      if (this.news_cnt >= this.js_news.length)
      {
        this.news_cnt=0;
        this.mySetInterval(this.name+".write()",this.pauseBetweenGroups);
      }
      else
      {
        this.mySetInterval(this.name+".printNextChar()",this.pauseBetweenNews);
      }
    }
    else
    {
      document.getElementById('typewriter_output').innerHTML = '<a href="stire_detalii.php?stire_id='+ this.js_news_ids[this.news_cnt] +'">' + this.js_news[this.news_cnt].substr(0, this.counterChar++) + '</a>';
      this.mySetInterval(this.name+".printNextChar()",this.pauseBetweenChars);
    }
	}
		
	function Write()
	{	
    if (this.js_news==null) return;
    if (this.js_news.length==0) return;
    
    this.runners++;
    if (this.runners <= this.stopAfter)
      this.mySetInterval(this.name+".printNextChar()",this.pauseBetweenChars); 
    else 
    {
      if (this.js_news.length==1) return;
      var an=new Array();an[0]=this.js_news[0];this.js_news=an;
      var ai=new Array();ai[0]=this.js_news_ids[0];this.js_news_ids=ai;
      this.stopAfter=1;
      this.mySetInterval(this.name+".printNextChar()",this.pauseBetweenChars);
    }
    
       
	}
	
	function ResetInterval()
	{
    if (this.IDInterval !=null)
    {
      clearInterval(this.IDInterval); this.IDInterval=null;
    }
  }
  
  function MySetInterval(functionName,duration)
	{
    if (this.IDInterval !=null)
    {
      if (this.lastIntervalFunction!=functionName || this.lastIntervalDuration != duration)
      {
        this.resetInterval();
        this.IDInterval = setInterval(functionName,duration);
      }
    }
    else
    {
      this.IDInterval = setInterval(functionName,duration);
    }
    
    this.lastIntervalFunction=functionName;
    this.lastIntervalDuration=duration;
  }
  
}

