COMMON_DIR = "/common/";
document.write('<link rel="stylesheet" type="text/css" media="all" href="'+COMMON_DIR+'includes/j-calendar/calendar-win2k-1.css" />');
document.write('<scr'+'ipt type="text/javascript" src="'+COMMON_DIR+'includes/j-calendar/calendar.js"></scr'+'ipt>');
document.write('<scr'+'ipt type="text/javascript" src="'+COMMON_DIR+'includes/j-calendar/lang/calendar-pl-utf8.js"></scr'+'ipt>');
document.write('<scr'+'ipt type="text/javascript" src="'+COMMON_DIR+'includes/j-calendar/calendar-setup.js"></scr'+'ipt>');

var calendarObject = null;
function showCalendar( itemName, anchorName )
{
  if ( calendarObject == null )
  {
    calendarObject = new CalendarPopup();
    calendarObject.setYearSelectStartOffset(80);
    calendarObject.setYearSelectEndOffset(5);
    calendarObject.setMonthNames("Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień");
    calendarObject.setMonthAbbreviations("Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Pa", "Lis", "Gru");
    calendarObject.setDayHeaders("N", "P", "W", "", "C", "P", "S");
    calendarObject.setTodayText("Dzi");
    calendarObject.showNavigationDropdowns();
  }
  var item = find_item( itemName );
  if ( xDef(calendarObject) && xDef( item ) )
  {
    calendarObject.select( item, anchorName, 'dd-MM-yyyy' );
  }
}

function showCalendar2( itemName, anchorName )
{
  if ( calendarObject == null )
  {
    calendarObject = new CalendarPopup();
    calendarObject.setMonthNames("Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień");
    calendarObject.setMonthAbbreviations("Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Pa", "Lis", "Gru");
    calendarObject.setDayHeaders("N", "P", "W", "", "C", "P", "S");
    calendarObject.setTodayText("Dzi");
    calendarObject.showNavigationDropdowns();
  }
  var item = find_item( itemName );
  if ( xDef(calendarObject) && xDef( item ) )
  {
    calendarObject.select( item, anchorName, 'yyyy-MM-dd' );
  }
}

function showDatetimeCalendar($inputField, $triggerItem) {
  Calendar.setup({
      inputField     :    $inputField,      // id of the input field
      ifFormat       :    "%Y-%m-%d %H:%M:00",  // format of the input field
      showsTime      :    true,            // will display a time selector
      button         :    $triggerItem,   // trigger for the calendar (button ID)
      singleClick    :    false,           // double-click mode
      step           :    1                // show all years in drop-down boxes (instead of every other year as default)
  });
}

function find_item( id )
{
  var itm = document.getElementsByName(id);
  return document.getElementById( id ) || ( itm && itm.length > 0 ? itm[0] : null ) ;
}

function xDef( el )
{
  return el != null && typeof( el ) != "undefined";
}

function xStr() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
  return true;
}

function xNum() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='number') return false;}
  return true;
}

function xSetAttribute( ele, attr, val )
{
  if ( xDef( ele ) ) {
    if ( xDef( ele.setAttribute ) ) ele.setAttribute( attr, val );
	else ele[attr] = val;
  }
}

function xGetAttribute( ele, attr )
{
  var a = null;
  if ( xStr(ele) )
  {
    ele = find_item(ele);
  }
  if ( ele != null && xDef( ele ) ) {
    if ( xDef( ele.getAttribute ) ) a = ele.getAttribute( attr );
    if ( !a ) a = ele[attr];
  }

  return a;
}

function copy( val, itm )
{
  itm = find_item(itm);
  if ( xDef( itm ) )
  {
    itm.value = val;
  }
}

function name_in( itm )
{
  itm = find_item(itm);
  if ( xDef(itm) )
  {
    return itm.value;
  }
  return null;
}

function doSubmit( request )
{
  try
  {
    var itm = find_item( 'REQUEST' );
    if ( xDef( itm ) )
    {
      itm.value = request;
    }
    var f = find_item( 'F_REQUEST' );
    f.submit();
  } catch  ( e )
  {

  }
}

function submitOnEnter(item, e, submitName)
{
  var key;
  submitName = submitName || item.id;
  key = getKeyCode( getEvent(e) );
  if (key == 13)
  {
    doSubmit(submitName);
    return eventFalse(e);
  }
  else
  {
    return true;
  }
}

function doConfirmSubmit( question, request )
{
  question = question || 'Czy jesteś pewien że chcesz usunąć?';
  if ( confirm( question ) )
  {
    doSubmit( request );
  }
}

function doConfirmDelete( question, request )
{
	doConfirmSubmit( question, request );
}

/********************************************
 *              LISTY WARTOSCI
 */

  // Lista elementow do ktorych beda wprowadzane wartosci
  var returnItems = new Array();

  /**
   * Wywoluje okno LOV z podanymi parametrami
   * @param page numer strony z raportem typu LOV
   * @param items lista elementow do ktorych maja byc przekazane wartosci
   *        z okna LOV ( typu Array )
   * @param width sugerowana szerokosc okna LOV (domyslnie 800)
   * @param height sugerowana wysokosc okna LOV (domyslnie 600)
   */
  function callLOV( url, items, width, height )
  {
    var url;
    returnItems = items;
    if ( width == null ) width = 800;
    if ( height == null ) height = 600;
    w = window.open(url,"lista","Scrollbars=1,resizable=1,width="+width+",height="+height);
    if (w)
    {
      if ( w.opener == null )
      {
        w.opener = self;
      }
      w.focus();
    }
  }

  /**
   * Zapisuje zwracane wartosci do elementow podanych jako wywolanie funkcji
   * callLov
   * @param values lista wartosci kolumn zwracana przez LOV. Kolejnosc wartosci
   *        musi byc stala aby dane zostaly poprawnie przekopiowane
   */
  function setReturnValues( values ) {

    if ( values != null && values.length != null &&
         returnItems != null && returnItems.length != null ) {

      for ( var i = 0; i < values.length && i < returnItems.length; i++ ) {
	    if ( values[i] != null && values[i].replace ) {
		  values[i] = values[i].replace(/\xB4/g, "'").replace(/\xBD/g,'"'); /* zmiana  na ' oraz  na " */
		}
        if ( window.processReturnValue )
          values[i] = window.processReturnValue( returnItems[i], values[i]);
        var item = find_item( returnItems[i] );
        if ( xDef(item) )
        {
          item.value = values[i];
        }
      }
	  if ( xDef( window.postReturnValues ) )
	  {
		window.postReturnValues( returnItems, values );
	  }
    }
  }

  /*********************************************************************************
   *                 Funkcje wykorzystywane po stronie okna LOV
   */

  /**
   * Uruchamia funkcje okna nadrzednego kopiujaca stosowne dane do elementow
   * w oknie nadrzednym. Po przekazaniu danych okno zostaje zamkniete.
   * @param lista wartosci do przekazania do okna nadrzednego w postaci
   *        kolejnych argumentow np. doSelect( 1, 'COS', 'Bleee', ... )
   *        ( dowolna liczba parametrow )
   */
  function doSelect() {
    if ( opener != null && opener.setReturnValues != null && arguments != null
         && arguments.length != null ) {
      try {
        opener.setReturnValues( arguments );
	  } catch ( e ) {
	    alert( e.message );
	  }

      if ( opener.postReturnValues )
	  {
	    try
		{
		  opener.postReturnValues( window );
	    }
		catch ( e )
		{
	      alert( e.message );
	    }
	  }
    }
    close();
  }

function confirmClear( msg )
{
  if ( arguments.length > 1 )
  {
    if ( name_in(arguments[1]) != "" && name_in(arguments[1]) != null && confirm("Czy chcesz wyczyścić to pole?") )
    {
      for ( var i = 1; i < arguments.length; i++ )
      {
        copy('', arguments[i]);
      }
      return true;
    }
    else if ( !xDef(find_item(arguments[1])) && msg != null && msg.length > 0 )
    {
      alert( msg );
    }
  }
  return false;
}

function xGetElementById(e) {
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}

function xHeight(e,uH) {
  if(!(e=xGetElementById(e))) return 0;
  if (xNum(uH)) {
    if (uH<0) uH = 0;
    else uH=Math.round(uH);
  }
  else uH=-1;
  var css=xDef(e.style);
  if(css && xDef(e.offsetHeight) && xStr(e.style.height)) {
    if(uH>=0) xSetCH(e, uH);
    uH=e.offsetHeight;
  }
  else if(css && xDef(e.style.pixelHeight)) {
    if(uH>=0) e.style.pixelHeight=uH;
    uH=e.style.pixelHeight;
  }
  return uH;
}

function xWidth(e,uW) {
  if(!(e=xGetElementById(e))) return 0;
  if (xNum(uW)) {
    if (uW<0) uW = 0;
    else uW=Math.round(uW);
  }
  else uW=-1;
  var css=xDef(e.style);
  if(css && xDef(e.offsetWidth) && xStr(e.style.width)) {
    if(uW>=0) xSetCW(e, uW);
    uW=e.offsetWidth;
  }
  else if(css && xDef(e.style.pixelWidth)) {
    if(uW>=0) e.style.pixelWidth=uW;
    uW=e.style.pixelWidth;
  }
  return uW;
}

function xGetCS(ele,sP){return parseInt(document.defaultView.getComputedStyle(ele,'').getPropertyValue(sP));}

function xSetCW(ele,uW){
  var pl=0,pr=0,bl=0,br=0;
  if(xDef(document.defaultView) && xDef(document.defaultView.getComputedStyle)){
    pl=xGetCS(ele,'padding-left');
    pr=xGetCS(ele,'padding-right');
    bl=xGetCS(ele,'border-left-width');
    br=xGetCS(ele,'border-right-width');
  }
  else if(xDef(ele.currentStyle,document.compatMode)){
    if(document.compatMode=='CSS1Compat'){
      pl=parseInt(ele.currentStyle.paddingLeft);
      pr=parseInt(ele.currentStyle.paddingRight);
      bl=parseInt(ele.currentStyle.borderLeftWidth);
      br=parseInt(ele.currentStyle.borderRightWidth);
    }
  }
  else if(xDef(ele.offsetWidth,ele.style.width)){ // ?
    ele.style.width=uW+'px';
    pl=ele.offsetWidth-uW;
  }
  if(isNaN(pl)) pl=0; if(isNaN(pr)) pr=0; if(isNaN(bl)) bl=0; if(isNaN(br)) br=0;
  var cssW=uW-(pl+pr+bl+br);
  if(isNaN(cssW)||cssW<0) return;
  else ele.style.width=cssW+'px';
}

function xSetCH(ele,uH){
  var pt=0,pb=0,bt=0,bb=0;
  if(xDef(document.defaultView) && xDef(document.defaultView.getComputedStyle)){
    pt=xGetCS(ele,'padding-top');
    pb=xGetCS(ele,'padding-bottom');
    bt=xGetCS(ele,'border-top-width');
    bb=xGetCS(ele,'border-bottom-width');
  }
  else if(xDef(ele.currentStyle,document.compatMode)){
    if(document.compatMode=='CSS1Compat'){
      pt=parseInt(ele.currentStyle.paddingTop);
      pb=parseInt(ele.currentStyle.paddingBottom);
      bt=parseInt(ele.currentStyle.borderTopWidth);
      bb=parseInt(ele.currentStyle.borderBottomWidth);
    }
  }
  else if(xDef(ele.offsetHeight,ele.style.height)){ // ?
    ele.style.height=uH+'px';
    pt=ele.offsetHeight-uH;
  }
  if(isNaN(pt)) pt=0; if(isNaN(pb)) pb=0; if(isNaN(bt)) bt=0; if(isNaN(bb)) bb=0;
  var cssH=uH-(pt+pb+bt+bb);
  if(isNaN(cssH)||cssH<0) return;
  else ele.style.height=cssH+'px';
}

function toggleSidebar()
{
  var sidebar = find_item( 'mdokSidebar' );
  var img = find_item('mdokSliderImg');
  if ( xDef(sidebar) )
  {
    if ( isSliderOpened() )
	{
	  hideSidebar( true );
	} else {
	  showSidebar( true );
	}
  }
}

function isSliderOpened()
{
  return GetCookie('slider') != 'close';
}

function showSidebar( commit )
{
  var sidebar = find_item( 'mdokSidebar' );
  var img = find_item('mdokSliderImg');
  sidebar.style.display = '';
  img.src = img.src.replace(/slider(2)?/gi,"slider");
  if ( commit )
  {
    SetCookie('slider', 'open');
  }
}

function hideSidebar( commit )
{
  var sidebar = find_item( 'mdokSidebar' );
  var img = find_item('mdokSliderImg');
  sidebar.style.display = 'none';
  img.src = img.src.replace(/slider(2)?/gi,"slider2");
  if ( commit )
  {
    SetCookie('slider', 'close');
  }
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);
  var cval = GetCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function showProperties(obj)
{
  var wnd = window.open('about:blank', '_blank');
  wnd.document.write('W?iwo?i obiektu <br/>'.bold());
  for ( var i in obj )
  {
    wnd.document.write( i + '=' + obj[i] + '<br/>' );
  }
}

var dragStartX = 0;
var dragWidthStart = 0;
var sliderDrag = false;
function sliderDragHandler( e )
{
  e = getEvent(e);
  switch ( e.type )
  {
    case 'dragstart' :
        if ( isSliderOpened() )
        {
          dragStartX = e.x;
          dragWidthStart = xWidth(find_item('divTreeContainer'));
          sliderDrag = true;
        } else {
          sliderDrag = false;
        }
        break;
    case 'drag'      :
        if ( sliderDrag )
        {
          var dragWidth = dragWidthStart + (e.x - dragStartX);
          find_item('divTreeContainer').style.width = Math.max(dragWidth,100);
        }
        break;
    case 'dragend'   :
        if ( sliderDrag )
        {
          var dragWidth = dragWidthStart + (e.x - dragStartX);
          find_item('divTreeContainer').style.width = Math.max(dragWidth,100);
          SetCookie('sidebarWidth', dragWidth);
        }
        break;
  }
}

function initializeSlider()
{
  // Inicjalizacja przy okazji tez paska bocznego
  // xAddEventListener( 'v_slide', 'mousemove', mouseOverSlider, false );

  var sidebar = find_item( 'mdokSidebar' );
  if ( !isSliderOpened() )
  {
  	hideSidebar();
  }
  var sidebarWidth = GetCookie('sidebarWidth');
  if ( !isNaN(parseInt(sidebarWidth)) )
  {
    find_item('divTreeContainer').style.width = sidebarWidth;
  }

}

/**
 * Pomocnicza - zatrymuje dalsze przetwarzanie zdarzenia
 */
function stopPropagation( e )
{
	e.cancelBubble = true;
	if (e.stopPropagation)
	{
		e.stopPropagation();
	}
}

/**
 * Zatrymuje dalsze przetwarzanie zdarzenia
 * @param e zdarzenie
 */
function eventFalse(e)
{
	if ( !e && window.event ) e = window.event;
	if ( e ) {
	  stopPropagation( e );
	  if (e.cancelable)
	  {
		e.preventDefault();
	  }
	  e.returnValue = false;
	}
	return false;
}

/**
 * Zwraca zdarzenie - IE/Mozilla
 * @param e  zdarzenie - w Mozilla OK, w IE puste
 */
function getEvent( e )
{
  if ( !e )
    e = window.event;
  return e;
}

/**
 * Zwraca kod nacisnietego klawisza
 * @param e zdarzenie
 */
function getKeyCode( e )
{
  e = getEvent( e );
  var charCode = (e.charCode) ? e.charCode :
                 ((e.keyCode) ? e.keyCode :
                 ((e.which) ? e.which : 0));
  return charCode;
}

var searchCleared = false;
function clearSearch(itm)
{
    if ( !searchCleared )
    {
      searchCleared = true;
      itm.value = '';
    }
}

function searchOnEnter(item, e, searchItem)
{
  var key;
  var item = find_item(searchItem);

  key = getKeyCode( getEvent(e) );

  if (key == 13 && xDef(item) )
  {
    document.forms['F_REQUEST'].action='admin.php?op=cms&t=550';
    doSubmit('AUTOSEARCH');
    return eventFalse(e);
  }
  else
  {
    return true;
  }
}

function searchInit( formName, url)
{
  if ( !searchCleared )
  {
    url = url+'&clear=1';
    searchCleared=true;
  }
  else
  {
    url = url+'&clear=0';
  }
  document.forms[formName].action=url;
  doSubmit('AUTOSEARCH');
  return false;
}

function doAutoSearch(item, formName, url)
{
  var item = find_item(item);
  clearSearch(item);
  document.forms[formName].action=url;
  doSubmit('AUTOSEARCH');
}

function selectTab( prefix, id )
{
  var i = 1;
  do
  {
    var frame = find_item(prefix + i);
    var a = find_item('a_' + prefix + i);
    if ( frame && i != id )
    {
      frame.style.display = 'none';
      if ( a ){ a.className = 'NotSelected'; }
    } else if ( frame ){
      frame.style.display = '';
      if ( a ){ a.className = 'Selected'; }
    }
    i++;
  }
  while( frame );
}

function toggleImage( obj, image )
{
  if ( obj && obj.src )
  {
  	obj.src = obj.src.replace( /[\w\d_]+\.gif/, image );
  }
}

function filterClick( obj, item, action )
{
	if ( action == 'down' )
	{
		toggleImage( obj, 'filter2.gif' );
	}
	else if ( action == 'up' )
	{
		toggleImage( obj, 'filter1.gif' );
	}
	else if ( action == 'out' )
	{
		toggleImage( obj, 'filter1.gif' );
	} 
	else if ( action == 'click' )
	{
		setTimeout("doSubmit('"+item+"')", 100);
	}
}

  function swapSelectOptions( sel, i, j )
  {
    var desc = sel.options[i].innerHTML;
    var val  = sel.options[i].value;
    sel.options[i].innerHTML = sel.options[j].innerHTML;
    sel.options[i].value     = sel.options[j].value;
    sel.options[j].innerHTML = desc;
    sel.options[j].value     = val;
    sel.options[i].selected = false;
    sel.options[j].selected = true;
  }
  
  function moveSelectedOptionsUp( selectId )
  {
    var sel = document.getElementById( selectId );
    if ( sel && sel.options.length > 0 && !sel.options[0].selected )
    {
      for ( i = 1; i < sel.options.length; i++ )
      {
        if ( sel.options[i].selected )
        {
          swapSelectOptions(sel, i, i-1);
        }
      }
    }
  }
  
  function moveSelectedOptionsDown( selectId )
  {
    var sel = document.getElementById( selectId );
    if ( sel && sel.options.length > 0 && !sel.options[sel.options.length-1].selected )
    {
      for ( i = sel.options.length-1; i >= 0; i-- )
      {
        if ( sel.options[i].selected )
        {
          swapSelectOptions(sel, i, i+1);
        }
      }
    }
  }
  
  function viewLicense(url)
	  {

	    wnd = window.open( url, 'Licencja GNU LGPL');

		/*if (wnd)
	    {
	      if ( wnd.opener == null )
	      {
	        wnd.opener = self;
	      }
	      wnd.focus();
	    }*/
	  }
	  
	  
  function ajaxChangeTree( TreeObj )
  {
    if(window.ajax)
    {
      try
      { 
        newTree = ajax.gets(TreeObj+"&tree=ajax");
        document.getElementById("divTreeContainer").innerHTML = newTree;
        return false;
      }catch(e)
      {
        return true;
      }
    }
    else
    {
      return true;
    }
  }
  /**
  * Aby ta funkcja działała poprawnie należy:
  *		nadać elementowi id:
  *				id='AJAX_REGION_{prefix paginacji}'>
  *		w pliku _v.php dodać blok obsługujący 
  *			if($ajax==1)
			  {
			  	$functions = array()// tablica funkcji drukujących np str 110 ("fol" => "printFolders", "dok" => "printDocuments", "plk"=>"printFiles", "wtk"=>"printPlugins" );
			  	printAjaxRegion( $functions);
			  }
  *		w pliku .php dać warunek przed drukowaniem strony (jak w 110.php)
  */
  function ajaxChangeRegionReport( url )
  {
    url = url.toString();
    url_tab = url.split("&");
    var raportId = '';
    for(var i = 0; i<url_tab.length; i++)
    {
      url_tab_tab = url_tab[i].split("=");
      pageIdx = url_tab_tab[0].indexOf("_page");
      if( pageIdx > -1)
      {
        raportId = url_tab_tab[0].substr(0,pageIdx);
        raportId = raportId.toUpperCase();
        url = url+"&ajax=1&raport="+raportId;
      }
    }
    raportHTMLId = "AJAX_REGION_"+raportId;

    if(window.ajax)
    {
      try
      { 
       if(document.getElementById(raportHTMLId))
       {
         newReport = ajax.gets(url);
         document.getElementById(raportHTMLId).innerHTML = newReport;
         return false;
       }else
       {
         return true;
       }
      }catch(e)
      {
        //alert("ex "+e);
        return true;
      }
    }
    else
    {
      return true;
    }
  }
  
  function timeToLogout( session_timeout )
  {
	if(session_timeout)
	{
		var min = session_timeout/60;
		min = Math.ceil(min)-1;
		//min_d = min.toFixed(0);
		var sec = session_timeout - min*60 - 1;
		var div = document.getElementById("timeToLogout");
		//div.class="OtherPathItem";
		if(session_timeout > 1)
		{
			if( session_timeout <= 120 )
			{
				if(sec < 10)
				{
					sec = '0'+sec;
				}
				//window.status = 'Czas pozostały do wylogowania użytkownika: '+min+':'+sec+'';
				if(div)
				{//class="OtherPathItem"
				  div.innerHTML = '<span class="OtherPathItem" >&nbsp;Do wylogowania: '+min+':'+sec+'</span>';
				}
			}else
			{
			  //window.status = 'Czas pozostały do wylogowania użytkownika: '+min+'';
			  if(div)
				{
				  div.innerHTML = '<span class="OtherPathItem" >&nbsp;Do wylogowania: '+min+' min.</span>';
				}
			}
			session_timeout = session_timeout -1;
			setTimeout( 'timeToLogout('+session_timeout+')', 1000 );
		}else
		{
			//window.status = 'Użytkownik został wylogowany';
		  if(div)
		  {
		    div.innerHTML = '<span class="OtherPathItem" >&nbsp;Użytkownik został wylogowany</span>';
		  }
		}
	}
  }
  
  function toggleBlock(id)
    {
      var itm = find_item(id);
      if ( xDef(itm) )
      {
        var dsp = itm.style.display;
        if ( dsp != 'inline' )
        {
          itm.style.display='inline';
          copy('T','showHide_'+id);
        } else {
          itm.style.display='none';
          copy('N','showHide_'+id);
        }
      }
    }
   
  
function showCurtain( timeout )
{
  var div = document.getElementById('curtainDIV');
  if ( div )
  {
    div.style.display = '';
    div.style.zIndex = 100;
    if ( !isNaN(parseInt(timeout)) && timeout > 0 )
    {
      setTimeout('hideCurtain()', timeout);
    }
  }
}

function hideCurtain()
{
  var div = document.getElementById('curtainDIV');
  if ( div )
  {
    div.style.zIndex = -100;
    div.style.display = 'none';
  }
}
  
function isJavaPlugin()
{
  if ( xDef(window.ActiveXObject) ) // MSIE
  {
    try
    {
      var java = new ActiveXObject('JavaPlugin');
      return xDef(java);
    }
    catch ( e )
    {
      return false;
    }
  }
  else // FireFox
  {
    if ( !navigator.javaEnabled )
    {
      for ( var i = 0; i < navigator.plugins.length; i++ )
      {
        var name = navigator.plugins[i].name;
        if ( name.match(/java/i) )
        {
          return true;
        }
      }
    } else {
      return navigator.javaEnabled();
    }
    return false;
  }
}
