// JavaScript Document

var nr_img=1,i=0;

function schimba_imagine(unde,care)
{
	var img=document.images['img_'+care];
	if (unde=='pe')
	{
		if (img.src.indexOf('selectat')<0) img.src='nou/imagini/buton_meniu_top_'+care+'_mo.jpg';
	}
	else
	{
		if (img.src.indexOf('selectat')<0) img.src='nou/imagini/buton_meniu_top_'+care+'.jpg';		
	}
}

function redimensionare()
{
	frm=document.getElementById("frame_cautare");
	alert(frm.clientHeight);
}

function setari_pagina(pag)
{
//	preincarca();
	if (document.getElementById("chenar_continut_dreapta"+pag)) dreapta=document.getElementById("chenar_continut_dreapta"+pag).clientHeight; else dreapta=0;
	if (document.getElementById("chenar_continut_stanga"+pag)) stanga=document.getElementById("chenar_continut_stanga"+pag).clientHeight; else stanga=0;
	var inaltime=(stanga>dreapta?stanga:dreapta);
	document.getElementById("fundal_continut").style.height=inaltime.toString()+"px";
	if (document.getElementById("chenar_continut_stanga"+pag)) document.getElementById("chenar_continut_stanga"+pag).style.height=inaltime.toString()+"px";
	else document.getElementById("chenar_continut_dreapta"+pag).style.height=inaltime.toString()+"px";
	document.getElementById("fundal_continut").style.visibility='visible';
	inaltime=inaltime+366;/*418;*/
	document.getElementById("fundal_continut").style.visibility="visible";
	document.getElementById("jos").style.top=inaltime.toString()+"px";
	document.getElementById("jos").style.visibility="visible";
	porneste_slideshow();
}

function setari_pagina_index()
{
//	preincarca();
	var inaltime=dreapta=document.getElementById("chenar_continut_dreapta_cautare").clientHeight;
	document.getElementById("fundal_continut").style.height=(document.getElementById("chenar_continut_linkuri_utile_index").clientHeight+inaltime).toString()+"px";
	document.getElementById("chenar_continut_dreapta_cautare").style.height=inaltime.toString()+"px";
	document.getElementById("fundal_continut").style.visibility='visible';
	document.getElementById("fundal_continut").style.visibility="visible";
	document.getElementById("chenar_continut_linkuri_utile_index").style.top=inaltime.toString()+"px";
	document.getElementById("chenar_continut_linkuri_utile_index").style.visibility="visible";
	document.getElementById("jos").style.top=(document.getElementById("chenar_continut_linkuri_utile_index").clientHeight+inaltime+366).toString()+"px";
	document.getElementById("jos").style.visibility="visible";
	porneste_slideshow();
}

function transparenta(procent)
{
	document["poza_slide1"].style.filter = "alpha(opacity=" + procent.toString() + ")";
	document["poza_slide1"].style.opacity = (procent/100);
	document["poza_slide1"].style.MozOpacity = (procent/100);
	document["poza_slide1"].style.KhtmlOpacity = (procent/100);
	procent=procent-5;
	if (procent>=0) setTimeout("transparenta("+procent.toString()+")", 60);
	else
	{
		if (nr_img<17) nr_img=nr_img+1; else nr_img=1; var x= nr_img+1;
		document["poza_slide1"].onload=function() {
			document["poza_slide1"].style.filter = "alpha(opacity=100)";
			document["poza_slide1"].style.opacity = 100;
			document["poza_slide1"].style.MozOpacity = 100;
			document["poza_slide1"].style.KhtmlOpacity = 100;
			document["poza_slide2"].style.visibility="hidden";
			document["poza_slide2"].src="imagini/slideshow/"+x.toString()+".jpg";
		}
		document["poza_slide1"].src="imagini/slideshow/"+nr_img.toString()+".jpg";
	}
}

function slideshow()
{
	document["poza_slide2"].style.visibility="visible";
	setTimeout("transparenta(100)", 80);
}

function porneste_slideshow()
{
	nr_img=1;
	inter=setInterval("slideshow()",8000);
}

function opreste_slideshow()
{
	nr_img=0;
	clearInterval(inter);
}
