document.getElementById("link_acasa").style.color="#990c06";
var c=0;
var counter=0;
var t,s;
var pause=false;
var fade=false;
var photono;
var nrpoza;
var galerieSlideshow=new Array();
var nr=0;
var myfade;
var nogallery;
function photoGallery(){
	myfade=document.getElementById("photo_gallery");
	if (!pause){
		nr=0;
		photono=c%nogallery;
			document.getElementById('photo_gallery').style.background ="url("+galerieSlideshow[photono]+")";
		galfi();
		t=setTimeout("galfo()",4500);
		c++;
		nr=0;
		s=setTimeout("photoGallery()", 7000);		
	}
}
function setgalopacity(opac) {
	myfade.style.opacity = opac;
 	myfade.style.MozOpacity = opac;
	myfade.style.KhtmlOpacity = opac;
	myfade.style.filter = 'alpha(opacity=' + (opac * 100) + ');';
}
function galfi(){
		for (i = 0; i <= 1; i += 0.01)
	   		setTimeout("setgalopacity(" + i +")", i * 2500);
	
}
function galfo(){
		for (i = 0; i <= 1; i += 0.01)
    		setTimeout("setgalopacity(" + (1 - i) +")", i * 2500);
}
function change(x){
		nr++;
		pause=true;
		clearTimeout(t);
		clearTimeout(s);
		if (x==-1){
			if (photono>0)
				photono--;}
		else if (x==nogallery){
			  if (photono<(nogallery-1))
				photono++;
				}
			else
				photono=x;
		document.getElementById("photo_gallery").style.opacity=1;
		document.getElementById('photo_gallery').style.background ="url("+galerieSlideshow[photono]+")";	
		if (nr==1)
			setTimeout("slideshow()", 10000);
}
function slideshow(){
	pause=false;
	photoGallery();
}
var site=document.getElementById('site');
var element = document.getElementById("popup_content");
var duration = 800; 
function SetOpa(Opa) {
  element.style.opacity = Opa;
  element.style.MozOpacity = Opa;
  element.style.KhtmlOpacity = Opa;
  element.style.filter = 'alpha(opacity=' + (Opa * 100) + ');';
}
function setopacity(opac){
	site.style.opacity = opac;
 	site.style.MozOpacity = opac;
	site.style.KhtmlOpacity = opac;
	site.style.filter = 'alpha(opacity=' + (opac * 100) + ');';
}
function fadeOut() {
  for (i = 0; i <= 1; i += 0.01)
    setTimeout("SetOpa(" + (1 - i) +")", i * duration);
}
function FadeIn() {
	setTimeout(dofade,1300);
  for (i = 0; i <= 1; i += 0.01)
    setTimeout("SetOpa(" + i +")", i * duration);
	
}
function showPopup(w,h){
		var popUp = document.getElementById("popup_content"); 
		var x=screen.width*1/3;
		var y=screen.height*1/8;
		site.style.opacity="0.2";
		site.style.MozOpacity = "0.2";
		site.style.KhtmlOpacity = "0.2";
		site.style.filter = 'alpha(opacity=20)';
		popUp.style.top = y+"px";
		popUp.style.left =x+"px";
		popUp.style.width = w + "px";
		popUp.style.height = h + "px";
    popUp.style.visibility = "visible";
		popUp.style.display="block";
		FadeIn();	
}
function hidePopup(){
	if (fade==true&&counter==0){
   var popUp = document.getElementById("popup_content");
	 popUp.style.zIndex=-1;
	 fadeOut();
	 redo();
	 counter++;
	}
}
function redo(){
	 for (i = 0.2; i <= 1; i += 0.01)
    setTimeout("setopacity(" + i +")", i * duration);
}
function dofade(){
	fade=true;
}
