function atf(url, title)
{
    if (!url) url = location.href;
    if (!title) title = document.title;
    
    //Gecko
    if((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function"))
	window.sidebar.addPanel (title, url, "");
    //IE4+
    else if(typeof window.external == "object")
	window.external.AddFavorite(url, title);
    //Opera7+
    else if(window.opera && document.createElement)
    {
	var a = document.createElement('A');
	if (!a) return false; //IF Opera 6
	a.setAttribute('rel','sidebar');
	a.setAttribute('href',url);
	a.setAttribute('title',title);
	a.click();
    }
    else return false;
    return true;
}

function ToggleRegion(id)
{
    var d = document.getElementById(id).style.display;
    document.getElementById(id).style.display = d=='none'?'block':'none';
}

function PrintVersion()
{
//    alert('asdfasdf');
    var win = window.open('/src/print_version.html', '1','resizable=no,menubar=no,scrollbars=yes,width=800,height=600,top=1');
    var a = '';
//    var obj = win.document;
//    for(var i in obj)
//    {
//	a += i + '\n';
//    }
//    alert(a);
//    a = document.getElementById('content').innerHTML;
//    win.document.write(a);
    //onLoad = function () { alert('dfgdfg');}
    
    
//    ('content')
}
/*
var obj = window;
var a = '';
for(var i in obj)
{
    a += "obj[" + i + "] = " + obj[i] + "\n";
}
document.write("<pre>" + a + "</pre>");

*/
//----------------------------------------------------------------------------
function swf_show(swf, div, w, h, vers, backgr) {
  var obj = document.getElementById(div);
  if (!obj) {return;}
	var so = new SWFObject(swf, div+'obj', w, h, vers, backgr);
  so.addParam("scale", "showall");
  so.addVariable("region_id", "çíà÷åíèå ïåðåìåííîé");	
  so.write(div);
}
//----------------------------------------------------------------------------
function Links2SlideGallery (idblock) {
  var bl = document.getElementById(idblock);
  if (!bl) {return;}
  var arr = bl.getElementsByTagName('IMG');
  var o, o_link, new_div, new_txt;
  for (var i = 0; i < arr.length; i++) {
    o = arr[i];
    if (!o.parentNode || !o.parentNode.href) {continue;}
  	if (o.parentNode.href.indexOf('jpg') == -1 && o.parentNode.href.indexOf('gif') == -1 && o.parentNode.href.indexOf('JPG') == -1 && o.parentNode.href.indexOf('GIF') == -1) {continue;}
    o_link = o.parentNode;
    o_link.className = 'highslide';
    o_link.onclick = function() { return hs.expand(this, miniGalleryOptions1) };
  }
}
//----------------------------------------------------------------------------
function Links2SlideSimple (idblock) {
  var bl = document.getElementById(idblock);
  if (!bl) {return;}
  var arr = bl.getElementsByTagName('IMG');
  var o, o_link, new_div, new_txt;
  for (var i = 0; i < arr.length; i++) {
    o = arr[i];
    if (!o.parentNode || !o.parentNode.href) {continue;}
  	if (o.parentNode.href.indexOf('jpg') == -1 && o.parentNode.href.indexOf('gif') == -1 && o.parentNode.href.indexOf('JPG') == -1 && o.parentNode.href.indexOf('GIF') == -1) {continue;}
    o_link = o.parentNode;
    o_link.className = 'highslide';
    o_link.onclick = function() { return hs.expand(this) };
    if (!o_link.title) {continue;}
    new_div = document.createElement('div');
    o_link.parentNode.appendChild(new_div);
    new_txt = document.createTextNode(o_link.title);
    new_div.appendChild(new_txt);
    new_div.className = 'highslide-caption';
    o_link.title = '';
  }
}
//----------------------------------------------------------------------------
var o;
var o_color = 'red';
var counter = 1;
var o_frm_now;
//----------------------------------------------------------------------------
function CheckRequared(o_frm,vars) {
  for (var k in vars) {
    if (o_frm[vars[k]].value && o_frm[vars[k]].value != '0') {continue;}
    o = o_frm[vars[k]];
    counter = 1;
    o_color = 'red';
    o.value = ' Ââåäèòå äàííûå';
    o.focus();
    setTimeout("ChangeBg()",10);
    return false;
  }
  if (o_frm.submit) {o_frm_now = o_frm; setTimeout("o_frm_now.submit.disabled = true;",300);}
  return true;
}
//----------------------------------------------------------------------------
function ChangeBg() {
  counter++;
  if (counter > 8) {o.value = ''; return;}
  o_color = (o_color == 'red') ? 'white' : 'red';
  o.style.background = o_color;
  setTimeout("ChangeBg()",300)
}
//----------------------------------------------------------------------------
