/**
 * Передача урла кнопке
 */
function GoButton($s)
{
  location.href=$s;
}

/**
 * Получение значения элемента по ID
 */

function GetVal($id) {
  if (typeof $id == 'string') {
    return document.getElementById($id).value;
  }
  return null;
}

/**
 * Передача урла кнопке
 */
function GoButtonParam($s,$p1,$p2,$p3,$p4)
{
  var $a;
    $a = $s;
if ($p1 != null && GetVal($p1) != null) {
      $a = $a+'&'+$p1+'='+GetVal($p1);
   }
if ($p2 != null && GetVal($p2) != null) {
      $a = $a+'&'+$p2+'='+GetVal($p2);
   }
if ($p3 != null && GetVal($p3) != null) {
      $a = $a+'&'+$p3+'='+GetVal($p3);
   }
if ($p4 != null && GetVal($p4) != null) {
      $a = $a+'&'+$p4+'='+GetVal($p4);
   }
  location.href=$a;
}

/**
 * Обработчик открывающегося меню
 */
function clickHandler(evt) { 
  var targetId, srcElement, targetElement; 

  srcElement = evt ? evt.target : window.event.srcElement;

  if (srcElement.className == "menu") { targetId = srcElement.id + "details"; 
    targetElement = document.getElementById(targetId);
    if (targetElement.style.display == "none") { targetElement.style.display = "inline"; 
    } else { 
      targetElement.style.display = "none"; 
    } 
  }
} 




function CheckFeed() {
var d = new Date();

p_email=document.mailer.mail.value.toString();
p_year=document.mailer.year.value.toString();

if (p_email == '')
{
alert('Не указан E-mail!');
    document.mailer.mail.focus();
    return false;
}

if (p_year != d.getFullYear())
{
alert('Не корректно указан текущий год!');
    document.mailer.year.focus();
    return false;
}

 t=p_email.indexOf('@');
  if ((p_email.indexOf('.')==-1)||(t==-1)||(t < 1)||
   (t > p_email.length - 5) || (p_email.charAt(t - 1)=='.') || (p_email.charAt(t + 1)=='.'))
  { alert('Некорректно указан E-mail!');
    document.mailer.mail.focus();
    return false;
  }
}
