﻿	//**************************************************************************************************
	// Константы
	__AUTH_FORM_AUTH_SUBMIT__ = 'auth_login_submit';
	__FORM_PSW_PARAM__ = 'psw';
	__FORM_PSW_PARAM_OPEN__  = 'pswo';


	//**************************************************************************************************
	// Обработчики событий
	handlers = [];
	handlers[__AUTH_FORM_AUTH_SUBMIT__] = function(e) {
		var pswo = $('#' + __FORM_PSW_PARAM_OPEN__).attr("value");
		// Хешируем пароль
		var psw = hex_sha1(pswo);
		$('#' + __FORM_PSW_PARAM__).attr({'value':psw});
		$('#' + __FORM_PSW_PARAM_OPEN__).attr({'value':'***********'});

		return true;
	}

//-------------------------------------------------------------------------------------------------
// Разбор строки url и формирования хеша параметров
function get_content_params() {
	var params = new Object();
	var href = document.location.href.replace(/#.*$/, '');
	if (href.indexOf("?") != -1) {
		var vars = href.substring(href.indexOf("?") + 1,href.length).split(/\?|&/);
		for (var v in vars) {
				var p = vars[v].split('=');
				params[p[0]] = p[1];
		}
	}
	return params;
}

	//**************************************************************************************************
	// Инициализация
	function init() {

	// Параметры контента в одном массиву
		set_html_handlers();
	}

	//**************************************************************************************************
	// Обычные обработчики HTML-елементов
	function set_html_handlers() {
		//$('#' + __AUTH_FORM_AUTH_SUBMIT__).submit(handlers[__AUTH_FORM_AUTH_SUBMIT__]);
		
		//Centrirovanie
		 $(".bigfoto").fancybox({'zoomSpeedIn':	0, 'zoomSpeedOut':	0,  'overlayShow':	true}); 
		 $('#portfolio').innerfade({ speed: 2000, timeout: 4000, type: 'sequence', containerheight: '150px' }); 
		 $('#partners').innerfade({ speed: 1000, timeout: 4000, type: 'sequence', containerheight: '100px' }); 
		 $('#clients').innerfade({ speed: 1000, timeout: 5000, type: 'sequence', containerheight: '100px' }); 
		 $('#banners').innerfade({ speed: 1000, timeout: 6000, type: 'sequence', containerheight: '250px' }); 
		 $('#banners').innerfade({ speed: 1000, timeout: 6000, type: 'sequence', containerheight: '250px' }); 
		 $('#photos_left').cycle({ fx: 'fade', speed: 1000, timeout: 7000 }); 
		 $('.newsline').crawlLine({ speed:2, crawElement:'div.move', textElement: 'p', hoverClass: 'viewText' });
		 //$('#mycarousel').jcarousel({ auto: 2, scroll: 1, wrap: 'last', initCallback: mycarousel_initCallback });
		 show_div_contact()
		
		$(".scroll-pane").jScrollPane({showArrows:true, scrollbarWidth:19, dragMaxHeight:408});
		//Прокрутка для ссылок в области со стилезованным скроллом
		$('a.scroll-to-label').bind(
					'click',
					function()
					{
						var targetElementSelectorString = $(this).attr('rel');
						$(".scroll-pane")[0].scrollTo(targetElementSelectorString);
						return false;
					}
				);

		
	 $('#newsblk').innerfade({ speed: 2000, timeout: 4000, type: 'sequence', containerheight: '50px' }); 
	 $('#commblk').innerfade({ speed: 2000, timeout: 10000, type: 'sequence', containerheight: '50px' });	
	
	}

	function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
