
function click() {
if (event.button==2) {
alert('Por razões de segurança não é permitido usar o botão direito!');
}
}
function keypresed() {
alert('Proibido a Cópia');
}
//document.onkeydown=keypresed;
document.onmousedown=click;




function b( bb )
{
  alert( bb );
}


//
// getO()
//
function getO( field_expr )
{
   var elem, endOfElem = field_expr.indexOf( '.' );

   endOfElem = ( endOfElem == -1 ? field_expr.indexOf( '[' ) : endOfElem );

   if ( endOfElem == -1 )
      elem = field_expr;
   else
      elem = field_expr.substr( 0, endOfElem );

   for ( var i = 0 ; i < document.forms.length ; i++ )
      if ( document.forms[ i ][ elem ] )
      {
         var v = document.forms[ i ][ elem ];
         break;
      } // if

//   alert( 'var v = ( typeof( ' + elem + ' ) == "undefined" ? null : ' + elem ' );' );
//   eval( 'var v = ' + elem + ';' );

   if ( v.length == 2 )
      eval( 'v = ' + elem + '[1]' + ( endOfElem == -1 ? '' : field_expr.substr( endOfElem ) ) + ';' );

   return v;
} // getO()



//
// bwChangePreviewImage()
//
function bwChangePreviewImage( img, target_img, max_width, max_height, doc )
{
   var i = new Image();

   i.src = img;

//   alert( i.size );

   if ( i && i.src )
   {
      orig_width = i.width;
      orig_height = i.height; 

//alert( orig_width + '.' + orig_height );
   
      if ( i.width > max_width )
      {
         i.height = max_width*i.height/i.width;
         i.width = max_width;
      } // if

      if ( i.height > max_height )
      {
         i.width = max_height*i.width/i.height;
         i.height = max_height;
      } // if
      
//    OLD CODE!!!!      
//      doc.bw_preview_image.src = img;
//      doc.bw_preview_image.width  = i.width;
//      doc.bw_preview_image.height = i.height;

//      doc.target_img.src = img;
//      doc.target_img.width  = i.width;
//      doc.target_img.height = i.height;


      eval( 'doc' + '.' + target_img + '_img' + '.src = img;' );
      eval( 'doc' + '.' + target_img + '_img' + '.width  = i.width;' );
      eval( 'doc' + '.' + target_img + '_img' + '.height = i.height;' );

      eval( 'doc' + '.' + target_img + '_width.value = orig_width;' );
      eval( 'doc' + '.' + target_img + '_height.value = orig_height;' );

//      doc.bwUploadForm.actionButton.value = 'Upload Image!';
//      bwCurrent_state = 1;
   } // if
   
} // bwChangePreviewImage()


/*

//
// bwUploadImage()
//
function bwUploadImage( public_path_var, image_var, image, serv_data, max_width, max_height )
{
   var tit = "** Image Upload **";
   var width  = 288;
   var height = 288;

   var left = (window.screen.availWidth-width)/2;
   var top = (window.screen.availHeight-height)/2;

   var w = window.open( '', 'bwFileUploadPanel', 'scrollbar=true, resizeable=false, toolbar=false, location=false, status=false, left=' + left + ', top=' + top + ', width=' + width + ', height=' + height );
   d = w.document;

   d.writeln( '<HT' + 'ML><HE' + 'AD><TIT' + 'LE>&nbsp;&nbsp;&nbsp;&nbsp;' + tit + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TI' + 'TLE>' );
   d.writeln();
   d.writeln( '<META NAME="Author" CONTENT="BusinessWare, Tecnologias de Comunicação, Lda.">' );
   d.writeln( '<META NAME="Author_Site" CONTENT="www.businessware.pt">' );
   d.writeln( '<META NAME="Author_Contact" CONTENT="info@businessware.pt">' );
   d.writeln( '<META NAME="Copyright" CONTENT="(c)2000-2002 BusinessWare, Tecnologias de Comunicação, Lda.">' );
   d.writeln();

   d.writeln( '<SCR' + 'IPT language="JavaScript" src="../system.js"></SCR' + 'IPT><SCR' + 'IPT language="JavaScript">var bwCurrent_state = 0;</SCR' + 'IPT></HE' + 'AD><BO' + 'DY>' );

   d.writeln( '<FORM action="iFileUpload.php" method="POST" enctype="multipart/form-data" name="bwUploadForm">' );
   d.write( '<TABLE border="0" width="100%" align="center" cellpadding="0" cellspacing="0">' );
   d.write( '<TR><TD height="' + max_height + '" align="center"><IMG name="bw_preview_image" src="' + image.src + '"></TD></TR>' );

   d.write( '<TR><TD height="17">&nbsp;</TD></TR>' );
   d.write( '<TR><TD align="center"><INPUT type="file" name="file" size="24" max_length="256" onChange="bwChangePreviewImage( this.value, ' + max_width + ', ' + max_height + ', window.document )" onBlur="bwChangePreviewImage( this.value, ' + max_width + ', ' + max_height + ', window.document )"></TD></TR>' );
//onBlur="bwChangePreviewImage( this.value, ' + max_width + ', ' + max_height + ', window.document )"
//     d.write( '<TR><TD align="center"><INPUT type="file" name="file" size="24" max_length="256" onChange="alert(\'a\');" onBlur="bwChangePreviewImage( this.value, ' + max_width + ', ' + max_height + ', window.document )"></TD></TR>' );
   
   d.write( '<TR><TD height="27">&nbsp;</TD></TR>' );
   d.write( '<TR><TD align="center"><INPUT name="actionButton" type="submit" value="Close Window" onClick="return bwUploadActButtonClick( bwCurrent_state, window.document )"></TD></TR>' );
   d.write( '<INPUT type="hidden" name="bwPublicPath" value="' + public_path_var.value + '">' );
   d.write( '<INPUT type="hidden" name="bwServData" value="' + serv_data + '">' );

   d.writeln( '</TABLE></FORM>' );
   d.write( '</BO' + 'DY></HT' + 'ML>' );
   d.close();

   d.bwParent_public_path_var = public_path_var;
   d.bwParent_image_var = image_var;
   d.bwParent_image = image;
   d.bwMax_width = max_width;
   d.bwMax_height = max_height;

   w.focus();
} // bwUploadImage()




//
// bwUploadActButtonClick()
//
function bwUploadActButtonClick( state, doc )
{
   if ( !state )
   {
      doc.parentWindow.close();

      return false;
   } // if

   if ( state == 1 )
   {
      var tit = "Uploading";

      var width  = 192;
      var height = 32;

      var left = (window.screen.availWidth-width)/2;
      var top = (window.screen.availHeight-height)/2;

      var w = window.open( '', 'bwUploadingNow', 'location=no, resizeable=no, toolbar=no, status=no, left=' + left + ', top=' + top + ', width=' + width + ', height=' + height );
      d = w.document;

      d.writeln( '<HT' + 'ML><HE' + 'AD><TIT' + 'LE>' + tit + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TI' + 'TLE>' );
      d.writeln();
      d.writeln( '<META NAME="Author" CONTENT="BusinessWare, Tecnologias de Comunicação, Lda.">' );
      d.writeln( '<META NAME="Author_Site" CONTENT="www.businessware.pt">' );
      d.writeln( '<META NAME="Author_Contact" CONTENT="info@businessware.pt">' );
      d.writeln( '<META NAME="Copyright" CONTENT="(c)2000-2002 BusinessWare, Tecnologias de Comunicação, Lda.">' );
      d.writeln();
      d.writeln( '</HE' + 'AD><BO' + 'DY>' );

      d.write( '<TABLE border="0" width="100%" align="center" cellpadding="0" cellspacing="0">' );
      d.writeln( '<TR><TD align="center"><IMG src="system_media/openfoldericon.png"></TD></TR><TR><TD height="13">&nbsp;</TD></TR><TR><TD align="center">Uploading ...</TD></TR></TABLE>' );

      d.write( '</BO' + 'DY></HT' + 'ML>' );
      d.close();

      d.bwParent_public_path_var = doc.bwParent_public_path_var;
      d.bwParent_image_var = doc.bwParent_image_var;
      d.bwParent_image = doc.bwParent_image;
      d.bwMax_width = doc.bwMax_width;
      d.bwMax_height = doc.bwMax_height;

      w.focus();

      return true;
   } // if

   return false;
} // bwUploadActButtonClick()

*/
