
var up = 1;
var mscreen1;
var platno1;

function nextPic(element)
{
	var povezave = document.getElementById('tabs').getElementsByTagName('a');
	for (i=0; i<povezave.length; i++)
	{
		povezave[i].className='';
	}
	element.className = 'thisPic'; 
	
	var temp = new Array();
	temp = element.id.split('#');
	var postP = 'wpID='+temp[0]+'&wpID2='+temp[1];
	
	wAjax(postP, 'platno', 'platno-b', 'arhiv');
}

function nextGalPic(element)
{
	var povezave = document.getElementById('tabs').getElementsByTagName('a');
	for (i=0; i<povezave.length; i++)
	{
		povezave[i].className='';
	}
	element.className = 'thisPic'; 
	
	var temp = new Array();
	temp = element.id.split('#');
	var postP = 'wpID='+temp[0]+'&wpID2='+temp[1];
	
	wAjax(postP, 'platno_galerija', 'platno-b', 'arhiv');
}

function showMe(element)
{
	if (up == 0)
	{
				platno1.clearTimer();
				platno1.hide();
				var platno2 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
					{
						$('tabs').style.display = 'none';
						$('x').style.display = 'none';
						wAjax('wpID=0', 'reset', 'platno-b', 'arhiv');
						wAjax('wpID=0', 'reset', 'tabs', 'arhiv');
						mscreen1.toggle();
						fly = document.getElementById("fly1");
						fly.style.display="block";
					}
				});
				platno2.toggle();
				up = 1;
				
	} else
	{
				mscreen1.clearTimer();
				mscreen1.hide();
				if (element.id != "" && element.id != "x") 
				{
					var mscreen2 = new fx.Height('platno1', {duration: 100, onComplete: function ()
						{
						var platno3 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
							{
								//var temp = new Array();
								//temp = element.id.split('#');
								var postP = 'wpID='+element.id+'&wpID2=1';
								wAjax(postP, 'platno', 'platno-b', 'arhiv');
								wAjax(postP, 'gumbi', 'tabs', 'arhiv');
							}
						});
						platno3.hide();
						platno3.toggle();
						timer = setTimeout("$('tabs').style.display = 'block'", 400);
						timer = setTimeout("$('x').style.display = 'block'", 100);
						}
					});
					mscreen2.toggle();
					fly = document.getElementById("fly1");
					fly.style.display="none";
					up = 0;
			}

	}
}

//galerija
function showGal(element)
{
	if (up == 0)
	{
				platno1.clearTimer();
				platno1.hide();
				var platno2 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
					{
						$('tabs').style.display = 'none';
						$('x').style.display = 'none';
						wAjax('wpID=0', 'reset', 'platno-b', 'arhiv');
						wAjax('wpID=0', 'reset', 'tabs', 'arhiv');
						mscreen1.toggle();
					}
				});
				platno2.toggle();
				up = 1;
	} else
	{
				mscreen1.clearTimer();
				mscreen1.hide();
				if (element.id != "" && element.id != "x") 
				{
					var mscreen2 = new fx.Height('platno1', {duration: 100, onComplete: function ()
						{
						var platno3 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
							{
								var temp = new Array();
								temp = element.id.split('#');
								var postP = 'wpID='+temp[0]+'&wpID2='+temp[1];
								wAjax(postP, 'platno_galerija', 'platno-b', 'arhiv');
								wAjax(postP, 'gumbi_galerija', 'tabs', 'arhiv');
							}
						});
						platno3.hide();
						platno3.toggle();
						timer = setTimeout("$('tabs').style.display = 'block'", 400);
						timer = setTimeout("$('x').style.display = 'block'", 100);
						}
					});
					mscreen2.toggle();
				
					up = 0;
			}

	}
}


function seznam_produkt(ID, ID2)
{
	var izbrani = 'narocnik_'+ID;
	var povezave = document.getElementById('file2').getElementsByTagName('a');
	for (i=0; i<povezave.length; i++)
	{
		povezave[i].className='choice';
	}
	document.getElementById(izbrani).className = 'choice choiceOn'; 

	wAjax('wpID='+ID+'&wpID2='+ID2, 'produkt2', 'file3', 'arhiv');
	wAjax('wpID='+ID+'&wpID2='+ID2, 'produkt2_Filter', 'filter2', 'arhiv');

}

function seznam_projekt(ID, ID2)
{
	var izbrani = 'produkt_'+ID;
	var povezave = document.getElementById('file2').getElementsByTagName('a');
	for (i=0; i<povezave.length; i++)
	{
		povezave[i].className='choice';
	}
	document.getElementById(izbrani).className = 'choice choiceOn'
	
	wAjax('wpID='+ID+'&wpID2='+ID2, 'narocnik2', 'file3', 'arhiv');
	wAjax('wpID='+ID+'&wpID2='+ID2, 'produkt2_Filter', 'filter2', 'arhiv');

}


function filter1(el) 
{
	wAjax('wpID='+el.id, 'narocnik1', 'file2', 'arhiv');
	wAjax('wpID='+el.id, 'narocnik_Filter', 'filter1', 'arhiv');
	wAjax('wpID=0', 'reset', 'file3', 'arhiv');
}

function filter2(el)
{
	wAjax('wpID='+el.id, 'produkt1', 'file2', 'arhiv');
	wAjax('wpID='+el.id, 'produkt_Filter', 'filter1', 'arhiv');
	wAjax('wpID=0', 'reset', 'file3', 'arhiv');
}



function initArhiv()
{		
	mscreen1 = new fx.Height('platno1', {duration: 100});
	platno1 = new fx.Opacity('platno-b', {duration: 400});
	mscreen1.hide();
	platno1.hide();

	if(getQueryVariable('P') == 'arhiv') 
	{
		inverseHandle(document.getElementById(arhiv));

		fly = document.getElementById("fly1");
		div = fly.getElementsByTagName("div")[0];
		divTop = div.style.top;
		span = div.getElementsByTagName("p")[0];	
		oTekst = span.innerHTML;

		fly.onmouseover = function() { div.style.display = "block";  }
		fly.onmouseout = function() { div.style.display = "none";  }
		
	}
	
	if(getQueryVariable('P') == 'galerija') inverseHandle(document.getElementById(galerija));
	wAjax('wpID=0', 'produkt1', 'file2', 'arhiv');
	wAjax('wpID=0', 'produkt_Filter', 'filter1', 'arhiv');
	wAjax('wpID=0', 'reset', 'file3', 'arhiv');
}


function shutUp()
{
	span.innerHTML = oTekst;
	div.style.top = divTop;
	div.style.display = "none";
}

function speakUp(tekst, top)
{
	span.innerHTML = tekst;
	if (top != "" && parseInt(top) != 0) div.style.top = parseInt(top) + "px";
	div.style.display = "block";
}

// muha govori
var fly;
var div;
var divTop; 
var span;	
var oTekst;


var oldhandler = window.onload;
window.onload = (typeof oldhandler == "function")
    ? function() { oldhandler(); initArhiv(); } : initArhiv;
