function bookmarksite(title,url){
			if (window.sidebar) // firefox
			window.sidebar.addPanel(title, url, "");
			else if(window.opera && window.print){ // opera
			var elem = document.createElement('a');
			elem.setAttribute('href',url);
			elem.setAttribute('title',title);
			elem.setAttribute('rel','sidebar');
			elem.click();
			}
			else if(document.all)// ie
			window.external.AddFavorite(url, title);
}

function VtopPanel(container){
this.container = container;
this.id='VtopPanel';

this.changeLang=function(){
	if(e('lang').firstChild.innerHTML=='RU'){
  changeLang('ru');
		e('lang').firstChild.innerHTML='EN'
	}else{
		changeLang('en');
		e('lang').firstChild.innerHTML='RU'
	};
}

this.ClearPanel = function (container){
while (this.container.hasChildNodes()){
this.container.removeChild(this.container.firstChild);}}

this.HidePanel=function(){
if(e('tableForTopPanel').style.display=='none'){
e('tableForTopPanel').style.display='';
e('TopContainerButton').style.display='';
//e('m1').style.display='';
e('tableForTopPanel').style.width="100%";
}else{
e('tableForTopPanel').style.display='none';
//e('m1').style.display='none';
e('TopContainerButton').style.display='none';
}}

this.resetButton=function()//переводит все кнопки в начальное состояние
  {
		for(var i=0; i<e('TopContainerButton').childNodes.length; i++){
		e('TopContainerButton').childNodes[i].className="tbutton";
	}
  }

this.resetModeButton=function()
  {
	if(e('buttonModeContainer')){
		for(var i=0; i<e('buttonModeContainer').childNodes.length; i++){
		e('buttonModeContainer').childNodes[i].className="button";
		}
  }
}
///--------------------------------------------------
this.onclickMenuButton=function(){					
		top.topPanel.activeMenuButton(this.Name);
	};


this.activeMenuButton=function(nameButton){
	top.WorkPanel.createMainButton(e("buttonContainer"), xmlMenu, nameButton);
 top.WorkPanel.changeName(nameButton);
	top.setShowMode("0");
	e('display1').innerHTML='&nbsp;';
	e('display2').innerHTML='&nbsp;';
	e('display3').innerHTML='&nbsp;';
	clearZone();//если была зона то отчищает и восстанавливает событие онклик
	helpPanel.help(nameButton);
	e('helpButton').firstChild.innerHTML=getWordLang('buttonHelp');
	showPanel("workPanel");
}
//--------------------------------------------------------------

this.createMenu=function(containerButton, xml){
	var items = xml.XMLDocument.documentElement.getElementsByTagName('item');
	var Buttons= new Array;
	for (var j = 0; j < items.length; j++)
	{
	   Buttons['Button'+j]=new buttonTop(containerButton);
	   Buttons['Button'+j].Name=items[j].getAttribute('name');
	   Buttons['Button'+j].attributeSet('Name', items[j].getAttribute('name'));
	   Buttons['Button'+j].onclick=this.onclickMenuButton;
	   Buttons['Button'+j].attributeSet('style.margin', '3px');
	   Buttons['Button'+j].CreateButton();
	}
//loadUserParams(); пренесено в logon.pl
}
this.changeValueHelpButton=function(word){
e('helpButton').firstChild.innerHTML=word;
}
//---------------------------------отлов событий ------------------
this.onEvent=function(ev)
{
if (ev=='changeMode') 
 { 

	topPanel.resetModeButton();
	if(Number(showMode)==0){e('mode0').className='ubutton';}
	if(Number(showMode)==1){e('mode1').className='ubutton';}
	if(Number(showMode)==2){e('mode2').className='ubutton';}
	/*if(Number(showMode)==3){e('mode3').className='ubutton';}
	if(Number(showMode)==4){e('mode3').className='ubutton';}*/
 }
if (ev=='hideHelpPanel') 
 { 
  e('helpButton').className='tbutton';
 }
if (ev=='stopLoad') 
 { 
 topPanel.stopLoad();
 }
if (ev=='startLoad') 
 { 
  topPanel.startLoad();
 }
}
//----------------------------------------------------------




this.creatPanel=function(container){

this.divMainTable=document.createElement("div");

this.menu=document.createElement("div");
this.menu.style.position='absolute';
this.menu.style.top='0px';
this.menu.style.left='45px';
this.menu.style.zIndex='150';
this.menu.id='TopContainerButton';
this.divMainTable.appendChild(this.menu);
this.createMenu(this.menu, xmlMenu);


this.divMainTable.style.position='absolute';
this.divMainTable.style.top='0px';
this.divMainTable.style.right='0';
this.MainTable=document.createElement("table");
var m = this.MainTable;
m.id='tableForTopPanel';
m.style.width='100%';
m.style.cellSpacing='0';
m.cellSpacing='0';
m.insertRow(0);
m.rows[0].insertCell(0);
m.rows[0].insertCell(1);
m.rows[0].insertCell(2);
m.rows[0].cells[0].innerHTML='&nbsp;';
m.rows[0].cells[0].style.verticalAlign='top'; 
m.rows[0].cells[0].style.width='25%';
m.rows[0].cells[0].style.height='66px';
m.rows[0].cells[2].style.verticalAlign='top'; 
m.rows[0].cells[1].className='topTableT1'; 
m.rows[0].cells[2].style.textAlign='right';
if(navigator.appVersion.indexOf('MSIE')!=-1){
m.rows[0].cells[0].style.background='none';
m.rows[0].cells[0].style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/top1.png\', sizingMethod=\'scale\')';
m.style.background='none';
m.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/top2.png\', sizingMethod=\'scale\')';
m.rows[0].cells[1].style.background='none';
m.rows[0].cells[1].style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/top2.png\', sizingMethod=\'scale\')';
m.rows[0].cells[2].style.background='none';
m.rows[0].cells[2].style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/top3.png\', sizingMethod=\'scale\')';
}else{
//m.rows[0].cells[0].style.background='url(img/top1.png) no-repeat 100% 0px;';
m.rows[0].cells[0].style.background='url(img/top1.png)';
m.rows[0].cells[0].style.backgroundRepeat='no-repeat';
m.rows[0].cells[0].style.backgroundPosition='top right';
this.divMainTable.style.position='';
//m.rows[0].cells[0].style.backgroundRepeat='';
m.rows[0].cells[1].style.backgroundImage='url(img/top2.png)';
m.rows[0].cells[1].style.backgroundRepeat='repeat-x';
m.rows[0].cells[2].style.background='url(img/top3.png)';
m.rows[0].cells[2].style.backgroundRepeat='no-repeat';}
m.rows[0].cells[2].style.width='25%';
//alert(D(m.rows[0].cells[0].style));
m.rows[0].cells[1].id='buttonModeContainer';

///------------------------------------------четыре кнопочки возможно переключения режимов------------------------
/*
this.r1=new buttonOK(m.rows[0].cells[1]);
this.r1.Name='<img src="img/button/b1.gif" style="border: #fff solid 0px; margin-top: 7px;" />';
this.r1.attributeSet('style.position', 'absolute');
this.r1.attributeSet('style.left', '702px');
this.r1.attributeSet('style.top', '4px');
this.r1.attributeSet('title', getWordLang('modeHistory'));
this.r1.Id='mode3';
this.r1.Active='1';
//this.r1.Action='0';
this.r1.onclick=function(){if(top.idselectTrack){top.InterReportShow(idselectTrack);}else{alert(getWordLang('alertSettingHistory'));}}
if(Number(showMode)==3){this.r1.firstStat='4'}
if(Number(showMode)==4){this.r1.firstStat='4'}
this.r1.CreateButton();
*/
this.r1=new buttonOK(m.rows[0].cells[1]);
this.r1.Name='<img src="img/button/izz.gif" style="border: #fff solid 0px; margin-top: 7px;" />';
this.r1.attributeSet('style.position', 'absolute');
this.r1.attributeSet('style.left', '702px');
this.r1.attributeSet('style.top', '4px');
this.r1.attributeSet('title', getWordLang('bookmark'));

this.r1.Id='mode3';
this.r1.Active='0';
//this.r1.Action='0';
//this.r1.onclick=function(){if(top.idselectTrack){top.InterReportShow(idselectTrack);}else{alert(getWordLang('alertSettingHistory'));}}
this.r1.onclick=function(){bookmarksite('VI-TEL','http://gps.vi-tel.ru');}
/*if(Number(showMode)==3){this.r1.firstStat='4'}
if(Number(showMode)==4){this.r1.firstStat='4'}*/
this.r1.CreateButton();


this.r2=new buttonOK(m.rows[0].cells[1]);
this.r2.Name='<img src="img/button/b2.gif" style="border: #fff solid 0px; margin-top: 7px;"/>';
this.r2.attributeSet('style.position', 'absolute');
this.r2.attributeSet('style.left', '670px');
this.r2.attributeSet('style.top', '4px');
this.r2.attributeSet('title', getWordLang('modeVision'));
this.r2.onclick=function(){top.setShowMode("2");}
this.r2.Active='1';
this.r2.Id='mode2';
if(Number(showMode)==2){this.r2.firstStat='4'}
this.r2.CreateButton();

this.r3=new buttonOK(m.rows[0].cells[1]);
this.r3.Name='<img src="img/button/b3.gif" style="border: #fff solid 0px;  margin-left: 2px; margin-top: 10px;"/>';
this.r3.attributeSet('style.position', 'absolute');
this.r3.attributeSet('style.left', '638px');
this.r3.attributeSet('style.top', '4px');
this.r3.attributeSet('title', getWordLang('modeObject'));
this.r3.onclick=function(){top.setShowMode("1");}
this.r3.Id='mode1';
this.r3.Active='1';
if(Number(showMode)==1){this.r3.firstStat='4'}
this.r3.CreateButton();

this.r4=new buttonOK(m.rows[0].cells[1]);
this.r4.Name='<img src="img/button/b4.gif" style="border: #fff solid 0px; margin-top: 7px;"/>';
this.r4.attributeSet('style.position', 'absolute');
this.r4.attributeSet('style.left', '604px');
this.r4.attributeSet('style.top', '4px');
this.r4.attributeSet('title', getWordLang('modeArea'));
this.r4.onclick=function(){top.setShowMode("0");}
this.r4.Active='1';
this.r4.Id='mode0';
if(Number(showMode)==0){this.r4.firstStat='4'}
this.r4.CreateButton();

/*
display1 = new VButtonFrom3Part(m.rows[0].cells[1]);
display1.Name='&nbsp;';
display1.LeftPart='img/blackwindowleft.gif';
display1.FonPart='url(img/blackwindowfon.gif)';
display1.RightPart='img/blackwindowright.gif';
display1.mainId="display1";
display1.CreateButton();
*/

/*
this.r5=new mainButton(m.rows[0].cells[2]);
this.r5.Name='EN';
this.r5.attributeSet('style.position', 'absolute');
this.r5.attributeSet('style.left', '738px');
this.r5.attributeSet('style.top', '4px');
//this.r5.onclick='';
this.r5.Active='0';
this.r5.CreateButton();*/

this.r4=new buttonOK(m.rows[0].cells[2]);
if(Language=='ru'){
this.r4.Name='EN';}else{
this.r4.Name='RU';
}
this.r4.attributeSet('style.position', 'absolute');
this.r4.attributeSet('style.left', '735px');
this.r4.attributeSet('style.top', '4px');
this.r4.onclick=this.changeLang;
this.r4.Active='0';
this.r4.Id='lang';
this.r4.firstStat='1'
this.r4.CreateButton();


this.HelpButton = document.createElement("div");
m.rows[0].cells[2].appendChild(this.HelpButton)
///------------------------------------------------------------------
  this.help=new buttonTop(this.HelpButton);
  this.help.Name=getWordLang('buttonHelp');
  this.help.attributeSet('Name', getWordLang('buttonHelp'));
  this.help.onclick=function(){helpPanel.ShowPanel()};
  this.help.attributeSet('style.margin', '3px');
  this.help.attributeSet('style.right', '25px');
  this.help.attributeSet('style.position', 'absolute');
  this.help.Id='helpButton';
  this.help.CreateButton();


d=new Date();
var month;
var todayDate;
month=d.getMonth()+1;
if (month<10){month='0'+month;}
todayDate=d.getDate()+'.'+month+'.'+d.getFullYear();
/*m.rows[0].cells[2].innerHTML+='<table cellpadding="0" cellspacing="0" border="0" align="left" style="margin-right: 0px"><tbody><tr><td class="top_td5">'+todayDate+'</td><td class="top_td4"><img src="img/en.gif" alt="переключить на английский язык"/></td><td class="top_td6" style="cursor:pointer;" onclick="if(parseInt(e(\'helpPanel\').style.right)<0){move2(\'helpPanel\', 50, \'left\');}else{move2(\'helpPanel\', 50, \'right\');}" >&#1087;&#1086;&#1084;&#1086;&#1097;&#1100;</td></tr></tbody></table>';*/
this.divMainTable.appendChild(m);   
this.container.appendChild(this.divMainTable);
this.HideButton = document.createElement("div");
this.HideButton.style.position='absolute';
this.HideButton.style.top='0px';
this.HideButton.style.right='0';
this.HideButton.style.zIndex='50';
this.HideButton.innerHTML='<img src="img/topbuttonright.gif" style="margin-right:0px; margin-top:5px;" border=0 />';
this.container.appendChild(this.HideButton);
this.HideButton.onclick=this.HidePanel;
this.Logo=document.createElement("div");
this.Logo.style.position='absolute';
this.Logo.style.top='2px';
this.Logo.style.left='2px';
this.Logo.style.fontSize='12px';
this.Logo.style.color='rgb(178,178,178)';
this.Logo.innerHTML='<img src="/img/logo.gif" style="margin-left:5px; margin-top:0px;" border="0" id="indicator" onclick="_reset()"/><br />VI-TEL SERVICES';
m.rows[0].cells[0].appendChild(this.Logo);
}

this.startLoad= function(){null;}
this.stopLoad= function(){null;}

}