function setHilight(id,mode)
{
	switch(mode)
	{
	  case 0:
		el=document.getElementById(id);
		el.style.backgroundColor="transparent";
		el.style.cursor="Auto"
	  break;
	  case 1:
		el=document.getElementById(id);
		el.style.backgroundColor="#78aade";
		el.style.cursor="Pointer"
	  break;
	}
}

function goHref(id)
{
	el=document.getElementById(id);
	document.location.href=el.href;
}

function checkSpelling(e,obj)
{
	var str
	
	if(e)
	{
		if(e.keyCode) str=e.keyCode;
		else
		if(e.which) str=e.which;
		if (obj && str==13) 
			if (e.srcElement)
				e.srcElement.blur();
			else
			if (e.target)
				e.target.blur();
		if ( (str<48) || (str>57) ) 
		  {
			e.returnValue = false;
		  }
			else
			e.returnValue = true;
	}
}
///////////////////////////////////////////////////////
//  Проверим формы
///////////////////////////////////////////////////////

function testForm(fldId,fldName,mode)
{
  var reMail,reTel,re,i,el;

  reMail=new RegExp('^[a-z|0-9|\\.|-]+@[a-z|0-9|\\.{1}|-]+\\.{1}[a-z]{2,3}$',"ig");
  reTel=new RegExp('^[0-9|\\-|\\+|\\(|\\)]+$',"ig");
  
  el=document.getElementById(fldId);
  
  if(el.value=="")
    {
	  alert('Заполните пожалуйста поле "'+fldName+'"!');
	  return 0;
	}
  else
  switch(mode)
  {
    case 'tel':
	  if(!reTel.test(el.value))
	    {
		  alert('Проверьте корректность заполнения поля "'+fldName+'"!');
		  return 0;
		}
	break;
    case 'mail':
	  if(!reMail.test(el.value))
	    {
		  alert('Проверьте корректность заполнения поля "'+fldName+'"!');
		  return 0;
		}
	break;
  }
	  
  return 1;
}


///////////////////////////
//   логин
//////////////////////////
var regwnd;

function regSubmit(num)
{
	regwnd=window.open('about:blank','regwnd','top='+(screen.height/2-50)+',left='+(screen.width/2-200)+',height=40,width=400,status=no,toolbar=no,menubar=no,location=no,titlebar=no');
	eval('document.regform'+num+'.submit()');
	setTimeout('regwnd.close()',3000);
}

function setRegForm(e1,e2,name)
{
	if(name)
	  {
	  	e1.visibility="hidden";
	  	e1.position="absolute";
	  	e1.zIndex=-1000;
	  	e2.visibility="visible";
	  	e2.position="static";
	  	e2.zIndex=1000;
	  }
	else
	  {
	  	e2.visibility="hidden";
	  	e2.position="absolute";
	  	e2.zIndex=-1000;
	  	e1.visibility="visible";
	  	e1.position="static";
	  	e1.zIndex=1000;
	  }
}


////////////////////////////////////////////////////
//   Вывод сообщений
////////////////////////////////////////////////////
var iconNone=0;
var iconOk=1;
var iconError=2;
var currAlpha;

function messDiv()
{
	return document.getElementById('messagediv');
}

function ShowMyMessage(strTitle,strMessage,nIcon,nTime)
{
	currAlpha=80;
	SetMsgAlpha(80);
	SetMsgPosition();
	messDiv().style.visibility='visible';
}
function HideMyMessage()
{
	if(currAlpha>0)
	  {
//		currAlpha-=20;
//		SetMsgAlpha(currAlpha);
//		setTimeout('HideMyMessage();',5);
	  }
	messDiv().style.visibility='hidden';
}

function SetMsgAlpha(alpha)
{
	messDiv().style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+alpha+')';
}

function SetMsgPosition()
{
	messDiv().style.left=document.body.clientWidth/2-160;
	messDiv().style.top=document.body.clientHeight/2-70;
}


