/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebCheckBox(inputElement)
{
	this.importCheckBoxData = function(inputElement)
	{
		if ((inputElement.tagName == 'input' || inputElement.tagName == 'INPUT') && inputElement.type == 'checkbox')
		{
			this.inputElement = inputElement;
			this.checked = this.inputElement.checked;
		}
	}
	this.createCheckBox = function()
	{
		var checkBox = document.createElement('div');
		checkBox.className = 'checkbox';
		addHandler(checkBox, 'click', this.click);
		this.checkBox = checkBox;
		
		var parent = this.inputElement.parentNode;
		parent.insertBefore(this.checkBox, this.inputElement);
	}
	this.hideInputElement = function()
	{
		this.inputElement.style.display = 'none';
	}
	this.check = function()
	{
		this.checkBox.className = 'checkbox checked';
		this.checked = true;
		this.inputElement.checked = true;
	}
	this.uncheck = function()
	{
		this.checkBox.className = 'checkbox';
		this.checked = false;
		this.inputElement.checked = false;
	}
	this.click = function()
	{
		if(instance.checked)
		{
			instance.uncheck();
		}
		else
		{
			instance.check();
		}
		fireEvent(instance.inputElement, 'change');
	}
	var instance = this;
	this.inputElement = null;
	this.checkBox = null;
	this.checked = false;

	this.importCheckBoxData(inputElement);
	this.createCheckBox();
	this.hideInputElement();
}

artWebCheckBoxManager = new function()
{
	this.init = function()
	{
		var inputElements = _('.artWebCheckBox');
		for (var i = 0; i < inputElements.length; i++)
		{
			var checkBoxObject = new artWebCheckBox(inputElements[i]);
			instance.checkBoxObjects.push(checkBoxObject);
		}
	}
	var instance = this;
	this.checkBoxObjects = new Array();
}

addHandler(window, 'load', artWebCheckBoxManager.init);;
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/
var artWebDarkLayer = new function()
{
	this.showLayer = function(onclickFunction, callback)
	{
		opacityHandler.setOpacity(this.domElement, 0);
		this.domElement.style.display = 'block';
		
		var parameters = {end:this.fullOpacity, step:this.step};
		
		if (callback)
		{
			artWebEffectsManager.startEffect('opacity', this.domElement, parameters, callback);
		}
		else
		{
			artWebEffectsManager.startEffect('opacity', this.domElement, parameters);
		}
		
		if (!onclickFunction)
		{
			var onclickFunction = this.hideLayer;
		}
		addHandler(this.domElement, "click", onclickFunction);
	}
	this.hideLayer = function()
	{
		var parameters = {end:0, step: instance.step};
		var callback = instance.hideLayerStyle;
		artWebEffectsManager.startEffect('opacity', instance.domElement, parameters, callback);
	}
	this.hideLayerStyle = function()
	{
		instance.domElement.style.display = 'none';
	}
	this.init = function()
	{
		if (instance.domElement == null)
		{
			var viewPortWidth = document.documentElement.scrollWidth;
			var viewPortHeight = document.documentElement.scrollHeight;
			var domElement = document.createElement('div');
			domElement.style.backgroundColor = instance.backgroundColor;
			domElement.style.position = 'absolute';
			domElement.style.top = '0';
			domElement.style.left = '0';
			domElement.style.width = viewPortWidth + 'px';
			domElement.style.height = viewPortHeight + 'px';
			domElement.style.zIndex = '999';
			domElement.style.display = 'none';
			instance.domElement = domElement;
			document.body.appendChild(domElement);
		}
	}
	
	var instance = this;
	this.domElement = null;
	this.fullOpacity = 0.9;
	this.step = 0.05;
	this.backgroundColor = '#000000';
	addHandler(window, "load", this.init);
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebDropDown(selectorElement)
{
	this.importSelectData = function(selectorElement)
	{
		if (selectorElement.tagName == 'select' || selectorElement.tagName == 'SELECT')
		{
			this.selectorElement = selectorElement;
			for (var i = 0; i < selectorElement.options.length; i++)
			{
				var optionObject = new artWebDropDownOption(this, selectorElement.options[i]);
				if (selectorElement.selectedIndex == i)
				{
					this.value = optionObject.value;
					this.text = optionObject.text;
				}
				this.optionObjects.push(optionObject);
			}
		}
	}
	this.createDropDownShort = function()
	{
		var dropDownShort = document.createElement('div');
		dropDownShort.className = 'dropdown_short';
		addHandler(dropDownShort, 'click', this.click);
		this.dropDownShort = dropDownShort;
		
		this.createDropDownTitle();
		this.createDropDownArrow();
		
		var parent = this.selectorElement.parentNode;
		parent.insertBefore(this.dropDownShort, this.selectorElement);
	}
	this.createDropDownTitle = function()
	{
		var dropDownTitle = document.createElement('div');
		dropDownTitle.className = 'dropdown_title';
		this.dropDownTitle = dropDownTitle;
		
		this.dropDownShort.appendChild(this.dropDownTitle);
		
		this.setTitle(this.text);
	}
	this.createDropDownArrow = function()
	{
		var dropDownArrow = document.createElement('div');
		dropDownArrow.className = 'dropdown_arrow';
		this.dropDownArrow = dropDownArrow;
		
		this.dropDownShort.appendChild(dropDownArrow);
	}
	this.createDropDownList = function()
	{
		var domElement = document.createElement('div');
		domElement.className = 'dropdown_full';
		
		this.dropDownList = domElement;
		
		var parent = this.dropDownShort.parentNode;
		parent.insertBefore(this.dropDownList, this.dropDownShort);
		
		for (var i = 0; i < this.optionObjects.length; i++)
		{
			var optionObject = this.optionObjects[i];
			var optionElement = optionObject.domElement;
			
			this.dropDownList.appendChild(optionElement);
		}
	}
	this.hideSelectorElement = function()
	{
		this.selectorElement.style.display = 'none';
	}
	this.selectOption = function(optionObject)
	{
		this.value = optionObject.value;
		this.text = optionObject.text;
		
		this.setValue(this.value);
		this.setTitle(this.text);
		this.hideOptionsList();
		fireEvent(instance.selectorElement, 'change');
	}
	this.setTitle = function(text)
	{
		while(this.dropDownTitle.firstChild)
		{
			this.dropDownTitle.removeChild(this.dropDownTitle.firstChild);
		}
		var content = document.createTextNode(text);
		this.dropDownTitle.appendChild(content);		
	}
	this.setValue = function(value)
	{
		this.selectorElement.value = value;
	}
	this.click = function(event)
	{
		cancelBubbling(event);
		if(instance.state=='closed')
		{
			instance.showOptionsList();
		}
		else
		{
			instance.hideOptionsList();
		}
	}
	this.showOptionsList = function()
	{
		artWebDropDownManager.hideLists();
		this.dropDownList.style.width = this.dropDownShort.clientWidth+'px';
		this.dropDownList.style.top = (this.dropDownShort.offsetTop+this.dropDownShort.offsetHeight)+'px';
		this.dropDownList.style.left = this.dropDownShort.offsetLeft+'px';
		this.dropDownList.style.display = 'block';
		this.state = 'opened';
	}
	this.hideOptionsList = function()
	{
		this.dropDownList.style.display = 'none';
		this.state = 'closed';
	}
	var instance = this;
	this.selectorElement = null;
	this.dropDownShort = null;
	this.dropDownTitle = null;
	this.dropDownArrow = null;
	this.dropDownList = null;
	this.optionObjects = new Array();
	this.state = 'closed';
	this.value = '';
	this.text = '';

	this.importSelectData(selectorElement);
	this.createDropDownShort();
	this.createDropDownList();
	this.hideSelectorElement();
}
function artWebDropDownOption(dropDownObject, optionElement)
{
	this.importOptionData = function(optionElement)
	{
		if (optionElement.tagName == 'option' || optionElement.tagName == 'OPTION')
		{
			this.optionElement = optionElement;
			this.value = optionElement.value;
			this.text = optionElement.text;
			this.selected = optionElement.selected;
		}
	}
	this.createDomElement = function()
	{
		var domElement = document.createElement('div');
		domElement.className = 'dropdown_option';
		
		addHandler(domElement, 'click', this.click);
		addHandler(domElement, 'mouseover', this.mouseover);
		addHandler(domElement, 'mouseout', this.mouseout);
		this.domElement = domElement;
		
		var content = document.createTextNode(this.text);
		domElement.appendChild(content);
	}
	this.mouseover = function()
	{
		instance.domElement.className = 'dropdown_option dropdown_option_hovered';
	}
	this.mouseout = function()
	{
		instance.domElement.className = 'dropdown_option';
	}
	this.click = function(event)
	{
		instance.dropDownObject.selectOption(instance);
	}
	var instance = this;
	this.dropDownObject = dropDownObject;
	this.value = null;
	this.text = null;
	this.selected = null;
	this.optionElement = null;
	this.domElement = null;
	
	this.importOptionData(optionElement);
	this.createDomElement();
}
artWebDropDownManager = new function()
{
	this.init = function()
	{
		var dropDownElements = _('.artWebDropDown');
		for (var i = 0; i < dropDownElements.length; i++)
		{
			var dropDownObject = new artWebDropDown(dropDownElements[i]);
			instance.dropDownObjects.push(dropDownObject);
		}
		addHandler(document, 'click', instance.hideLists);
	}
	this.hideLists = function()
	{
		for (var i = 0; i < instance.dropDownObjects.length; i++)
		{
			var dropDownObject = instance.dropDownObjects[i];
			if (dropDownObject.state != 'closed')
			{
				dropDownObject.state = 'closed';
				dropDownObject.hideOptionsList();
			}
		}
	}
	var instance = this;
	this.dropDownObjects = new Array();
}

addHandler(window, 'load', artWebDropDownManager.init);
;
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebEffect_opacity()
{
	this.renderFrame = function(frame)
	{
		var direction = 1;
		var startOpacity = this.startOpacity;
		var endOpacity = this.parameters.end;
		var opacityStep = this.parameters.step;
		if (startOpacity > endOpacity)
		{
			direction = -1;
		}
		var currentOpacity = (startOpacity + opacityStep * frame * direction);
		if (currentOpacity*direction > endOpacity*direction) currentOpacity = endOpacity;
		opacityHandler.setOpacity(this.element, currentOpacity);
	}
	this.calculateFramesCount = function()
	{
		var direction = 1;
		if (this.parameters.start)
		{
			var startOpacity = this.parameters.start;
		}
		else
		{
			var startOpacity = opacityHandler.getOpacity(this.element);
		}
		this.startOpacity = startOpacity;
		var endOpacity = this.parameters.end;
		var opacityStep = this.parameters.step;
		var framesCount = 0;
		
		if (startOpacity > endOpacity)
		{
			direction = -1;
		}
		var opacityChange = (endOpacity - startOpacity)*direction;
		
		framesCount = Math.ceil(opacityChange / opacityStep) + 1;
		return framesCount;
	}
	
	var instance = this;
	this.opacityType = false;
	this.defaults = {end: 0, step: 0.01};
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebEffect_position()
{
	this.renderFrame = function(frame)
	{
		var xDirection = 1;
		var yDirection = 1;
		
		var xStep = this.xStep;
		var yStep = this.yStep;
		
		var xSource = this.xSource;
		var ySource = this.ySource;
		
		var xTarget = this.parameters.xTarget;
		var yTarget = this.parameters.yTarget;
		
		var positionStep = this.parameters.step;
		
		if (xSource > xTarget)
		{
			xDirection = -1;
		}
		if (ySource > yTarget)
		{
			yDirection = -1;
		}
		
		var xPath = (xTarget - xSource)*xDirection;
		var yPath = (yTarget - ySource)*yDirection;
		
		var currentXPosition = (xSource + xStep * frame * xDirection);
		var currentYPosition = (ySource + yStep * frame * yDirection);
		
		this.element.style.left = currentXPosition+'px';
		this.element.style.top = currentYPosition+'px';
	}
	this.calculateFramesCount = function()
	{
		this.xSource = this.element.offsetLeft;
		this.ySource = this.element.offsetTop;
		
		var xDirection = 1;
		var yDirection = 1;
		
		var xSource = this.xSource;
		var ySource = this.ySource;
		
		var xTarget = this.parameters.xTarget;
		var yTarget = this.parameters.yTarget;
		
		var positionStep = this.parameters.step;
		var framesCount = 0;
		
		if (xSource > xTarget)
		{
			xDirection = -1;
		}
		if (ySource > yTarget)
		{
			yDirection = -1;
		}
		
		var xPath = (xTarget - xSource)*xDirection;
		var yPath = (yTarget - ySource)*yDirection;
		
		var overallPath = Math.sqrt((xPath*xPath + yPath*yPath));
		
		framesCount = Math.ceil(overallPath / positionStep) + 1;
		
		this.xStep = xPath/framesCount;
		this.yStep = yPath/framesCount;
		
		return framesCount;
	}
	
	var instance = this;
	this.opacityType = false;
	this.defaults = {end: 0, step: 0.01};
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebEffect_slide()
{
	this.renderFrame = function(frame)
	{
		frame = frame + 1;
		var currentPath = this.step * frame + this.acceleration*frame*frame/2;
		var currentHeight = this.startHeight + (currentPath * this.direction);
		
		if (currentHeight*(this.direction) > this.endHeight*(this.direction))
		{
			currentHeight = this.endHeight;
		}
		
		this.element.slideValue = currentHeight;
		this.element.style.height = currentHeight+'px';
	}
	this.calculateFramesCount = function()
	{
		this.direction = 1;
		
		this.startHeight = this.element.offsetHeight;
		
		this.endHeight = this.parameters.end;
		this.step = this.parameters.step;
		this.acceleration = this.parameters.acceleration;
		
		if (this.endHeight < this.startHeight)
		{
			this.direction = -1;
		}
		
		var totalPath = this.endHeight - this.startHeight;
		totalPath = this.direction * totalPath;
		
		if (this.acceleration > 0)
		{
			var framesCount = Math.ceil((-1*this.step - Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			if (framesCount < 0)
			{
				framesCount = Math.ceil((-1*this.step + Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			}
		}
		else
		{
			var framesCount = Math.ceil(totalPath/this.step);
		}
		return framesCount;
	}
	
	var instance = this;
	this.defaults = {end: 0, step: 1, acceleration: 1};
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebEffect_slideunslide()
{
	this.renderFrame = function(frame)
	{
		frame = frame + 1;
		var currentPath = this.step * frame + this.acceleration*frame*frame/2;
		var currentHeight = this.startHeight + (currentPath * this.direction);
		
		if (currentHeight*(this.direction) > this.endHeight*(this.direction))
		{
			currentHeight = this.endHeight;
		}
		this.secondaryElement.style.height = this.fullHeight - currentHeight+'px';
		this.element.style.height = currentHeight+'px';
	}
	this.calculateFramesCount = function()
	{
		this.direction = 1;
		
		this.startHeight = this.element.offsetHeight;
		
		this.secondaryElement = this.parameters.secondary;
		this.fullHeight = this.parameters.secondaryHeight;
		this.endHeight = this.parameters.end;
		this.step = this.parameters.step;
		this.acceleration = this.parameters.acceleration;
		
		if (this.endHeight < this.startHeight)
		{
			this.direction = -1;
		}
		
		var totalPath = this.endHeight - this.startHeight;
		totalPath = this.direction * totalPath;
		
		if (this.acceleration > 0)
		{
			var framesCount = Math.ceil((-1*this.step - Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			if (framesCount < 0)
			{
				framesCount = Math.ceil((-1*this.step + Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			}
		}
		else
		{
			var framesCount = Math.ceil(totalPath/this.step);
		}
		return framesCount;
	}
	
	var instance = this;
	this.defaults = {end: 0, step: 1, acceleration: 1};
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebEffect_unwrap()
{
	this.renderFrame = function(frame)
	{
		frame = frame + 1;
		var currentPath = this.step * frame + this.acceleration*frame*frame/2;
		var currentWidth = this.startWidth + (currentPath * this.direction);
		
		if (currentWidth*(this.direction) > this.endWidth*(this.direction))
		{
			currentWidth = this.endWidth;
		}
		
		var difference = this.element.offsetWidth - currentWidth;
		var x1 = difference/2 + currentWidth;
		var x2 = difference/2;
		this.element.unwrapValue = currentWidth;
		this.element.style.clip = 'rect(auto,'+x1+'px,auto,'+x2+'px'+')';
	}
	this.calculateFramesCount = function()
	{
		this.direction = 1;
		
		if (this.parameters.start)
		{
			this.startWidth = this.parameters.start;
		}
		else if (this.element.unwrapValue)
		{
			this.startWidth = this.element.unwrapValue;
		}
		else
		{
			this.startWidth = 0;
		}
		
		this.endWidth = this.parameters.end;
		this.step = this.parameters.step;
		this.acceleration = this.parameters.acceleration;
		
		if (this.endWidth < this.startWidth)
		{
			this.direction = -1;
		}
		
		var totalPath = this.endWidth - this.startWidth;
		totalPath = this.direction * totalPath;
		
		if (this.acceleration > 0)
		{
			var framesCount = Math.ceil((-1*this.step - Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			if (framesCount < 0)
			{
				framesCount = Math.ceil((-1*this.step + Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			}
		}
		else
		{
			var framesCount = Math.ceil(totalPath/this.step);
		}
		return framesCount;
	}
	
	var instance = this;
	this.defaults = {end: 0, step: 0.5, acceleration: 1};
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

var artWebEffectsManager = new function()
{
	this.startEffect = function(effectName, element, parameters, callback)
	{
		var effectPlugin = false;
		if (effectPlugin = this.getEffectPlugin(effectName, element))
		{
			this.setEffectParameters(effectPlugin, parameters);
			
			var effectInfo = null;
			if (effectInfo = this.registerEffectInfo(effectName, element))
			{
				effectInfo.clearTimeOuts(effectName);
				
				this.assignTimeouts(effectPlugin, effectInfo, callback);
			}
		}
	}
	this.queueEffect = function(effectName, element, parameters, callback)
	{
		var effectPlugin = false;
		if (effectPlugin = this.getEffectPlugin(effectName, element))
		{
			this.setEffectParameters(effectPlugin, parameters);
			
			var effectInfo = null;
			if (effectInfo = this.registerEffectInfo(effectName, element))
			{
				this.assignTimeouts(effectPlugin, effectInfo, callback);
			}
		}
	}
	this.assignTimeouts = function(effectPlugin, effectInfo, callback)
	{
		var timeOutDelay = this.timeOutDelay;
		
		var offsetTimeout = effectInfo.getOffsetTimeout(effectPlugin.effectName);
		var timeoutsArray = effectInfo.getTimeoutList(effectPlugin.effectName);
		
		var olderFrames = timeoutsArray.length;

		var framesCount = effectPlugin.calculateFramesCount();
		
		var currentDelay = offsetTimeout;
		for (frame = 1; frame < framesCount; frame++)
		{
			var currentDelay = offsetTimeout + frame * timeOutDelay;
			
			timeoutsArray[frame + olderFrames] = setTimeout(
			function(effectPlugin, frame)
			{
				return function(){effectPlugin.renderFrame(frame);};
			}(effectPlugin, frame), currentDelay);
		}
		
		if (callback)
		{
			var currentDelay  = offsetTimeout + framesCount * timeOutDelay;
			timeoutsArray[framesCount + olderFrames] = setTimeout(callback, currentDelay);
		}

		effectInfo.setTimeoutList(timeoutsArray, effectPlugin.effectName);
		effectInfo.calculateEndDate(currentDelay, effectPlugin.effectName);
	}
	this.setEffectParameters = function(effectPlugin, parameters)
	{
		effectPlugin.parameters = new Array();
		if (effectPlugin.defaults)
		{
			effectPlugin.parameters = effectPlugin.defaults;
		}
		for (var index in parameters)
		{
			effectPlugin.parameters[index] = parameters[index];
		}
	}
	this.registerEffectInfo = function(effectName, element)
	{
		if (!element.artWebEffects)
		{
			element.artWebEffects = new effectsInfo();
		}
		element.artWebEffects.register(effectName);
		
		return element.artWebEffects;
	}
	this.getEffectPlugin = function(effectName, element)
	{
		var newEffect = false;
		try
		{
			newEffect = eval('new artWebEffect_'+effectName);
			newEffect.effectName = effectName;
			newEffect.element = element;
		}
		catch(error)
		{
			alert('Effect "'+ effectName +'" load error');
		}
		return newEffect;
	}
	
	this.fps = 50;
	this.timeOutDelay = 1000 / this.fps;
}

function effectsInfo()
{
	this.register = function(effectName)
	{
		if (!this.effects[effectName])
		{
			this.effects[effectName] = new Array();
		}
		if (!this.effects[effectName].timeoutList)
		{
			this.effects[effectName].timeoutList = new Array();
		}
		if (!this.effects[effectName].endDate)
		{
			this.calculateEndDate(0, effectName);
		}
	}
	this.calculateEndDate = function(offsetValue, effectName)
	{
		var offsetDate = new Date();
		
		offsetDate.setTime(parseInt(offsetDate.getTime() + offsetValue));
		
		
		this.effects[effectName].endDate = offsetDate;
	}
	this.getOffsetTimeout = function(effectName)
	{
		var resultOffset = 0;
		var nowDate = new Date();
		var endDate = this.effects[effectName].endDate;
		
		if (nowDate < endDate)
		{
			resultOffset = endDate.getTime() - nowDate.getTime();
		}
		return resultOffset;
	}
	this.getTimeoutList = function(effectName)
	{
		try
		{
			var timeoutList = this.effects[effectName].timeoutList;
		}
		catch(error)
		{
			var timeoutList = false;
		}
		return timeoutList;
	}
	this.setTimeoutList = function(timeoutList, effectName)
	{
		this.effects[effectName].timeoutList = timeoutList;
	}
	this.clearTimeOuts = function(effectName)
	{
		var timeOutsList = this.getTimeoutList(effectName);
		for (var index in timeOutsList)
		{
			clearTimeout(timeOutsList[index]);
		}
		timeOutsList = new Array();
		this.setTimeoutList(timeOutsList, effectName);
		
		this.calculateEndDate(0, effectName);
	}
	
	this.effects = new Array();
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebGallery(imagesUrlList)
{
	this.registerImagesUrls = function()
	{		
		for (var index in instance.incomingImageUrls)
		{
			if (document.getElementById(index))
			{
				imageElement = document.getElementById(index);
				addHandler(imageElement, "click", instance.showClickedImage);
				instance.imagesUrlList[index] = instance.incomingImageUrls[index];
			}
		}
		instance.createLeftSide();
		instance.createRightSide();
		instance.createPreviousButton();
		instance.createNextButton();
		instance.createCloseButton();
	}
	this.createLeftSide = function()
	{
		var leftSide = document.createElement('div');
		leftSide.className = 'artWebGalleryLeftSide';
		addHandler(leftSide, "click", this.showPreviousImage);
		addHandler(leftSide, "mouseover", this.showPreviousButton);
		addHandler(leftSide, "mouseout", this.hidePreviousButton);
		document.body.appendChild(leftSide);
		this.leftSide = leftSide;
	}
	this.createPreviousButton = function()
	{
		var previousButton = document.createElement('div');
		previousButton.className = 'artWebGalleryPrevious';
		this.leftSide.appendChild(previousButton);
		this.previousButtonElement = previousButton;
	}
	this.createRightSide = function()
	{
		var rightSide = document.createElement('div');
		rightSide.className = 'artWebGalleryRightSide';
		addHandler(rightSide, "click", this.showNextImage);
		addHandler(rightSide, "mouseover", this.showNextButton);
		addHandler(rightSide, "mouseout", this.hideNextButton);
		document.body.appendChild(rightSide);
		this.rightSide = rightSide;
	}
	this.createNextButton = function()
	{	
		var nextButton = document.createElement('div');
		nextButton.className = 'artWebGalleryNext';
		this.rightSide.appendChild(nextButton);
		this.nextButtonElement = nextButton;
	}
	this.createCloseButton = function()
	{	
		var closeButton = document.createElement('div');
		closeButton.className = 'artWebGalleryClose';
		addHandler(closeButton, "click", this.hideGallery);
		document.body.appendChild(closeButton);
		this.closeButtonElement = closeButton;
	}
	this.showClickedImage = function(event)
	{
		var clickedImage = getEventTarget(event);
		instance.currentImageId = clickedImage.id;
		instance.showGallery();
	}
	this.showGallery = function(event)
	{
		instance.status = 'visible';
		artWebDarkLayer.showLayer(instance.hideGallery, instance.checkCurrentImage);
		instance.closeButtonElement.style.display = 'block';
	}
	this.showNextImage = function(event)
	{
		cancelBubbling(event);
		instance.hideCurrentImage();
		
		instance.currentImageId = instance.nextImageId;
		instance.checkCurrentImage();
	}
	this.showPreviousImage = function(event)
	{
		cancelBubbling(event);
		instance.hideCurrentImage();
		
		instance.currentImageId = instance.previousImageId;
		instance.checkCurrentImage();
	}
	this.checkCurrentImage = function()
	{
		var currentImageId = instance.currentImageId;
		if (!instance.imagesElementsList[currentImageId])
		{
			instance.originalCursor = instance.getCursorValue(document.documentElement);
			document.documentElement.style.cursor = 'wait';
			var fullImageUrl = instance.imagesUrlList[currentImageId];
			var newImage = document.createElement('img');
			newImage.src = fullImageUrl;
			newImage.style.position = 'absolute';
			newImage.style.zIndex = '1000';
			opacityHandler.setOpacity(newImage, 0);
			document.body.appendChild(newImage);

			instance.imagesElementsList[currentImageId] = newImage;
		}
		else
		{
			opacityHandler.setOpacity(instance.imagesElementsList[currentImageId], 0);
			instance.imagesElementsList[currentImageId].style.display = 'block';
		}
		
		if (!instance.imagesElementsList[currentImageId].complete)
		{
			instance.preloadTimeoutID = setTimeout(function(){instance.checkCurrentImage()}, 100);
		}
		else
		{
			document.documentElement.style.cursor = instance.originalCursor;
			instance.renderCurrentImage();
		}
	}
	this.renderCurrentImage = function()
	{
		var imageElement = this.imagesElementsList[this.currentImageId];
		
		var imageWidth = imageElement.offsetWidth;
		var imageHeight = imageElement.offsetHeight;
		var aspectRatio = imageWidth/imageHeight;
		
		if (window.pageYOffset)
		{
			var viewPortLeft = window.pageXOffset;
			var viewPortTop = window.pageYOffset;
		}
		else
		{
			var viewPortLeft = document.documentElement.scrollLeft;
			var viewPortTop = document.documentElement.scrollTop;
		}
		
		var viewPortWidth = document.documentElement.offsetWidth;
		var viewPortHeight = document.documentElement.offsetHeight;
		
		var resizedWidth = imageWidth;
		var resizedHeight = imageHeight;
		if (resizedWidth > viewPortWidth * this.imageProportion)
		{
			resizedWidth = viewPortWidth * this.imageProportion;
			resizedHeight = resizedWidth/aspectRatio;
		}
		if (resizedHeight > viewPortHeight * this.imageProportion)
		{
			resizedHeight = viewPortHeight * this.imageProportion;
			resizedWidth = resizedHeight*aspectRatio;
		}
		var positionLeft = viewPortLeft + (viewPortWidth - resizedWidth) / 2;
		var positionTop = viewPortTop + (viewPortHeight - resizedHeight) / 2;
		
		imageElement.style.width = resizedWidth + 'px';
		imageElement.style.height = resizedHeight + 'px';
		imageElement.style.top = positionTop + 'px';
		imageElement.style.left = positionLeft + 'px';
		imageElement.style.opacity = '0';
		
		this.checkButtons();
		
		var parameters = {end:1, step: instance.opacityStep};
		artWebEffectsManager.startEffect('opacity', imageElement, parameters);
	}
	this.checkButtons = function()
	{
		var previousElement = null;
		var nextElement = null;
		var currentElement = null;
		var currentImageId = this.currentImageId;
		
		for (var index in this.imagesUrlList)
		{
			if (currentImageId == index)
			{
				currentElement = index;
			}
			else if(nextElement == null && currentElement != null)
			{
				nextElement = index;
			}
			
			if (currentElement == null)
			{
				previousElement = index;
			}
		}
		var imageElement = this.imagesElementsList[currentImageId];
		var imageElementLeft = imageElement.offsetLeft;
		var imageElementTop = imageElement.offsetTop;
		var imageElementWidth = imageElement.offsetWidth;
		var imageElementHeight = imageElement.offsetHeight;
		
		var leftSide = this.leftSide;
		var rightSide = this.rightSide;
		var previousButtonElement = this.previousButtonElement;
		var nextButtonElement = this.nextButtonElement;
		var closeButtonElement = this.closeButtonElement;
		
		if (previousElement != null)
		{
			this.previousImageId = previousElement;
			
			leftSide.style.left = imageElementLeft + 'px';
			leftSide.style.top = imageElementTop + 'px';
			leftSide.style.width = (imageElementWidth/2) + 'px';
			leftSide.style.height = imageElementHeight + 'px';
			leftSide.style.display = 'block';
			
			previousButtonElement.style.top = ((leftSide.offsetHeight - previousButtonElement.offsetHeight)/2) + 'px';
		}
		else
		{
			leftSide.style.display = 'none';
		}

		if (nextElement != null)
		{
			this.nextImageId = nextElement;
			
			rightSide.style.left = (imageElementLeft + imageElementWidth/2) + 'px';
			rightSide.style.top = imageElementTop + 'px';
			rightSide.style.width = (imageElementWidth/2) + 'px';
			rightSide.style.height = imageElementHeight + 'px';
			rightSide.style.display = 'block';
			nextButtonElement.style.top = ((rightSide.offsetHeight - nextButtonElement.offsetHeight)/2) + 'px';
		}
		else
		{
			rightSide.style.display = 'none';
		}
		
		closeButtonElement.style.top = (imageElementTop - 17) + 'px';
		closeButtonElement.style.left = (imageElementLeft + imageElementWidth - closeButtonElement.offsetWidth + 16) + 'px';
	}
	this.showPreviousButton = function()
	{
		instance.previousButtonElement.style.visibility = 'visible';
	}
	this.hidePreviousButton = function()
	{
		instance.previousButtonElement.style.visibility = 'hidden';
	}
	this.showNextButton = function()
	{
		instance.nextButtonElement.style.visibility = 'visible';
	}
	this.hideNextButton = function()
	{
		instance.nextButtonElement.style.visibility = 'hidden';
	}
	this.hideGallery = function()
	{
		instance.status = 'hidden';
		
		instance.hideCurrentImage();
		
		clearTimeout(instance.preloadTimeoutID);
		document.documentElement.style.cursor = instance.originalCursor;
		
		instance.leftSide.style.display = 'none';
		instance.rightSide.style.display = 'none';
		instance.closeButtonElement.style.display = 'none';
	}
	this.hideCurrentImage = function()
	{
		var imageElement = instance.imagesElementsList[instance.currentImageId];
		var parameters = {end:0, step: instance.opacityStep};
		artWebEffectsManager.startEffect('opacity', imageElement, parameters, function(){instance.afterFadeOut(imageElement)});
	}
	this.afterFadeOut = function(imageElement)
	{
		imageElement.style.display = 'none';
		if (instance.status == 'hidden')
		{
			artWebDarkLayer.hideLayer();
		}
	}
	this.getCursorValue = function(element)
	{
		var value = null;
		if (element.currentStyle)
		{
			value = element.currentStyle['cursor'];
		}
		else if (window.getComputedStyle)
		{
			value = document.defaultView.getComputedStyle(element, null).getPropertyValue('cursor');
		}
		return value;
	}
	var instance = this;
	this.incomingImageUrls = new Array();
	this.imagesUrlList = new Array();
	this.imagesElementsList = new Array();
	this.currentImageId = null;
	this.preloadTimeoutID = null;
	this.imageProportion = 0.8;
	this.opacityStep = 0.04;
	this.previousButtonElement = null;
	this.nextButtonElement = null;
	this.nextImageId = null;
	this.previousImageId = null;
	this.status = 'hidden';
	this.originalCursor = 'auto';
	if (imagesUrlList)
	{
		this.incomingImageUrls = imagesUrlList;
		this.registerImagesUrls();
	}
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

artWebMouseTracker = new function()
{
	this.init = function()
	{
		addHandler(document, 'mousemove', this.captureMouseCoordinates);
	}
	this.captureMouseCoordinates = function(event)
	{
		var mouseX = 0;
		var mouseY = 0;
		var IE = document.all?true:false;
		if (!IE)
		{
			mouseX = event.pageX;
			mouseY = event.pageY;
		}
		else
		{
			mouseX = window.event.clientX + document.documentElement.scrollLeft;
			mouseY = window.event.clientY + document.documentElement.scrollTop;
		}
		
		if (mouseX < 0)
		{
			mouseX = 0;
		}
		if (mouseY < 0)
		{
			mouseY = 0;
		}
		
		thisObj.mouseX = mouseX;
		thisObj.mouseY = mouseY;
	}
	this.checkMouseOver = function(domElement)
	{
		var currentMouseX = this.mouseX;
		var currentMouseY = this.mouseY;
		
		var elementCoordinates = this.getElementCoordinates(domElement);
		
		var elementX = elementCoordinates[0];
		var elementY = elementCoordinates[1];
		
		var elementWidth = domElement.offsetWidth;
		var elementHeight = domElement.offsetHeight;
		
		var check = false;
		if ((currentMouseX >= elementX) && (currentMouseX < elementX + elementWidth))
		{
			if ((currentMouseY >= elementY) && (currentMouseY < elementY + elementHeight))
			{
				check = true;
			}
		}
		return check;
	}
	this.getDelta = function(event)
	{
		var delta = 0;
		if (event.wheelDelta) 
		{
			delta = event.wheelDelta/120;
		} 
		else if (event.detail) 
		{ 
			delta = -event.detail/3;
		}
		return delta;
	}
	this.getElementCoordinates = function(domElement) 
	{
		var curleft = curtop = 0;
		if (domElement.offsetParent)
		{
			var curleft = domElement.offsetLeft;
			var curtop = domElement.offsetTop;
			while (domElement = domElement.offsetParent) 
			{
				curleft += domElement.offsetLeft - domElement.scrollLeft;
				curtop += domElement.offsetTop - domElement.scrollTop;
			}
		}
		return [curleft,curtop];
	}

	
	var thisObj = this;
	this.mouseX = 0;
	this.mouseY = 0;
	
	this.init();
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function artWebScrollBar(scrollContent, scrollBar, scrollUp, scrollDown)
{
	this.checkScrollVisibility = function()
	{
		var scrollVisible = false;
		if (this.scrollContent.offsetHeight < this.scrollContent.scrollHeight)
		{
			scrollVisible = true;
		}
		return scrollVisible;
	}
	this.showScrollBar = function()
	{
		this.scrollContent.style.overflow = 'hidden';
		var scrollBar = this.getScrollBar();
		instance.calculateScrollBarSliderTop();
		scrollBar.style.display = 'block';
	}
	this.getScrollBar = function()
	{
		if (!this.scrollBarElement)
		{
			this.scrollBarElement = this.createScrollBar();
			this.calculateScrollBarDimensions();
		}
		return this.scrollBarElement;
	}
	this.getScrollBarDown = function()
	{
		if (!this.scrollBarDownElement)
		{
			this.scrollBarDownElement = this.createScrollBarDown();
		}
		return this.scrollBarDownElement;
	}
	this.getScrollBarUp = function()
	{
		if (!this.scrollBarUpElement)
		{
			this.scrollBarUpElement = this.createScrollBarUp();
		}
		return this.scrollBarUpElement;
	}
	this.getScrollBarTrack = function()
	{
		if (!this.scrollBarTrackElement)
		{
			this.scrollBarTrackElement = this.createScrollBarTrack();
		}
		return this.scrollBarTrackElement;
	}
	this.getScrollBarSlider = function()
	{
		if (!this.scrollBarSliderElement)
		{
			this.scrollBarSliderElement = this.createScrollBarSlider();
		}
		return this.scrollBarSliderElement;
	}
	this.createScrollBar = function()
	{
		var scrollBarElement = document.createElement('div');
		scrollBarElement.className = 'artWebScrollBar';
		
		var scrollUp = this.getScrollBarUp();
		var scrollTrack = this.getScrollBarTrack();
		var scrollDown = this.getScrollBarDown();
		
		scrollBarElement.appendChild(scrollUp);
		scrollBarElement.appendChild(scrollTrack);
		scrollBarElement.appendChild(scrollDown);
		
		this.scrollContent.parentNode.appendChild(scrollBarElement);
		return scrollBarElement;
	}
	this.recalculateScrollBar = function()
	{
		instance.calculateScrollBarDimensions();
		instance.calculateScrollBarSliderTop();
	}
	this.calculateScrollBarSliderTop = function()
	{
		instance.scroll(1, 0);
	}
	this.calculateScrollBarDimensions = function()
	{
		var scrollBarElement = instance.scrollBarElement;
		scrollBarElement.style.left = (instance.scrollContent.offsetLeft + instance.scrollContent.offsetWidth - scrollBarElement.offsetWidth) + 'px';
		scrollBarElement.style.height = instance.scrollContent.offsetHeight + 'px';
		scrollBarElement.style.top = instance.scrollContent.offsetTop + 'px';
	}
	this.createScrollBarUp = function()
	{
		var scrollBarUpElement = document.createElement('div');
		scrollBarUpElement.className = 'artWebScrollBarUp';
		return scrollBarUpElement;
	}
	this.createScrollBarDown = function()
	{
		var scrollBarDownElement = document.createElement('div');
		scrollBarDownElement.className = 'artWebScrollBarDown';
		return scrollBarDownElement;
	}
	this.createScrollBarTrack = function()
	{
		var scrollBarTrackElement = document.createElement('div');
		scrollBarTrackElement.className = 'artWebScrollBarTrack';
		
		var scrollBarSliderElement = this.getScrollBarSlider();
		scrollBarTrackElement.appendChild(scrollBarSliderElement);
		
		return scrollBarTrackElement;
	}
	this.createScrollBarSlider = function()
	{
		var scrollBarSliderElement = document.createElement('div');
		scrollBarSliderElement.className = 'artWebScrollBarSlider';
		
		return scrollBarSliderElement;
	}
	this.init = function()
	{
		if (!window.mouseTracker)
		{
			window.mouseTracker = new artWebMouseTracker();
		}

		if (this.checkScrollVisibility())
		{
			this.showScrollBar();
			addHandler(document, 'mousedown', this.checkScrollBarDrag);
			addHandler(document, 'mousewheel', this.catchMouseWheel);
			addHandler(window, 'resize', this.recalculateScrollBar);
		}
	}
	
	this.catchMouseWheel = function(event)
	{
		if (window.mouseTracker.checkMouseOver(instance.scrollContent))
		{
			var delta = window.mouseTracker.getDelta(event);
			if (delta > 0)
			{
				instance.scrollPage(-1, delta/20);
			}
			else if (delta < 0)
			{
				instance.scrollPage(1, delta/-20);
			}
		}
	}
	this.checkScrollBarDrag = function()
	{
		if (window.mouseTracker.checkMouseOver(instance.getScrollBarSlider()))
		{
			instance.startDrag();
		}
		else if (window.mouseTracker.checkMouseOver(instance.getScrollBarTrack()))
		{
			instance.trackClick();
		}
		else if (window.mouseTracker.checkMouseOver(instance.getScrollBarUp()))
		{
			instance.scrollLine(-1);
		}
		else if (window.mouseTracker.checkMouseOver(instance.getScrollBarDown()))
		{
			instance.scrollLine(1);
		}
	}
	this.trackClick = function()
	{
		var sliderTop = this.scrollBarSliderElement.offsetTop;
		var clickY = window.mouseTracker.mouseY;
		var trackerY = window.mouseTracker.getElementCoordinates(this.scrollBarTrackElement)[1];
		var clickTop = clickY - trackerY;
		
		var direction = 1;
		if (clickTop <= sliderTop)
		{
			direction = -1;
		}
		this.scrollPage(direction);
	}
	this.scrollPage = function(direction)
	{
		this.scroll(direction, 1);
	}
	this.scroll = function(direction, percentage)
	{
		var sliderHeight = this.scrollBarSliderElement.offsetHeight;
		var trackHeight = this.scrollBarTrackElement.offsetHeight;
		var scrollHeight = this.scrollContent.scrollHeight;
		var scrollTop = this.scrollContent.scrollTop;
		var viewHeight = this.scrollContent.offsetHeight;
		var newY = (scrollTop + viewHeight*direction*percentage)/(scrollHeight - viewHeight)*(trackHeight - sliderHeight);
		
		newY = this.validateNewY(newY);
		
		this.scrollBarSliderElement.style.top = newY + 'px';
		this.synchronizeScrolls();
	}
	this.scrollLine = function(direction)
	{
		this.scrollPage(direction, 0.2);
	}
	this.startDrag = function()
	{
		this.disableDocumentSelection();
		
		this.sliderStartY = this.scrollBarSliderElement.offsetTop;
		this.mouseStartY = window.mouseTracker.mouseY;
		addHandler(document, 'mouseup', this.endDrag);
		addHandler(document, 'mousemove', this.dragSlider);
	}
	this.disableDocumentSelection = function()
	{
		addHandler(document.documentElement, 'selectstart', this.selectionDisableHelper);
		document.documentElement.style.userSelect = 'none';
		document.documentElement.style.MozUserSelect = 'none';
	}
	this.enableDocumentSelection = function()
	{
		removeHandler(document.documentElement, 'selectstart', this.selectionDisableHelper);
		document.documentElement.style.userSelect = 'text';
		document.documentElement.style.MozUserSelect = 'text';
	}
	this.selectionDisableHelper = function()
	{
		return false;
	}
	this.dragSlider = function()
	{
		var mouseCurrentY = window.mouseTracker.mouseY;
		var newY = (instance.sliderStartY + mouseCurrentY - instance.mouseStartY);
		newY = instance.validateNewY(newY);
		instance.scrollBarSliderElement.style.top = newY + 'px';
		instance.synchronizeScrolls();
	}
	this.validateNewY = function(newY)
	{
		if (newY < 0) 
		{
			newY = 0;
		}
		else if (newY > this.scrollBarTrackElement.offsetHeight - this.scrollBarSliderElement.offsetHeight)
		{
			newY = this.scrollBarTrackElement.offsetHeight - this.scrollBarSliderElement.offsetHeight;
		}
		return newY;
	}
	this.endDrag = function()
	{
		removeHandler(document, 'mousemove', instance.dragSlider);
		instance.enableDocumentSelection();
	}
	this.synchronizeScrolls = function()
	{
		var sliderTop = this.scrollBarSliderElement.offsetTop;
		var sliderHeight = this.scrollBarSliderElement.offsetHeight;
		var trackHeight = this.scrollBarTrackElement.offsetHeight;
		var scrollHeight = this.scrollContent.scrollHeight;
		var viewHeight = this.scrollContent.offsetHeight;
		
		var newScrollPosition = 0;
		
		newScrollPosition = (sliderTop/(trackHeight - sliderHeight)) * (scrollHeight - viewHeight);
		this.scrollContent.scrollTop = newScrollPosition;
		
	}
	var instance = this;
	this.scrollContent = scrollContent;
	this.scrollBarElement = false;
	this.scrollBarDownElement = false;
	this.scrollBarUpElement = false;
	this.scrollBarTrackElement = false;
	this.scrollBarSliderElement = false;
	this.sliderStartY = 0;
	this.init();
}
function attachArtWebScrollBar(element)
{
	element.scrollBar = new artWebScrollBar(element);
};
try 
{
  document.execCommand("BackgroundImageCache", false, true);
} 
catch(err) 
{
}

addHandler(window, "load", onloadFunctions);

function onloadFunctions()
{
	initMenu();
	initTopGallery();
	initReviews();
	initGallery();
	initFeedback()
	initMapElements()
}

function initMapElements()
{
	var mapButtons = _('.map_button');
	
	for (i = 0; i < mapButtons.length; i++)
	{
		var mapButtonObj = new mapButton(mapButtons[i]);
	}
}
function mapButton(element)
{
	this.click = function(event)
	{
		preventDefaultAction(event);
		
		instance.centerBlock = document.getElementById('centerblock_content');
		instance.mapElement.style.width = instance.centerBlock.offsetWidth + 'px';
		instance.mapElement.style.height = '0' + 'px';
		instance.mapElement.style.display = 'block';
		
		var parameters = {end: instance.centerBlock.offsetHeight, step: 0.5, acceleration: 2};
		artWebEffectsManager.startEffect('slide', instance.mapElement, parameters);
	}	
	this.clickClose = function(event)
	{
		preventDefaultAction(event);
		
		var parameters = {end: 0, step: 0.5, acceleration: 2};
		artWebEffectsManager.startEffect('slide', instance.mapElement, parameters, instance.closeMap);
	}	
	this.closeMap = function()
	{
		instance.mapElement.style.display = 'none';
	}
	this.init = function()
	{
		this.domElement = element;
		
		if (this.mapElement = document.getElementById('map_block'))
		{
			addHandler(this.domElement, 'click', this.click);
			
			this.mapElementClose = _('.map_button_close')[0];
			addHandler(this.mapElementClose, 'click', this.clickClose);
		}
	}
	var instance = this;
	this.init();
}
function initReviews()
{
	var reviewBlocks = _('.review_block');
	
	for (i = 0; i < reviewBlocks.length; i++)
	{
		var reviewBlockObj = new reviewSlides(reviewBlocks[i]);
	}
}
function reviewSlides(element)
{
	this.init = function()
	{
		this.element = element;
		var reviews = _('.review_item', this.element);
		for (var i in reviews)
		{
			if (reviews[i].tagName)
			{
				var galleryReview = reviews[i];
				
				opacityHandler.setOpacity(galleryReview, 0);
				galleryReview.style.display = 'block';
				
				this.reviewsCollection.push(galleryReview);
			}
		}
		this.startAnimation();
	}
	this.startAnimation = function()
	{
		this.currentQueryNumber = 0;
		if (this.reviewsCollection.length > 0)
		{
			var reviewsCollection = this.reviewsCollection;
			while(reviewsCollection.length > 0)
			{
				var index = Math.floor(Math.random()*reviewsCollection.length);
				this.reviewsQuery.push(reviewsCollection[index]);
				reviewsCollection.splice(index,1);
			}
			this.startReview();
		}
	}
	this.startReview = function()
	{
		var currentReview = instance.reviewsQuery[instance.currentQueryNumber];
		opacityHandler.setOpacity(currentReview, 1);
		this.endSwitch();
	}
	this.switchReview = function()
	{
		var currentReview = instance.reviewsQuery[instance.currentQueryNumber];
		var newQueryNumber = instance.currentQueryNumber + 1;
		if (newQueryNumber >= instance.reviewsQuery.length)
		{
			newQueryNumber = 0;
		}
		var newReview = instance.reviewsQuery[newQueryNumber];
		
		instance.currentQueryNumber = newQueryNumber;
		
		var parameters = {start: 0, end: 1, step: instance.showSpeed};
		artWebEffectsManager.startEffect('opacity', newReview, parameters, instance.endSwitch);
		
		var parameters = {start: 1, end: 0, step: instance.showSpeed};
		artWebEffectsManager.startEffect('opacity', currentReview, parameters);
	}
	this.endSwitch = function()
	{
		setTimeout(instance.switchReview, instance.showDelay);
	}
	var instance = this;
	this.reviewsCollection = new Array();
	this.reviewsQuery = new Array();
	this.currentQueryNumber = null;
	this.previousQueryNumber = null;
	this.showDelay = 5500;
	this.showSpeed = 0.02;
	this.init();
}
function initTopGallery()
{
	if (topGalleryElement = document.getElementById('header_gallery'))
	{
		var topGalleryObj = new topGallery(topGalleryElement);
	}
}
function topGallery(element)
{
	this.click = function()
	{
		document.location.href = instance.overlayButton.href;
	}
	this.mouseOver = function(event)
	{
		var parameters = {end: 1, step: 0.2};
		artWebEffectsManager.startEffect('opacity', instance.overlayButton, parameters);
	}
	this.mouseOut = function(event)
	{
		var parameters = {start: 1, end: 0, step: 0.2};
		artWebEffectsManager.queueEffect('opacity', instance.overlayButton, parameters);
	}
	this.init = function()
	{
		this.element = element;
		var images = _('img', this.element);
		for (var i in images)
		{
			if (images[i].tagName)
			{
				var galleryImage = images[i];
				
				if (galleryImage.className != 'header_gallery_first')
				{
					opacityHandler.setOpacity(galleryImage, 0);
					galleryImage.style.display = 'none';
				}
				
				
				this.imagesCollection.push(galleryImage);
			}
		}
		this.overlayElement = _('.header_overlay')[0];
		this.overlayButton = _('a', this.overlayElement)[0];
		opacityHandler.setOpacity(this.overlayButton, 0);
		this.overlayButton.style.display = 'block';
		
		this.startAnimation();
		addHandler(this.overlayElement, 'click', this.click);
		addHandler(this.overlayElement, "mouseenter", this.mouseOver);
		addHandler(this.overlayElement, "mouseleave", this.mouseOut);
	}
	this.startAnimation = function()
	{
		this.currentQueryNumber = 0;
		if (this.imagesCollection.length > 0)
		{
			var imagesCollection = this.imagesCollection;
			while(imagesCollection.length > 0)
			{
				var index = Math.floor(Math.random()*imagesCollection.length);
				this.imagesQuery.push(imagesCollection[index]);
				if (imagesCollection[index].className == 'header_gallery_first')
				{
					this.currentQueryNumber = this.imagesQuery.length - 1;
				}
				imagesCollection.splice(index,1);
			}
			this.endSwitch();
		}
	}
	this.switchImage = function()
	{
		var currentImage = instance.imagesQuery[instance.currentQueryNumber];
		var newQueryNumber = instance.currentQueryNumber + 1;
		if (newQueryNumber >= instance.imagesQuery.length)
		{
			newQueryNumber = 0;
		}
		var newImage = instance.imagesQuery[newQueryNumber];
		
		currentImage.style.zIndex = '1';
		newImage.style.zIndex = '2';
		newImage.style.display = 'block';
		
		instance.previousQueryNumber = instance.currentQueryNumber;
		instance.currentQueryNumber = newQueryNumber;
		
		var parameters = {start: 0, end: 1, step: instance.showSpeed};
		artWebEffectsManager.startEffect('opacity', newImage, parameters, instance.endSwitch);
	}
	this.endSwitch = function()
	{
		if (instance.previousQueryNumber != null)
		{
			var previousImage = instance.imagesQuery[instance.previousQueryNumber];
			previousImage.style.zIndex = '0';
			opacityHandler.setOpacity(previousImage, 0);
			previousImage.style.display = 'none';
		}
		setTimeout(instance.switchImage, instance.showDelay);
	}
	var instance = this;
	this.imagesCollection = new Array();
	this.imagesQuery = new Array();
	this.currentQueryNumber = null;
	this.previousQueryNumber = null;
	this.showDelay = 2000;
	this.showSpeed = 0.007;
	this.init();
}
function initGallery()
{
	var urlList = new Array();
	var links = _('.gallery_item');
	if (links.length > 0)
	{
		for (var i in links)
		{
			var linkObj = links[i];
			if (linkObj.href)
			{
				var url = linkObj.href;
				var imageObject = _('.gallery_image_color', linkObj)[0];
				urlList[imageObject.id] = url;
				
				var galleryImageObj = new galleryImage(linkObj);
				addHandler(linkObj, 'click', function(event){preventDefaultAction(event);});
			}
		}
		
		var newGallery = new artWebGallery(urlList);
	}
}
function initFeedback()
{
	if (element = document.getElementById('feedback'))
	{
		var feedbackObj = new feedbackForm(element);
	}
}
function feedbackForm(element)
{
	this.submit = function()
	{
		instance.element.submit();
	}
	this.init = function()
	{
		var sendButton = _('.button', this.element)[0];
		addHandler(sendButton, 'click', this.submit);
	}
	var instance = this;
	this.element = element;
	this.init();
}
function initMenu()
{
	var menuList = _('.menu_item');
	for (index = 0; index < menuList.length; index++)
	{
		var menuElement = menuList[index];
		if (menuElement.className == 'menu_item')
		{
			var menuObject = new menuItem(menuElement);			
		}
	}
}
function menuItem(element)
{
	this.mouseOver = function(event)
	{
		var parameters = {end: 1, step: 0.1};
		artWebEffectsManager.startEffect('opacity', instance.activeElement, parameters);
	}
	this.mouseOut = function(event)
	{
		var parameters = {start: 1, end: 0, step: 0.1};
		artWebEffectsManager.queueEffect('opacity', instance.activeElement, parameters);
	}
	this.init = function()
	{
		this.domElement = element;
		this.activeElement = _('.menu_image_active', this.domElement)[0];
		opacityHandler.setOpacity(this.activeElement, 0);
		this.activeElement.style.display = 'block';
		
		addHandler(this.domElement, "mouseenter", this.mouseOver);
		addHandler(this.domElement, "mouseleave", this.mouseOut);
	}
	var instance = this;
	this.init();
}

function galleryImage(element)
{
	this.mouseOver = function(event)
	{
		var parameters = {end: 1, step: 0.2};
		artWebEffectsManager.startEffect('opacity', instance.activeElement, parameters);
	}
	this.mouseOut = function(event)
	{
		var parameters = {start: 1, end: 0, step: 0.03};
		artWebEffectsManager.queueEffect('opacity', instance.activeElement, parameters);
	}
	this.init = function()
	{
		this.domElement = element;
		this.passiveElement = _('.gallery_image_bw', this.domElement.parentNode)[0];
		this.activeElement = _('.gallery_image_color', this.domElement.parentNode)[0];
		opacityHandler.setOpacity(this.activeElement, 0);
		this.activeElement.style.left = this.passiveElement.offsetLeft+'px';
		this.activeElement.style.top = this.passiveElement.offsetTop+'px';
		this.activeElement.style.visibility = 'visible';
		
		addHandler(this.domElement, "mouseenter", this.mouseOver);
		addHandler(this.domElement, "mouseleave", this.mouseOut);
	}
	var instance = this;
	this.init();
}
function debug(text)
{
	document.getElementById('logo_block').innerHTML = text;
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

function getEventTarget(event) 
{
	var eventElement = null;
	if (event.target)
	{
		eventElement = event.target;
	}
	else if (event.srcElement)
	{
		eventElement = event.srcElement;
	}
	return eventElement;
}
function addHandler(object, event, handler) 
{
	if (object.addEventListener)
	{
		if (event === 'mouseenter')
		{ 
			object.addEventListener('mouseover', mouseEnter(handler), false); 
		}
		else if (event === 'mouseleave')
		{
			object.addEventListener('mouseout', mouseEnter(handler), false); 
		}
		else if (event == 'mousewheel') 
		{
			object.addEventListener('DOMMouseScroll', handler, false);
		}
		object.addEventListener(event, handler, false);
	} 
	else if (object.attachEvent) 
	{
		object.attachEvent('on' + event, handler);
	}
}
function mouseEnter(handler)
{
	return function(event)
	{
		var relTarget = event.relatedTarget;
		if (this === relTarget || isAChildOf(this, relTarget))
		{
			return; 
		}
		handler.call(this, event);
	}
}
function isAChildOf(_parent, _child)
{
	if (_parent === _child) 
	{ 
		return false; 
	}
	while (_child && _child !== _parent)
	{ 
		_child = _child.parentNode; 
	}
	
	return _child === _parent;
}
function fireEvent(object, eventName)
{
	if (document.createEventObject)
	{
		var eventObject = document.createEventObject();
		return object.fireEvent('on'+eventName, eventObject)
	}
	else
	{
		var eventObject = document.createEvent("HTMLEvents");
		eventObject.initEvent(eventName, true, true);
		return !object.dispatchEvent(eventObject);
	}
}
function removeHandler(object, event, handler) 
{
	if (object.removeEventListener) 
	{
		if (event == 'mousewheel') 
		{
			object.removeEventListener('DOMMouseScroll', handler, false);
		}
		object.removeEventListener(event, handler, false);
	}
	else if (object.detachEvent) 
	{
		object.detachEvent('on' + event, handler);
	}
}
function cancelBubbling(event)
{
	event.cancelBubble = true;
	if (event.stopPropagation) 
	{
		event.stopPropagation();
	}
}
function preventDefaultAction(event)
{
	if (event.preventDefault)
	{
		event.preventDefault();
	}
	event.returnValue = false;
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  This file is a part of ArtWeb effects manager, created by ArtWeb OÜ. *
*                                                                       *
*  Any unauthorized use of this file is strictly prohibited.            *
*  For all questions concerning the usage of this code please send an   * 
*  email to info@art-web.ee or contact us on http://www.art-web.ee      *
*                                                                       *
/* --------------------------------------------------------------------*/

var opacityHandler = new function()
{
	this.getOpacityType = function()
	{
		if (typeof(document.body.style.opacity) == 'string')
		{
			instance.opacityType = 'opacity';
		}
		else if (typeof(document.body.style.MozOpacity) == 'string')
		{
			instance.opacityType = 'MozOpacity';
		}
		else if (typeof(document.body.style.KhtmlOpacity) == 'string')
		{
			instance.opacityType = 'KhtmlOpacity';
		}
		else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1] >= 5.5 )
		{
			instance.opacityType =  'filter';
		}
	}
	this.setOpacity = function(element, opacity)
	{
		if (!this.opacityType)
		{
			this.getOpacityType();
		}
		if (opacity < 0)
		{
			opacity = 0;
		}
		if (this.opacityType == "filter")
		{
			try
			{
				element.filters.item('DXImageTransform.Microsoft.alpha').opacity = opacity*100;
			}
			catch(error)
			{
				element.style.filter += "progid:DXImageTransform.Microsoft.Alpha(style=0, opacity="+ Math.round(opacity*100) +", FinishOpacity="+ Math.round(opacity*100) +")";
			}
		}
		else
		{
			element.style[this.opacityType] = opacity;
		}
	}
	this.getOpacity = function(element)
	{
		if (element.filters)
		{
			try 
			{
				opacity = element.filters.item("DXImageTransform.Microsoft.Alpha").opacity / 100;
			}
			catch(error)
			{
				opacity = 1;
			}
		}
		else if (window.getComputedStyle)
		{
			opacity = document.defaultView.getComputedStyle(element, null).getPropertyValue(this.opacityType);
		}
		return parseFloat(opacity);
	}

	var instance = this;
	this.opacityType = false;
	addHandler(window, "load", this.getOpacityType);
};
/**/
(function(){var _=function(selector,root,noCache){if(_.c[selector]&&!noCache&&!root){return _.c[selector]}noCache=noCache||!!root;root=root||_.doc;var sets=[];if(/^[\w[:#.][\w\]*^|=!]*$/.test(selector)){var idx=0;switch(selector.charAt(0)){case"#":idx=selector.slice(1);sets=_.doc.getElementById(idx);if(_.browser.ie&&sets.id!==idx){sets=_.doc.all[idx]}sets=sets?[sets]:[];break;case".":var klass=selector.slice(1);if(_.k){sets=(idx=(sets=root.getElementsByClassName(klass)).length)?sets:[]}else{klass=" "+klass+" ";var nodes=root.getElementsByTagName("*"),i=0,node;while(node=nodes[i++]){if((" "+node.className+" ").indexOf(klass)!=-1){sets[idx++]=node}}sets=idx?sets:[]}break;case":":var node,nodes=root.getElementsByTagName("*"),i=0,ind=selector.replace(/[^(]*\(([^)]*)\)/,"$1"),mod=selector.replace(/\(.*/,"");while(node=nodes[i++]){if(_.mods[mod]&&!_.mods[mod](node,ind)){sets[idx++]=node}}sets=idx?sets:[];break;case"[":var nodes=root.getElementsByTagName("*"),node,i=0,attrs=/\[([^!~^*|$ [:=]+)([$^*|]?=)?([^ :\]]+)?\]/.exec(selector),attr=attrs[1],eql=attrs[2]||"",value=attrs[3];while(node=nodes[i++]){if(_.attr[eql]&&(_.attr[eql](node,attr,value)||(attr==="class"&&_.attr[eql](node,"className",value)))){sets[idx++]=node}}sets=idx?sets:[];break;default:sets=(idx=(sets=root.getElementsByTagName(selector)).length)?sets:[];break}}else{if(_.q&&selector.indexOf("!=")==-1){sets=root.querySelectorAll(selector)}else{var groups=selector.split(/ *, */),gl=groups.length-1,concat=!!gl,group,singles,singles_length,single,i,ancestor,nodes,tag,id,klass,attr,eql,mod,ind,newNodes,idx,J,child,last,childs,item,h;while(group=groups[gl--]){if(!(nodes=_.c[group])||noCache){singles_length=(singles=group.replace(/(\([^)]*)\+/,"$1%").replace(/(\[[^\]]+)~/,"$1&").replace(/(~|>|\+)/," $1 ").split(/ +/)).length;i=0;ancestor=" ";nodes=[root];while(single=singles[i++]){if(single!==" "&&single!==">"&&single!=="~"&&single!=="+"&&nodes){single=single.match(/([^[:.#]+)?(?:#([^[:.#]+))?(?:\.([^[:.]+))?(?:\[([^!&^*|$[:=]+)([!$^*|&]?=)?([^:\]]+)?\])?(?:\:([^(]+)(?:\(([^)]+)\))?)?/);tag=single[1]||"*";id=single[2];klass=single[3]?" "+single[3]+" ":"";attr=single[4];eql=single[5]||"";mod=single[7];ind=mod==="nth-child"||mod==="nth-last-child"?/(?:(-?\d*)n)?(?:(%|-)(\d*))?/.exec(single[8]==="even"&&"2n"||single[8]==="odd"&&"2n%1"||!/\D/.test(single[8])&&"0n%"+single[8]||single[8]):single[8];newNodes=[];idx=J=0;last=i==singles_length;while(child=nodes[J++]){switch(ancestor){case" ":childs=child.getElementsByTagName(tag);h=0;while(item=childs[h++]){if((!id||item.id===id)&&(!klass||(" "+item.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!item.yeasss&&!(_.mods[mod]?_.mods[mod](item,ind):mod)){if(last){item.yeasss=1}newNodes[idx++]=item}}break;case"~":tag=tag.toLowerCase();while((child=child.nextSibling)&&!child.yeasss){if(child.nodeType==1&&(tag==="*"||child.nodeName.toLowerCase()===tag)&&(!id||child.id===id)&&(!klass||(" "+child.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!child.yeasss&&!(_.mods[mod]?_.mods[mod](child,ind):mod)){if(last){child.yeasss=1}newNodes[idx++]=child}}break;case"+":while((child=child.nextSibling)&&child.nodeType!=1){}if(child&&(child.nodeName.toLowerCase()===tag.toLowerCase()||tag==="*")&&(!id||child.id===id)&&(!klass||(" "+item.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!child.yeasss&&!(_.mods[mod]?_.mods[mod](child,ind):mod)){if(last){child.yeasss=1}newNodes[idx++]=child}break;case">":childs=child.getElementsByTagName(tag);i=0;while(item=childs[i++]){if(item.parentNode===child&&(!id||item.id===id)&&(!klass||(" "+item.className+" ").indexOf(klass)!=-1)&&(!attr||(_.attr[eql]&&(_.attr[eql](item,attr,single[6])||(attr==="class"&&_.attr[eql](item,"className",single[6])))))&&!item.yeasss&&!(_.mods[mod]?_.mods[mod](item,ind):mod)){if(last){item.yeasss=1}newNodes[idx++]=item}}break}}nodes=newNodes}else{ancestor=single}}}if(concat){if(!nodes.concat){newNodes=[];h=0;while(item=nodes[h]){newNodes[h++]=item}nodes=newNodes}sets=nodes.concat(sets.length==1?sets[0]:sets)}else{sets=nodes}}idx=sets.length;while(idx--){sets[idx].yeasss=sets[idx].nodeIndex=sets[idx].nodeIndexLast=null}}}return noCache?sets:_.c[selector]=sets};_.c=[];_.doc=document;_.win=window;_.attr={"":function(child,attr){return !!child.getAttribute(attr)},"=":function(child,attr,value){return(attr=child.getAttribute(attr))&&attr===value},"&=":function(child,attr,value){return(attr=child.getAttribute(attr))&&(new RegExp("(^| +)"+value+"($| +)").test(attr))},"^=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&!attr.indexOf(value)},"$=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&attr.indexOf(value)==attr.length-value.length},"*=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&attr.indexOf(value)!=-1},"|=":function(child,attr,value){return(attr=child.getAttribute(attr)+"")&&(attr===value||!!attr.indexOf(value+"-"))},"!=":function(child,attr,value){return !(attr=child.getAttribute(attr))||!(new RegExp("(^| +)"+value+"($| +)").test(attr))}};_.mods={"first-child":function(child){return child.parentNode.getElementsByTagName("*")[0]!==child},"last-child":function(child){var brother=child;while((brother=brother.nextSibling)&&brother.nodeType!=1){}return !!brother},root:function(child){return child.nodeName.toLowerCase()!=="html"},"nth-child":function(child,ind){var i=child.nodeIndex||0,a=ind[3]=ind[3]?(ind[2]==="%"?-1:1)*ind[3]:0,b=ind[1];if(i){return !((i+a)%b)}else{var brother=child.parentNode.firstChild;i++;do{if(brother.nodeType==1&&(brother.nodeIndex=++i)&&child===brother&&((i+a)%b)){return 0}}while(brother=brother.nextSibling);return 1}},"nth-last-child":function(child,ind){var i=child.nodeIndexLast||0,a=ind[3]?(ind[2]==="%"?-1:1)*ind[3]:0,b=ind[1];if(i){return !((i+a)%b)}else{var brother=child.parentNode.lastChild;i++;do{if(brother.nodeType==1&&(brother.nodeLastIndex=i++)&&child===brother&&((i+a)%b)){return 0}}while(brother=brother.previousSibling);return 1}},empty:function(child){return !!child.firstChild},parent:function(child){return !child.firstChild},"only-child":function(child){return child.parentNode.getElementsByTagName("*").length!=1},checked:function(child){return !child.checked},lang:function(child,ind){return child.lang!==ind&&_.doc.documentElement.lang!==ind},enabled:function(child){return child.disabled||child.type==="hidden"},disabled:function(child){return !child.disabled},selected:function(elem){child.parentNode.selectedIndex;return !child.selected}};_.isReady=0;_.ready=function(fn){if(typeof fn==="function"){if(!_.isReady){_.ready.list[_.ready.list.length]=fn}else{fn()}}else{if(!_.isReady){_.isReady=1;var idx=_.ready.list.length;while(idx--){_.ready.list[idx]()}}}};_.ready.list=[];_.bind=function(element,event,fn){if(typeof element==="string"){var elements=_(element),idx=0;while(element=elements[idx++]){_.bind(element,event,fn)}}else{event="on"+event;var handler=element[event];if(handler){element[event]=function(){handler();fn()}}else{element[event]=fn}}};_.ua=navigator.userAgent.toLowerCase();_.q=!!_.doc.querySelectorAll;_.k=!!_.doc.getElementsByClassName;_.browser={safari:_.ua.indexOf("webkit")!=-1,opera:_.ua.indexOf("opera")!=-1,ie:_.ua.indexOf("msie")!=-1&&_.ua.indexOf("opera")==-1,mozilla:_.ua.indexOf("mozilla")!=-1&&(_.ua.indexOf("compatible")+_.ua.indexOf("webkit")==-2)};if(_.doc.addEventListener&&!_.browser.opera){_.doc.addEventListener("DOMContentLoaded",_.ready,false)}if(_.browser.ie&&_.win==top){(function(){if(_.isReady){return}try{_.doc.documentElement.doScroll("left")}catch(e){setTimeout(arguments.callee);return}_.ready()})()}if(_.browser.opera){_.doc.addEventListener("DOMContentLoaded",function(){if(_.isReady){return}var i=0,ss;while(ss=_.doc.styleSheets[i++]){if(ss.disabled){setTimeout(arguments.callee);return}}_.ready()},false)}if(_.browser.safari){(function(){if(_.isReady){return}if((_.doc.readyState!=="loaded"&&_.doc.readyState!=="complete")||_.doc.styleSheets.length!==_("style,link[rel=stylesheet]").length){setTimeout(arguments.callee);return}_.ready()})()}_.bind(_.win,"load",_.ready);_.modules={yass:[]};_.load=function(aliases,text){var loader=function(alias,text,tries,aliases){if(!(tries%100)&&_.modules[alias].status<2){_.modules[alias].status=0;if(!(tries-=1000)){_.modules[alias].status=-1;return}}switch(_.modules[alias].status){case 2:try{eval(text)}catch(a){}case 3:case -2:break;default:_.modules[alias].status=1;var script=_.doc.createElement("script");script.src=alias.indexOf(".js")+alias.indexOf("/")!=-2?alias:_.base+"yass."+alias+".js";script.type="text/javascript";script.text=text||"";script.title=alias;script.onreadystatechange=function(){if(this.readyState==="complete"){_.postloader(this)}};script.onload=function(e){_.postloader(e.srcElement||e.target)};_("head")[0].appendChild(script);case 1:setTimeout(function(){loader(alias,text,--tries,aliases)},10);break}},idx=0,alias,a;aliases=aliases.split("-");_.base=_.base||_("script[src*=yass.]")[0].src.replace(/yass[^\/]*\.js$/,"");while(alias=aliases[idx++]){if(!_.modules[alias]){_.modules[alias]={};_.modules.yass[_.modules.yass.length]=alias}_.modules[alias].deps=_.modules[alias].deps||{yass:[]};_.modules[alias].notloaded=_.modules[alias].notloaded||0;if((a=aliases[idx-2])&&a!==alias&&!_.modules[alias].deps[a]){_.modules[alias].deps[a]=1;_.modules[alias].deps.yass[_.modules[alias].deps.yass.length]=a;_.modules[alias].notloaded++}if(!_.modules[alias].status&&!(_.modules[alias].status-=2)){_.modules[alias].status=0;loader(alias,text,11999,aliases)}}};_.postloader=function(e){if(_.browser.opera){try{eval(e.innerHTML)}catch(a){}}var module=_.modules[e.title],aliases=module.deps.yass,idx=aliases.length-1;module.status=3;while(aliases[idx]&&_.modules[aliases[idx]].status==2&&idx--){}if(idx>-1){return}module.status=2;if(module.init){module.init()}var modules=_.modules.yass,recursive=function(title){var dep,alias,idx=0;while(alias=modules[idx++]){dep=_.modules[alias];if(dep.deps[title]&&!(--dep.notloaded)&&dep.status==3){dep.status=2;if(dep.init){dep.init()}recursive(alias)}}};recursive(e.title)};_.win._=_.win._||(_.win.yass=_)})();_.ready(function(){var c=_("[class^=yass-module-]"),d,b=c.length,a=0;while(a<b){d=c[a++];_.load(d.className.slice(d.className.indexOf("yass-module-")+12),d.title);d.title=null}});
;
