$(document).ready(function () {

    //activate the lightbox
    jQuery('a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg]').prettyPhoto({ theme: "light_square" });

    $('#fading_curtain').aviaSlider({blockSize: {height: 'full', width: 40},
        display: 'topleft',
        transition: 'fade',
        betweenBlockDelay: 30,
        animationSpeed: 120,
        switchMovement: true
    });

	 $('#fading_curtain1').aviaSliderA({blockSize: {height: 'full', width: 40},
        display: 'topleft',
        transition: 'fade',
        betweenBlockDelay: 30,
        animationSpeed: 120,
        switchMovement: true
    });

	 $('#fading_curtain2').aviaSliderB({blockSize: {height: 'full', width: 40},
        display: 'topleft',
        transition: 'fade',
        betweenBlockDelay: 30,
        animationSpeed: 120,
        switchMovement: true
    });

	 $('#fading_curtain3').aviaSliderC({blockSize: {height: 'full', width: 40},
        display: 'topleft',
        transition: 'fade',
        betweenBlockDelay: 30,
        animationSpeed: 120,
        switchMovement: true
    });

	 $('#fading_curtain4').aviaSliderD({blockSize: {height: 'full', width: 40},
        display: 'topleft',
        transition: 'fade',
        betweenBlockDelay: 30,
        animationSpeed: 120,
        switchMovement: true
    });





    //# вот тут id типа эффекта перехода ###############################################
    window.nameP = "#fading_curtain"
    window.delayAni = 5000


    var gb = tool_getElementsByClassName("GBforJS"), mas, ob
    if (gb)
	 {

		if (tool_getElementsByClassName("aviaslider mini")[0] != null)
		{
			window.indIm = 0

			function setInt()
			{
				window.indIm = window.indIm<4?window.indIm+1:0
				window.mas[window.indIm].setActiv()
			}
			window.intervalID = window.setInterval(setInt,window.delayAni)

			window.mas = gb[0].getElementsByTagName('li')

			for (var i = 0; i < window.mas.length; i ++ )
			{
				ob = window.mas[i]
				ob.ind = i
				ob.mas = window.mas

				if (ob.className == 'ActiveLi' && i != 0) $(window.nameP).setInd(i)

				ob.onclick = function()
				{
					this.setActiv()
					window.indIm = this.ind
				}
				ob.setActiv = function()
				{
					for (var i = 0; i < this.mas.length; i ++) this.mas[i].className = ''
					this.className = 'ActiveLi'
					$(window.nameP).setInd(this.ind)
					clearInterval(window.intervalID)
					window.intervalID = window.setInterval(setInt,window.delayAni)
				}
			}

		}
		else
		{
			gb = gb[0]
			window.indIm = 0
			window.kolvoSl = gb.getElementsByTagName('li').length


			function setInt()
			{
				window.indIm = window.indIm < window.kolvoSl-1 ? window.indIm + 1 : 0

				try
				{
				$('').setInd(window.indIm)
				$('').setInd2(window.indIm)
				$('').setInd3(window.indIm)
				$('').setInd4(window.indIm)
				$('').setInd5(window.indIm)
				}
				catch(e){}

				document.getElementById('OTB').innerHTML = window.mas2[window.indIm]
			}
			window.intervalID = window.setInterval(setInt, window.delayAni)


			window.mas = gb.getElementsByTagName('li')
			window.mas2 = []
			var t,i

			for (i = 0; i < window.mas.length; i++)
			{
				ob = window.mas[i]
				t = tool_getElementsByClassName("info",ob)[0]
				window.mas2.push(t.innerHTML)
				ob.removeChild(t)
			}

			document.getElementById('OTB').innerHTML = window.mas2[0]
		}

	 }


});

function tool_getElementsByClassName(cName, _boss) {
    var boss = (_boss) ? _boss : document.body,
		i = 0, mR = [], m = boss.getElementsByTagName('*'), rE = new RegExp("\\b" + cName + '\\b')
    while (i < m.length) {if (rE.test(m[i].className)) mR.push(m[i]);i++}
    if (mR.length == 0) mR = false
    return mR
}


