/* -------------------------------------------------- */
/* SOURCE CODE                                        */
/* -------------------------------------------------- */
/**
*
* @copyright Copyright (c) 2007, NETCRIATIVA
*
*/

function abrirJanela(file, name, width, height, scrollbars)
{
   // Certifica-se de que uma dimensão de tela existe
   screen_width  = 800;
   screen_height = 600;

   if (scrollbars) if (scrollbars !== '') scrollbars = ',' + scrollbars;

   // Dimensões da tela do usuário
   if (screen) if (screen.width) screen_width = screen.width;
   if (screen) if (screen.height) screen_height = screen.height;

   // Calcula a posição da janela no centro
   window_left = (screen_width / 2) - (width / 2);
   window_top  = (screen_height / 2) - (height / 2);

   // Abre janela
   if (window)
   {
      if (window.open)
      {
         w = window.open(file, name, 'width=' + width + ', height=' + height + ', left=' + window_left + ', top=' + window_top + ', screenX=' + window_left + ', screenY=' +  window_top + ', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=' + scrollbars + ', resizable=no, menubar=no');

         if (w.moveTo)
            w.moveTo(window_left, window_top);

         if (w.focus)
            w.focus();

         return w;
      }
   }
}

function abrirFoto(file, name, width, height, scrollbars)
{
   // Certifica-se de que uma dimensão de tela existe
   screen_width = 800;
   screen_height = 600;

   if (scrollbars) if (scrollbars !== '') scrollbars = ',' + scrollbars;

   // Dimensões da tela do usuário
   if (screen) if (screen.width) screen_width = screen.width;
   if (screen) if (screen.height) screen_height = screen.height;

   // Calcula a posição da janela no centro
   window_left = (screen_width / 2) - (width / 2);
   window_top = (screen_height / 2) - (height / 2);

   // Abre janela
   if (window)
   {
      if (window.open)
      {
         w = window.open(file,name,'width='+width+',height='+height+',left='+window_left+',top='+ window_top+',screenX='+window_left+',screenY='+ window_top+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable=no,menubar=no,copyhistory=no');
         if (w.moveTo)
            w.moveTo(window_left, window_top);
         if (w.focus)
            w.focus();

         w.document.write("<html>");
         w.document.write("<head>");
         w.document.write("<title></title>");
         w.document.write("</head>");
         w.document.write("<body topmargin='0' leftmargin='0'>");
         w.document.write("<table width='100%' height='" + height + "' border='0' cellpadding='0' cellspacing='0'>");
         w.document.write("  <tr>");
         w.document.write("    <td width='" + width + "' class='foto'>");
         w.document.write("<p><img src='" + file + "' alt='' /></p>");
         w.document.write("    </td>");
         w.document.write("  </tr>");
         w.document.write("</table>");
         w.document.write("</body>");
         w.document.write("</html>");
         w.document.close();
      }
   }
}

function cellMouseOver(obj)
{
   obj.className = "cellMouseOver";
}
function cellMouseOut(obj)
{
   obj.className = "cellMouseOut";
}

function trocaClassForms()
{
   for (f = 0; f < document.forms.length; f++)
   {
      form = document.forms[f];

      for (i = 0; i < form.length; i++)
      {
         // text | textarea | password
         if ((form[i].type == 'text') || (form[i].type == 'textarea') || (form[i].type == 'password'))
         {
            // onfocus
            form[i].onfocus = function()
            {
               this.className = "textF";
            }

            // onblur
            form[i].onblur = function()
            {
               this.className = "text";
            }
         }
         // select-one | select-multiple
         if ((form[i].type == 'select-one') || (form[i].type == 'select-multiple'))
         {
            // onfocus
            form[i].onfocus = function()
            {
               this.className = "selectF";
            }

            // onblur
            form[i].onblur = function()
            {
               this.className = "select";
            }
         }
      }
   }
}

window.onload = function()
{
	trocaClassForms();
}

/* -------------------------------------------------- */