function Menu ()
{
}
/**
 * Показываем блок, используя атрибут href у ссылки
 */
Menu.prototype.show = function (link)
{
	if (this.element && this.lastLink.href == link.href)
	{
		return this.hide(this.element)
	}
	this.hide()
	this.lastLink	= link
	this.element	= $(link.href.split('#')[1])
	this.element.show()
	link.className += ' now-link'
	this.element.style.zIndex = 2
	this.element.animate('easeOutQuart', { height: [32], width: [32] }, .5, 'em')
	
}

/* закрывает текущее окно */
Menu.prototype.hide = function ()
{
	if (!this.element)
		return
	
	needHide = this.element
	needHide.style.zIndex = 1
	needHide.animate('easeOutQuart', { height: [0], width: [0] }, 2, 'em').oncomplete = function() {
		needHide.hide()
		if (needHide.id == 'our-contact')
			$('form-contact').reset()
	}
	$('contact-form-ok').hide()
	$('contact-form-container').show()
	this.lastLink.className = this.lastLink.className.replace(/now-link/g, '')
	this.element = null

}

function FormLabelAsValue (formId)
{
	this.formElement	= $(formId)
	this.startValue		= Programica.Form.form2hash(this.formElement)
	for (var i = 0; i < this.formElement.length; i++)
	{
		var elem = this.formElement.elements[i]
		
		switch (elem.tagName)
		{
			case 'TEXTAREA':
			case 'INPUT':
				// если элемент пустой, то события не вешаются
				if ( elem.value != '' && (elem.type == 'text' || elem.type == 'textarea') )
				{
					// замыканием сохраняем elem.value
					elem.onfocus = (function (value) { return function ()
					{
						if (this.value == value)
							this.value = ''
					}})(elem.value)
					
					elem.onblur = (function (value) { return function ()
					{
						if (this.value === '')
							this.value = value
					}})(elem.value)
				}
			break
			
		}
	}
}

/* Изменялись ли форма */
FormLabelAsValue.prototype.isChange = function()
{
	//console.log(this.startValue.length)
	//console.log(Programica.Form.form2hash(this.formElement))
	/*for (var i = Things.length - 1; i >= 0; i--)
	{
		Things[i]
	}*/
	//console.log(Programica.Form.form2hash(this.formElement)==Programica.Form.form2hash(this.startValue))
}
