function move2(object, count, orient){
var c;
if ((orient=='left')&&(parseInt(e(object).style.right)<0)){
if (count>0){
clearTimeout(rightTimeout);
c=parseInt(e(object).style.right)+300;
e(object).style.right=c+'px';
count=count-25;
func="move2('"+object+"','"+count+"','left');";
leftTimeout=window.setTimeout(func,1);
}}
if (orient=='right'){
if (count>0){
clearTimeout(leftTimeout);
c=parseInt(e(object).style.right)-300;
e(object).style.right=c+'px';
count=count-25;
func="move2('"+object+"','"+count+"','right');";
rightTimeout=window.setTimeout(func,1);
}}}

function sendHelpform(){
var enter=String.fromCharCode(13)+String.fromCharCode(10);	

var chktext=e('helpFormname').value+e('helpFormemail').value+e('helpFormname').value+e('helpFormobj').value+e('helpFormcontent').value;	

if(chktext == '')return 1;

var text='Имя '+e('helpFormname').value+enter+' E-mail '+e('helpFormemail').value+enter+' Номер телефона '+e('helpFormname').value+enter+' Название объекта '+e('helpFormobj').value+enter+' Содержание проблемы '+e('helpFormcontent').value;	


 if(e('sendHelpWait')) {e('sendHelpWait').style.display='';}
 var url = "/php/sendmail.php";
  xmlHttp=createRequest(); 
try{
  xmlHttp.open("POST", url, false);
  xmlHttp.send(text);

  }
  catch(e)
  {
	 xmlHttp = false;     
     return;
  }
	if(e('sendHelpWait')) {e('sendHelpWait').style.display='none';}
	showSendHelp();
	alert(getWordLang('supportsave'));
}


function VhelpPanel(container){


this.onEvent=function(ev){

}
this.namePanel=getWordLang('buttonHelp');
this.container=container;
this.reNamePanel = function (newname) {
 e('namePanel').innerHTML=newname;
}
this.HidePanel = function (){
	appEvents.dispatchEvent('hideHelpPanel','hideHelpPanel');	
	hidePanel("helpPanel");
	
	}

this.help=function(param){
if(e('namePanel').innerHTML==getWordLang('nameHistoryPanel')){
this.HidePanel();
}
//var support = getWordLang('emailForReport');
var support = getWordLang('support');
var supportname   = getWordLang('supportname');
var supportemail  = getWordLang('supportemail');
var supportphone  = getWordLang('supportphone');
var supportobject = getWordLang('supportobject');
var supportdetail = getWordLang('supportdetail');
var supportsend   = getWordLang('send');
var form='<div class="helpform" style="width:100%;cursor:pointer;" onclick="showSendHelp();"><br/>&nbsp;'+support+' E-mail <br/></div>'+
	'<hr class="helpform"/><div class="helpform" id="sendHelp" style="display:none;">'+
	'<form method="POST" class="helpform"><br/><table id="formQueryCall">'+
					'<tr>'+
						'<td>'+supportname+'</td>'+
						'<td><input type="text" name="name" onclick="this.focus();" style="width:100%;" id="helpFormname" value="" /></td>'+
					'</tr>'+
					'<tr>'+
						'<td>E-mail</td>'+
						'<td ><input type="text" name="email" onclick="this.focus();" style="width:100%;" id="helpFormemail" value="" /></td>'+
					'</tr>'+
					'<tr>'+
						'<td>'+supportphone+'</td>'+
						'<td><input type="text" name="phone" onclick="this.focus();" style="width:100%;"  id="helpFormphone" value="" /></td>'+
					'</tr>'+
					'<tr>'+
						'<td>'+supportobject+'</td>'+
						'<td ><input type="text" name="obj" onclick="this.focus();" style="width:100%;" id="helpFormobj" value="" /></td>'+
					'</tr>'+

					'<tr>'+
						'<td>'+supportdetail+'</td>'+
						'<td><textarea name="content" onclick="this.focus();" id="helpFormcontent" style="width:100%;"></textarea></td>'+
					'</tr>'+
				'<tr><td>&nbsp;</td><td><input type="button" name="queryCall" onclick="sendHelpform();" value="'+supportsend+'"/></td></tr>'+
				'</table>'+
				'</form><img id="sendHelpWait" style="display:none;position:absolute;left:40%;top:20%;width:48px;" src="/img/ajax-loader-white.gif"/></div>';
switch (param) {
case 'Смена пользователя':
case 'Баланс':
case 'Показать все трекеры':
case 'Начать слежение':
case 'Старт':
        this.reNamePanel('Помощь: Старт');
        this.writeText(form+'<iframe src="/help/work.html" class="framehelp" frameborder="0" ALLOWTRANSPARENCY="true"/>');
break;
case 'Контроль':
        this.reNamePanel('Помощь: Контроль');
        this.writeText(form+'<iframe src="/help/control.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;

case 'Настройки': 
        this.reNamePanel('Помощь: Настройки');
        this.writeText(form+'<iframe src="/help/settings.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;


case 'История':
        this.reNamePanel('Помощь: История');
        this.writeText(form+'<iframe src="/help/history.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;

case 'Отображение на сайте':
        this.reNamePanel('Помощь: Отображение на сайте');
        this.writeText(form+'<iframe src="/help/display.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;

case 'События on-line':
        this.reNamePanel('Помощь: События on-line');
        this.writeText(form+'<iframe src="/help/events.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Добавить трекер':
        this.reNamePanel('Помощь: Добавить трекер');
        this.writeText(form+'<iframe src="/help/new.html" class="framehelp" frameborder="0" ALLOWTRANSPARENCY="true"/>');
break;
case 'Редактировать трекер':
        this.reNamePanel('Помощь: Редактировать трекер');
        this.writeText(form+'<iframe src="/help/edit.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Удалить трекер':
        this.reNamePanel('Помощь: Удалить трекер');
        this.writeText(form+'<iframe src="/help/delete.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Оповещения о событиях':
        this.reNamePanel('Помощь: Оповещения о событиях');
        this.writeText(form+'<iframe src="/help/signalsEvent.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;

case 'Ежедневные отчеты':
        this.reNamePanel('Помощь: Ежедневные отчеты');
        this.writeText(form+'<iframe src="/help/everyDayReport.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Контрольные точки':
        this.reNamePanel('Помощь: точки');
        this.writeText(form+'<iframe src="/help/kt.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Контрольные маршруты':
        this.reNamePanel('Помощь: маршруты');
        this.writeText(form+'<iframe src="/help/m.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Контрольные зоны':
        this.reNamePanel('Помощь: зоны');
        this.writeText(form+'<iframe src="/help/zk.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Посмотреть историю':
        this.reNamePanel('Помощь: Посмотреть историю');
        this.writeText(form+'<iframe src="/help/showHistory.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Отобразить маршрут':
        //this.reNamePanel('Помощь: Отобразить маршрут');
        //this.writeText('<iframe src="/help/showRoute.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
case 'Show route':
        //this.reNamePanel('Помощь: Отобразить маршрут');
        //this.writeText('<iframe src="/help/showRoute.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
break;
default:
this.reNamePanel(getWordLang('buttonHelp'));
this.writeText(form+'<iframe src="'+getWordLang('urlempty')+'" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');
        }
/*if(param=='работа'){
this.reNamePanel('Помощь: Работа');
this.writeText('<iframe src="/help/work.html" class="frametrackList" frameborder="0" />');
}else{
this.reNamePanel('Помощь');
this.writeText('Данных нет');
}*/

}

this.ShowPanel = function (){showPanel("helpPanel");}
this.createPanel = function (container) {
this.MainTable= document.createElement("table");
this.MainTable.insertRow(0);
this.MainTable.rows[0].insertCell(0);
this.MainTable.insertRow(1);
this.MainTable.rows[1].insertCell(0);
this.MainTable.style.position="absolute";
this.MainTable.style.width="90%";
this.MainTable.style.height="85%";
this.MainTable.style.top="0";
this.MainTable.style.right="0";
this.NamePanelDiv=document.createElement("div");
this.NamePanelDiv.className="dpt1";
this.NamePanelDiv.id="namePanel";
this.NamePanelDiv.innerHTML=this.namePanel;
this.MainTable.rows[0].cells[0].appendChild(this.NamePanelDiv);
//this.MainTable.rows[0].cells[0].appendChild(this.krest);


this.MainTable.rows[0].cells[0].className="wpt1";
this.MainTable.rows[0].cells[0].id="namePanel1";
this.MainTable.rows[0].cells[0].onmouseover=function()
	 { 
		 if(this.className=="wpt1")
		 {
		 this.className="hwpt1";
		 }
	 } 
this.MainTable.rows[0].cells[0].onmouseout=function()
	 {
		 if(this.className=="hwpt1")
		 {
		 this.className="wpt1";
		 }
	  } 
this.MainTable.rows[0].cells[0].onclick=this.HidePanel;
this.MainTable.rows[1].cells[0].style.textAlign='left';
this.MainTable.rows[1].cells[0].style.verticalAlign='top';
this.MainTable.rows[1].cells[0].style.height='95%';
this.divcontent= document.createElement("div");
if(isFF){
   var h=(window.innerHeight/2)-20;
   h=h+'px';
  }else{var h='100%';}
this.divcontent.style.height=h;
this.divcontent.style.width='100%';
this.divcontent.style.overflow='auto';

this.MainTable.rows[1].cells[0].appendChild(this.divcontent);
this.MainTable.style.background="url('img/traspatenrfon.png')";
this.container.appendChild(this.MainTable);
this.writeText = function (text){
this.MainTable.rows[1].cells[0].firstChild.innerHTML=text;
}

this.writeText('<iframe src="/help/start.html" class="framehelp" frameborder="0"  ALLOWTRANSPARENCY="true"/>');

}}

function showSendHelp()
{
	if(e('sendHelp'))
	{
		if(e('sendHelp').style.display == 'none')
		{
			e('sendHelp').style.display = '';
		}
		else
		{
			e('sendHelp').style.display = 'none';
		}
		
	}

}
