var x = 0;

function efect_imagine_film(picId, dir){
	if (picId == undefined){
		picId = 'poza';
	}
	if (dir == undefined){
		dir = 1;
	}
	x = x + 1 * dir; 
	if (dir > 0){ 
		if (x<=9) { 
			setTimeout ( "efect_imagine_film('"+picId+"', "+dir+")", 50 );  
			fx = '0.'+x;
		} else {
			fx = 1;
		}

	} else {
		if ( x >= 1 ) { 
			setTimeout ( "efect_imagine_film('"+picId+"', "+dir+")", 50 );  
			fx = '0.'+x;
		} else {
			fx = 0;
		}
	} 

	setOpacity(picId, fx);
}

function setOpacity(elId, fx){
	document.getElementById(elId).style.opacity = fx;

	if (navigator.appName=="Microsoft Internet Explorer") {
		document.getElementById(elId).filters(0).opacity = 100 * fx; 
	}
}

var currentImg = '';
var moutedTimeout = 0;
function movieOver(id,pic){
	if (moutedTimeout != 0){
		clearTimeout(moutedTimeout);
	}
	var mah = $('mid_'+id);
	mah.addClassName('loading');
	var img = $('pozaOver');
	if (currentImg == ''){
		currentImg = img.src;
	}
	img.src = pic; /*'/files/movie/'+id+'/'+id+'/'+id+'_main.jpg'; */
	img.onload = function(){
		mah.removeClassName('loading');
		setOpacity('pozaOver', 10);
		//x = 0;
		//efect_imagine_film('pozaOver');
	}
    var cdvd = document.getElementById('cumpara-dvd')
    if (cdvd){
    cdvd.style.display = 'none';
    }
}

function movieOut(id){
	moutedTimeout = setTimeout('doMovieOut('+id+')', 200);
	var mah = $('mid_'+id);
	mah.removeClassName('loading');
    var cdvd = document.getElementById('cumpara-dvd')
    if (cdvd){
    cdvd.style.display = 'block';
    }
}

function doMovieOut(id){
	setOpacity('pozaOver', 0);
	//efect_imagine_film('pozaOver', -1);
	//var img = $('pozaOver');
	//img.src = currentImg;
}

function textInit(){
	var objBody = $$('body')[0];
	objBody.appendChild(Builder.node('div',{id:'textContent'}));
}

function showText(id){
	$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
	var arrayPageSize = lightbox.getPageSize();
	$('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
	new Effect.Appear(lightbox.overlay, { duration: lightbox.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });

	var arrayPageScroll = document.viewport.getScrollOffsets();
	var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
	var lightboxLeft = arrayPageScroll[0];
	this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
}

function colectiiOver(){
	var covr = document.getElementById('colectiiOver');
	if (covr == undefined){ return; }
	covr.style.display = 'block';
}

function colectiiOut(){
}

var colectiiOnBoxTO = false;
function colectiiBoxOver(){
	if (colectiiOnBoxTO){
		clearTimeout(colectiiOnBoxTO);
	}
}

function colectiiBoxOut(){
	colectiiOnBoxTO = setTimeout('hideColectii();', 500);
}

function hideColectii(){
	//alert(colectiiOnBoxTO);
	var covr = document.getElementById('colectiiOver');
	if (covr == undefined){ return; }
	covr.style.display = 'none';
}
