function setHeight(to_div, h)
{
	document.getElementById(to_div).style.height = h+"px";
	return true;
}

function showHideDiv(div)
{
	st = document.getElementById(div).style.display;
	if(st == "none"){
		document.getElementById(div).style.display = "block";
	} else {
		document.getElementById(div).style.display = "none";
	}
}

function showDiv(div)
{
 st = document.getElementById(div).style.display;
 if(st == "none")document.getElementById(div).style.display = "block";
 }

function hideDiv(div)
{
 st = document.getElementById(div).style.display;
 if(st == "block")document.getElementById(div).style.display = "none";
 }

function getHeight(div)
{
	var h = document.getElementById(div).offsetHeight;
	return h;
}

function loopMainNews(id)
{
	document.getElementById("article_"+allmain[currentMainIndex]).style.display = "none";
	document.getElementById("article_"+allmain[id]).style.display = "block";
	document.getElementById("lnk_"+allmain[currentMainIndex]).className = "lnkGreyLight";
	document.getElementById("lnk_"+allmain[id]).className = "lnkRedLight";
	currentMainNews = allmain[id];
	currentMainIndex = id;
}

function loopMainNewsNext()
{
	if(currentMainIndex < allmain.length-1){
		loopMainNews(currentMainIndex+1);
	}
	return false;
}

function loopMainNewsPrev()
{
	if(currentMainIndex > 0){
		loopMainNews(currentMainIndex-1);
	}
	return false;
}

function sendEvent(swf,typ,prm) {
  thisMovie(swf).sendEvent(typ,prm);
};

function thisMovie(swf) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[swf];
	} else {
		return document[swf];
	}
}

var currentVideoNews = null;
function loadFile(swf,obj,id)
{
	thisMovie(swf).loadFile(obj);
	thisMovie(swf).sendEvent(swf,'playpause');
	document.getElementById("video_news_"+id).className = "allico_play_on";
	if(currentVideoNews != null){
		document.getElementById(currentVideoNews).className = "allico_play_off";
	}
	currentVideoNews = "video_news_"+id;
	window.location = "#ultimeleStiriVideo";
	sendEvent(swf,'playpause');
}

function loadJurnal(swf,obj,id)
{
	thisMovie(swf).loadFile(obj);
	thisMovie(swf).sendEvent(swf,'playpause');
	document.getElementById("video_news_"+id).className = "allico_play_on";
	if(currentVideoNews != null){
		document.getElementById(currentVideoNews).className = "allico_play_off";
	}
	currentVideoNews = "video_news_"+id;
	//document.getElementById('jurnal').innerHTML = document.getElementById('jurnal_title_'+id).innerHTML;
	document.getElementById('jurnal').innerHTML = document.getElementById('j_title_'+id).innerHTML;
	window.location = "#multimediaPlayer";
	sendEvent(swf,'playpause');
}

function bookmarkPage(title,url)
{
	if (window.sidebar) { //Mozilla Firefox
		window.sidebar.addPanel(title, url, "");
	}
	else if( window.external ) { //IE
		window.external.AddFavorite(url, title);
	}
	else if(window.opera && window.print) { //Opera
		CreateBookmarkLink();
	}
}

var zoomCounter = 0;
function zoom()
{
	if(zoomCounter == 0){
		document.getElementById('fullArticle').style.fontSize = "14px";
		zoomCounter = 1;
	} else {
		document.getElementById('fullArticle').style.fontSize = "12px";
		zoomCounter = 0;
	}
}

function submitMiniArhiva()
{
	var ok = 0;
	var zi = document.getElementById('zi').value;
	var ln = document.getElementById('luna').value
	var an = document.getElementById('an').value
	if(zi == ''){ ok = 1; }
	if(ln == ''){ ok = 1; }
	if(an == ''){ ok = 1; }

	if(ok == 0){
		window.location = "http://"+window.location.host+"/"+an+"-"+ln+"-"+zi;
	}
}

function realitateaLive() {
	Tip("<div style='width: 320px; z-index: 99999'><img src='http://85.186.156.227/live/live.jpg?x="+ Math.round(100*Math.random())+"'></div>");
}

function wPop(url, t, w, h)
{
	window.open(url,t,
		'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=no,'+
		'scrollbars=no,width='+w+',height='+h+',left=20,top=20,location');
	return true;
}


function submitletter ( selectedletter )
{
  document.selectletter.letter.value = selectedletter ;
  document.selectletter.nume.value = document.mainform.nume.value;
  document.selectletter.email.value = document.mainform.email.value;
  document.selectletter.tag.value = document.mainform.tag.value;
  document.selectletter.submit() ;
}

function trimAll(sString)
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}

function submittag ( selectedtag )
{
  var tags = document.mainform.tag.value;
  var brokenstring=tags.split(",");
  var gasit =0;
  for (var i in brokenstring)
	{
	    if(trimAll(brokenstring[i])==selectedtag)gasit=1;
	}

  if(gasit==0)
  {
  	document.mainform.tag.value = tags + selectedtag +", " ;
  }

}

