var good_browser = 0;
var d_id = "dd1";
var offset = 0;
var min_ns_width = 755;
var lay_top = 0;
var top_offset = 3;

  with (navigator)
  {
     if ( (appVersion.indexOf("MSIE")>0) && (parseInt(appVersion.substring(0,1))>=4) )
            good_browser = 1;
  }

function show_div(div_id)
{
  hide_div(d_id);
  if (good_browser)
  {
      d_id = div_id;
      document.all[d_id].style.visibility = "visible";
  }
  else
  {
      d_id = div_id;
      lay_top = document.layers[d_id].top;
      document.layers[d_id].top += top_offset;
      document.layers[d_id].visibility = "show";
  }
}

function show_right_div(div_id)
{
//  alert(document.forms[0].elements.length);
  hide_div(d_id);
  offset = parseInt( eval("document.forms[0].o" + div_id.substring(1) + ".value") );
  if (good_browser)
  {
      d_id = div_id;
      document.all[d_id].style.left = document.all['b1'].scrollWidth - offset;
      document.all[d_id].style.visibility = "visible";
  }
  else
  {
      d_id = div_id;
      lay_top = document.layers[d_id].top;
      document.layers[d_id].top += top_offset;
      document.layers[d_id].left = (window.innerWidth > min_ns_width ? window.innerWidth : min_ns_width ) - offset;
//alert(window.innerWidth);
//      document.layers[d_id].left = document.ids['b1'].width - offset;
      document.layers[d_id].visibility = "show";
  }
}

function nshow_div(div_id)
{
      document.layers[d_id].visibility = "hide";
      d_id = div_id;
      document.layers[d_id].visibility = "show";
      return;   
}

function nshow_right_div(div_id)
{
  ind_a = div_id.indexOf('a');

  if (ind_a<0)
  {
    offset = parseInt( eval("document.forms[0].o" + div_id.substring(1) + ".value") );
  }
  else
  { 
    offset = parseInt( eval("document.forms[0].o" + div_id.substring(1,  parseInt(ind_a)) + ".value") )  
  }  
      document.layers[d_id].visibility = "hide";
      d_id = div_id;
      document.layers[d_id].left = (window.innerWidth > min_ns_width ? window.innerWidth : min_ns_width ) - offset;
      document.layers[d_id].visibility = "show";
      return;
}

function hide_div(div_id)
{
   if (good_browser)
   {
     document.all[div_id].style.visibility = "hidden";
   }
   else
   {
     document.layers[div_id].visibility = "hide";
     if (lay_top)
     {
       document.layers[div_id].top = lay_top;
     }
   }  
}

function catch_event(e)
{
   ev_x = e.pageX;
   hide_div(d_id); 
}

	function SetTextAndBGColor(layername,bgcolor,textcolor) {
		document.all[layername].style.backgroundColor='#'+bgcolor;
		document.all[layername].style.color='#'+textcolor;
	}

	function SetBGColor(layername,bgcolor) {
		document.all[layername].style.backgroundColor='#'+bgcolor;
	}

	function SetBGR(layername,backgroundfile) {
		document.all[layername].style.background='URL('+backgroundfile+')';
	}


