function InputPlaceholder (input, value)
{
	var thisCopy = this
	
	this.Input = input
	this.Value = value
	this.SaveOriginal = (input.value == value)

	this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()})
	this.setupEvent (this.Input, 'blur',  function() {return thisCopy.onBlur()})

	if (input.value == '') this.onBlur();

	return this
}

InputPlaceholder.prototype.setupEvent = function (elem, eventType, handler)
{
	if (elem.attachEvent) elem.attachEvent ('on' + eventType, handler)
	if (elem.addEventListener) elem.addEventListener (eventType, handler, false)
}

InputPlaceholder.prototype.onFocus = function()
{
	if (!this.SaveOriginal &&  this.Input.value == this.Value) this.Input.value = ''
}

InputPlaceholder.prototype.onBlur = function()
{
	if (this.Input.value == '' || this.Input.value == this.Value) this.Input.value = this.Value
}

if(document.getElementById) var ph = new InputPlaceholder (document.getElementById ('SearchField'), 'введите фразу', '', 'emptySearch');
