var interval = null;

// подстановка описаний в галерею
var descContent = [];

descContent["exotic1"]  = '<h4>Орхидея</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic2"]  = '<h4>Орхидея 2</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic3"]  = '<h4>Орхидея 3</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic4"]  = '<h4>Орхидея 4</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic5"]  = '<h4>Орхидея 5</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic6"]  = '<h4>Орхидея 6</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic7"]  = '<h4>Орхидея</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic8"]  = '<h4>Орхидея</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic9"]  = '<h4>Орхидея</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';
descContent["exotic10"] = '<h4>Орхидея</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p><a href="#">Заказать</a></p>';

descContent["pic01"] = '<h4>Музыка осени</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p class="order"><a href="#">Заказать</a><strong>Цена:</strong> 52145 руб.</p>';
descContent["pic02"] = '<h4>Музыка осени</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p class="order"><a href="#">Заказать</a><strong>Цена:</strong> 52145 руб.</p>';
descContent["pic03"] = '<h4>Музыка осени</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p class="order"><a href="#">Заказать</a><strong>Цена:</strong> 52145 руб.</p>';
descContent["pic04"] = '<h4>Музыка осени</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p class="order"><a href="#">Заказать</a><strong>Цена:</strong> 52145 руб.</p>';
descContent["pic05"] = '<h4>Музыка осени</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p class="order"><a href="#">Заказать</a><strong>Цена:</strong> 52145 руб.</p>';
descContent["pic06"] = '<h4>Музыка осени</h4><p><strong>Описание:</strong></p><p>Proin a neque vitae lorem ornare vestibulum. Donec vel diam. Duis urna neque, molestie non, sagittis in, feugiat sit amet, enim.</p><p class="order"><a href="#">Заказать</a><strong>Цена:</strong> 52145 руб.</p>';

function replaceDesc(elm)
{
	for(var i in descContent)
	{
		if(i == elm.id) { return descContent[i] + '<div class="br"></div>'; }
		// br - для float элементов (clear: both)
	}
}

// Image groups:
var imageGroups = new Object();

imageGroups.group1 = { img_cur: new Array(3), img1: new Array(3), img2: new Array(3), img3: new Array(3) };
imageGroups.group1.img1[0] = "gal01";
imageGroups.group1.img1[1] = "gal02";
imageGroups.group1.img1[2] = "gal03";

imageGroups.group1.img2[0] = "gal04";
imageGroups.group1.img2[1] = "gal05";
imageGroups.group1.img2[2] = "gal06";

imageGroups.group1.img3[0] = "gal07";
imageGroups.group1.img3[1] = "gal08";
imageGroups.group1.img3[2] = "gal09";


function initImages(container)
{
	imageGroups[container].img_cur = imageGroups[container].img1;
}


function changeImages(container, toImgGroup)
{
	var path = "img/pics/";
	var postfix = "big";
	
	var images = document.getElementById(container).getElementsByTagName('img');
	var hrefs = document.getElementById(container).getElementsByTagName('a');
	//for(var i in elements) alert(elements[i]);
	
	for(var i in images)
	{
		if(images[i].src != undefined) // фильтруем только собственные свойства
			images[i].src = path + imageGroups[container][toImgGroup][i] + ".jpg";
	}
	
	var a = 0;
	for(var i in hrefs)
	{
		if(hrefs[i].href != undefined) // фильтруем только собственные свойства
		{	
			hrefs[i].href = path + imageGroups[container][toImgGroup][a] + postfix + ".jpg";
			a++;
		}
	}
	
}

var tmp = null;
var tmpH = null;


//animation:
function anim(f, prop, style, start, stop, time)
{
	var isRunning = false;
	t1 = new Tween(f.style, prop, style, start, stop, time, 'px');
	t1.onMotionStarted = function() { isRunning = true; };
	t1.onMotionFinished = function() { isRunning = false; };
	if(!isRunning)
		t1.start();
}

function newImg(elm)
{
	
	//var hover = document.getElementById('gal01hover');
	
	tmp = elm;
	//tmpH = hover;
	//anim(elm,'left',Tween.regularEaseInOut,0,-200,0.5);
	//anim(hover,'left',Tween.regularEaseInOut,0,-200,0.5);
	var isRunning = false;
	
	opacityTween = new OpacityTween(elm,Tween.regularEaseIn, 100, 0, 0.5);
	opacityTween.onMotionStarted = function() { isRunning = true; };
	opacityTween.onMotionFinished = function() { isRunning = false; };
	if(!isRunning)
		opacityTween.start();
	
	
}

function oldImg(elm)
{
	//var hover = document.getElementById('gal01hover');
	//anim(tmp,'left',Tween.regularEaseInOut,-200,0,0.5);
	//anim(hover,'left',Tween.regularEaseInOut,-200,0,0.5);
	var isRunning = false;
	
	opacityTween = new OpacityTween(elm,Tween.regularEaseIn, 0, 100, 0.5);
	opacityTween.onMotionStarted = function() { isRunning = true; };
	opacityTween.onMotionFinished = function() { isRunning = false; };
	if(!isRunning)
		opacityTween.start()
}









