function onCmdOrderFirms(evt, id, bool) {
	try {
		this.tbl=document.getElementById(id);
		if(!this.tbl)return false;
		this.trs=this.tbl.getElementsByTagName("tr");
		this.arr=[];
		this.prop=document.body.textContent?"textContent":"innerText";
		for(this.i=0; this.i<this.trs.length; this.i++) {
			this.tr=this.trs[this.i];
			this.tds=this.tr.getElementsByTagName("td");
			this.arr.push({
					"order":this.tds[0][prop],
					"title":this.tds[0].innerHTML,
					"city":this.tds[1][prop],
					"phone":this.tds[2][prop]
			});
		}
		this.mul=bool?1:-1;
		this.arr=this.arr.sort(function(a, b) {
			return a.order<b.order?this.mul:a.order>b.order?-this.mul:0;
		});
		for(this.i=0; this.i<this.trs.length; this.i++) {
			this.tr=this.trs[this.i];
			this.tds=this.tr.getElementsByTagName("td");
			this.tds[0].innerHTML=this.arr[this.i].title;
			this.tds[1][prop]=this.arr[this.i].city;
			this.tds[2][prop]=this.arr[this.i].phone;
		}
	} catch(error) {
		alert(error);
	}
	return true;
}

function onCmdOpenBasket(evt) {
	try {
		open("/data/1basket", null, "dependent=yes,location=no,scrollbars=yes,menubar=yes,width=1000,height=600,top=0").focus();
	} catch(error) {
	}
	return false;
}

function addEngine(evt) {
  if (
		(typeof window.sidebar == "object") &&
		(typeof window.sidebar.addSearchEngine == "function")
	)
		window.sidebar.addSearchEngine(
			"http://www.tovarspravka.ru/static/search.src",
			"http://www.tovarspravka.ru/favicon.ico",
			"tovarspravka.ru",
			3153
		);
}

function Otkroysya(objid) {
	var obj=document.getElementById(objid);
	if(obj.style.display=='none')
		obj.style.display='inherit';
	else
		obj.style.display='none';
}

function addBookmark() {
	
	var title = 'Поиск товаров и услуг. Кубанская справочная 0-81';
	var url = 'http://www.tovarspravka.ru/';  
	if(window.sidebar) { 
	// Mozilla Firefox Bookmark		
	window.sidebar.addPanel(title, url,"");
	}else if( window.external ) { 
	// IE Favorite		
	window.external.AddFavorite( url, title); 
	}
	else if(window.opera && window.print) { 
	// Opera Hotlist		
	}
}

 function addmark()
   {
    if (document.all)
      window.external.AddFavorite("http://www.tovarspravka.ru/","Кубанская справочная")
   }

 function add2Fav (x){
        if (document.all  && !window.opera) {
             if (typeof window.external == "object") {
                window.external.AddFavorite (document.location, document.title);
                return true;
              }
              else return false;

        }
        else{
            x.href=document.location;
            x.title=document.title;
            
            return true;
        }
    }