

function changeImage(Crr){
    if (Start==0) return false;
    _fadeOutStep(10, Crr);
    _fadeInStep(0, ((Crr==RandLength)?1:(Crr+1)));  
    setTimeout('changeImage('+((Crr==RandLength)?1:(Crr+1))+')',  (Delay*1000));
}

_fadeOutStep = function(Nr, Crr){

if (Nr >= 0){
  _setOpacity('img_rand_'+Crr, Nr/10);
  Nr --;

  setTimeout("_fadeOutStep("+Nr+",'"+Crr+"')", 30);

}
else {
//  _hide('img_rand_'+Crr);
//  _show('img_rand_'+Next);
  return true;
}
};

_setOpacity = function(Obj, Val){
document.getElementById(Obj).style.filter     = "alpha(opacity="+Val*100+")";
document.getElementById(Obj).style.mozOpacity = Val;
document.getElementById(Obj).style.opacity    = Val;
};

_fadeInStep = function(Nr, Crr){

if (Nr <= 10){
  _setOpacity('img_rand_'+Crr, Nr/10);
  Nr ++;
  setTimeout("_fadeInStep("+Nr+", '"+Crr+"')", 30);

}
else return true;
};

_hide = function (el){

document.getElementById(el).style.visibility = 'hidden';
}

_show = function (el){
document.getElementById(el).style.visibility = 'visible';
}

var blankImg='http://www.valeasebesului.ro/web/content/css/blank.gif';
var Languages = Array('ro', 'en'/*, 'de'*/);
var cUrl = document.location.href;

function setIE6Heights(){
	setTimeout('setIE6HeightsDelayed()', 0);
}

function setIE6HeightsDelayed(){
	var h = document.getElementById('layout_23').offsetHeight;
	document.getElementById('layout_12').style.height = parseInt(h+100)+'px';
	document.getElementById('layout_35').style.height = parseInt(h+100)+'px';
	document.getElementById('layout_1').style.height = parseInt(h+330)+'px';
	document.getElementById('layout_5').style.height = parseInt(h+330)+'px';
	document.getElementById('layout_2').style.height = parseInt(h+350)+'px';
	document.getElementById('layout_4').style.height = parseInt(h+350)+'px';
}

function changeLang(L){
	
	if (L==Lang) return false;
	if (cUrl=='http://www.valeasebesului.ro'||cUrl=='http://www.valeasebesului.ro/'||cUrl.replace('http://','http://www.')=='http://www.valeasebesului.ro'||cUrl.replace('http://','http://www.')=='http://www.valeasebesului.ro/') cUrl = 'http://www.valeasebesului.ro/'+L+'/prima-pagina';		
	else{
		for(var i=0; i<Languages.length; i++){
			cUrl = cUrl.replace('/'+Languages[i]+'/','/'+L+'/');
		}
	}
	document.location.href = cUrl;		
}

window.onload=function(){
	var h = document.getElementById('layout_23').offsetHeight;

	//if (/*parseFloat(navigator.appVersion)==4 &&*/ navigator.appName=='Microsoft Internet Explorer' /*&& typeof document.body.style.maxHeight == "undefined"*/) 
	setIE6Heights();
	setTimeout('changeImage(1)', Delay*1000);
	externalLinks();
}

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("class") == "blank")
     anchor.target = "_blank";
}
}