window.artWebAjaxManager = new function()
{
	this.makeRequest = function(ajaxRequestURL, callBack, postParameters)
	{
		if (postParameters == null)
		{
			postParameters = '';
		}
		
		this.ajaxRequestResourceNumber++;
		
		var ajaxRequest = new artWebAjaxRequest(ajaxRequestURL, callBack, postParameters);
		ajaxRequest.makeRequest();
		this.requestsHistory.push(ajaxRequest);
		return ajaxRequest;
	}
	
	this.debugAjaxScreen = function()
	{
		var requestsHistory = this.requestsHistory;
		
		if (!(debugDiv = document.getElementById('debugAjaxScreen')))
		{
			var debugDiv = document.createElement('div');
			
			debugDiv.style.top = '0';
			debugDiv.style.left = '0';
			debugDiv.style.zIndex = '2000';
			debugDiv.className = 'debugBlock';
			
			debugDiv.id = 'debugAjaxScreen';
			
			document.body.appendChild(debugDiv);
		}
	
		var debugTable = document.createElement('table');
		
		while ( debugDiv.childNodes.length >= 1 )
		{
			debugDiv.removeChild(debugDiv.firstChild);       
		}
		
		for (index in requestsHistory)
		{
			var debugTableRow = document.createElement('tr');
			
			var debugTableCell = document.createElement('td');
			debugTableCell.textContent = requestsHistory[index].queryTime;
			debugTableRow.appendChild(debugTableCell);
			
			var debugTableCell = document.createElement('td');
			debugTableCell.textContent = requestsHistory[index].answerTime;
			debugTableRow.appendChild(debugTableCell);
			
			var debugTableCell = document.createElement('td');
			debugTableCell.textContent = requestsHistory[index].status;
			debugTableRow.appendChild(debugTableCell);
			
			debugTable.appendChild(debugTableRow);
		}
		debugDiv.appendChild(debugTable);
	}
	var instance = this;
	this.requestsHistory = new Array();
}
function artWebAjaxRequest(ajaxRequestURL, callBack, postParameters)
{
	this.init = function()
	{
		this.ajaxRequestURL = ajaxRequestURL;
		this.callBack = callBack;
		this.postParameters = postParameters;
		
		if(ajaxRequestResource = this.getXMLHttpRequestObject())
		{
			this.ajaxRequestResource = ajaxRequestResource;
		}
	}
	this.makeRequest = function()
	{
		postParametersString = '';
		for (var index in this.postParameters)
		{
			postParametersString = postParametersString + index + '=' + postParameters[index] + '&';
		}
		
		this.ajaxRequestResource.open("POST", this.ajaxRequestURL, true);
		this.ajaxRequestResource.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		this.ajaxRequestResource.setRequestHeader("Content-length", postParametersString.length);
		
		addHandler(this.ajaxRequestResource, 'readystatechange', this.catchRequestAnswer);
		
		this.ajaxRequestResource.send(postParametersString); 
		
		this.queryTime = this.getCurrentTime();
		this.failureCheckTimeOut = window.setTimeout(this.checkFailure, this.failureTime);
	}
	this.catchRequestAnswer = function()
	{
		if(instance.ajaxRequestResource.readyState == 4 && instance.ajaxRequestResource.status == 200)
		{
			clearTimeout(instance.failureCheckTimeOut);
			instance.status = 'success';
			instance.answerTime = instance.getCurrentTime();
			
			if (typeof(callBack) != "undefined")
			{
				callBack(ajaxRequestResource.responseText);
			}
		}
	}
	this.checkFailure = function()
	{
		if (instance.status != 'success')
		{
			removeHandler(instance.ajaxRequestResource, 'readystatechange', instance.catchRequestAnswer);
			instance.status = 'failure';
		}
	}
	this.getCurrentTime = function()
	{
		var currentTime = new Date();
		var hours = this.formatNumber(currentTime.getHours(), 2);
		var minutes = this.formatNumber(currentTime.getMinutes(), 2);
		var seconds = this.formatNumber(currentTime.getSeconds(), 2);
		var milliseconds = this.formatNumber(currentTime.getMilliseconds(), 3);

		return hours+':'+minutes+':'+seconds;
	}

	this.formatNumber = function(number, decimals)
	{
		number = number.toString();
		if (number.length < decimals)
		{
			for (a=decimals-number.length; a>0; a--)
			{
				number = '0'+number;
			}
		}
		return number;
	}
	
	this.getXMLHttpRequestObject = function() 
	{
		var result = false;
		if (window.XMLHttpRequest) 
		{
			result = new XMLHttpRequest();
		}
		else if (window.ActiveXObject) 
		{
			try 
			{
				result = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e) 
			{
				try 
				{
					result = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (E) 
				{
					result = false;
				}
			}
		}
		
		return result;
	}
	var instance = this;
	this.status = null;
	this.failureTime = 1000;
	this.queryTime = '--:--:--';
	this.answerTime = '--:--:--';
	this.ajaxRequestResource = null;
	this.failureCheckTimeOut = null;
	
	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 artWebCalendar(placeHolder)
{
	this.init = function()
	{
		this.calendarElement = placeHolder;
		var dateObject = new Date();
		
		this.currentDate = dateObject.getDate();
		this.currentMonth = dateObject.getMonth();
		this.currentYear = dateObject.getFullYear();
		
		this.selectedDate = this.currentDate;
		this.selectedMonth = this.currentMonth;
		this.selectedYear = this.currentYear;
		
		this.readLinks();
		this.prepareDOMStructure();
		this.renderCurrentMonth();
	}
	this.readLinks = function()
	{
		while (this.calendarElement.firstChild)
		{
			var element = this.calendarElement.firstChild;
			
			if (element.href)
			{
				if (element.textContent != null)
				{
					var linkContent = element.textContent;
				}
				else
				{
					var linkContent = element.innerText;
				}
				var linkDateObj = new Date();
				var timeStamp = parseInt(linkContent) * 1000;
				linkDateObj.setTime(timeStamp);
				
				var timeStamp = linkDateObj.getTime() + linkDateObj.getTimezoneOffset() * 60000;
				linkDateObj.setTime(timeStamp);
				
				var linkYear = linkDateObj.getFullYear();
				var linkMonth = linkDateObj.getMonth();
				var linkDate = linkDateObj.getDate();
				
				if (!this.links[linkYear])
				{
					this.links[linkYear] = new Array();
				}
				if (!this.links[linkYear][linkMonth])
				{
					this.links[linkYear][linkMonth] = new Array();
				}
				this.links[linkYear][linkMonth][linkDate] = element.href;
			}
			this.calendarElement.removeChild(element);
		}
	}
	this.showNextMonth = function()
	{
		var nextMonthFirstDay = new Date(this.selectedYear, this.selectedMonth + 1, 1);
		
		this.selectedDate = nextMonthFirstDay.getDate();
		this.selectedMonth = nextMonthFirstDay.getMonth();
		this.selectedYear = nextMonthFirstDay.getFullYear();
		
		this.renderCurrentMonth();
	}
	this.showPreviousMonth = function()
	{
		var previousMonthLastDay = new Date(this.selectedYear, this.selectedMonth, 0);
		
		this.selectedDate = previousMonthLastDay.getDate();
		this.selectedMonth = previousMonthLastDay.getMonth();
		this.selectedYear = previousMonthLastDay.getFullYear();
		
		this.renderCurrentMonth();
	}
	this.prepareDOMStructure = function()
	{
		this.calendarElement.style.display = 'block';
	
		var headerElement = document.createElement('div');
		headerElement.className = 'artWeb_calendar_header';
		this.headerElement = headerElement;
		this.calendarElement.appendChild(headerElement);
		
		var bodyElement = document.createElement('div');
		bodyElement.className = 'artWeb_calendar_body';
		this.bodyElement = bodyElement;
		this.calendarElement.appendChild(bodyElement);
		
		this.buttonNextMonth = new artWebCalendar_nextMonth(this);
		this.buttonPreviousMonth = new artWebCalendar_previousMonth(this);
		this.currentLocation = new artWebCalendar_currentLocation(this);
	}
	this.renderCurrentMonth = function()
	{
		var bodyElement = this.bodyElement;
		while (bodyElement.firstChild) 
		{
			bodyElement.removeChild(bodyElement.firstChild);
		}
		if (!this.monthPages[this.selectedYear])
		{
			this.monthPages[this.selectedYear] = new Array();
		}
		if (!this.monthPages[this.selectedYear][this.selectedMonth])
		{
			var monthObject = new artWebCalendarMonth(this.selectedMonth, this.selectedYear);
			this.monthPages[this.selectedYear][this.selectedMonth] = monthObject;
		}
		else
		{
			var monthObject = this.monthPages[this.selectedYear][this.selectedMonth]
		}
		var weekDaysNames = this.getWeekDaysNames();
		var tableElement = document.createElement('table');
		var tableBodyElement = document.createElement('tbody');
		
		tableElement.appendChild(tableBodyElement);
		
		var tableRow = document.createElement('tr');
		for (var cell = 0; cell < 7; cell++)
		{
			var tableCell = document.createElement('th');
			var weekDayName = weekDaysNames[cell];			
			if (tableCell.textContent != null)
			{
				tableCell.textContent = weekDayName;
			}
			else
			{
				tableCell.innerText = weekDayName;
			}
			
			tableRow.appendChild(tableCell);
		}
		tableBodyElement.appendChild(tableRow);
		
		for (var row = 0; row < monthObject.daysGrid.length; row++)
		{
			var tableRow = document.createElement('tr');
			for (var cell = 0; cell < monthObject.daysGrid[row].length; cell++)
			{
				var tableCell = document.createElement('td');
				var month = monthObject.daysGrid[row][cell].getMonth();
				var day = monthObject.daysGrid[row][cell].getDate();
				var weekDay = monthObject.daysGrid[row][cell].getDay();
				var year = monthObject.daysGrid[row][cell].getFullYear();
				
				var linkFound = false;
				if (this.links[year])
				{
					if (this.links[year][month])
					{
						if (this.links[year][month][day])
						{
							linkFound = true;
							var linkElement = document.createElement('a');
							linkElement.href = this.links[year][month][day];
							if (linkElement.textContent != null)
							{
								linkElement.textContent = day;
							}
							else
							{
								linkElement.innerText = day;
							}
							tableCell.appendChild(linkElement);
						}
					}
				}
				if (!linkFound)
				{
					if (tableCell.textContent != null)
					{
						tableCell.textContent = day;
					}
					else
					{
						tableCell.innerText = day;
					}
				}
				
				
				var className = '';
				if (month == this.selectedMonth)
				{
					className = className + ' artwebCalendar_activemonth';
					
					if (weekDay == 0 || weekDay == 6)
					{
						className = className + ' artwebCalendar_weekend';
					}
					if (day == this.currentDate && month == this.currentMonth && year == this.currentYear)
					{
						className = className + ' artwebCalendar_today';
					}
				}
				tableCell.className = className;
				tableRow.appendChild(tableCell);
			}
			tableBodyElement.appendChild(tableRow);
		}
		bodyElement.appendChild(tableElement);
		
		var monthsNames = this.getMonthsNames();
		this.currentLocation.setLocation(monthsNames[this.selectedMonth], this.selectedYear);
	}
	this.getWeekDaysNames = function()
	{
		var weekDaysNames = new Array();
		if (window.currentLanguageCode && window.currentLanguageCode == 'eng')
		{
			weekDaysNames[0] = 'M';
			weekDaysNames[1] = 'T';
			weekDaysNames[2] = 'W';
			weekDaysNames[3] = 'T';
			weekDaysNames[4] = 'F';
			weekDaysNames[5] = 'S';
			weekDaysNames[6] = 'S';
		}
		else
		{
			weekDaysNames[0] = 'E';
			weekDaysNames[1] = 'T';
			weekDaysNames[2] = 'K';
			weekDaysNames[3] = 'N';
			weekDaysNames[4] = 'R';
			weekDaysNames[5] = 'L';
			weekDaysNames[6] = 'P';
		}
		
		
		
		return weekDaysNames;
	}
	this.getMonthsNames = function()
	{
		var monthsNames = new Array();
		if (window.currentLanguageCode && window.currentLanguageCode == 'eng')
		{
			monthsNames[0] = 'January';
			monthsNames[1] = 'February';
			monthsNames[2] = 'March';
			monthsNames[3] = 'April';
			monthsNames[4] = 'May';
			monthsNames[5] = 'June';
			monthsNames[6] = 'July';
			monthsNames[7] = 'August';
			monthsNames[8] = 'September';
			monthsNames[9] = 'October';
			monthsNames[10] = 'November';
			monthsNames[11] = 'December';
		}
		else
		{
			monthsNames[0] = 'Jaanuar';
			monthsNames[1] = 'Veebruar';
			monthsNames[2] = 'Märts';
			monthsNames[3] = 'Aprill';
			monthsNames[4] = 'Mai';
			monthsNames[5] = 'Juuni';
			monthsNames[6] = 'Juuli';
			monthsNames[7] = 'August';
			monthsNames[8] = 'September';
			monthsNames[9] = 'Oktoober';
			monthsNames[10] = 'November';
			monthsNames[11] = 'Detsember';
		}
		return monthsNames;
	}
	this.calendarElement = null;
	
	this.currentDate = null;
	this.currentMonth = null;
	this.currentYear = null;
	
	this.selectedDate = null;
	this.selectedMonth = null;
	this.selectedYear = null;
	this.monthPages = new Array();
	this.links = new Array();
	var self = this;
	this.init();
}
function artWebCalendarMonth(month, year)
{
	this.init = function()
	{
		this.month = month;
		this.year = year;
		
		var monthFirstDay = new Date(year, month, 1);
		
		var weekDay = monthFirstDay.getDay() - 1;
		if (weekDay < 0) weekDay = 6;
		
		var tableFirstDay = new Date(year, month, 1 - weekDay);

		var monthLastDay = new Date(year, month+1, 0);
		
		var weekDay = monthLastDay.getDay() - 1;
		if (weekDay < 0) weekDay = 6;
		
		var tableLastDay = new Date(year, month+1, 6 - weekDay);
		
		this.monthFirstDay = monthFirstDay;
		this.monthLastDay = monthLastDay;
		this.tableFirstDay = tableFirstDay;
		this.tableLastDay = tableLastDay;
		
		this.calculateDaysData();
	}
	this.calculateDaysData = function()
	{
		var currentDate = new Date();
		currentDate.setTime(this.tableFirstDay.getTime());
		
		var currentRow = 0;
		var currentWeekDay = 0;
		
		while (currentDate.getTime() <= this.tableLastDay.getTime())
		{
			if (!this.daysGrid[currentRow])
			{
				this.daysGrid[currentRow] = new Array();
			}
			
			this.daysGrid[currentRow][currentWeekDay] = new Date(currentDate.getTime());
			
			currentDate.setDate(currentDate.getDate() + 1);
			
			currentWeekDay++;
			if (currentWeekDay == 7)
			{
				currentWeekDay = 0;
				currentRow ++;
			}
		}
	}
	this.daysGrid = new Array();
	var self = this;
	this.init();
}
function artWebCalendar_nextMonth(calendarObject)
{
	this.init = function()
	{
		this.calendarObject = calendarObject;
		var buttonElement = document.createElement('a');
		buttonElement.className = 'artWeb_calendar_nextmonth';
		calendarObject.headerElement.appendChild(buttonElement);
		buttonElement.href='';
		
		var buttonText = '>>';
		
		if (buttonElement.textContent != null)
		{
			buttonElement.textContent = buttonText;
		}
		else
		{
			buttonElement.innerText = buttonText;
		}
		
		addHandler(buttonElement, 'click', this.click);
	}
	this.click = function(event)
	{
		preventDefaultAction(event);
		self.calendarObject.showNextMonth();
	}
	var self = this;
	this.init();
}
function artWebCalendar_previousMonth(calendarObject)
{
	this.init = function()
	{
		this.calendarObject = calendarObject;
		var buttonElement = document.createElement('a');
		buttonElement.className = 'artWeb_calendar_previousmonth';
		calendarObject.headerElement.appendChild(buttonElement);
		buttonElement.href='';
		
		var buttonText = '<<';
		
		if (buttonElement.textContent != null)
		{
			buttonElement.textContent = buttonText;
		}
		else
		{
			buttonElement.innerText = buttonText;
		}
		
		addHandler(buttonElement, 'click', this.click);
	}
	this.click = function(event)
	{
		preventDefaultAction(event);
		self.calendarObject.showPreviousMonth();
	}
	var self = this;
	this.init();
}
function artWebCalendar_currentLocation(calendarObject)
{
	this.init = function()
	{
		this.calendarObject = calendarObject;
		var locationElement = document.createElement('div');
		locationElement.className = 'artWeb_calendar_location';
		calendarObject.headerElement.appendChild(locationElement);
		
		this.locationElement = locationElement;
	}
	this.setLocation = function(month, year)
	{
		var locationText = month + ' ' + year;
		
		if (this.locationElement.textContent != null)
		{
			this.locationElement.textContent = locationText;
		}
		else
		{
			this.locationElement.innerText = locationText;
		}
	}
	var self = this;
	this.init();
}


artWebCalendarManager = new function()
{
	this.init = function()
	{
		var calendars = _('.artWeb_calendar');
		for (var i = 0; i<calendars.length; i++)
		{
			self.calendarObjects.push(new artWebCalendar(calendars[i]));
		}
	}
	var self = this;
	this.calendarObjects = new Array();
}

addHandler(window, 'load', artWebCalendarManager.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 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)
		{
			if (document.documentElement.scrollHeight > document.body.scrollHeight)
			{
				var viewPortHeight = document.documentElement.scrollHeight;
				var viewPortWidth = document.documentElement.scrollWidth;
			} 
			else 
			{
				var viewPortHeight = document.body.scrollHeight;
				var viewPortWidth = document.body.scrollWidth;
			}

			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_color()
{
	this.renderFrame = function(frame)
	{
		var direction = 1;
		var startColor = this.startColor;
		var endColor = this.parameters.end;
		var colorStep = this.parameters.step;
		if (startColor > endColor)
		{
			direction = -1;
		}
		var currentColor = (startColor + colorStep * frame * direction);
		if (currentColor*direction > endColor*direction) currentColor = endColor;
		this.element.style.color = 'rgb('+currentColor+','+currentColor+','+currentColor+')';
		this.element.currentColor = currentColor;
	}
	this.calculateFramesCount = function()
	{
		var direction = 1;
		if (this.parameters.start)
		{
			var startColor = this.parameters.start;
		}
		else
		{
			var startColor = opacityHandler.getOpacity(this.element);
		}
		this.startColor = startColor;
		var endColor = this.parameters.end;
		var colorStep = this.parameters.step;
		var framesCount = 0;
		
		if (startColor > endColor)
		{
			direction = -1;
		}
		var colorChange = (endColor - startColor)*direction;
		
		framesCount = Math.ceil(colorChange / colorStep) + 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_falldown()
{
	this.renderFrame = function(frame)
	{
		var direction = this.direction;
		var source = this.source;
		var target = this.target;
		var acceleration = this.acceleration;
		
		var step = this.step;
		
		var path = step * frame + acceleration*frame*frame/2;
		
		var currentPosition = source + path*direction;
		
		this.element.style.top = currentPosition+'px';
	}
	this.calculateFramesCount = function()
	{
		var acceleration = this.parameters.acceleration;
		var source = this.parameters.start;
		var target = this.parameters.target;
		var step = this.parameters.step;
		
		//define direction
		var direction = 1;
		if (source > target)
		{
			direction = -1;
		}
		
		var path = (target - source)*direction;
		
		var framesCount = 0;
		
		if (acceleration > 0)
		{
			var framesCount = ((-1*step - Math.sqrt(step*step + 2*acceleration*(path)))/acceleration);
			if (framesCount < 0)
			{
				framesCount = ((-1*step + Math.sqrt(step*step + 2*acceleration*(path)))/acceleration);
			}
		}
		else
		{
			var framesCount = (path/step);
		}
		
		this.source = source;
		this.direction = direction;
		this.target = target;
		this.step = step;
		this.acceleration = acceleration;
		
		return framesCount;
	}
	
	var instance = this;
	this.opacityType = false;
	this.defaults = {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_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);
		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 = (opacityChange / opacityStep);
		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 direction = this.direction;
		var source = this.source;
		var target = this.target;
		var acceleration = this.acceleration;
		
		var step = this.step;
		
		var path = step * frame + acceleration*frame*frame/2;
		
		var currentPosition = source + path*direction;
		
		this.element.currentDirection = direction;
		this.element.currentStep = step + acceleration*frame;
		
		this.element.style.top = currentPosition+'px';
	}
	this.calculateFramesCount = function()
	{
		var acceleration = this.parameters.acceleration;
		var source = this.element.offsetTop;
		var target = this.parameters.target;
		
		//define direction
		var direction = 1;
		if (source > target)
		{
			direction = -1;
		}
		if (!this.element.currentDirection)
		{
			this.element.currentDirection = direction;
		}
		
		//define step
		if (!this.element.currentStep || this.element.currentDirection != direction)
		{
			var step = this.parameters.step;
		}
		else
		{
			var step = this.element.currentStep;
		}
		
		var path = (target - source)*direction;
		
		var framesCount = 0;
		
		if (acceleration > 0)
		{
			var framesCount = ((-1*step - Math.sqrt(step*step + 2*acceleration*(path)))/acceleration);
			if (framesCount < 0)
			{
				framesCount = ((-1*step + Math.sqrt(step*step + 2*acceleration*(path)))/acceleration);
			}
		}
		else
		{
			var framesCount = (path/step);
		}
		
		this.source = source;
		this.direction = direction;
		this.target = target;
		this.step = step;
		this.acceleration = acceleration;
		
		return framesCount;
	}
	
	var instance = this;
	this.opacityType = false;
	this.defaults = {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_size()
{
	this.renderFrame = function(frame)
	{
		var direction = this.direction;
		var source = this.source;
		var target = this.target;
		var acceleration = this.acceleration;
		
		var step = this.step;
		
		var path = step * frame + acceleration*frame*frame/2;
		
		var currentWidth = source + path*direction;
		this.element.style.width = currentWidth+'px';
	}
	this.calculateFramesCount = function()
	{
		var acceleration = this.parameters.acceleration;
		var source = this.element.offsetWidth - 20;
		var target = this.parameters.target;
		
		//define direction
		var direction = 1;
		if (source > target)
		{
			direction = -1;
		}
		
		var step = this.parameters.step;
		
		var path = (target - source)*direction;
		
		var framesCount = 0;
		
		if (acceleration > 0)
		{
			var framesCount = ((-1*step - Math.sqrt(step*step + 2*acceleration*(path)))/acceleration);
			if (framesCount < 0)
			{
				framesCount = ((-1*step + Math.sqrt(step*step + 2*acceleration*(path)))/acceleration);
			}
		}
		else
		{
			var framesCount = (path/step);
		}
		
		this.source = source;
		this.direction = direction;
		this.target = target;
		this.step = step;
		this.acceleration = acceleration;
		
		return framesCount;
	}
	
	var instance = this;
	this.opacityType = false;
	this.defaults = {step: 0.1, acceleration: 0.7};
};
/* --------------------------------------------------------------------*\
*                                                                       *
*  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)
	{
		var currentPath = this.step * frame + this.acceleration*frame*frame/2;
		var currentHeight = this.startHeight + (currentPath * this.direction);
		if (currentHeight < 0) currentHeight = 0;
		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 = ((-1*this.step - Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			if (framesCount < 0)
			{
				framesCount = ((-1*this.step + Math.sqrt(this.step*this.step + 2*this.acceleration*(totalPath)))/this.acceleration);
			}
		}
		else
		{
			var framesCount = (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;
		var time = null;
		for (var frame = 1; frame <= framesCount; frame++)
		{
			time = frame;
			
			var currentDelay = offsetTimeout + time * timeOutDelay;
			
			timeoutsArray[currentDelay] = setTimeout(
			function(effectPlugin, time)
			{
				return function(){effectPlugin.renderFrame(time);};
			}(effectPlugin, time), currentDelay);
		}
		if (time < framesCount)
		{
			time = framesCount;
			frame = framesCount;
			var currentDelay = offsetTimeout + time * timeOutDelay;
			
			timeoutsArray[currentDelay] = setTimeout(
			function(effectPlugin, time)
			{
				return function(){effectPlugin.renderFrame(time);};
			}(effectPlugin, time), currentDelay);
			
		}
		
		if (callback)
		{
			var currentDelay  = offsetTimeout + (framesCount +1) * timeOutDelay;
			timeoutsArray[framesCount + 1  + 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)
	{
		cancelBubbling(event);
		var clickedImage = getEventTarget(event);
		if (clickedImage.tagName == 'img' || clickedImage.tagName == 'IMG')
		{
			clickedImage = clickedImage.parentNode;
		}
		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;
		}
		
		if (window.innerHeight)
		{
			var viewPortWidth = window.innerWidth;
			var viewPortHeight = window.innerHeight;
		}
		else
		{
			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];
		//~ opacityHandler.setOpacity(imageElement, 0);
		//~ instance.afterFadeOut(imageElement);
		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.03;
	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()
{
	initMainMenu();
	initGalleries();
	initGalleriesTable();
	initSubscribe();
};
function initGalleries()
{
	var galleries = _('.js_gallery');
	for (var i = 0; i<galleries.length; i++)
	{
		new gallery(galleries[i]);
	}
}

function gallery(domElement)
{
	this.init = function()
	{
		this.smallPictures = new Array();
		this.biggerPictures = new Array();
		
		this.gallery = domElement;
		var urlList = new Array();
		var pictureList = _('.gallery_bigger', domElement);
		for (i = 0; i < pictureList.length; i++)
		{
			this.biggerPictures.push(new galleryBiggerImage(pictureList[i], this));
			urlList[pictureList[i].id] = pictureList[i].href;
		}
		var newGallery = new artWebGallery(urlList);
		
		this.currentBigPicture = _('.gallery_bigger.gallery_first', domElement)[0];
		var urlList = new Array();
		var pictureList = _('.gallery_item', domElement);
		for (i = 0; i < pictureList.length; i++)
		{
			this.smallPictures.push(new galleryImage(pictureList[i], this));
			urlList[pictureList[i].id] = pictureList[i].href;
		}
		var newGallery = new artWebGallery(urlList);
		
		this.pagesList = _('.gallery_page', domElement);
		for (i = 0; i < this.pagesList.length; i++)
		{
			if (this.pagesList[i].className != 'gallery_page gallery_page_first')
			{
				opacityHandler.setOpacity(this.pagesList[i], 0);
				this.pagesList[i].style.zIndex = '1';
			}
			else
			{
				this.pagesList[i].style.zIndex = '10';
			}
		}
		this.currentPage = 0;
		
		if (this.buttonNext = _('.gallery_next', domElement)[0])
		{
			addHandler(this.buttonNext, 'click', this.showNextPage);
		}
		
		if (this.buttonPrevious = _('.gallery_previous', domElement)[0])
		{
			addHandler(this.buttonPrevious, 'click', this.showPreviousPage);
		}
	}
	this.swapBiggerPicture = function(container)
	{
		var pictureId = 'bigger_'+container.id;
		var currentBigPicture = this.currentBigPicture;		
		var newBigPicture = document.getElementById(pictureId);
		
		if (currentBigPicture != newBigPicture)
		{
			currentBigPicture.style.zIndex = '2';
			newBigPicture.style.zIndex = '10';
			newBigPicture.style.display = 'block';
		
			var parameters = {end: 1, step: 0.05};
			artWebEffectsManager.startEffect('opacity', newBigPicture, parameters);
			
			var parameters = {end: 0, step: 0.05};
			artWebEffectsManager.startEffect('opacity', currentBigPicture, parameters, function(picture){return function(){picture.style.display = 'none'}}(currentBigPicture));
			this.olderBigPicture = this.currentBigPicture;
			this.currentBigPicture = newBigPicture;
		}
	}
	this.showNextPage = function(event)
	{
		preventDefaultAction(event);
		if (self.currentPage + 1 < self.pagesList.length)
		{
			newPage = self.currentPage + 1;
		}
		else
		{
			newPage = 0;
		}
		self.buttonNext.blur();
		self.swapPages(newPage);
	}
	this.showPreviousPage = function(event)
	{
		preventDefaultAction(event);
		if (self.currentPage > 0)
		{
			newPage = self.currentPage - 1;
		}
		else
		{
			newPage = self.pagesList.length - 1;
		}
		self.buttonPrevious.blur();
		self.swapPages(newPage);
	}
	this.swapPages = function(newPageNumber)
	{
		if (newPageNumber != self.currentPage)
		{
			self.pagesList[newPageNumber].style.zIndex = '10';
			self.pagesList[newPageNumber].style.display = 'block';
			
			var parameters = {end: 1, step: 0.05};
			artWebEffectsManager.startEffect('opacity', self.pagesList[newPageNumber], parameters);
			
			self.pagesList[self.currentPage].style.zIndex = '1';
			var parameters = {end: 0, step: 0.05};
			artWebEffectsManager.startEffect('opacity', self.pagesList[self.currentPage], parameters, self.hideOlderPage);
			
			self.olderPage = self.currentPage;
			self.currentPage = newPageNumber;
		}
	}
	this.hideOlderPage = function()
	{
		self.pagesList[self.olderPage].style.display = 'none';
	}
	var self = this;
	this.init();
}

function galleryNext(buttonElement, galleryObject)
{
	this.init = function()
	{
		this.buttonElement = buttonElement;
		this.galleryObject = galleryObject;
		
		addHandler(this.buttonElement, 'click', this.click);
	}
	this.click = function(event)
	{
		preventDefaultAction(event);
		galleryObject.showNextPage();
	}
	var self = this;
	this.init();
}
function galleryBiggerImage(container, galleryObject)
{
	this.init = function()
	{
		this.container = container;
		this.galleryObject = galleryObject;
		
		if (container.className != 'gallery_bigger gallery_first')
		{
			opacityHandler.setOpacity(container, 0);
			container.style.zIndex = '1';
			container.style.display = 'none';
		}
		addHandler(this.container, 'click', this.click);
	}
	this.click = function(event)
	{
		preventDefaultAction(event);
	}
	var self = this;
	this.init();
}
function galleryImage(container, galleryObject)
{
	this.init = function()
	{
		this.container = container;
		this.galleryObject = galleryObject;
		addHandler(this.container, 'click', this.click);
		addHandler(this.container, 'focus', this.mouseover);
		addHandler(this.container, 'mouseover', this.mouseover);
	}
	this.mouseover = function()
	{
		self.galleryObject.swapBiggerPicture(self.container);
	}
	this.click = function(event)
	{
		preventDefaultAction(event);
	}
	var self = this;
	this.init();
};
function initGalleriesTable()
{
	var galleriesTableElements = _('.galleriestable_item');
	for (var i=0; i<galleriesTableElements.length; i++)
	{
		new galleryTableItem(galleriesTableElements[i]);
	}
}
function galleryTableItem(linkElement)
{
	this.init = function()
	{
		this.linkElement = linkElement;
		this.blackWhiteImage = _('img.galleriestable_image_bw', linkElement)[0];
		
		addHandler(linkElement, 'mouseover', this.mouseOver);
		addHandler(linkElement, 'focus', this.mouseOver);
		
		addHandler(linkElement, 'mouseout', this.mouseOut);
		addHandler(linkElement, 'blur', this.mouseOut);
	}
	this.mouseOver = function(event)
	{
		preventDefaultAction(event);
		var parameters = {end: 0, step: 0.1};
		artWebEffectsManager.startEffect('opacity', self.blackWhiteImage, parameters);
	}
	this.mouseOut = function(event)
	{
		preventDefaultAction(event);
		var parameters = {end: 1, step: 0.1};
		artWebEffectsManager.queueEffect('opacity', self.blackWhiteImage, parameters);
	}
	var self = this;
	this.linkElement = null;
	
	this.init();
};

function initMainMenu()
{
	var menuElement = _('.menu_block')[0];
	new mainMenu(menuElement);
}
function mainMenu(element)
{
	this.init = function()
	{
		this.menuElement = element;
		var menuElements = _('.menu_item', this.menuElement);
		var activeMenuObject = false;
		for (var i = 0; i < menuElements.length; i++)
		{
			var menuElement = menuElements[i];
			var menuObject = new menuItem(menuElement, this);
			
			if (menuElement.className == 'menu_item menu_active')
			{
				activeMenuObject = menuObject;
			}
		}
		if (activeMenuObject)
		{
			this.active = true;
		
			var menuElement = activeMenuObject.menuElement;
			var menuLine = document.getElementById('menuitem_fork');
			
			var newMenuLine = menuLine.cloneNode(true);
			newMenuLine.style.position = 'absolute';
			newMenuLine.style.left = (menuElement.offsetLeft+menuLine.offsetLeft)+'px';
			newMenuLine.style.top = (menuElement.offsetTop + menuElement.offsetHeight/2 - 5)+'px';
			newMenuLine.style.height = '11px';
			newMenuLine.style.zIndex = '1';
			
			newMenuLine.originalTop = (menuElement.offsetTop + menuElement.offsetHeight/2 - 5);
			
			this.menuElement.appendChild(newMenuLine);
			this.menuLine = newMenuLine;
			
			menuLine.parentNode.removeChild(menuLine);
			
			menuElement.className = 'menu_item';
		}
	}
	this.moveLine = function(menuObject)
	{
		if (instance.active)
		{
			var menuElement = menuObject.menuElement;		
			var newYPosition = (menuElement.offsetTop + menuElement.offsetHeight/2 - 5);
			
			var parameters = {target: newYPosition, step: 0.6, acceleration: 0.7};
			artWebEffectsManager.startEffect('position', instance.menuLine, parameters, instance.resetLine);
		}
	}
	this.returnLine = function()
	{
		if (instance.active)
		{
			var newYPosition = instance.menuLine.originalTop;
			
			var parameters = {target: newYPosition, step: 0.1, acceleration: 0.15};
			artWebEffectsManager.startEffect('position', instance.menuLine, parameters, instance.resetLine);
		}
	}
	this.resetLine = function()
	{
		instance.menuLine.currentStep = 3;
	}
	var instance = this;
	this.active = false;
	this.init();
}
function menuItem(menuElement, mainMenu)
{
	this.init = function()
	{
		this.menuElement = menuElement;
		this.mainMenu = mainMenu;
		addHandler(menuElement, 'focus', this.mouseOver);
		addHandler(menuElement, 'blur', this.mouseOut);
		addHandler(menuElement, 'mouseenter', this.mouseOver);
		addHandler(menuElement, 'mouseleave', this.mouseOut);
	}
	this.mouseOver = function()
	{
		instance.mainMenu.moveLine(instance);
	}
	this.mouseOut = function()
	{
		instance.mainMenu.returnLine();
	}
	var instance = this;
	this.init();
};
function initSubscribe()
{
	if (element = _('.subscribeForm')[0])
	{
		new subscribeForm(element);
	}
}

function subscribeForm(domElement)
{
	this.init = function()
	{
		this.formElement = domElement;
		
		if (submitButton = _('a.button', domElement)[0])
		{
			this.submitButton = submitButton;
			addHandler(submitButton, 'click', this.submitForm)
		}
	}
	this.submitForm = function(event)
	{
		preventDefaultAction(event);
		self.formElement.submit();
	}
	var self = this;
	
	this.submitButton = null;
	this.formElement = null;
	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 debug(text)
{
	document.title = 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 == null || typeof object != 'object')
	{
		return false;
	}
	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);
	}
	return true;
}
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);
};
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();;
/**/
(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.replace(/=([^\]]+)/,'="$1"'))}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();_.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)};_.q=!!_.doc.querySelectorAll&&!_.browser.ie&&!_.browser.opera;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){_("head")[0].removeChild(_("script[title="+alias+"]")[0]);_.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)},100);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}});;

