
 var agt = navigator.userAgent.toLowerCase();
 var appVer = navigator.appVersion.toLowerCase();
 var is_minor = parseFloat(appVer);
 var is_major = parseInt(is_minor);

 var iePos = appVer.indexOf('msie');
 if (iePos != -1) {
  is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
  is_major = parseInt(is_minor);
 }

 var is_gecko = ((navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
 var is_gver  = 0;
 if (is_gecko) is_gver=navigator.productSub;

 var is_moz = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
              (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1) &&
              (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1) &&
              (is_gecko) && ((navigator.vendor=="")||(navigator.vendor=="Mozilla")));
 if (is_moz) {
  var is_moz_ver = (navigator.vendorSub)?navigator.vendorSub:0;
  if(!(is_moz_ver)) {
   is_moz_ver = agt.indexOf('rv:');
   is_moz_ver = agt.substring(is_moz_ver+3);
   is_paren = is_moz_ver.indexOf(')');
   is_moz_ver = is_moz_ver.substring(0,is_paren);
  }
  is_minor = is_moz_ver;
  is_major = parseInt(is_moz_ver);
 }

 var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
              && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
              && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)
              && (!(is_moz)));
 if ((navigator.vendor)&&((navigator.vendor=="Netscape6")||(navigator.vendor=="Netscape"))&&(is_nav)) {
  is_major = parseInt(navigator.vendorSub);
  is_minor = parseFloat(navigator.vendorSub);
 }

 var is_opera = (agt.indexOf("opera") != -1);
 var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
 var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
 var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
 var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
 var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
 var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
 var is_opera6up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5);

 var is_nav2 = (is_nav && (is_major == 2));
 var is_nav3 = (is_nav && (is_major == 3));
 var is_nav4 = (is_nav && (is_major == 4));
 var is_nav4up = (is_nav && is_minor >= 4);
 var is_nav6 = (is_nav && is_major==6);
 var is_nav6up = (is_nav && is_minor >= 6);
 var is_nav5 = (is_nav && is_major == 5 && !is_nav6);
 var is_nav5up = (is_nav && is_minor >= 5);
 var is_nav7 = (is_nav && is_major == 7);
 var is_nav7up = (is_nav && is_minor >= 7);

 var is_ie = ((iePos!=-1) && (!is_opera));
 var is_ie3 = (is_ie && (is_major < 4));
 var is_ie4 = (is_ie && is_major == 4);
 var is_ie4up = (is_ie && is_minor >= 4);
 var is_ie5 = (is_ie && is_major == 5);
 var is_ie5up = (is_ie && is_minor >= 5);
 var is_ie5_5 = (is_ie && (agt.indexOf("msie 5.5") !=-1));
 var is_ie5_5up =(is_ie && is_minor >= 5.5);
 var is_ie6 = (is_ie && is_major == 6);
 var is_ie6up = (is_ie && is_minor >= 6);

function print_layer(layer_get, layer_x1, layer_y1) {
 if (is_ie4up) {
  doc = "document.all";
  sty = ".style";
  layer_vis = eval(doc + '[layer_get]' + sty);
  layer_vis.left = layer_x1;
  layer_vis.top = layer_y1;
  layer_vis.visibility = "visible";
 }
 else if (is_nav7) {
  layer_vis = document.getElementById(layer_get);
  layer_vis.style.left = layer_x1;
  layer_vis.style.top = layer_y1;
  layer_vis.style.visibility = "visible";
 }
 else if (is_nav4up) {
  doc = "document";
  layer_vis = eval(doc + '[layer_get]');
  layer_vis.left = layer_x1;
  layer_vis.top = layer_y1;
  layer_vis.visibility = "visible";
 }
 else if (is_opera) {
  layer_vis = document.getElementById(layer_get);
  layer_vis.style.left = layer_x1;
  layer_vis.style.top = layer_y1;
  layer_vis.style.visibility = "visible";
 }
}

function hide_layer(layer_get) {
 if (is_ie4up) {
  doc = "document.all";
  sty = ".style";
  layer_vis = eval(doc + '[layer_get]' + sty);
  layer_vis.visibility = "hidden";
 }
 else if (is_nav7) {
  layer_vis = document.getElementById(layer_get);
  layer_vis.style.visibility = "hidden";
 }
 else if (is_nav4up) {
  doc = "document";
  layer_vis = eval(doc + '[layer_get]');
  layer_vis.visibility = "hidden";
 }
 else if (is_opera) {
  layer_vis = document.getElementById(layer_get);
  layer_vis.style.visibility = "hidden";
 }
}

function display_info(layer_off, layer_on, line_num) {
 if (layer_off != '') {
  hide_layer(layer_off);
  if (line_num != '') {
   hide_layer(line_num);
  }
 }
 if (layer_on != '') {
  print_layer(layer_on, x, y);
  if (line_num != '') {
   print_layer(line_num, xline, yline);
  }
 }
}

function ani_news() {
 //для пяти новостей в бегущей строке
 /*if (count == 1) {
  lnews='news1';
 }
 if (count == 2) {
  lnews='news2';
 }
 if (count == 3) {
  lnews='news3';
 }
 if (count == 4) {
  lnews='news4';
 }
 if (count == 5) {
  lnews='news5';
  }
 if (count == 6) {
  lnews='news1';
  count=1;
 }*/
 //для четырех новостей в бегущей строке
 /*if (count == 1) {
  lnews='news1';
 }
 if (count == 2) {
  lnews='news2';
 }
 if (count == 3) {
  lnews='news3';
 }
 if (count == 4) {
  lnews='news4';
 }
 if (count == 5) {
  lnews='news1';
  count=1;
 }
*/

 //для трех новостей в бегущей строке
if (count == 1) {
  lnews='news1';
 }
 if (count == 2) {
  lnews='news2';
 }
 if (count == 3) {
  lnews='news3';
 }
 if (count == 4) {
  lnews='news1';
  count=1;
 }



 //для двух новостей в бегущей строке
 /* if (count == 1) {
  lnews='news1';
 }
 if (count == 2) {
  lnews='news2';
 }
 if (count == 3) {
  lnews='news1';
  count=1;
 } */

 if (xnews>available_width/2-240) {
  xnews = xnews - 10;
  print_layer(lnews, xnews, ynews);
  setTimeout("ani_news()",1);
 }
 else {
  setTimeout("news_stop()",5000);
 }
}

function news_start() {
 setTimeout("ani_news()",3000);
}

function news_stop() {
 display_info(lnews,'','');
 xnews=available_width;
 count++;
 if (count >= 6) {
  count=1;
 }
 setTimeout("ani_news()",1);
}

function layer_change(layer_off, layer_on) {
 hide_layer(layer_off);
 print_layer(layer_on, xslogan, yslogan);
}

function win(title,filename,width,height)
{
var margin_x=10;
var margin_y=10;
var w=width+2*margin_x+2;
var h=height+2*margin_y+2;
var params='status=yes,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h;
picwindow=window.open("","",params);
picwindow.document.write('<html>\n<head>\n<title>'+title+'</title>\n<style>img.pic{border-style:solid;border-color:#4C4C4C;border-width:1}</style>\n</head>\n');
picwindow.document.write('<body bgcolor="#FFFFFF" leftmargin="'+margin_x+'" topmargin="'+margin_y+'" marginwidth="'+margin_x+'" marginheight="'+margin_y+'">\n');
picwindow.document.write('<a href="javascript:window.close();"><img src="'+filename+'" width="'+width+'" height="'+height+'" alt="'+title+'" class="pic"></a>\n');
picwindow.document.write('</body>\n</html>');
}