function showImg( img, w, h, ttl ){
  w += 20;
  h += 30;
  img = 'src=' + escape( img );
  if( ttl != "" ) ttl = '&ttl=' + escape(ttl);
  window.open( '/showimg.phtml?' + img + ttl, '_blank', 'width='+w+',height='+h );
  }

function openDocImg( img, w, h, ttl ){
  showImg( 'images/docs/'+img, w, h, ttl );
  }

function setbg( id, color ){
  var td = document.getElementById(id);
  if( td != null ) td.bgColor = color;
  }

function setmc( id, o ){
  var color = '#E8E8E8';
  if( o == 0 ) color = '#EEEEEE';//'';
  setbg( 'mc'+id, color );
  }

function setm( id, o ){
  var color = '#E8E8E8';
  if( o == 0 ) color = '';
  setbg( 'mn'+id, color );
  }

function setmenu( name, state ){
  var src = document.getElementById('i'+name).src;
  var i = src.length;
  var ext = src.substr( i-4, 4 );
  src = src.substr( 0, i-6 );
  document.getElementById('i'+name).src = src + state + ext;
  document.getElementById('d'+name).className = 'dm' + state;
  }

function toggle( dname ){
  if( document.getElementById('d'+dname).className == 'dmop' ) setmenu( dname, 'cl' );
  else{
    var i, s;
    for( i = 0; i < divi; i++ ){
      s = 'm'+i;
      if( s != dname ) setmenu( s, 'cl' );
      }
    setmenu( dname, 'op' );
    }
  }

function sendmail( name, host ){
  document.location = "mailto:" + name + '@' + host;
  }

function sendmails( name, host, subj ){
  document.location = "mailto:" + name + '@' + host + "?subject=" + subj;
  }

function writemail( name, host ){
  var at = 64;
  document.write( "<a href=\"javascript:sendmail('" + name + "','" + host + "')\">" );
  document.write( name + "&#" + at + ";" + host + "</a>" );
  }

function toggledoc( dname ){
  var itm = document.getElementById('d'+dname)
  if( itm.className == 'ddocop' ) itm.className = 'ddoccl';
  else itm.className = 'ddocop';
  }

function openCalc( root, name ){
  var w = "";
  var h = "";
  switch( name ){
    case 'credit':
      w = 400;
      h = 300;
      break;
    case 'osago':
      w = 450;
      h = 270;
      break;
    }
  if( w == "" ) return;
  window.open( root + 'calc_' + name + '.html', 'w_' + name, 'width=' + w + ',height=' + h +
      ',toolbar=no,location=no,directories=no,statusno,menubar=no,scrollbars=no' );
  }

function setsmap( td, o ){
  var color = '#E8E8E8';
  if( o != 0 ) color = '#D0DCEE';
  td.bgColor = color;
  }

function setsmapl( td, o ){
  var color = '#E8E8E8';
  var color1 = '#E8E8E8';
  if( o != 0 ){
    color = '#D0DCEE';
    color1 = '#D8D8D8';
    }
  td.bgColor = color;
  document.getElementById('smchcr').bgColor = color1;
  document.getElementById('smchse').bgColor = color1;
  document.getElementById('smchsu').bgColor = color1;
  document.getElementById('sminco').bgColor = color1;
  document.getElementById('sminsu').bgColor = color1;
  document.getElementById('smdisc').bgColor = color1;
  }

function setsmapr( td, o ){
  var color = '#E8E8E8';
  var color1 = '#E8E8E8';
  if( o != 0 ){
    color = '#D0DCEE';
    color1 = '#D8D8D8';
    }
  td.bgColor = color;
  document.getElementById('smchcr').bgColor = color1;
  document.getElementById('smchse').bgColor = color1;
  document.getElementById('smchsu').bgColor = color1;
  document.getElementById('sminco').bgColor = color1;
  document.getElementById('sminsu').bgColor = color1;
  document.getElementById('smdisc').bgColor = color1;
  document.getElementById('smcrre').bgColor = color1;
  document.getElementById('smcrco').bgColor = color1;
  }

function setcas( id, o ){
  var color = '#E8E8E8';
  if( o != 0 ) color = '#E0E0E0';
  document.getElementById('tdc1n'+id).bgColor = color;
  document.getElementById('tdc2n'+id).bgColor = color;
  }

function togglecas( id ){
  var itm = document.getElementById( 'cas'+id )
  if( itm.className == 'caso' ) itm.className = 'casc';
  else itm.className = 'caso';
  }

function faq( id ){
  var tab = document.getElementById('faqt'+id);
  var div = document.getElementById('faqd'+id);
  if( tab.className == 'faqtc' ){
    tab.className = 'faqto';
    div.className = 'faqdo';
    }
  else{
    tab.className = 'faqtc';
    div.className = 'faqdc';
    }
  }
