var strip;
var overstrip;
var speed=5;
var step=5;
var speedE=15;
var stepE=5;
var speedrot=5;
var shift=10;
var soupatko;
var s;
var maindiv;
var bottomstripthumb;
var bottomstrip;
var innerWin;
var winOpened=false;
var aktImLeft=0;
var aktDivLeft;
var moveRightVar;
var moveLeftVar;
var opStep=5;
var opSpeed=60;
var showTime=200;
var maxImages=4;
var aktDivNo=0;

var imageSrc=new Array();
var images=new Array(
		"images/excalibur.jpg","images/excaliburgray.jpg", 	//id 0
		"images/koncerty.jpg","images/koncertygray.jpg",            //id 2
		"images/laska.jpg","images/laskagray.jpg",  //id 4
		"images/bronzy.jpg","images/bronzygray.jpg", 		//id 6;
		"images/close01.gif","images/close01ak.gif",//id 8
		"images/whiteone.gif","images/grayone.gif", //id 10
		"images/close01.gif","images/close01ak.gif",//id 12
		"images/loading01.gif");                    //13

for	(n=0;n<images.length;n++)
{
	imageSrc[n]=new Image();
	imageSrc[n].src=images[n];
}

function active(id)
{
	document.getElementById(id).src=images[id+1];
}

function noactive(id)
{
	document.getElementById(id).src=images[id];
}


function openMenu()
{
	strip=document.getElementById('strip');
	overstrip=document.getElementById('overstrip');
	menuGoRight();
	openAktualitu();
}

function menuGoRight()
{
	strip.style.width=parseInt(strip.style.width)+step+"px";
	overstrip.style.width=parseInt(overstrip.style.width)+step+"px";
	if (parseInt(strip.style.width)<800)
		setTimeout(menuGoRight,speed);
}

function moveSoupatko(right,size)
{
	soupatko=document.getElementById('soupatko');
	soupatko.style.right=right+"px";
	s=size;
	soupatko.style.width="0px";
	soupatko.style.display="block"
	enlarge();
}

function enlarge()
{
	if (parseInt(soupatko.style.width)<s)
	{
		soupatko.style.width=parseInt(soupatko.style.width)+stepE+"px";
		setTimeout(enlarge,speedE);
	}

}

function openThumb()
{
	document.getElementById('content').innerHTML='<img src="images/loading02.gif" class="loader">';

	bottomstripthumb=document.getElementById("bottomstripthumb");
	bottomstrip=document.getElementById("bottomstrip");

	bottomStripMove();
}

function bottomStripMove()
{
    if (parseInt(bottomstripthumb.style.height)>0)
	{
		bottomstripthumb.style.height=parseInt(bottomstripthumb.style.height)-stepE+"px";
		setTimeout(bottomStripMove,speedE);
	}
	else
	    bottomStripSmaller()
}


function bottomStripMoveUp()
{
    if (parseInt(bottomstripthumb.style.height)<90)
	{
		bottomstripthumb.style.height=parseInt(bottomstripthumb.style.height)+stepE+"px";
		setTimeout(bottomStripMoveUp,speedE);
	}
	//else
	 //   bottomStripSmaller()
}

function bottomStripSmaller()
{
    if (parseInt(bottomstrip.style.height)>60)
	{
		bottomstrip.style.height=parseInt(bottomstrip.style.height)-stepE+"px";
		setTimeout(bottomStripSmaller,speedE);
	}
	else
	    {
			document.getElementById('pleasehide').style.visibility="visible";
			document.getElementById('12').style.visibility="visible";
	    }
}

function bottomStripLarger()
{
	document.getElementById('pleasehide').style.visibility="hidden";
	document.getElementById('12').style.visibility="hidden";
    if (parseInt(bottomstrip.style.height)<155)
	{
		bottomstrip.style.height=parseInt(bottomstrip.style.height)+stepE+"px";
		setTimeout(bottomStripLarger,speedE);
	}
	else
	    {
	        bottomStripMoveUp()
	    }
}

function closeThumb()
{
    bottomStripLarger();
}


function scrollLeftImages()
{
	if (-parseInt(innerWin.left)+443<contWidth)
		{
			innerWin.left=parseInt(innerWin.left)-shift+"px";
			moveLeftVar=setTimeout("scrollLeftImages()",speedrot);
		}

}

function scrollRightImages()
{
	if (parseInt(innerWin.left)<0)
		{
			innerWin.left=parseInt(innerWin.left)+shift+"px";
			moveRightVar=setTimeout("scrollRightImages()",speedrot);
		}
}

function changeIm()
{
	var im=aktDivLeft.getElementsByTagName('img')[aktImLeft].style;
	var st=im.filter.indexOf('=')+1;
	var aktOp=parseInt(im.filter.substr(st,3));
	if (aktOp<=100)
	{
	    aktOp+=opStep;
		im.filter="progid:DXImageTransform.Microsoft.Alpha( Opacity="+aktOp+", Style=0)";
    //    alert(im.filter);
		setTimeout("changeIm()",opSpeed);
	}
	else
	{
		if(aktImLeft<maxImages || aktDivNo<2)
		{
			
			if (aktDivNo<2)
			{
                aktDivNo++;
				aktDivLeft=document.getElementById('main').getElementsByTagName('DIV')[aktDivNo];
				
			}
			else
			{
                aktImLeft++;
                aktDivLeft=document.getElementById('main').getElementsByTagName('DIV')[0];
				aktDivNo=0;
			}
			setTimeout("changeIm()",showTime);
		}
		else
		{
            aktDivNo=0;
            aktDivLeft=document.getElementById('main').getElementsByTagName('DIV')[aktDivNo];
            for (i=1;i<maxImages;i++)
			{
               	aktDivLeft.getElementsByTagName('img')[i].style.filter="progid:DXImageTransform.Microsoft.Alpha( Opacity=0, Style=0)";
			}
			setTimeout("changeReboot()",showTime);
		}
	}

	//im.filter="progid:DXImageTransform.Microsoft.Alpha( Opacity="+45+", Style=0)";
}

function changeReboot()
{
    var im=aktDivLeft.getElementsByTagName('img')[maxImages].style;
	var st=im.filter.indexOf('=')+1;
	var aktOp=parseInt(im.filter.substr(st,3));
	if (aktOp>=0)
	{
	    aktOp-=opStep;
		im.filter="progid:DXImageTransform.Microsoft.Alpha( Opacity="+aktOp+", Style=0)";
    //    alert(im.filter);
		setTimeout("changeReboot()",opSpeed);
	}
	else
	{
		if (aktDivNo<2)
		{
            aktDivNo++;
			aktDivLeft=document.getElementById('main').getElementsByTagName('DIV')[aktDivNo];
			for (i=1;i<maxImages;i++)
			{
               	aktDivLeft.getElementsByTagName('img')[i].style.filter="progid:DXImageTransform.Microsoft.Alpha( Opacity=0, Style=0)";
			}
			setTimeout("changeReboot()",showTime);
		}
		else
		{
			aktImLeft=1;
            aktDivLeft=document.getElementById('main').getElementsByTagName('DIV')[0];
			aktDivNo=0;
			setTimeout("changeIm()",showTime);
		}
	//	aktImLeft=1;
		
	}
}

function imOpacityUp()
{

}
