function SR_IsListSelected(el)
{
  for (var i = 0; i < el.length; i ++)
    if (el[i].selected ||
      el[i].checked)
      return i;
  return -1;
}
function SR_trim(f)
{
  return f.toString().replace(/^[ ]+/, '').replace(/[ ]+$/, '');
}
function SR_submit(f)
{
  f["field_email"].value = SR_trim(f["field_email"].value);
  f["field_name_first"].value = SR_trim(f["field_name_first"].value);
  if ((SR_focus = f["field_email"]) && f["field_email"].value.replace(/^[ ]+/, '').replace(/[ ]+$/, '').length < 1 || (SR_focus = f["field_name_first"]) && f["field_name_first"].value.replace(/^[ ]+/, '').replace(/[ ]+$/, '').length < 1) { alert("Укажите значения всех обязательных для заполнения полей (помечены звездочкой)"); SR_focus.focus(); return false; }
  if (!f["field_email"].value.match("^[A-Za-z0-9][A-Za-z0-9\._-]*[A-Za-z0-9_]*@([A-Za-z0-9]+([A-Za-z0-9-]*[A-Za-z0-9]+)*\.)+[A-Za-z]+$")) { alert("Некорректный синтаксис email-адреса!"); f["field_email"].focus(); return false; } 
  if (!f["field_name_first"].value.match("^[А-Яа-яA-Za-z]*$")) { alert("Значение поля \"Ваше имя\" не удовлетворяет описанию: \
\
Буквы русского и английского алфавитов"); f["field_name_first"].focus(); return false; } 
return true;
}

var goodBrowser=(document.getElementById && navigator.appName.indexOf("Netscape")!=-1) || (document.all && navigator.appVersion.indexOf("MSIE")!=-1)
if (goodBrowser){
	document.write('<DIV id=AvtosportDiv2 style="position:absolute;left:-500px;top:-500px;visibility:hidden;">');


document.write( '<style>');
document.write( '#cat, #cat input {font-family:Verdana, Arial, Helvetica, sans-serif;}');
document.write( '#cat a {color:#333366;font-size:11px;font-weight:bold;text-decoration:none;}');
document.write( '#cat a:hover {color:red;font-size:11px;font-weight:bold;text-decoration:underline;}');
document.write( '</style>');
document.write( '<table border=0 cellpadding=0 cellspacing=0 width=310 bgcolor=0099FF>');
document.write( '<tr><td><FORM name=SR_form style="padding:0px;margin:0px;" target="_blank" action="http://smartresponder.ru/subscribe.html?ref=Grigorus" method="post" onsubmit="return SR_submit(this)"><input type=hidden name=version value="1"><input type=hidden name=tid value="0"><input type=hidden name=uid value="41832"><input type=hidden name=charset value="windows-1251"><input type=hidden name=lang value="ru"><input type=hidden name="field_name_first" value="Подписчик"><input type=hidden name="did[]" value="21424">');
document.write( '<table border=0 cellpadding=0 bgcolor=FFFFFF cellspacing=0 style="border-left:2px solid #0099FF;border-right:2px solid #0099FF;border-bottom:1px solid #0099FF;border-top:2px solid #0099FF;"><tr><td width=100% style="background-image: url(http://www.avtosport.spb.ru/images/forms/bg1.gif);text-align:left;"><img src=../../images/wall/blue.gif width=1 height=25 border=0><img src=http://www.avtosport.spb.ru/images/wall/1.gif width=12 height=1 border=0><input style="WIDTH: 123px;height:22px; background-image: url(http://www.avtosport.spb.ru/images/forms/bg2.gif); font-size: 14px;border: 2px solid #008888;" maxlength=170 name=field_email value=ваш@mail.ru>&nbsp;<img src=http://www.avtosport.ru/images/wall/1.gif width=8 height=1>&nbsp;<INPUT TYPE=submit VALUE="Получать новости" title=&nbsp;подписка&nbsp;на&nbsp;Петербургские&nbsp;новости&nbsp;автоспорта NAME=SR_submitButton style="height:22px;width:150px; border: 2px solid #008888;background-image: url(http://www.avtosport.spb.ru/images/forms/bg3.gif); font-size:14px; font-weight: bold;color:#00427E;"></td>');
document.write( '<td align=right><img src=http://www.avtosport.ru/images/wall/1.gif width=2 height=1></td></tr></table></form>');

document.write( '<table width=310 border=0 cellpadding=8 cellspacing=1 bgcolor=00AAAA id=cat>');
document.write( '<tr><td bgcolor=ffffff nowrap style="text-align:left;">');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/offroad.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Внедорожники</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/rally.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Ралли</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/nevaring.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Кольцевые&nbsp;гонки</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/mototrek.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Трековые гонки</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/mult.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Автомногоборье</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/kart.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Картинг</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/history/first.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>История автоспорта</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/wm/index.html><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Интернет-магазин</a></b></td>');

document.write( '<td bgcolor=ffffff nowrap style="text-align:left;"><a href=http://www.avtosport.spb.ru/html/win/tv.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Автоспорт на ТВ</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/show.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Выставки</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/umor.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Юмор</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/links.shtml><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Ссылки</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/smskopilka.html target=_blank><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Копилка</b></a><br>');
document.write( '<a href=http://avtospb.borda.ru target=_blank><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Конференция</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru/html/win/chat.html target=_blank><img src=http://www.avtosport.spb.ru/images/forms/round01.gif width=12 height=6 border=0  align=bottom><b>Общение в Чате</b></a><br>');
document.write( '<a href=http://www.avtosport.spb.ru style=color:blue;font-size:12px;text-decoration:underline;><img src=http://www.avtosport.spb.ru/images/wall/1.gif width=12 height=6 border=0  align=bottom><b>www.avtosport.spb.ru</b></a></td></tr></table>');
document.write( '</td></tr></table>');
	
document.write('</DIV></DIV><DIV id=AvtosportDiv style="position:absolute;left:0px;top:0px;width:0;height:0;visibility:hidden;z-index:1;" onmouseover="hM();document.forms.SR_form.field_email.blur();">')
}
var dontShow
function hM() {
if (hM.arguments.length && drawPosition==xB) dontShow=1
selSH(1)
if (document.getElementById) {document.getElementById("AvtosportDiv").style.visibility="hidden";document.getElementById("AvtosportDiv2").style.visibility="hidden";}
else if (document.all) {document.all.AvtosportDiv.style.visibility="hidden";document.all.AvtosportDiv2.style.visibility="hidden";}
}

function sM() {
if (!goodBrowser) return
if (dontShow) {
if (sM.arguments.length) dontShow=0
return
}
if (document.getElementById) {
var myBody = document.getElementsByTagName("BODY")[0]
var myAvtosportDiv = document.getElementById("AvtosportDiv") ? document.getElementById("AvtosportDiv") : false
var myAvtosportDiv2 = document.getElementById("AvtosportDiv2")
var myAvtosportSR = document.getElementById("AvtosportSR")
var myMarginTop = 0
if (navigator.appVersion.indexOf("MSIE 5.0")!=-1) myMarginTop = myBody.style.marginTop ? myBody.style.marginTop : parseInt(myBody.getAttribute("topmargin"))
} else if (document.all) {
var myBody = document.body
var myAvtosportDiv = document.all.AvtosportDiv
var myAvtosportDiv2 = document.all.AvtosportDiv2
var myAvtosportSR = document.all.AvtosportSR
}
var pageTop	= myBody.scrollTop
var pageWidth	= window.innerWidth ? window.innerWidth : myBody.offsetWidth
var pageHeight	= window.innerHeight ? window.innerHeight : myBody.offsetHeight
var baseTop	= myAvtosportSR.offsetTop / ((document.getElementByID) ? 2 : 1)
var baseWidth	= myAvtosportSR.offsetWidth
var baseHeight	= myAvtosportSR.offsetHeight
var richWidth	= myAvtosportDiv2.offsetWidth
var richHeight	= myAvtosportDiv2.offsetHeight

drawPosition=dP

selSH(0)
myAvtosportDiv2.style.left	= ((drawPosition==1 || drawPosition==2) ? 0 : (baseWidth-richWidth))
myAvtosportDiv2.style.top	= ((drawPosition==2 || drawPosition==3) ? 0 : (baseHeight-richHeight))
myAvtosportDiv2.style.visibility="visible"
myAvtosportDiv.style.width	= pageWidth - (navigator.appName.indexOf("Netscape")!=-1 ? 20 : 20)

cur_max = 0

if (window.innerHeight>cur_max) cur_max = window.innerHeight

if (myBody.offsetHeight>cur_max) cur_max = myBody.offsetHeight

if (myBody.scrollHeight>cur_max) cur_max = myBody.scrollHeight

myAvtosportDiv.style.height	=  cur_max - 4

myAvtosportDiv.style.visibility="visible"
}

function selSH(s) {
if (navigator.appName.indexOf("Microsoft")<0) return
for (fF=0;fF<document.forms.length;fF++) {
for (eL=0;eL<document.forms[fF].length;eL++) {
if (document.forms[fF][eL].tagName=="SELECT") document.forms[fF][eL].style.visibility = s ? "visible" : "hidden"
}}}

function left(obj,left1){
var1=obj.offsetLeft+left1
if (obj.offsetParent!=document.body) left(obj.offsetParent,var1)
return(var1)
}

function top(obj,top1){
var2=obj.offsetTop+top1
if (obj!=document.body) {
if(obj.offsetParent) {
if (obj.offsetParent.style.position!="relative") top(obj.offsetParent,var2)
else top(obj.offsetParent,var2-obj.offsetParent.offsetTop/2)
}
}
return(var2)
}

