

function reset () {
	$('#info-text').animate(
		{'opacity':0}
	);
	$('#info-icon').animate(
		{'opacity':1}
	);
	}
	
	
$(document).ready(function(){
	
	
/*	index.tpl	*/
        windowHeightForResizeMin = 600;
        windowHeightForResizeMax = 1000;
        
        windowHeightForResize = $(window).height();
        
        if(windowHeightForResize < windowHeightForResizeMin)
        {
            windowHeightForResize = windowHeightForResizeMin;
        }
        
        if(windowHeightForResize > windowHeightForResizeMax)
        {
            windowHeightForResize = windowHeightForResizeMax;
        }
        
        contentPaddingTop = parseInt($('.content').css('padding-top')) - 50;
        
        resizeKoef = (windowHeightForResize - windowHeightForResizeMin + 1) / (windowHeightForResizeMax - windowHeightForResizeMin);
        
        $('.content').css('padding-top', contentPaddingTop * resizeKoef + 50 + 'px');
		
	$("#info-icon").click (function() {
	$(this).animate(
		{'opacity':0}
	);
	
	$('#info-text').animate(
		{'opacity':1}
	);
	setTimeout('reset()', 10000);
	});
	
	
/*	first.tpl		*/	
	
	    var menuDraggingReady = true;
		
	    $(".scroll-content").draggable({ 
		axis: 'x',
		distance: '20',
		
		start: function(event, ui)
		{
		    if(menuDraggingReady == false)
		    {
			return false;
		    }
		    
		    menuDraggingReady = false;
		    
		    leftStart = parseInt($(this).css('left'));
		    timeStart = event.timeStamp;
		},
		
		drag: function(event, ui)
		{
		    scrollbarValue = parseInt(0 - parseInt($(".scroll-content").css('left')) / ($(".scroll-content").width() - $(".scroll-pane").width()) * 100);
		    scrollbar.slider('value', scrollbarValue);
		},
		
		stop: function(event, ui)
		{
		    leftStop = parseInt($(this).css('left'));
		    timeStop = event.timeStamp;
		    
		    if(timeStop - timeStart < 250)
		    {
			draggingOffset = parseInt((leftStop - leftStart) / 2);
		    }
		    else
		    {
			draggingOffset = (leftStop > leftStart) ? 0 : -0;
		    }
		    
		    leftOffset = leftStop + draggingOffset;
		    
		    
		    maxLeftOffset = ((parseInt($('.scroll-pane').css('width')) + 0) / 1) - parseInt($('.scroll-content').css('width'));
		    maxRightOffset = 0;
		    if (leftOffset < maxLeftOffset)
		    {
			leftOffset = maxLeftOffset;
		    }
		    if (leftOffset > maxRightOffset)
		    {
			leftOffset = maxRightOffset;
		    }
		    
		    $(this).animate(
			{'left': leftOffset},
			{duration: 250, queue: false, complete:
			    function()
			    {
				scrollbarValue = parseInt(0 - parseInt($(".scroll-content").css('left')) / ($(".scroll-content").width() - $(".scroll-pane").width()) * 100);
				scrollbar.slider('value', scrollbarValue);
				menuDraggingReady = true;
			    }
			}
		    );
		}
	    });
	    
	    $('div.scroll-content-item a').click(function() {
		$.cookie('scl', $('div.scroll-content').position().left , { expires: 7 });
	    });	
		
		
    $(".iframe").fancybox({
	'overlayColor'		: '#000000',
	'width'				: '100%',
	'height'			: '100%',
	'autoScale'			: true,
	'transitionIn'		: 'none',
	'transitionOut'		: 'none',
	'type'				: 'iframe',
	'showDemoButton'	: false	
	
    });  
	
    $(".iframe-demo").fancybox({
	'overlayColor'		: '#000000',
	'width'				: '100%',
	'height'			: '100%',
	'autoScale'			: true,
	'transitionIn'		: 'none',
	'transitionOut'		: 'none',
	'showDemoButton'	: true,
	'type'				: 'iframe'
	
    }); 		
	
	
	
});



