// JavaScript Document
Gallery = function(items, itemscount, toshow, redraw, prefix)
{
	this.prefix = prefix;
	this.items = items;
	this.redraw = redraw;
	this.toshow = toshow;
	this.selected = 0;

	this.itemscount = itemscount;

	this.current = 0;

	this.Prev = function()
	{
		if (this.current>0)
		{
			this.current--;
			this.redraw(this, this.prefix);
		}
	}

	this.Next = function()
	{
		if (this.current+this.toshow<this.itemscount)
		{
			this.current++;
			this.redraw(this, this.prefix);
		}
	}
}

redrawfunction = function (gallery)
{
	document.getElementById('preview_sm1_'+gallery.prefix).src = '/files/'+gallery.items[gallery.current]['sm'];
	document.getElementById('preview_sm2_'+gallery.prefix).src = '/files/'+gallery.items[gallery.current+1]['sm'];
	document.getElementById('preview_sm3_'+gallery.prefix).src = '/files/'+gallery.items[gallery.current+2]['sm'];

	if (gallery.selected == gallery.current)
	{
		document.getElementById('preview_sm1_'+gallery.prefix).style.border="1px solid red";
	}
	else
	{
		document.getElementById('preview_sm1_'+gallery.prefix).style.border="1px solid #E0EBF1";
	}

	if (gallery.selected == (gallery.current+1))
	{
		document.getElementById('preview_sm2_'+gallery.prefix).style.border="1px solid red";
	}
	else
	{
		document.getElementById('preview_sm2_'+gallery.prefix).style.border="1px solid #E0EBF1";
	}

	if (gallery.selected == (gallery.current+2))
	{
		document.getElementById('preview_sm3_'+gallery.prefix).style.border="1px solid red";
	}
	else
	{
		document.getElementById('preview_sm3_'+gallery.prefix).style.border="1px solid #E0EBF1";
	}
}

selfunction = function (gallery,num)
{
	if (gallery.items[num])
	{
		document.getElementById('preview_big_'+gallery.prefix).src = '/files/'+gallery.items[gallery.current+num]['big'];
	}
	gallery.selected = gallery.current+num;
	gallery.redraw(gallery, gallery.prefix);
}

chkloading = function( imgsrc )
{
	nw = window.open ( '/files/viewimg.html', "subwin", "menubar=no,resizeable=no,status=no,location=no,scrollbars=no,toolbar=no,dependent,height="+(document.iimg.height+20)+",width="+(document.iimg.width+20)+"");
	document.nw = nw;
}

crwin = function( imgsrc )
{
	iiimg = new Image( );

	iiimg.src = imgsrc;

	document.iimg = iiimg;
	document.iimgsrc = imgsrc;


	setTimeout("chkloading(\'"+imgsrc+"\')",1000);

}

function ShowVacancy(id) {

	if (document.getElementById("vac_"+id+"").style.display == "none") {

		document.getElementById("vac_"+id+"").style.display = "block";

	} else {

		document.getElementById("vac_"+id+"").style.display = "none";
	}
}
