function MenuDown (object)
{
	object = document.getElementById (object);

	if ( !object.style )
	{
		return false;
	}

	if( object.style.display == 'none' )
	{
		object.style.display = '';

	}
	else
	{
		object.style.display = 'none';
	}
}

function setHome (obj) {
 obj.style.behavior = 'url(#default#homepage)';
 obj.setHomePage (document.location);
}

function onEnter(e){
	if (!e) e = event;
	if (e.keyCode == 13) {
		document.fsearch.submit();
	}
}

function errorMessage (title, msg) {
  showDialog(title, '<span style="color: red; font-size: 11px;">' + msg + '</span>', 'login');
}

function checkSearch (object) {
  object = document.getElementById (object);

  if (object.value == "")
  errorMessage ('Ошибка', 'Введите, что Вы хотите найти');
  else document.fsearch.submit();;
}

function showSubMenu (object, HOST) {
	image = document.getElementById ("ico" + object);
	object = document.getElementById (object);

	if ( !object.style || !image) {return false;}

	if( object.style.display == 'none' ) {
		object.style.display = '';
        image.src = HOST + "img/ico_collapse.gif";
	}else{
		object.style.display = 'none';
		image.src = HOST + "img/ico_expand.gif";
	}
}

function ChangeClass(obj, setclass) {
  document.getElementById(obj).className = setclass;
}

function MenuUpon (object)
{
	object = document.getElementById (object);

	if ( !object.style )
	{
		return false;
	}

	if( object.style.display == 'none' )
	{
		object.style.display = '';
		object.style.position = 'fixed';
		object.style.top = '180px';
		object.style.left = '12px';
		object.style.width = '240px';
		object.style.bgcolor = 'red';
		object.style.background = 'red';
		object.style.backgroundColor = 'red';




	}
	else
	{
		object.style.display = 'none';
	}
}


function showItem (id, name, url, image, sdesc, cost, HOST, final_price, type) {
	document.getElementById('incase').value = id;
	document.getElementById('sdesc').innerHTML = sdesc;
	document.getElementById('show_img').innerHTML = '<a class="hh1" href="'+HOST+url+'/"><img src="'+image+'" alt="'+name+'" /></a>';
	document.getElementById('name').innerHTML = '<a class="hh1" href="'+HOST+url+'/">'+name+'</a>';
	if (type !== 'D') {
      document.getElementById('fcost').className = 'cost';
	  document.getElementById('fcost').innerHTML = cost + " руб.";
	}else{
      document.getElementById('fcost').className = 'discount';
      document.getElementById('fcost').innerHTML = '<img class="img_discount" src="' + HOST + 'img/ico_discount.gif" alt="Цена со скидкой" title="Цена со скидкой" />';
	  document.getElementById('fcost').innerHTML += cost + " руб.";
	}
}

function CreateWindow(widthx, heightx, urlx, scrolls) {
  if (!scrolls)
    window.open(urlx, 'TehnoMan', "width=" + widthx + ", height=" + heightx + ", location=no, menubar=no, resizable=no, scrollbars=no, statusbar=no");
  else
    window.open(urlx, 'TehnoMan', "width=" + widthx + ", height=" + heightx + ", location=no, menubar=no, resizable=no, scrollbars=yes, statusbar=no");
}

function SetTimerAndClose(time) {
  for (i=1; i<=time; i++) {
      setTimeout ("", 1000*(i+1));
  }
  setTimeout ("window.close();", 1000*(time+1));
}

function showpopup()
	{
	document.getElementById('s1').style.display = "block";
	}
function hidepopup()
	{
	document.getElementById('s1').style.display = "none";
	}