// pro window operace

//Otevře okno podle parametrů, zajistí nad ním kontrolu hlavním oknem
function JOpenWinCtrl(loc,m)
{
  var win = window.open(loc,'',m);
  try
  {	

	
	if(window.AddWinVoid==null||window.AddWinVoid=="")
	{
		win.AddWinVoid = window.parent.AddWinVoid;
		window.parent.AddWinVoid(win);
	}
	else
	{
		win.AddWinVoid = window.AddWinVoid;
		window.AddWinVoid(win);
	}	
  }
  catch(e){}
}

// okno bez menu ale s listovanim
function WSOpen(loc,W,H)
{
    W = W * 1
    H = H * 1 
    
    if (W == 0) {
        W = screen.width - 20;
    }

    if (H == 0) {
        H = screen.height - 20;
    }

    // pokud je mensi jak 0 vypocitam rozmery  a pouziji minus
    if (W < 0) {
        W = screen.width - 20 + W;
    }

    if (H < 0) {
        H = screen.height - 10 + H;
    }

    wl = (screen.width - (W * 1 + 12)) / 2;

    wt = (screen.height - (H * 1 + 61)) / 2;


  if (wl < 0) { wl = 0; }
  if (wt < 0) { wt = 0; }

  m = 'scrollbars=yes,resizable=yes,width=' + W + ',height=' + H + ',left=' + wl + ',top=' + wt;

  JOpenWinCtrl(loc,m); 

}

// okno s menu
function WMOpen(loc,W,H)
{
    W = W * 1
    H = H * 1

    if (W == 0) {
        W = screen.width - 20;
    }

    if (H == 0) {
        H = screen.height - 20;
    }

    // pokud je mensi jak 0 vypocitam rozmery  a pouziji minus
    if (W < 0) {
        W = screen.width - 20 + W;
    }

    if (H < 0) {
        H = screen.height - 10 + H;
    }

    wl = (screen.width - (W * 1 + 12)) / 2;

    wt = (screen.height - (H * 1 + 61)) / 2;


    if (wl < 0) { wl = 0; }
    if (wt < 0) { wt = 0; }

    m = 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=' + W + ',height=' + H + ',left=' + wl + ',top=' + wt;

  JOpenWinCtrl(loc,m);
}

// rozmery okna
function winH() 
{
	if (window.innerHeight)
	{
		/* NN4 a kompatibilní prohlížeče */
		try{return window.parent.innerHeight;}catch(e){}
		return window.innerHeight;
	}
  	else 
  	{
		if  (document.documentElement &&  document.documentElement.clientHeight)
		{
      			/* MSIE6 v std. režimu - Opera a Mozilla již uspěly s window.innerHeight */
			try{return window.parent.document.documentElement.clientHeight;}catch(e){}
      			return document.documentElement.clientHeight;
		}
   		else 
		{
			if  (document.body && document.body.clientHeight)
      			{
				/* starší MSIE + MSIE6 v quirk režimu */
				try{return window.parent.document.body.clientHeight;}catch(e){}
				return document.body.clientHeight;
			}
			else return 500;
		}
	}
}

function winW() 
{
   if (window.innerWidth)   
      /* NN4 a kompatibilní prohlížeče */      
      return window.innerWidth;
   else 
   if  (document.documentElement &&  document.documentElement.clientWidth)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerwidth */
      return document.documentElement.clientWidth;
   else 
   if  (document.body && document.body.clientWidth)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientWidth;
   else
      return 700;
}

function WCenter(W,H)
{

  wl=(screen.width-(W*1+12))/2;
  wt=(screen.height-(H*1+61))/2;
  if(wl<0){wl=0;}if(wt<0){wt=0;}
  window.moveTo(wl,wt) 
}
