function hide_id(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        node.className=node.className.replace('showed', '');
        node.className += ' hidden';
    }
}

function show_id(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        node.className=node.className.replace('hidden', '');
        node.className += ' showed';
    }
}

function toggle_id(nodeId)
{
    var node = document.getElementById(nodeId);
    if (node)
    {
        if (node.className.indexOf('hidden') != -1)
            node.className=node.className.replace('hidden', 'showed')
        else if (node.className.indexOf('showed') != -1)
            node.className=node.className.replace('showed', 'hidden')
        else node.className += ' showed';
     }
}

function setPrintCSS(isPrint) {
// By Akella cssing.org.ua
  if (document.getElementsByTagName)
      x = document.getElementsByTagName('link');
  else
  {
      return;
  }
  for (var i=0;i<x.length;i++) {
      if(x[i].title == 'printview'){x[i].disabled = !isPrint;}
      if(x[i].title == 'screenview'){x[i].disabled = isPrint;}
  }
}


function moveHintsN(e)
{
	document.getElementById('hints').style.visibility = "visible";
	var z = []; 		
	if (!e) e = event;
	if (e.pageX)
		{
			z['left'] = e.pageX ;
			z['top'] = e.pageY-20;
		}
		else
		{
			z['left'] = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			z['top'] = e.clientY + document.body.scrollTop + document.documentElement.scrollTop - 20;
		}
			z['height'] = 30;
			z['width'] = 20;
	setPosition(document.getElementById('hints'), z);
}



function hideHintsN(e)
{
	document.onmousemove = null;
	document.onmouseout = null;
    document.getElementById('hints').style.visibility = "hidden";
}

function showHints(text, el)
{
	if (text == "") return;
	document.getElementById('hints').innerHTML = text;
	document.onmousemove = moveHintsN;
	document.onmouseout = hideHintsN;
}

function getBounds(tElement)
{
	var left = tElement.offsetLeft,
		top = tElement.offsetTop,
		parent;
	console.debug(left + ' ' + top);
	for (parent = tElement.offsetParent; parent; parent = parent.offsetParent)
	{
		left += parent.offsetLeft;
		top += parent.offsetTop;
	}
	return {left: left, top: top, width: tElement.offsetWidth, height: tElement.offsetHeight};
}

function setPosition()
{
	var scrollTop = document.documentElement.scrollTop,
		tElement = arguments[0],
		tBounds = arguments[1],
		w = tElement.clientWidth,
		h = tElement.clientHeight,
		winW = document.documentElement.clientWidth,
		winH = document.documentElement.clientHeight,
		vPX = 0,
		tHeightNotSet = true;

	if ((w + tBounds.left > winW) && (winW - w + tBounds.left > w))
		tElement.style.left = tBounds.left - w + tBounds.width + 'px';
	else
		tElement.style.left = tBounds.left + 'px';

	if (h + tBounds.top > winH + scrollTop)
	{
		if (h - tBounds.top > 0)
			if (h + tBounds.top - winH - scrollTop > h - tBounds.top)
				tHeightNotSet = false;
	}
	
	if ((tBounds.top + h > winH + scrollTop) && tHeightNotSet)
		if (tBounds.top - h - scrollTop > 0)
			tHeightNotSet = false;
	
	if ((winH - tBounds.top + scrollTop - h - tBounds.height < 0) && (tBounds.top - scrollTop - h > winH - tBounds.top + scrollTop - h - tBounds.height))
		tHeightNotSet = false;
//alert(tBounds.height);
	if (tHeightNotSet)
		tElement.style.top = tBounds.top + tBounds.height + vPX + 'px';
	else
		tElement.style.top = tBounds.top - h - vPX + 'px';
}

/*
CUSTOM FORM ELEMENTS
*/

var checkboxHeight = "25";
var radioHeight = "25";


/* No need to change anything after this */

document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
		}
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}

		if (this.getAttribute('onchange1'))
		{
			eval(this.getAttribute('onchange1'))
		}
	}
}
window.onload = Custom.init;



/* carousel*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.1g.1w=6(o){o=$.1f({r:n,x:n,N:n,17:q,J:n,L:1a,16:n,y:q,u:12,H:3,B:0,k:1,K:n,I:n},o||{});8 G.R(6(){p b=q,A=o.y?"15":"w",P=o.y?"t":"s";p c=$(G),9=$("9",c),E=$("10",9),W=E.Y(),v=o.H;7(o.u){9.1h(E.D(W-v-1+1).V()).1d(E.D(0,v).V());o.B+=v}p f=$("10",9),l=f.Y(),4=o.B;c.5("1c","H");f.5({U:"T",1b:o.y?"S":"w"});9.5({19:"0",18:"0",Q:"13","1v-1s-1r":"S","z-14":"1"});c.5({U:"T",Q:"13","z-14":"2",w:"1q"});p g=o.y?t(f):s(f);p h=g*l;p j=g*v;f.5({s:f.s(),t:f.t()});9.5(P,h+"C").5(A,-(4*g));c.5(P,j+"C");7(o.r)$(o.r).O(6(){8 m(4-o.k)});7(o.x)$(o.x).O(6(){8 m(4+o.k)});7(o.N)$.R(o.N,6(i,a){$(a).O(6(){8 m(o.u?o.H+i:i)})});7(o.17&&c.11)c.11(6(e,d){8 d>0?m(4-o.k):m(4+o.k)});7(o.J)1p(6(){m(4+o.k)},o.J+o.L);6 M(){8 f.D(4).D(0,v)};6 m(a){7(!b){7(o.K)o.K.Z(G,M());7(o.u){7(a<=o.B-v-1){9.5(A,-((l-(v*2))*g)+"C");4=a==o.B-v-1?l-(v*2)-1:l-(v*2)-o.k}F 7(a>=l-v+1){9.5(A,-((v)*g)+"C");4=a==l-v+1?v+1:v+o.k}F 4=a}F{7(a<0||a>l-v)8;F 4=a}b=12;9.1o(A=="w"?{w:-(4*g)}:{15:-(4*g)},o.L,o.16,6(){7(o.I)o.I.Z(G,M());b=q});7(!o.u){$(o.r+","+o.x).1n("X");$((4-o.k<0&&o.r)||(4+o.k>l-v&&o.x)||[]).1m("X")}}8 q}})};6 5(a,b){8 1l($.5(a[0],b))||0};6 s(a){8 a[0].1k+5(a,\'1j\')+5(a,\'1i\')};6 t(a){8 a[0].1t+5(a,\'1u\')+5(a,\'1e\')}})(1x);',62,96,'||||curr|css|function|if|return|ul|||||||||||scroll|itemLength|go|null||var|false|btnPrev|width|height|circular||left|btnNext|vertical||animCss|start|px|slice|tLi|else|this|visible|afterEnd|auto|beforeStart|speed|vis|btnGo|click|sizeCss|position|each|none|hidden|overflow|clone|tl|disabled|size|call|li|mousewheel|true|relative|index|top|easing|mouseWheel|padding|margin|200|float|visibility|append|marginBottom|extend|fn|prepend|marginRight|marginLeft|offsetWidth|parseInt|addClass|removeClass|animate|setInterval|0px|type|style|offsetHeight|marginTop|list|jCarouselLite|jQuery'.split('|'),0,{}))



$(window).resize(function() {
	if (document.getElementById('welcome'))
	{						  
			if (document.body.clientWidth <= 1150)
				$('#welcome').addClass('small-welcome');
			else
				$('#welcome').removeClass('small-welcome');
    }
	if (document.getElementById('content-text'))
	{						  
			if (document.body.clientWidth <= 1150)
				$('body').addClass('small');
			else
				$('body').removeClass('small');
    }	

if (document.getElementById('gallery'))
	{						  
			if (document.body.clientWidth <= 1024)
				$('#gallery').addClass('small-gallery');
			else
				$('#gallery').removeClass('small-gallery');
		
				$(".carousel").jCarouselLite({
					btnPrev: ".prev",
					btnNext: ".next",
					visible: 3,
					speed:700,
					circular: true
				});
    }
	if (document.getElementById('gallery2'))
	{	
	if (document.body.clientWidth <= 1024)
		$('#gallery2').addClass('small-gallery');
	else
		$('#gallery2').removeClass('small-gallery');

        $(".carousel-2").jCarouselLite({
            btnPrev: ".prev-2",
            btnNext: ".next-2",
            visible: 3,
			speed:700,
            circular: true
        });

}
	if (document.getElementById('gallery3'))
	{	

	if (document.body.clientWidth <= 1024)
		$('#gallery3').addClass('small-gallery');
	else
		$('#gallery3').removeClass('small-gallery');

        $(".carousel-3").jCarouselLite({
            btnPrev: ".prev-3",
            btnNext: ".next-3",
            visible: 3,
			speed:700,
            circular: true
        });
}
})

function customchkbox()
{
    	var checks = document.getElementById('dstrb').getElementsByTagName('label');
    	var checksLnt = checks.length;
    	for(var i=0; i<checksLnt; i++)
    	{
    		var curr = checks[i];
    		var box = checks[i].firstChild;
    		if (box.nodeName == 'INPUT') {
        		box.className = 'lost';
				box.style.left = '-9999em';
        		checks[i].className += box.type;
    	    	checks[i].className += (box.checked) ? '-on' : '-off';
            }
            else break;

    		box.onclick = function()
    		{
    			var label = this.parentNode;
   				label.className = (label.className.indexOf('-on')+1) ? label.className.replace('-on','-off') : label.className.replace('-off','-on');
    		}
    	}
}
function checkForm()
{
var err = '';
 if (document.getElementById('email').value == '')
 {
  err = err + '<li>' + '<strong>Email</strong> - нужно заполнить обязательно' + '</li>';
 }
if (document.getElementById('email').value != '')
 {
  if (!checkEmail(document.getElementById('email').value))
  {
   err = err + '<li>' + '<strong>Email должен быть валидным</strong></li>';
  }
 }


if (document.getElementById('password').value == '')
{
   err = err + '<li>' + '<strong>' + 'Пароль' + '</strong>' + ' - нужно заполнить обязательно' + '</li>';
}
if (document.getElementById('conf_pass').value == '')
 {
   err = err + '<li>' + '<strong>' + 'Повторите пароль' + '</strong>' + ' - нужно заполнить обязательно' + '</li>';
}
if (document.getElementById('password').value != '' && document.getElementById('conf_pass').value != '')
 {
  if (document.getElementById('password').value != document.getElementById('conf_pass').value)
  {
   err = err + '<li>' + '<strong>' + 'Пароли не совпадают' + '</strong>' + '</li>';
  }
}

if (err != '')
 {
  err ='<a class="close" href="close" onclick="return closewindow()">Закрыть</a><span>Вы забыли или не правильно ввели одно или несколько полей. Пожалуйста, исправьте эти ошибки:</span><ul>' + err + '</ul>';
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";
return false;
 }

 return true;
}

function REGcheckForm()
{
var err = '';
 if (document.getElementById('reg_email').value == '')
 {
  err = err + '<li>' + '<strong>Email</strong> - нужно заполнить обязательно' + '</li>';
 }
if (document.getElementById('reg_email').value != '')
 {
  if (!checkEmail(document.getElementById('reg_email').value))
  {
   err = err + '<li>' + '<strong>Email должен быть валидным</strong></li>';
  }
 }


if (document.getElementById('reg_password').value == '')
{
   err = err + '<li>' + '<strong>' + 'Пароль' + '</strong>' + ' - нужно заполнить обязательно' + '</li>';
}
if (document.getElementById('reg_conf_pass').value == '')
 {
   err = err + '<li>' + '<strong>' + 'Повторите пароль' + '</strong>' + ' - нужно заполнить обязательно' + '</li>';
}
if (document.getElementById('reg_password').value != '' && document.getElementById('reg_conf_pass').value != '')
 {
  if (document.getElementById('reg_password').value != document.getElementById('reg_conf_pass').value)
  {
   err = err + '<li>' + '<strong>' + 'Пароли не совпадают' + '</strong>' + '</li>';
  }
}

if (err != '')
 {
  err ='<a class="close" href="close" onclick="return closewindow()">Закрыть</a><span>Вы забыли или не правильно ввели одно или несколько полей. Пожалуйста, исправьте эти ошибки:</span><ul>' + err + '</ul>';
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";
return false;
 }

 return true;
}

function checkEmail(e)
{
 ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

 for(i=0; i < e.length ;i++)
  if(ok.indexOf(e.charAt(i))<0)
   return (false);

 if (document.images)
 {
  re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
  re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
  if (!e.match(re) && e.match(re_two))
   return true;
  else
   return false;

 }
 return true;

}

function checkForm2()
{
var err = '';
 if (document.getElementById('p_email').value == '')
 {
  err = err + '<li>' + '<strong>Email</strong> - нужно заполнить обязательно' + '</li>';
 }
if (document.getElementById('p_email').value != '')
 {
  if (!checkEmail(document.getElementById('p_email').value))
  {
   err = err + '<li>' + '<strong>Email должен быть валидным</strong></li>';
  }
 }


if (document.getElementById('p_message').value == '')
{
   err = err + '<li>' + '<strong>' + 'Ваше сообщение' + '</strong>' + ' - нужно заполнить обязательно' + '</li>';
}

if (err != '')
 {
  err ='<a class="close" href="close" onclick="return closewindow()">Закрыть</a><span>Вы забыли или не правильно ввели одно или несколько полей. Пожалуйста, исправьте эти ошибки:</span><ul>' + err + '</ul>';
  document.getElementById('fill_form').innerHTML=err;
  document.getElementById('fill_form').className="visible";
return false;
 }

 return true;
}

function closewindow()
{
document.getElementById("fill_form").className='';
return false;
}

/**
* LightGallery v1.3
* Author: Dmitri Ischenko ischenkodv@gmail.com
* Freely distributable under MIT-style license
* Patched by iDeus.biz
*/
var lightgallery=(function(){var h,g,c,a,H,ad,J={showOverlay:true,overlayColor:"#000",overlayOpacity:0.85,zoomStep:0.2,animate:true,framesNumber:20,speed:30,resizeSync:false,enableZoom:true,fadeImage:true,alias:"lightgallery",fullSize:false,minPadding:15},al={next:"Next",prev:"Previous",zoomIn:"Zoom In",zoomOut:"Zoom Out",fullSize:"Full Size",fitScreen:"Fit screen",close:"Close",image:"Image",of:"of"},p,T,Q,s,L,b,k,x,l,aj,d,B,w,ai,af="hidden",am="visible",y="block",U="none",z="opacity",I="left",S="top",i="width",P="height",an="px",A="div",Y=window,R=document,f;var r={setLangVars:function(G){t(al,G)},init:function(at){if(at){t(J,at)}J.fullSize=J.fullSize?1:0;if(/MSIE ([^;]+)/.test(navigator.userAgent)){p=parseFloat(RegExp["$1"])}f=[];var av=R.getElementsByTagName("a"),au=new RegExp("^"+J.alias+"\\[([a-zA-Z]+)\\]|"+J.alias+"$"),ar;for(var aq=0,ap=av.length;aq<ap;aq++){if(av[aq].rel&&(ar=av[aq].rel.match(au))){m(av[aq],"click",r.showImage);if(ar=ar[1]){av[aq].__gallery__=ar;if(!f[ar]){f[ar]=[]}av[aq].__index__=f[ar].push(av[aq])-1}}}var G=R.getElementsByTagName("body")[0];G.appendChild(ai=ao(A,{id:"LG_overlay",events:{click:r.close}}));G.appendChild(T=D());innerCont=T.lastChild;m((G.attachEvent)?G:Y,"keypress",v);(x=ao("img")).onload=function(){e();l.setAttribute("src",x.src);q(J.fullSize,true);o()};g=T.offsetHeight;c=p?200:T.offsetWidth;h=0;ab(ai,{background:(J.overlayColor),display:U});aa(ai,J.overlayOpacity)},open:function(){if(d){return}n();l.style.display=y;q();ab(T,{visibility:am,display:y});d=1},close:function(){M();ab(T,{visibility:af,display:U});d=0;x.src=l.src=""},zoomIn:function(){r.Zoom(1+J.zoomStep)},zoomOut:function(){r.Zoom(1-J.zoomStep)},zoomNormal:function(){if(this.$disabled){return}r.Zoom(l.width==x.width&&l.height==x.height?0:1)},Zoom:function(G){ah();q(G)},showImage:function(ap){var G=this.__index__;N(ap||Y.event);if(this.__gallery__&&G>-1){aj=this.__gallery__;r.show(G)}else{r.showSingle(this)}},showSingle:function(G){r.open();ah();E();x.src=G.href;Q.innerHTML=G.title;b.innerHTML="";s.style.visibility=L.style.visibility=af},show:function(ap){if(ap<0||ap>f[aj].length-1||(J.animate&&ad)){return}r.open();var G=f[aj],aq=L.style,ar=s.style;ah();E();ad=1;x.src=G[ap].href;Q.innerHTML=G[ap].title;b.innerHTML=al.image+" "+(ap+1)+" "+al.of+" "+G.length;B=ap;ac()?aq.visibility=am:aq.visibility=af;u()?ar.visibility=am:ar.visibility=af;Y.focus()},next:function(){r.show(B+1)},prev:function(){r.show(B-1)}};function ac(){return(B<(f[aj].length-1))?true:false}function u(){return(B)?true:false}function o(){var G=f[aj];if(!G){return}if(G[B+1]){(new Image).src=G[B+1].href}if(G[B-1]){(new Image).src=G[B-1].href}}function n(ap){if(J.showOverlay){var G=C();ab(ai,{width:G[0]+"px",height:G[1]+"px"});if(ai.style.display!=y){ab(ai,{display:y});F(ai,{end:J.overlayOpacity*100,onend:ap})}}else{if(typeof ap=="function"){ap.call(this)}}}function M(){ae(ai,{start:J.overlayOpacity*100,onEnd:function(){ai.style.display=U}})}function q(aH,aB){var au,aL,az,aJ,aE=J.minPadding*2,aD=J.framesNumber,aI=x.width,aK=x.height,aF=C(),aq=aF[2],av=aF[3],aw=aq-aE-h,aM=av-aE-g;if(aH==0||(aB&&!aH)){if(aI>aw||aK>aM){var aA=aw,aG=aw*aK/aI;if(aG>aM){aG=aM;aA=aM*aI/aK}az=(l.width=aA)+h;aJ=(l.height=aG)+g}else{az=(l.width=aI)+h;aJ=(l.height=aK)+g}}else{if(aH==1){az=(l.width=aI)+h;aJ=(l.height=aK)+g}else{if(aH<1||aH>1){az=(l.width*=aH)+h;aJ=(l.height*=aH)+g}else{az=aJ=300;var ap=true}}}if(au=(az>(aw+h)||aJ>(aM+g))){aL=al.fitScreen;fsClass="LG_fitScreen"}else{if(l.width!=aI||l.height!=aK){aL=al.fullSize;fsClass="LG_zoomNormal"}}k.$disabled=false;if(l.width==aI){if(au){k.id=fsClass;k.setAttribute("title",aL)}else{k.id="LG_zoom_disabled";k.$disabled=true}}else{k.id="LG_zoomNormal";k.setAttribute("title",al.fullSize)}az=Math.max(az,c);var aN=W(),ax=(av>aJ?(av-aJ)/2:J.minPadding)+aN[1],ay=(aq>az?(aq-az)/2:J.minPadding)+aN[0],aC=(az/3)+"px",G=(aJ-g-10)+"px";ab(L,{width:aC,height:G});ab(s,{width:aC,height:G});if(J.animate&&!ap){var at=new K(T,aD,J.speed);if(J.resizeSync){at.addThread(i,0,az,0,aD).addThread(I,0,ay,0,aD).addThread(P,0,aJ,0,aD).addThread(S,0,ax,0,aD)}else{var aO=Math.ceil(aD/2);at.addThread(i,0,az,0,aO).addThread(I,0,ay,0,aO).addThread(P,0,aJ,aO,aD).addThread(S,0,ax,aO,aD)}at.onEnd=function(){n();O()};at.run()}else{ab(T,{top:ax+an,left:ay+an,width:az+an,height:aJ+an});n();O()}}function O(){innerCont.style.display=y;if(J.fadeImage){F(l,{frames:8,speed:J.speed,onEnd:function(){ad=0}})}else{aa(l,100);ad=0}}function ah(){innerCont.style.display=U}function E(){w.style.display=y}function e(){w.style.display=U}function D(){var ap,G;if(J.enableZoom){ap=ao(A,{id:"LG_zoomIn",title:al.zoomIn,events:{click:r.zoomIn}});G=ao(A,{id:"LG_zoomOut",title:al.zoomOut,events:{click:r.zoomOut}})}return ao(A,{id:"LG_container"},w=ao(A,{id:"LG_loading"}),ao(A,{id:"LG_innerCont"},ao(A,{id:"LG_panel"},ap,G,k=ao(A,{id:"LG_zoomNormal",title:al.fullSize,events:{click:r.zoomNormal}}),b=ao(A,{id:"LG_imgIndex"},al.image+" 20 "+al.of+" 20 "),ao(A,{id:"LG_closeBtn",title:al.close,events:{click:r.close}}),ao(A,{style:"clear:both"})),l=ao("img",{id:"LG_pic",width:300,height:300}),Q=ao(A,{id:"LG_titleBar"}),s=ao(A,{id:"LG_prevLink",title:al.prev,events:{click:r.prev,mouseover:Z,mouseout:ag}}),L=ao(A,{id:"LG_nextLink",title:al.next,events:{click:r.next,mouseover:Z,mouseout:ag}})))}function v(ap){if(!d){return}var ap=ap||Y.event,G=ap.keyCode?ap.keyCode:(ap.which?ap.which:ap.charCode);switch(G){case 110:r.next();break;case 98:r.prev();break;case 102:r.zoomNormal();break;case 43:r.zoomIn();break;case 45:r.zoomOut();break;case 27:r.close();default:return}N(ap)}function Z(){F(this)}function ag(){ae(this)}function F(ap,G){G=G||{};G.start=G.start||0;G.end=G.end||100;ak(ap,G)}function ae(ap,G){G=G||{};G.start=G.start||100;G.end=G.end||0;ak(ap,G)}function ak(aq,ap){if(J.animate){var G=new K(aq,ap.frames||5,ap.speed||40);G.addThread(z,ap.start,ap.end);G.onStart=ap.onStart;G.onEnd=ap.onEnd;G.run()}else{aa(aq,ap.end);if(typeof ap.onEnd=="function"){ap.onEnd()}}}function N(G){if(G.preventDefault){G.preventDefault()}else{G.returnValue=false}}function m(aq,ap,G){if(Y.addEventListener){m=function(au,at,ar){au.addEventListener(at,ar,false)}}else{if(Y.attachEvent){m=function(au,at,ar){var av=function(){ar.call(au,Y.event)};au.attachEvent("on"+at,av)}}}return m(aq,ap,G)}function t(aq,ap){for(var G in ap){aq[G]=ap[G]}}function ab(ap,G){if(ap){t(ap.style,G)}}function C(){var ar,ap,aq,au,G=R.body,at=R.documentElement;if(Y.innerHeight&&Y.scrollMaxY){ar=G.scrollWidth;ap=Y.innerHeight+Y.scrollMaxY}else{if(G.scrollHeight>G.offsetHeight){ar=G.scrollWidth;ap=G.scrollHeight}else{if(at&&at.scrollHeight>at.offsetHeight){ar=at.scrollWidth;ap=at.scrollHeight}else{ar=G.offsetWidth;ap=G.offsetHeight}}}if(Y.innerHeight){aq=G.clientWidth;au=Y.innerHeight}else{if(at&&at.clientHeight){aq=at.clientWidth;au=at.clientHeight}else{if(G){aq=G.clientWidth;au=G.clientHeight}}}return[ar<aq?aq:ar,ap<au?au:ap,aq,au]}function W(){var aq=0,ap=0,G=R.body,ar=R.documentElement;if(typeof(Y.pageYOffset)=="number"){ap=Y.pageYOffset;aq=Y.pageXOffset}else{if(G&&(G.scrollLeft||G.scrollTop)){ap=G.scrollTop;aq=G.scrollLeft}else{if(ar&&(ar.scrollLeft||ar.scrollTop)){ap=ar.scrollTop;aq=ar.scrollLeft}}}return[aq,ap]}function X(aq,G){var ar=R.defaultView;if(aq.style[G]){return aq.style[G]}else{if(aq.currentStyle){return aq.currentStyle[G]}else{if(ar&&ar.getComputedStyle){G=G.replace(/([A-Z])/g,"-$1");var ap=ar.getComputedStyle(aq,"");return ap&&ap.getPropertyValue(G.toLowerCase())}}}return null}function aa(){aa=arguments[0].filters?function(G,ap){G.style.filter="alpha(opacity="+ap+")"}:function(G,ap){G.style.opacity=ap/100};aa(arguments[0],arguments[1])}function ao(aq,ap){var av=R.createElement(aq);if(ap){for(var at in ap){if(at=="events"){for(var ar in ap[at]){m(av,ar,ap[at][ar])}}else{var aw=ap[at];if(typeof aw!="undefined"){if(at=="class"){av.className=aw}else{av.setAttribute(at,aw)}}}}}for(var au=2,G=arguments.length;au<G;au++){switch(typeof arguments[au]){case"string":av.innerHTML+=arguments[au];break;case"object":av.appendChild(arguments[au])}}return av}function j(){if(!H){if(!R.body){return setTimeout(j,13)}H=true;r.init()}}function V(){if(a){return}a=true;if(R.readyState==="complete"){return j()}if(R.addEventListener){R.addEventListener("DOMContentLoaded",function ap(){R.removeEventListener("DOMContentLoaded",ap,false);j()},false)}else{if(R.attachEvent){R.attachEvent("onreadystatechange",function at(){if(document.readyState==="complete"){R.detachEvent("onreadystatechange",at);j()}});var aq=false;try{aq=Y.frameElement==null}catch(ar){}if(R.documentElement.doScroll&&aq){function G(){if(H){return}try{R.documentElement.doScroll("left")}catch(au){setTimeout(G,1);return}j()}G()}}}}function K(aq,ap,G){if(!aq){return null}this.E=aq;this.N=ap||0;this.F=[];this.S=G||10}K.prototype={addThread:function(at,aq,G,ar,ap){if(!at||G===undefined||G===null){return}if(at!=z){aq=parseFloat(X(this.E,at))}ar=ar||0;ap=ap||this.N;var aw=this.F,av=(ap-ar)||1,au=(aq-G)/av;for(;ar<ap;ar++){if(!aw[ar]){aw[ar]={}}aw[ar][at]=(aq-=au)}return this},P:function(){var ar=this.F.shift(),ap=[],aq=p;if(ar){for(var G in ar){ap.push(G=="opacity"?(aq?"filter: alpha(opacity="+ar[G]+")":"opacity: "+ar[G]/100):G+": "+ar[G]+"px")}this.E.style.cssText+="; "+ap.join("; ")}else{if(typeof this.onEnd=="function"){this.onEnd()}clearInterval(this.I)}},run:function(){clearInterval(this.I);this.P();if(typeof this.onStart=="function"){this.onStart()}var G=this;if(this.N>1){this.I=setInterval(function(){G.P()},this.S)}}};return r})();

try{
	lightgallery.setLangVars({
		next	: 'Вперед',
		prev	: 'Назад',
		zoomIn	: 'Увеличить',
		zoomOut	: 'Уменьшить',
		fullSize: 'Реальный размер',
		fitScreen: 'По размеру экрана',
		close	: 'Закрыть',
		image	: 'Изображение',
		of		: 'из'
	})
}catch(e){}


/* *********************************
        ON LOAD
********************************* */
$(function(){
  	lightgallery.init();
    
	if (document.getElementById('gallery'))
	{
		if (document.body.clientWidth <= 1024)
			$('#gallery').addClass('small-gallery');
		else
			$('#gallery').removeClass('small-gallery');
	}

	if (document.getElementById('gallery2'))
	{
		if (document.body.clientWidth <= 1024)
			$('#gallery2').addClass('small-gallery');
		else
			$('#gallery2').removeClass('small-gallery');		   
	}

	if (document.getElementById('gallery3'))
	{
		if (document.body.clientWidth <= 1024)
			$('#gallery3').addClass('small-gallery');
		else
			$('#gallery3').removeClass('small-gallery');		   
	}
	
	if (document.getElementById('content-text'))
	{
		if (document.body.clientWidth <= 1024)
			$('body').addClass('small');
		else
			$('body').removeClass('small');		   
	}	
	
	if (document.getElementById('welcome'))
	{						  
			if (document.body.clientWidth <= 1150)
				$('#welcome').addClass('small-welcome');
			else
				$('#welcome').removeClass('small-welcome');
    }	
	
$(function(){
	if (document.getElementById('gallery'))
	{
	           $(".carousel").jCarouselLite({
            btnPrev: ".prev",
            btnNext: ".next",
            visible: 3,
			speed:700,
            circular: true
        });
	}

	if (document.getElementById('gallery2'))
	{
		        $(".carousel-2").jCarouselLite({
            btnPrev: ".prev-2",
            btnNext: ".next-2",
            visible: 3,
			speed:1000,
            circular: true
        });
		   
	}

	if (document.getElementById('gallery3'))
	{
		        $(".carousel-3").jCarouselLite({
            btnPrev: ".prev-3",
            btnNext: ".next-3",
            visible: 3,
			speed:1000,
            circular: true
        });
	}

$("div.search ul.details li.contact a, a.contact-form").click(function() {
  $("#popup_wrapper").fadeIn();
  return false;
})
$("a.btn_close-popup").click(function() {
  $("#popup_wrapper").fadeOut();
  return false;
})
})
	if (document.getElementById('dstrb'))
	{
    customchkbox();
	}
})


function valid_guest_form(){

  var err='';
  if (document.getElementById("name").value == ""){
    err = err + '<li>Ваше имя</li>';
  }
  if (document.getElementById("contacts").value == ""){
    err = err + '<li>Контакты</li>';
  }
  if (document.getElementById("capture").value == ""){
    err = err + '<li>Введите код</li>';
  }

  if(err==""){
  //	document.getElementById("schedule_listing").submit();
  return true;
  }
  else{
  	err = '<strong>Пожалуйста заполните обязательные поля:</strong><ul>'+err+'</ul>';
  	document.getElementById("check_error").innerHTML = err;
    self.location.href='#check_error';
    return false;
  }
}
//



// Verify
function checkEmail(e)
{
 ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

 for(i=0; i < e.length ;i++)
  if(ok.indexOf(e.charAt(i))<0)
   return (false);

 if (document.images)
 {
  re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
  re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
  if (!e.match(re) && e.match(re_two))
   x
  else
   return false;

 }
 return true;

}

function valid_restore_form(){

  var err='';
  if (document.getElementById("e_mail").value == ""){
    err = err + '<li>Введите Электронный адрес</li>';
  }
  if (document.getElementById('e_mail').value != '')
 {
  if (!checkEmail(document.getElementById('e_mail').value))
  {
   err = err + '<li>Неверный Электронный адрес</li>';
  }
 }

  if(err==""){
    return true;
  }
  else{
  	err = '<ul>'+err+'</ul>';
  	document.getElementById("check_error").innerHTML = err;
    self.location.href='#check_error';
    return false;
  }
}

function valid_authorization(){

  var err='';
  if (document.getElementById("email").value == ""){
    err = err + '<li>Введите E-Mail</li>';
  }
  if (document.getElementById('email').value != '')
 {
  if (!checkEmail(document.getElementById('email').value))
  {
   err = err + '<li>Некорректый E-Mail</li>';
  }
 }
  if (document.getElementById("password").value == ""){
    err = err + '<li>Введите Пароль</li>';
  }


  if(err==""){
    return true;
  }
  else{
  	err = '<ul>'+err+'</ul>';
  	document.getElementById("check_error").innerHTML = err;
    self.location.href='#check_error';
    return false;
  }
}
//


function get_tags(TAG)
{
	document.getElementById('search').value=TAG;
	document.getElementById('search_form').submit();
}


function valid_edit_contact_info(){

  var err='';
  if (document.getElementById("name").value == ""){
    err = err + '<li>Введите ваще имя</li>';
  }
  if (document.getElementById("email").value == ""){
    err = err + '<li>Введите E-Mail</li>';
  }
  if (document.getElementById("old_pasword").value == ""){
    err = err + '<li>Введите старый пароль</li>';
  }
  if (document.getElementById("new_pasword").value == ""){
    err = err + '<li>Введите новый пароль</li>';
  }


  if(err==""){
    return true;
  }
  else{
  	err = '<ul>'+err+'</ul>';
  	document.getElementById("check_error").innerHTML = err;
    self.location.href='#check_error';
    return false;
  }
}
