<?php 
/**
 *  
 */
function create_winPage( $winPage,
                         $winPage_Conf,
                         $destino = "emBranco.php" )
{
  writeTO( '  <div id="'      . $winPage . '_Barra">'                                    );
  writeTO( '    <div id="'    . $winPage .'_Titulo">'                                    );
  writeTO( '      '           . $winPage_Conf['titulo']                                  );
  writeTO( '    </div end="'  . $winPage .'_Titulo">'                                    );
  writeTO( '    <img id="'    . $winPage . '_Minimizar" src="imagens/minimizar.gif" >'   );
  writeTO( '    <img id="'    . $winPage . '_Restaurar" src="imagens/maximizar.gif" >'   );
  writeTO( '    <img id="'    . $winPage . '_Fechar"    src="imagens/fechar.gif" >'      );
  writeTO( '  </div end="'    . $winPage . '_Barra">'                                    );
  writeTO( '  '                                                                        );
  writeTO( '  <iframe id="'   .$winPage.'_iFrame" src="'.$destino.'" name="'.$winPage.'">');
  writeTO( '  </iframe end="' .$winPage.'_iFrame">'                                      );
}// End create_winPage()

function create_windows( $winPage,
                         $winPage_Conf )
{
  writeTO( '  <div id="'     . $winPage . '_Barra">'                                     );
  writeTO( '    <div id="'   . $winPage .'_Titulo">'                                     );
  writeTO( '      '          . $winPage_Conf['titulo']                                   );
  writeTO( '    </div end="' . $winPage .'_Titulo">'                                     );
  writeTO( '    <div id="' . $winPage .'_MenuSys">'                                      );
  writeTO( '      <img id="'   . $winPage . '_Minimizar" src="imagens/minimizar.gif" />' );
  writeTO( '      <img id="'   . $winPage . '_Restaurar" src="imagens/maximizar.gif" />' );
  writeTO( '      <img id="'   . $winPage . '_Fechar"    src="imagens/fechar.gif" />'    );
  writeTO( '    </div end="' . $winPage .'_MenuSys">'                                    );
  writeTO( '  </div end="'   . $winPage . '_Barra">'                                     );
}// End create_winPage()


 
function create_winPage_css1( $winPage,
                              $winPage_Global,
                              $winPage_Style,
                              $winPage_Conf )
{
  $len = $winPage_Global['width'];
  $l = strlen($len);
  $len = (substr($len, 0, $l-2) -9);
  $alt = $winPage_Global['height'];
  $l = strlen($alt);
  $alt = (substr($alt, 0, $l-2) -24); 

  if ( $winPage_Conf[ 'tipo' ] == 'normal' )
  {
    $zIndex = 10;
  }else
  {
    $zIndex = 500;
  }// End if()
  
  if ( $winPage_Conf[ 'iconeMin' ] )
  {
    $iconeMin = 'inherit';
  }else
  {
    $iconeMin = 'hidden';
  }// End if()

  if ( $winPage_Conf[ 'iconeMax' ] )
  {
    $iconeMax = 'inherit';
  }else
  {
    $iconeMax = 'hidden';
  }// End if()

  if ( $winPage_Conf[ 'menuSys' ] )
  {
    $iconeSys = 'inherit';
  }else
  {
    $iconeSys = 'hidden';
  }// End if()

  if ( isset( $winPage_Conf['overflow'] ) )
  {
    $overflow = $winPage_Conf['overflow'];
  }else
  {
    $overflow = 'hidden';
  }

  $visible = ( $winPage_Global['visibility'] == "visible" ) ? 'inherit' : 'hidden' ;

  writeTO( '  #' . $winPage . '{    '                                     );
  writeTO( '    position:absolute;    '                                   );
  writeTO( '    top:' . $winPage_Global['top'] . '; '                     );
  writeTO( '    left:' . $winPage_Global['left'] . '; '                   );
  writeTO( '    z-index:' . $zIndex . '; '                                );
  writeTO( '    width:' . $winPage_Global['width'] . '; '                 );
  writeTO( '    height:' . $winPage_Global['height'] . '; '               );
  writeTO( '    color:' . $winPage_Global['color'] . '; '                 );
  writeTO( '    background-color:' . $winPage_Global['bgcolor'] . '; '    );
  writeTO( '    visibility:' . $visible                          . ';'    );
  writeTO( '    border-top:' . $winPage_Style['borderTop'] . '; '         );
  writeTO( '    border-bottom:' . $winPage_Style['borderBottom'] . '; '   );
  writeTO( '    border-left:' . $winPage_Style['borderLeft'] . '; '       );
  writeTO( '    border-right:' . $winPage_Style['borderRight'] . '; '     );
  writeTO( '  }  '                                                        );
  writeTO( '    '                                                         );

  writeTO( '  #' . $winPage . '_Barra{    '                               );
  writeTO( '    position:absolute;    '                                   );
  writeTO( '    top:2px;    '                                             );
  writeTO( '    left:2px;    '                                            );
  writeTO( '    z-index:10;    '                                          );
  writeTO( '    width:' . $len . 'px;    '                                );
  writeTO( '    height:18px;    '                                         );
  writeTO( '    font-family:verdana;    '                                 );
  writeTO( '    font-weight:bold;    '                                    );
  writeTO( '    font-size:11px ;    '                                     );
  writeTO( '    padding-top:1px;    '                                     );
  writeTO( '    padding-left:4px;    '                                    );
  writeTO( '    color:#FFFFFF;    '                                       );
  writeTO( '    background-color:#808080;    '                            );
  writeTO( '  }  '                                                        );

  writeTO( '  #' . $winPage . '_Frame{    '                               );
  writeTO( '    position:absolute;    '                                   );
  writeTO( '    top:24px;    '                                            );
  writeTO( '    left:3px;    '                                            );
  writeTO( '    z-index:10;	    '                                         );
  writeTO( '    overflow:'.$overflow.';    '                              );
  writeTO( '    width:' . ($len-1) . 'px;    '                            );
  writeTO( '    height:' . ($alt-7) . 'px;    '                           );
  writeTO( '    background-color:'.$winPage_Style['bgColorFrame'].'; '    );
  writeTO( '    border-top:2px inset #FFFFFF'  . '; '                     );
  writeTO( '    border-bottom:2px inset #FFFFFF'  . '; '                  );
  writeTO( '    border-left:2px inset #FFFFFF'  . '; '                    );
  writeTO( '    border-right:2px inset #FFFFFF'  . '; '                   );
  writeTO( '  }  '                                                        );


  writeTO( '  #' . $winPage . '_iFrame{    '                               );
  writeTO( '    position:absolute;    '                                   );
  writeTO( '    top:24px;    '                                            );
  writeTO( '    left:3px;    '                                            );
  writeTO( '    z-index:10;	    '                                        );
  writeTO( '    overflow:auto;    '                                     );
  writeTO( '    width:' . ($len+2) . 'px;    '                            );
  writeTO( '    height:' . ($alt-3) . 'px;    '                               );
  writeTO( '  }  '                                                        );

  writeTO( '  #' . $winPage . '_MenuSys{    '                           );
  writeTO( '    visibility:' . $iconeSys . '; '                           );
  writeTO( '  }   '                                                       );

  writeTO( '  #' . $winPage . '_Minimizar{    '                           );
  writeTO( '    position:absolute;    '                                   );
  writeTO( '    top:3px;    '                                             );
  writeTO( '    left:'.($len-50).'px;    '                                );
  writeTO( '    z-index:10;    '                                          );
  writeTO( '    visibility:' . $iconeMin . '; '                           );
  writeTO( '  }   '                                                       );

  writeTO( '  #' . $winPage . '_Restaurar{    '                           );
  writeTO( '    position:absolute;    '                                   );
  writeTO( '    top:3px;    '                                             );
  writeTO( '    left:' . ($len-32) . 'px;    '                            );
  writeTO( '    z-index:10;    '                                          );
  writeTO( '    visibility:' . $iconeMax . '; '                           );
  writeTO( '  }  '                                                        );

  writeTO( '  #'. $winPage .'_Fechar{    '                                );
  writeTO( '    position:absolute;    '                                   );
  writeTO( '    top:3px;    '                                             );
  writeTO( '    left:' . ($len-14) . 'px;    '                            );
  writeTO( '    z-index:10;    '                                          );
  writeTO( '    visibility:inherit;'                                      );
  writeTO( '  }  '                                                        );
  writeTO( '    '                                                         );
}// End 
 
 
function create_winPage_config( $modo_RAD )
{
  global $componentes_no_Prj;

  $path  = ( $modo_RAD )? _CFG_ : CFG;
  $nDest = $path . "winPage.config.js.php";

  $fp = @fopen( $nDest, 'wb' );
  foreach( $componentes_no_Prj as $comp_ => $obj_ )
  {
    if( $comp_ == 'winPage' )
    {
      $nrObj  = 0;
      $arrObj = array();
      foreach( $obj_ as $i_ => $v_ )
      {
        $arrObj[ $nrObj ] = $i_;
        $nrObj ++;
      }// end foreach()

      writeTO( "winPage_obj       = ". $nrObj .";", $fp );
      writeTO( "winPage_selected  = ". $nrObj .";", $fp );
      writeTO( "  "       , $fp );
      writeTO( "winPage_tipo   = new Array(". $nrObj .");", $fp );
      writeTO( "winPage_top    = new Array(". $nrObj .");", $fp );
      writeTO( "winPage_left   = new Array(". $nrObj .");", $fp );
      writeTO( "winPage_width  = new Array(". $nrObj .");", $fp );
      writeTO( "winPage_height = new Array(". $nrObj .");", $fp );
      writeTO( "  "       , $fp );

      for( $ix = 0; $ix < $nrObj; $ix ++)
      {
        $tmp = $arrObj[$ix];
        include( CFG . $tmp . ".config.def.php" );
        $tmp .= "_Conf";
        $arr = $$tmp;
        writeTO( "winPage_tipo["   . $ix . "] = '" . $arr['tipo']   . "';", $fp );
        writeTO( "winPage_top["    . $ix . "] = "  . $arr['top']    . ";" , $fp );
        writeTO( "winPage_left["   . $ix . "] = "  . $arr['left']   . ";" , $fp );
        writeTO( "winPage_width["  . $ix . "] = "  . $arr['width']  . ";" , $fp );
        writeTO( "winPage_height[" . $ix . "] = "  . $arr['height'] . ";" , $fp );
        writeTO( "  "                                                     , $fp );

      }// End for()
      
      break;
    }// End if()
  }// End foreach()
  fclose( $fp );

  return( $nDest );
}// End if()

 
?> 
