function gebi(name){return document.getElementById(name);};
function rw(s){document.write(s);};
function conf(msg){if(confirm(msg)){return true;}else{return false;};};
function ltrim(s){return s.replace(/^\s*/,"");};function rtrim(s){return s.replace(/\s*$/,"");};function trim(s){return rtrim(ltrim(s));};
function open_w(url){window.open(url,'','location=no,menubar=no,toolbar=no,resizable=no,status=no,scrollbars=no');};
function open_ws(url){window.open(url,'','location=no,menubar=no,toolbar=no,resizable=no,status=no,scrollbars=yes');};
function eml(t1,t2){var s1="",s2="";for(var i=0;i<t1.length;i++){s1=t1.charAt(i)+s1;};for(var i=0;i<t2.length;i++){s2=t2.charAt(i)+s2;};if((trim(s1).length!="")&&(trim(s2).length!="")){return s2+"@"+s1;}else{return s2+s1;};};
function set_sel(sel,val){for(var i=0;i<sel.length;i++){if(sel.options[i].value==val){sel.options[i].selected=true;break;};};};
function sel_val(sel){return sel.options[sel.selectedIndex].value;};
function sel_txt(sel){return sel.options[sel.selectedIndex].text;};
function objXY(obj){var x=0,y=0;do{x+=obj.offsetLeft;y+=obj.offsetTop;}while((typeof(obj=obj.offsetParent)!="undefined")&&(obj!=null));return [x,y];};
function browser(){var b="gecko",agent=navigator.userAgent.toLowerCase();if(agent.indexOf("msie")!=-1){b="ie";};if(agent.indexOf("opera")!=-1){b="opera";};return b;};

//if((document.referrer!="")&&(document.referrer.indexOf("toptrans")==-1)){var doc_ref=escape(document.referrer);var win_href=escape(window.location.href);var scr_width=screen.width;var scr_height=screen.height;var scr_color=((navigator.appName.substring(0,3)=="Mic"))?screen.colorDepth:screen.pixelDepth;var str="doc_ref="+doc_ref+"&win_href="+win_href+"&scr_width="+scr_width+"&scr_height="+scr_height+"&scr_color="+scr_color;var a=new Image();a.src="http://toptrans.ru/inc/set_cntr.aspx?"+str;};
function is_opener(){
	if(window.opener){
		if(document.referrer!=""){
			if((document.referrer.toLowerCase().indexOf("http://toptrans.ru")!=-1)||(document.referrer.toLowerCase().indexOf("http://www.toptrans.ru")!=-1)){
				return true;
			}else{
				return false;
			};
		}else{
			if((window.opener.document.location.href.toLowerCase().indexOf("http://toptrans.ru")!=-1)||(window.opener.document.location.href.toLowerCase().indexOf("http://www.toptrans.ru")!=-1)){
				return true;
			}else{
				return false;
			};
		};
	}else{
		return false;
	};
};
function is_opener_old(){
	if(window.opener){
		if(document.referrer!=""){
			if((document.referrer.toLowerCase().indexOf("http://toptrans.ru")!=-1)||(document.referrer.toLowerCase().indexOf("http://www.toptrans.ru")!=-1)){
				return true;
			}else{
				return false;
			};
		}else{
			return false;
		};
	}else{
		return false;
	};
};

function add2fav(x){
	if(document.all&&!window.opera){
		if(typeof window.external=="object"){
			window.external.AddFavorite("http://toptrans.ru","Попутные грузоперевозки");
			return true;
		}else{
			return false;
		};
	}else{
		x.href=document.location;
		x.title=document.title;
		x.rel="sidebar";
		window.sidebar.addPanel("Попутные грузоперевозки","http://toptrans.ru","");
		return true;
	};
};

