// JavaScript Document
function preview(imgid, action)
{
	var img = document.getElementById(imgid);
	if(action == 'show')
	{
		img.style.display = 'block';
	}
	if(action == 'hide')
	{
		img.style.display = 'none';
	}
}
function info(infoid, action)
{
	var id		= document.getElementById(infoid);
	var block	= document.getElementById('infos');
	if(action == 'show')
	{
		id.style.display = 'block';
		block.style.display = 'block';
	}
	if(action == 'hide')
	{
		id.style.display = 'none';
		block.style.display = 'none';
	}
}

function show(id)
{
	var d	= document.getElementById(id);
	if(d.style.display == 'block') { d.style.display = 'none'; }
	else { d.style.display = 'block'; }
}
function mshow(id, pos)
{
	var d	= document.getElementById(id);
	if(pos == 'top') { d.style.backgroundPosition = 'top'; }
	else if(pos == 'bot') { d.style.backgroundPosition = 'bottom'; }
}

function reSize(img) {

	var coeff = 0;	
	var maxWidth = 450;
	var maxHeight = 350;
	
	if(img.width != 0 && img.height != 0) {
		if( img.width >= img.height && img.width >= maxWidth  ) {
			coeff = maxWidth / img.width;
			img.width = maxWidth;
			img.height = img.height * coeff;
			
		}
		else if( img.height > img.width && img.height >= maxHeight  ) {
			coeff = maxHeight / img.height;
			img.height = maxHeight;
			img.width = img.width * coeff;
		}
	}
}

function num(x)
{
	var a = document.getElementById('img'+x+'_photo_1');
	var b = document.getElementById('img'+x+'_photo_2');
	var c = document.getElementById('img'+x+'_photo_3');
	
	if(a.style.display == 'block')
	{
		a.style.display = 'none';
		b.style.display = 'block';
		c.style.display = 'none';
	}
	else if(b.style.display == 'block')
	{
		a.style.display = 'none';
		b.style.display = 'none';
		c.style.display = 'block';
	}
	else if(c.style.display == 'block')
	{
		a.style.display = 'block';
		b.style.display = 'none';
		c.style.display = 'none';
	}
	else
	{
		a.style.display = 'block';
		b.style.display = 'none';
		c.style.display = 'none';
	}
	setTimeout("num("+x+")",4000);
}
