function hide(id)
{
  document.getElementById(id).style.visibility = "hidden";
}

function show(id)
{
  document.getElementById(id).style.visibility = "visible";
}

function changevisibility(id)
{
  if (document.getElementById(id).style.visibility != "visible")
  {
    document.getElementById(id).style.visibility = "visible";
  }
  else
  {
    document.getElementById(id).style.visibility = "hidden";
  }
}


function pagecentered(id)
{

  var innerHeight_ = window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight;
  var obj = document.getElementById(id);
  obj.style.left = ( document.body.clientWidth / 2 - obj.clientWidth / 2 ) + 'px';
  obj.style.top = ( document.documentElement.scrollTop + innerHeight_ / 2 - obj.clientHeight / 2 ) + 'px';

}


function imgopen(imgf,tit)
{

  rand_id='image'+(Math.round(Math.random()*1000));

  outf="<html>"
 +"<head>"
 +"<title>"+tit+"</title>"
 +"<style>body{margin:0px}</style>"
 +"</head>"
 +"<body leftmargin=0 topmargin=0>"
 +"<img src=\""+imgf+"\">";

  iopen="iwin=self.open('"+imgf+"', '"+rand_id+"', 'width='+(img1.width)+',height='+(img1.height)+',top=0,left=0');"
 +"iwin.document.write('"+outf+"');"
 +"iwin.focus();";

  img1=new Image();
  img1.src=imgf;

  if(img1.width!=0) eval(iopen);

  else
  {
    iwin = self.open('about:blank', 'f'+rand_id, 'width=100,height=100,top=0,left=0');
    iwin.document.write("<html>"
    +"<body>Загрузка...<br>"
    +"<"+"script>"
    +"function imo(img1){"+iopen
    +"self.close();"
    +"}<"+"/script>"
    +"<img src='"+imgf+"' onload='imo(this);'>");
  }
}

var siteUrl = "http://www.hros.ru/";
var siteName = 'Бронирование Гостиниц Онлайн';

function setAsStartPage(){
	var obj = window.event.srcElement;
	if (obj != undefined){
		obj.style.behavior = "url(#default#homepage)";
		obj.setHomePage(siteUrl);
	}
	//return false;
}

function addToFavorites(){
	if (window.external != undefined)
		window.external.addFavorite(siteUrl, siteName);
	//return false;
}

function replace_string(cut_str,paste_str,txt)
{ 
  var f=0;
  var ht='';
  ht = ht + txt;
  f=ht.indexOf(cut_str);
  while (f!=-1)
  { 
    //цикл для вырезания всех имеющихся подстрок 
    f=ht.indexOf(cut_str);
    if (f>0)
    {
      ht = ht.substr(0,f) + paste_str + ht.substr(f+cut_str.length);
    };
  };
  return ht
};