$(document).ready(function(){
	window.Lightbox = new jQuery().visualLightbox({autoPlay:false,borderSize:39,classNames:'vlightbox',descSliding:true,enableRightClick:false,enableSlideshow:true,resizeSpeed:7,slideTime:4,startZoom:true});
});

var VSA_scrollAreas = new Array();
var VSA_default_imagesPath = "images";
var VSA_default_btnUpImage = "";
var VSA_default_btnDownImage = "";
var VSA_default_scrollStep = 5;
var VSA_default_wheelSensitivity = 10;
var VSA_default_scrollbarPosition = 'right';//'left','right','inline';
var VSA_default_scrollButtonHeight = 22;
var VSA_default_scrollbarWidth = 22;
var VSA_resizeTimer = 2000;
var VSA_touchFlag = isTouchDevice(); // true/false - move scroll with scrollable body

if (window.addEventListener) window.addEventListener("load", VSA_initScrollbars, false);
else if (window.attachEvent) window.attachEvent("onload", VSA_initScrollbars);

function VSA_initScrollbars(){
	if(!document.body.children) return;
	var scrollElements = VSA_getElements("vscrollable", "DIV", document, "class");
	for (var i=0; i<scrollElements.length; i++){
		VSA_scrollAreas[i] = new VScrollArea(i, scrollElements[i]);
	}
}
function isTouchDevice(){
	try{
		document.createEvent("TouchEvent");
		return true;
	} catch (e){
		return false;
	}
}
function touchHandler(event){
	var touches = event.changedTouches, first = touches[0], type = "";
	switch(event.type){
		case "touchstart": type = "mousedown"; break;
		case "touchmove":  type = "mousemove"; break;
		case "touchend":   type = "mouseup"; break;
		default: return;
	}
	var simulatedEvent = document.createEvent("MouseEvent");
	simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null);
	first.target.dispatchEvent(simulatedEvent);
	event.preventDefault();
}
function VScrollArea(index, elem){
	this.index = index;
	this.element = elem;
	var attr = this.element.getAttribute("imagesPath");
	this.imagesPath = attr ? attr : VSA_default_imagesPath;
	attr = this.element.getAttribute("btnUpImage");
	this.btnUpImage = attr ? attr : VSA_default_btnUpImage;
	attr = this.element.getAttribute("btnDownImage");
	this.btnDownImage = attr ? attr : VSA_default_btnDownImage;
	attr = Number(this.element.getAttribute("scrollStep"));
	this.scrollStep = attr ? attr : VSA_default_scrollStep;
	attr = Number(this.element.getAttribute("wheelSensitivity"));
	this.wheelSensitivity = attr ? attr : VSA_default_wheelSensitivity;
	attr = this.element.getAttribute("scrollbarPosition");
	this.scrollbarPosition = attr ? attr : VSA_default_scrollbarPosition;
	attr = this.element.getAttribute("scrollButtonHeight");
	this.scrollButtonHeight = attr ? attr : VSA_default_scrollButtonHeight;
	attr = this.element.getAttribute("scrollbarWidth");
	this.scrollbarWidth = attr ? attr : VSA_default_scrollbarWidth;
	this.scrolling = false;
	this.iOffsetY = 0;
	this.scrollHeight = 0;
	this.scrollContent = null;
	this.scrollbar = null;
	this.scrollup = null;
	this.scrolldown = null;
	this.scrollslider = null;
	this.scroll = null;
	this.enableScrollbar = false;
	this.scrollFactor = 1;
	this.scrollingLimit = 0;
	this.topPosition = 0;
	//functions declaration
	this.init = VSA_init;
	this.scrollUp = VSA_scrollUp;
	this.scrollDown = VSA_scrollDown;
	this.createScrollBar = VSA_createScrollBar;
	this.scrollIt = VSA_scrollIt;
	this.init();
}
function VSA_init(){
	this.scrollContent = document.createElement("DIV");
	this.scrollContent.style.position = "absolute";
	this.scrollContent.style.overflow = "hidden";
	this.scrollContent.style.width = this.element.offsetWidth + "px";
	this.scrollContent.style.height = this.element.offsetHeight + "px";
	while(this.element.childNodes.length) this.scrollContent.appendChild(this.element.childNodes[0]);
	this.element.style.overflow = "hidden";
	this.element.style.display = "block";
	this.element.style.visibility = "visible";
	this.element.style.position = "relative";
	this.element.appendChild(this.scrollContent);
	this.scrollContent.className = 'scroll-content';
	this.element.index = this.index;
	this.element.over = false;
	var _this = this;
	if(document.all && !window.opera){
		this.element.onmouseenter = function(){_this.element.over = true;};
		this.element.onmouseleave = function(){_this.element.over = false;}
	} else{
		this.element.onmouseover = function(){_this.element.over = true;};
		this.element.onmouseout = function(){_this.element.over = false;}
	}
	if (document.all){
		this.element.onscroll = VSA_handleOnScroll;
		this.element.onresize = VSA_handleResize;
	}
	else{window.onresize = VSA_handleResize;}
	this.createScrollBar();
	if (window.addEventListener){
		/* DOMMouseScroll is for mozilla. */
		this.element.addEventListener('DOMMouseScroll', VSA_handleMouseWheel, false);
	}
	/* IE/Opera. */
	this.element.onmousewheel = document.onmousewheel = VSA_handleMouseWheel;
	// move content by touch
	if(VSA_touchFlag){
		_this.scrollContent.onmousedown = function(e){
			var startY = e.pageY-getRealTop(_this.scrollContent);
			var origTop = _this.scrollContent.scrollTop;
			_this.scrollContent.onmousemove = function(e){
				var moveY = e.pageY-getRealTop(_this.scrollContent);
				var iNewY = origTop-(moveY-startY);
				if(iNewY < 0) iNewY = 0;
				if(iNewY > _this.scrollContent.scrollHeight) iNewY = _this.scrollContent.scrollHeight;
				_this.scrollContent.scrollTop = iNewY;
				_this.scrollslider.style.top =  1 / _this.scrollFactor * Math.abs(_this.scrollContent.scrollTop) + _this.scrollButtonHeight + "px";
			}
		}
		_this.scrollContent.onmouseup = function(e){
			_this.scrollContent.onmousemove = null;
		}
		this.scrollContent.addEventListener("touchstart", touchHandler, true);
		this.scrollContent.addEventListener("touchmove", touchHandler, true);
		this.scrollContent.addEventListener("touchend", touchHandler, true);
	}
}
function VSA_createScrollBar(){
	if (this.scrollbar != null){
		this.element.removeChild(this.scrollbar);
		this.scrollbar = null;
	}
	if (this.scrollContent.scrollHeight <= this.scrollContent.offsetHeight)
		this.enableScrollbar = false;
	else if (this.element.offsetHeight > 2*this.scrollButtonHeight)
		this.enableScrollbar = true;
	else
		this.enableScrollbar = false;
	if (this.scrollContent.scrollHeight - Math.abs(this.scrollContent.scrollTop) < this.element.offsetHeight)
		this.scrollContent.style.top = 0;
	if (this.enableScrollbar){
		this.scrollbar = document.createElement("DIV");
		this.element.appendChild(this.scrollbar);
		this.scrollbar.style.position = "absolute";
		this.scrollbar.style.top = "0px";
		this.scrollbar.style.height = this.element.offsetHeight+"px";
		this.scrollbar.style.width = this.scrollbarWidth + "px";
		this.scrollbar.className = 'vscroll-bar';
		if(this.scrollbarWidth != this.scrollbar.offsetWidth){
			this.scrollbarWidth = this.scrollbar.offsetHeight;
		}
		this.scrollbarWidth = this.scrollbar.offsetWidth;
		if(this.scrollbarPosition == 'left'){
			this.scrollContent.style.left = this.scrollbarWidth + 5 + "px";
			this.scrollContent.style.width = this.element.offsetWidth - this.scrollbarWidth - 5 + "px";
		}
		else if(this.scrollbarPosition == 'right'){
			this.scrollbar.style.left = this.element.offsetWidth - this.scrollbarWidth  + "px";
			this.scrollContent.style.width = this.element.offsetWidth - this.scrollbarWidth - 5 + "px";
		}
		//create scroll up button
		this.scrollup = document.createElement("DIV");
		this.scrollup.index = this.index;
		this.scrollup.onmousedown = VSA_handleBtnUpMouseDown;
		this.scrollup.onmouseup = VSA_handleBtnUpMouseUp;
		this.scrollup.onmouseout = VSA_handleBtnUpMouseOut;
		if(VSA_touchFlag){
			this.scrollup.addEventListener("touchstart", touchHandler, true);
			this.scrollup.addEventListener("touchend", touchHandler, true);
		}
		
		this.scrollup.style.position = "absolute";
		this.scrollup.style.top = "0px";
		this.scrollup.style.left = "0px";
		this.scrollup.style.height = this.scrollButtonHeight + "px";
		this.scrollup.style.width = this.scrollbarWidth + "px";
		this.scrollup.innerHTML = '<img src="' + this.imagesPath + '/' + this.btnUpImage + '" border="0"/>';
		this.scrollbar.appendChild(this.scrollup);
		this.scrollup.className = 'vscroll-up';
		if(this.scrollButtonHeight != this.scrollup.offsetHeight){
			this.scrollButtonHeight = this.scrollup.offsetHeight;
		}
		//create scroll down button
		this.scrolldown = document.createElement("DIV");
		this.scrolldown.index = this.index;
		this.scrolldown.onmousedown = VSA_handleBtnDownMouseDown;
		this.scrolldown.onmouseup = VSA_handleBtnDownMouseUp;
		this.scrolldown.onmouseout = VSA_handleBtnDownMouseOut;
		if(VSA_touchFlag){
			this.scrolldown.addEventListener("touchstart", touchHandler, true);
			this.scrolldown.addEventListener("touchend", touchHandler, true);
		}
		this.scrolldown.style.position = "absolute";
		this.scrolldown.style.left = "0px";
		this.scrolldown.style.top =  this.scrollbar.offsetHeight - this.scrollButtonHeight + "px";
		this.scrolldown.style.width = this.scrollbarWidth + "px";
		this.scrolldown.innerHTML = '<img src="' + this.imagesPath + '/' + this.btnDownImage + '" border="0"/>';
		this.scrollbar.appendChild(this.scrolldown);
		this.scrolldown.className = 'vscroll-down';
		//create scroll
		this.scroll = document.createElement("DIV");
		this.scroll.index = this.index;
		this.scroll.style.position = "absolute";
		this.scroll.style.zIndex = 0;
		this.scroll.style.textAlign = "center";
		this.scroll.style.top = this.scrollButtonHeight + "px";
		this.scroll.style.left = "0px";
		this.scroll.style.width = this.scrollbarWidth + "px";
		var h = this.scrollbar.offsetHeight - 2*this.scrollButtonHeight;
		this.scroll.style.height = ((h > 0) ? h : 0) + "px";
		this.scroll.innerHTML = '';
		this.scroll.onclick = VSA_handleScrollbarClick;
		this.scrollbar.appendChild(this.scroll);
		this.scroll.style.overflow = "hidden";
		this.scroll.className = "vscroll-line";
		//create slider
		this.scrollslider = document.createElement("DIV");
		this.scrollslider.index = this.index;
		this.scrollslider.style.position = "absolute";
		this.scrollslider.style.zIndex = 1000;
		this.scrollslider.style.textAlign = "center";
		this.scrollslider.innerHTML = '<div id="vscrollslider' + this.index + '" style="padding:0;margin:0;"><div class="scroll-bar-top"></div><div class="scroll-bar-bottom"></div></div>';
		this.scrollbar.appendChild(this.scrollslider);
		this.subscrollslider = document.getElementById("vscrollslider"+this.index);
		this.subscrollslider.style.height = Math.round((this.scrollContent.offsetHeight/this.scrollContent.scrollHeight)*(this.scrollbar.offsetHeight - 2*this.scrollButtonHeight)) + "px";
		this.scrollslider.className = "vscroll-slider";
		this.scrollHeight = this.scrollbar.offsetHeight - 2*this.scrollButtonHeight - this.scrollslider.offsetHeight;
		this.scrollFactor = (this.scrollContent.scrollHeight - this.scrollContent.offsetHeight)/this.scrollHeight;
		this.topPosition = getRealTop(this.scrollbar) + this.scrollButtonHeight;
		/* this.scrollbarHeight = this.scrollbar.offsetHeight - 2*this.scrollButtonHeight - this.scrollslider.offsetHeight; */
		this.scrollslider.style.top = /* 1 / this.scrollFactor * Math.abs(this.scrollContent.offsetTop) +*/ this.scrollButtonHeight + "px";
		this.scrollslider.style.left = "0px";
		this.scrollslider.style.width = "100%";
		this.scrollslider.onmousedown = VSA_handleSliderMouseDown;
		if(VSA_touchFlag){
			this.scrollslider.addEventListener("touchstart", touchHandler, true);
		}
		if (document.all)
			this.scrollslider.onmouseup = VSA_handleSliderMouseUp;
	}
	else
		this.scrollContent.style.width = this.element.offsetWidth + "px";
}
function VSA_handleBtnUpMouseDown(){
	var sa = VSA_scrollAreas[this.index];
	sa.scrolling = true;
	sa.scrollUp();
}
function VSA_handleBtnUpMouseUp(){VSA_scrollAreas[this.index].scrolling = false;}
function VSA_handleBtnUpMouseOut(){VSA_scrollAreas[this.index].scrolling = false;}
function VSA_handleBtnDownMouseDown(){
	var sa = VSA_scrollAreas[this.index];
	sa.scrolling = true;
	sa.scrollDown();
}
function VSA_handleBtnDownMouseUp(){VSA_scrollAreas[this.index].scrolling = false;}
function VSA_handleBtnDownMouseOut(){VSA_scrollAreas[this.index].scrolling = false;}
function VSA_scrollIt(){
	this.scrollContent.scrollTop = this.scrollFactor * ((this.scrollslider.offsetTop + this.scrollslider.offsetHeight/2) - this.scrollButtonHeight - this.scrollslider.offsetHeight/2);
}
function VSA_scrollUp(){
	if (this.scrollingLimit > 0){
		this.scrollingLimit--;
		if (this.scrollingLimit == 0) this.scrolling = false;
	}
	if (!this.scrolling) return;
	if ( this.scrollContent.scrollTop - this.scrollStep > 0){
		this.scrollContent.scrollTop -= this.scrollStep;
		this.scrollslider.style.top = 1 / this.scrollFactor * Math.abs(this.scrollContent.scrollTop) + this.scrollButtonHeight + "px";
	}
	else{
		this.scrollContent.scrollTop = "0";
		this.scrollslider.style.top = this.scrollButtonHeight + "px";
		return;
	}
	setTimeout("VSA_Ext_scrollUp(" + this.index + ")", 30);
}
function VSA_Ext_scrollUp(index){VSA_scrollAreas[index].scrollUp();}
function VSA_scrollDown(){
	if (this.scrollingLimit > 0){
		this.scrollingLimit--;
		if (this.scrollingLimit == 0) this.scrolling = false;
	}
	if (!this.scrolling) return;
	this.scrollContent.scrollTop += this.scrollStep;
	this.scrollslider.style.top =  1 / this.scrollFactor * Math.abs(this.scrollContent.scrollTop) + this.scrollButtonHeight + "px";
	if (this.scrollContent.scrollTop >= (this.scrollContent.scrollHeight - this.scrollContent.offsetHeight)){
		this.scrollContent.scrollTop = (this.scrollContent.scrollHeight - this.scrollContent.offsetHeight);
		this.scrollslider.style.top = this.scrollbar.offsetHeight - this.scrollButtonHeight - this.scrollslider.offsetHeight + "px";
		return;
	}
	setTimeout("VSA_Ext_scrollDown(" + this.index + ")", 30);
}
function VSA_Ext_scrollDown(index){VSA_scrollAreas[index].scrollDown();}
function VSA_handleMouseMove(evt){
	var sa = VSA_scrollAreas[((document.all && !window.opera) ? this.index : document.documentElement.scrollAreaIndex)];
	var posy = 0;
	if (!evt) var evt = window.event;
	if (evt.pageY)
		posy = evt.pageY;
	else if (evt.clientY)
		posy = evt.clientY;
		if (document.all && !window.opera){
			if(!document.addEventListener){
				posy += document.documentElement.scrollTop;
			}
		}
	var iNewY = posy - sa.iOffsetY - getRealTop(sa.scrollbar) - sa.scrollButtonHeight;
		iNewY += sa.scrollButtonHeight;
	if (iNewY < sa.scrollButtonHeight)
		iNewY = sa.scrollButtonHeight;
	if (iNewY > (sa.scrollbar.offsetHeight - sa.scrollButtonHeight) - sa.scrollslider.offsetHeight)
		iNewY = (sa.scrollbar.offsetHeight - sa.scrollButtonHeight) - sa.scrollslider.offsetHeight;
	sa.scrollslider.style.top = iNewY + "px";
	sa.scrollIt();
}

function VSA_handleSliderMouseDown(evt){
	if (!(document.uniqueID && document.compatMode && !window.XMLHttpRequest)){
		document.onselectstart = function(){return false;}
		document.onmousedown = function(){return false;}
	}
	var sa = VSA_scrollAreas[this.index];
	if (document.all && !window.opera){
		sa.scrollslider.setCapture()
		sa.iOffsetY = event.offsetY;
		sa.scrollslider.onmousemove = VSA_handleMouseMove;
		if(VSA_touchFlag){
			sa.scrollslider.addEventListener("touchmove", touchHandler, true);
		}
	}
	else
	{
		if(window.opera)
		{
			sa.iOffsetY = event.offsetY;
		}
		else
		{
			sa.iOffsetY = evt.layerY;
		}
		document.documentElement.scrollAreaIndex = sa.index;
		document.documentElement.addEventListener("mousemove", VSA_handleMouseMove, true);
		document.documentElement.addEventListener("mouseup", VSA_handleSliderMouseUp, true);
		if(VSA_touchFlag){
			document.documentElement.addEventListener("touchmove", touchHandler, true);
			document.documentElement.addEventListener("touchend", touchHandler, true);
		}
	}
	return false;
}
function VSA_handleSliderMouseUp(){
	if (!(document.uniqueID && document.compatMode && !window.XMLHttpRequest)){
		document.onmousedown = null;
		document.onselectstart = null;
	}
	if (document.all && !window.opera){
		var sa = VSA_scrollAreas[this.index];
		sa.scrollslider.onmousemove = null;
		sa.scrollslider.releaseCapture();
		sa.scrollIt();
	}
	else{
		var sa = VSA_scrollAreas[document.documentElement.scrollAreaIndex];
		document.documentElement.removeEventListener("mousemove", VSA_handleMouseMove, true);
		document.documentElement.removeEventListener("mouseup", VSA_handleSliderMouseUp, true);
		if(VSA_touchFlag){
			document.documentElement.removeEventListener("touchmove", touchHandler, true);
			document.documentElement.removeEventListener("touchend", touchHandler, true);
		}
		sa.scrollIt();
	}
	return false;
}
function VSA_handleResize(){
	if (VSA_resizeTimer){
		clearTimeout(VSA_resizeTimer);
		VSA_resizeTimer = 0;
	}
	VSA_resizeTimer = setTimeout("VSA_performResizeEvent()", 100);
}
function VSA_performResizeEvent(){
	for (var i=0; i<VSA_scrollAreas.length; i++)
		VSA_scrollAreas[i].createScrollBar();
}
function VSA_handleMouseWheel(event){
	if (this.index != null){
		var sa = VSA_scrollAreas[this.index];
		if (sa.scrollbar == null) return;
		sa.scrolling = true;
		sa.scrollingLimit = sa.wheelSensitivity;
		var delta = 0;
		if (!event)
			event = window.event;
		if (event.wheelDelta){
			delta = event.wheelDelta/120;
		} else if (event.detail){
			delta = -event.detail/3;
		}
		if (delta && sa.element.over){
			if (delta > 0){sa.scrollUp();}
			else{sa.scrollDown();}
			if (event.preventDefault){event.preventDefault();}
			event.returnValue = false;
		}
	}
}
function VSA_handleSelectStart(){event.returnValue = false;}
function VSA_handleScrollbarClick(evt){
	var sa = VSA_scrollAreas[this.index];
	var offsetY = (document.all ? event.offsetY : evt.layerY);
	if (offsetY < (sa.scrollButtonHeight + sa.scrollslider.offsetHeight/2))
		sa.scrollslider.style.top = sa.scrollButtonHeight + "px";
	else if (offsetY > (sa.scrollbar.offsetHeight - sa.scrollButtonHeight - sa.scrollslider.offsetHeight))
		sa.scrollslider.style.top = sa.scrollbar.offsetHeight - sa.scrollButtonHeight - sa.scrollslider.offsetHeight + "px";
	else{
		sa.scrollslider.style.top = offsetY + sa.scrollButtonHeight - sa.scrollslider.offsetHeight/2 + "px";
	}
	sa.scrollIt();
}
function VSA_handleOnScroll(){}
function VSA_getElements(attrValue, tagName, ownerNode, attrName){
	if (!tagName) tagName = "*";
	if (!ownerNode) ownerNode = document;
	if (!attrName) attrName = "name";
	var result = [];
	var nl = ownerNode.getElementsByTagName(tagName);
	for (var i=0; i<nl.length; i++){
		if (nl.item(i).className.indexOf(attrValue) != -1)
		result.push(nl.item(i));
	}
	return result;
}
function getRealTop(obj){
	var posTop = 0;
	while (obj.offsetParent){
		posTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return posTop;
}
// -----------------------------------------------------------------------------------
//
// VisualLightBox for jQuery v 1.8.13j
// http://visuallightbox.com/
// VisualLightBox is a free wizard program that helps you easily generate LightBox photo
// galleries, in a few clicks without writing a single line of code. For Windows and Mac!
// Last updated: 2010-04-12
//
(function($){$.fn.visualLightbox=function(options){var C=null,badObjects=["select","object","embed"],l=null,B=[],k=null,c=null,m=50,I,showTimer;if(!document.getElementsByTagName){return;}options=$.extend({animate:true,autoPlay:true,borderSize:39,containerID:document,enableSlideshow:true,googleAnalytics:false,descSliding:true,imageDataLocation:"south",shadowLocation:"",closeLocation:"",initImage:"",loop:true,overlayDuration:0.2,overlayOpacity:0.7,prefix:"",classNames:"vlightbox",resizeSpeed:7,Ae:false,slideTime:4,strings:{closeLink:"",loadingMsg:"loading",nextLink:"",prevLink:"",startSlideshow:"",stopSlideshow:"",numDisplayPrefix:"",numDisplaySeparator:"/"},enableRightClick:false,featBrowser:true,breathingSize:20,startZoom:false,floating:true},options);if(options.animate){var overlayDuration=Math.max(options.overlayDuration,0);options.resizeSpeed=Math.max(Math.min(options.resizeSpeed,10),1);var resizeDuration=(11-options.resizeSpeed)*0.15;}else{var overlayDuration=0;var resizeDuration=0;}var enableSlideshow=options.enableSlideshow;options.overlayOpacity=Math.max(Math.min(options.overlayOpacity,1),0);var playSlides=options.autoPlay;var container=$(options.containerID);var classNames=options.classNames;AW();var objBody=container.length&&container.get(0)!=document?container.get(0):document.getElementsByTagName("body").item(0);if(objBody.childNodes.length){$(objBody.childNodes[0]).before($("<div></div>"));objBody=objBody.childNodes[0];}function connectEvent(obj,name,func){$(obj)[name](func);}var n=document.createElement("div");n.setAttribute("id",getID("overlay"));n.style.display="none";objBody.appendChild(n);connectEvent(n,"click",end);var W=document.createElement("div");W.setAttribute("id",getID("lightbox"));W.style.display="none";objBody.appendChild(W);connectEvent(W,"click",end);var U=document.createElement("div");U.setAttribute("id",getID("imageDataContainer"));U.className=getID("clearfix");var P=document.createElement("table");P.setAttribute("id",getID("outerImageContainer"));P.cellSpacing=0;W.appendChild(P);var AG=P.insertRow(-1);var AY=AG.insertCell(-1);AY.className="tl";var Ac=AG.insertCell(-1);Ac.className="tc";var AI=AG.insertCell(-1);AI.className="tr";var AF=P.insertRow(-1);var Af=AF.insertCell(-1);Af.className="ml";var b=AF.insertCell(-1);b.setAttribute("id",getID("lightboxFrameBody"));var Ag=AF.insertCell(-1);Ag.className="mr";var AD=P.insertRow(-1);var AZ=AD.insertCell(-1);AZ.className="bl";var Ab=AD.insertCell(-1);Ab.className="bc";var Ad=AD.insertCell(-1);Ad.className="br";if(options.imageDataLocation=="north"){b.appendChild(U);}var p=document.createElement("div");p.setAttribute("id",getID("imageData"));U.appendChild(p);var g=document.createElement("div");g.setAttribute("id",getID("imageDetails"));p.appendChild(g);var AP=document.createElement("div");AP.setAttribute("id",getID("caption"));g.appendChild(AP);var AK=document.createElement("span");AK.setAttribute("id",getID("numberDisplay"));g.appendChild(AK);var S=document.createElement("span");S.setAttribute("id",getID("detailsNav"));g.appendChild(S);

var social=document.createElement("div");social.setAttribute("id",getID("social"));g.appendChild(social);
var tweet=document.createElement("a");tweet.setAttribute("id",getID("tweet"));tweet.setAttribute("href","#");social.appendChild(tweet);
var like=document.createElement("a");like.setAttribute("id",getID("like"));like.setAttribute("href","#");social.appendChild(like);
var vk=document.createElement("a");vk.setAttribute("id",getID("vkontakte"));vk.setAttribute("href","#");social.appendChild(vk);
var odnoklasniki=document.createElement("a");odnoklasniki.setAttribute("id",getID("odnoklasniki"));odnoklasniki.setAttribute("href","#");social.appendChild(odnoklasniki);

var T=document.createElement("a");T.setAttribute("id",getID("prevLinkDetails"));T.setAttribute("href","javascript:void(0);");T.innerHTML=options.strings.prevLink;S.appendChild(T);connectEvent(T,"click",showPrev);var q=document.createElement("a");q.setAttribute("id",getID("slideShowControl"));q.setAttribute("href","javascript:void(0);");S.appendChild(q);connectEvent(q,"click",AH);var Z=document.createElement("a");Z.setAttribute("id",getID("closeLink"));Z.setAttribute("href","javascript:void(0);");Z.innerHTML=options.strings.closeLink;if(options.closeLocation=="nav"){S.appendChild(Z);}else{var _=document.createElement("div");_.setAttribute("id",getID("close"));if(options.closeLocation=="top"){AI.appendChild(_);}else{p.appendChild(_);}_.appendChild(Z);}connectEvent(Z,"click",end);var f=document.createElement("a");f.setAttribute("id",getID("nextLinkDetails"));f.setAttribute("href","javascript:void(0);");f.innerHTML=options.strings.nextLink;S.appendChild(f);connectEvent(f,"click",showNext);var objImageContainerMain=document.createElement("div");objImageContainerMain.setAttribute("id",getID("imageContainerMain"));b.appendChild(objImageContainerMain);var h=document.createElement("div");h.setAttribute("id",getID("imageContainer"));objImageContainerMain.appendChild(h);var AJ=document.createElement("img");AJ.setAttribute("id",getID("lightboxImage"));h.appendChild(AJ);if(!options.enableRightClick){var AB=document.createElement("div");AB.setAttribute("id",getID("hoverNav"));AB.style.background="white";AB.style.opacity=0;AB.style.filter="alpha(opacity=0)";h.appendChild(AB);connectEvent(AB,"mousemove",hoverNav);connectEvent(AB,"mouseout",outNav);}var AA=document.createElement("a");AA.setAttribute("id",getID("prevLinkImg"));AA.setAttribute("href","javascript:void(0);");objImageContainerMain.appendChild(AA);connectEvent(AA,"click",showPrev);var u=document.createElement("a");u.setAttribute("id",getID("nextLinkImg"));u.setAttribute("href","javascript:void(0);");objImageContainerMain.appendChild(u);connectEvent(u,"click",showNext);var AE=document.createElement("div");AE.setAttribute("id",getID("loading"));h.appendChild(AE);var a=document.createElement("a");a.setAttribute("id",getID("loadingLink"));a.setAttribute("href","javascript:void(0);");a.innerHTML=options.strings.loadingMsg;AE.appendChild(a);connectEvent(a,"click",end);if(options.imageDataLocation!="north"){b.appendChild(U);}var objShadow=document.createElement("div");objShadow.setAttribute("id",getID("shadow"));(options.shadowLocation?document.getElementById(getID(options.shadowLocation)):Ab).appendChild(objShadow);if(options.initImage!=""){start("#"+options.initImage);}function getHref(Node){if(Node.tagName.toLowerCase()!="a"){Node=$("A:first",Node);}return $(Node).attr("href");}function getTitle(Node){if(Node.tagName.toLowerCase()=="a"){return $(Node).attr("title")||Node.title;}return $(">*:last",Node).html();}function AW(){$("."+classNames.replace(",",",."),container).each(function(){if(getHref(this)){$(this).click(function(event){event.preventDefault();start(this);return false;});}});}var t="";if(t){var c=$("<div></div>");c.css({position:"absolute",right:"0px",bottom:"0px",padding:"2px 3px",'background-color':"#EEE",'z-index':10});$(h).append(c);var d=$(document.createElement("A"));d.css({color:"#555",font:"11px Arial,Verdana,sans-serif",padding:"3px 6px",width:"auto",height:"auto",margin:"0 0 0 0",outline:"none"});d.attr({href:"http://"+t.toLowerCase()});d.html(t);d.bind("contextmenu",function(eventObject){return false;});c.append(d);}var start=this.start=function(G){Aa();G=$(G);$$("overlay").css({height:docWH()[1]+"px"});if(options.descSliding){}$$("lightboxImage").hide().attr({src:""});if(options.startZoom){$$("imageContainer").css({width:G.width()+"px",height:G.height()+"px"});if(!document.all){$$("outerImageContainer").css({opacity:0.1});}$$("lightbox").css({left:G.offset().left-options.borderSize+"px",top:G.offset().top-options.borderSize+"px",width:G.width()+options.borderSize*2+"px",height:"auto"});}else{$$("overlay").css({opacity:0}).show().fadeTo(overlayDuration*1000,options.overlayOpacity);$$("lightbox").css({left:0,width:"100%"});}$$("lightbox").show();B=[];l=null;c=0;$("."+(G.attr("className")||G.get(0).className),container).each(function(){if(getHref(this)){B.push({link:getHref(this),title:getTitle(this)});if(this==G.get(0)){c=B.length-1;}}});if(B.length>1){l=G.attr("className");}if(options.featBrowser){$(window).resize(v);}if(options.floating){$(window).scroll(v);}$(window).resize(adjustOverlay);$(window).scroll(adjustOverlay);changeImage(c);};function changeImage(imageNum){C=imageNum;disableKeyboardNav();V();showLoading();if(!options.startZoom){$$("lightboxImage").hide();}$$("prevLinkImg").hide();$$("nextLinkImg").hide();if(options.descSliding){}I=new Image;I.onload=function(){B[C].link=I.src;B[C].width=I.width;B[C].height=I.height;AC(false);};if(options.startZoom&&!$$("lightboxImage").attr("src")){B[C].width=320;B[C].height=240;AC(false,true);}I.src=B[C].link;if(options.googleAnalytics){urchinTracker(B[C].link);}}function AC(recall,J){var imgWidth=B[C].width;var imgHeight=B[C].height;var L=w();var r=imgWidth/imgHeight;if(options.featBrowser){var AX=L.AL/L.s;if(r>AX){var t=L.AL-options.borderSize*2-options.breathingSize*2;var z=Math.round(t/r);}else{var z=L.s-options.borderSize*2-options.breathingSize*2-m;var t=Math.round(z*r);}if(imgWidth>t||imgHeight>z){imgWidth=t;imgHeight=z;}}var K=AM().y+(w().s-(imgHeight+m+options.borderSize*2))/2;var Q=$$("imageContainer");if(recall==true){Q.css({height:imgHeight+"px",width:imgWidth+"px"});if(options.floating){moveEffect($$("lightbox"),K);}else{$$("lightbox").css({top:K+"px"});}}else{var F=$$("lightboxImage");Q.stop(true,false);F.stop(true,false);var H;if(options.startZoom&&F.attr("src")){H=F;H.attr({id:getID("lightboxImage2")});}else{F.remove();}if(!J){F=$(I);F.hide();F.attr({id:getID("lightboxImage")});Q.append(F);}with(Q){var D=r/(width()/height());}if(!J){if(options.startZoom){if(H){$$("lightboxImage2").stop(true,true);}var o=H?120:100;if(H){with(H){css({width:1>D?"auto":width()/parent().width()*100+"%",height:1>D?height()/parent().height()*100+"%":"auto",left:0,top:0});}}F.css({opacity:0,display:"block",position:"absolute",width:1>D?o+"%":"auto",height:1>D?"auto":o+"%",left:(100-o*(1>D?1:D))/2+"%",top:(100-o*(1>D?1/D:1))/2+"%"});}if(options.startZoom){hideLoading();}}AV(K,imgWidth,imgHeight,D,J);}if(document.all){$$("imageDataContainer").css({width:imgWidth+"px"});}if(options.enableRightClick){$$("lightboxImage").mousemove(hoverNav);$$("lightboxImage").mouseout(outNav);}}function AV(K,imgWidth,imgHeight,D,J){var Q=$$("imageContainer");var F=$$("lightboxImage");var lightbox=$$("lightbox");if(!J){var H=$$("lightboxImage2");}if(options.startZoom){F.fadeTo(resizeDuration*1000,1);if(!document.all){$$("outerImageContainer").fadeTo(resizeDuration*1000,1);}}moveEffect(lightbox,K);if(options.startZoom&&!J){H.animate($.extend({opacity:0},D<1?{height:"120%",top:"-10%",left:(100-120/D)/2+"%"}:{width:"120%",left:"-10%",top:(100-D*120)/2+"%"}),{queue:false,duration:resizeDuration*1000,complete:function(){$(this).remove();}});F.animate($.extend({left:0,top:0},D<1?{width:"100%"}:{height:"100%"}),{queue:false,duration:resizeDuration*1000});}Q.animate({width:imgWidth+"px",height:imgHeight+"px"},{queue:false,duration:resizeDuration*1000,complete:!J?function(){showImage();}:null});}function moveEffect(lightbox,K){lightbox.stop(true,false);lightbox.animate({width:"100%",left:0,top:K},{queue:false,duration:resizeDuration*1000});}function showLoading(){clearTimeout(showTimer);var loading=$$("loading");loading.show();loading.css({visibility:"hidden"});showTimer=setTimeout(function(){$$("loading").css({visibility:"visible"});},300);}function hideLoading(){clearTimeout(showTimer);$$("loading").hide();}function showImage(){hideLoading();if(options.startZoom){$$("overlay:hidden").css({opacity:0}).show().fadeTo(overlayDuration*1000,options.overlayOpacity);showDetails();}else{$$("lightboxImage").css({opacity:0}).show().fadeTo(500,1,function(){showDetails();});}AS();}function updateDetails(){$$("caption").html(B[C].title||"");if(B.length>1){var num_display=options.strings.numDisplayPrefix+" "+eval(C+1)+" "+options.strings.numDisplaySeparator+" "+B.length;if(options.Ae&&l){num_display+=" "+options.strings.numDisplaySeparator+" "+l;}$$("numberDisplay").text(num_display);$$("slideShowControl").css({display:enableSlideshow?"":"none"});}}function showDetails(){updateDetails();if(options.descSliding){}else{updateNav();}}function updateNav(){var d=1/B.length;m=m*(1-d)+$$("imageDataContainer").height()*d;if(B.length>1){$$("prevLinkImg").show();$$("nextLinkImg").show();if(enableSlideshow){if(playSlides){AN();}else{AO();}}}AR();}function AN(){if($$("lightbox:hidden").length){return;}V();playSlides=true;k=setTimeout(function(){showNext();},options.slideTime*1000);$$("slideShowControl").text(options.strings.stopSlideshow);$$("slideShowControl").addClass("started");}function AO(){playSlides=false;V();$$("slideShowControl").text(options.strings.startSlideshow);$$("slideShowControl").removeClass("started");}function AH(){if(playSlides){AO();}else{AN();}}function V(){if(k){k=clearTimeout(k);}}function showNext(){if(B.length>1){V();if(!options.loop&&(C==B.length-1&&c==0||C+1==c)){end();return;}if(C==B.length-1){O(0);}else{O(C+1);}}}function O(imageNum){if(options.descSliding){changeImage(imageNum);}else{changeImage(imageNum);}}function showPrev(){if(B.length>1){if(C==0){O(B.length-1);}else{O(C-1);}}}function showFirst(){if(B.length>1){O(0);}}function showLast(){if(B.length>1){O(B.length-1);}}function AR(){document.onkeydown=keyboardAction;}function disableKeyboardNav(){document.onkeydown="";}function keyboardAction(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}key=String.fromCharCode(keycode).toLowerCase();if(key=="x"||key=="o"||key=="c"){end();}else if(key=="p"||key=="%"){showPrev();}else if(key=="n"||key=="'"){showNext();}else if(key=="f"){showFirst();}else if(key=="l"){showLast();}else if(key=="s"){if(B.length>0&&options.enableSlideshow){AH();}}}function AS(){var AT=B.length-1==C?0:C+1;(new Image).src=B[AT].link;var AQ=C==0?B.length-1:C-1;(new Image).src=B[AQ].link;}function end(Event){if(Event){var id=$(Event.target).attr("id");if(getID("closeLink")!=id&&getID("lightbox")!=id&&getID("overlay")!=id){return;}}$$("imageContainer").stop(true,false);$$("lightboxImage").stop(true,false);I.onload=null;disableKeyboardNav();V();$$("lightbox").hide();AU();if(options.overlayOpacity){$$("overlay").fadeOut(overlayDuration*1000);}else{$$("overlay").hide();}$(window).unbind("resize",v);$(window).unbind("scroll",v);$(window).unbind("resize",adjustOverlay);$(window).unbind("scroll",adjustOverlay);}function hoverNav(event){if(event.pageX-$$("imageContainer").offset().left<$$("imageContainer").width()/2){$$("prevLinkImg").addClass("hover");$$("nextLinkImg").removeClass("hover");}else{$$("prevLinkImg").removeClass("hover");$$("nextLinkImg").addClass("hover");}}function outNav(){$$("prevLinkImg").removeClass("hover");$$("nextLinkImg").removeClass("hover");}function v(){AC(true);}function adjustOverlay(){$$("overlay").css({left:AM().x+"px",top:0,width:"100%",height:docWH()[1]+"px"});}function AU(){var els;var tags=badObjects;for(var i=0;i<tags.length;i++){els=document.getElementsByTagName(tags[i]);for(var j=0;j<els.length;j++){$(els[j]).css({visibility:"visible"});}}}function Aa(){var tags=badObjects;for(var i=0;i<tags.length;i++){$(tags[i]).css({visibility:"hidden"});}}function AM(){var x,y;if(self.pageYOffset){x=self.pageXOffset;y=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;}else if(document.body){x=document.body.scrollLeft;y=document.body.scrollTop;}return{x:x,y:y};}function w(){var N,M;if(self.innerHeight){N=self.innerWidth;M=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){N=document.documentElement.clientWidth;M=document.documentElement.clientHeight;}else if(document.body){N=document.body.clientWidth;M=document.body.clientHeight;}return{AL:N,s:M};}function docWH(){var b=document.body,e=document.documentElement,w=0,h=0;if(e){w=Math.max(w,e.scrollWidth,e.offsetWidth);h=Math.max(h,e.scrollHeight,e.offsetHeight);}if(b){w=Math.max(w,b.scrollWidth,b.offsetWidth);h=Math.max(h,b.scrollHeight,b.offsetHeight);if(window.innerWidth){w=Math.max(w,window.innerWidth);h=Math.max(h,window.innerHeight);}}return[w,h];}function getID(id){return options.prefix+id;}function $$(name){return $("#"+getID(name));}return this;};})(jQuery);
