////////////////////////////////////////////////////////////////////////
// %W% %E% %Q% Copyright (c) 2000 by Xinet, Inc.  All Rights Reserved.
// WN_Include_Safe
//
// Create a button which links to imageinfo in version mode.  
////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////
// Step 1.  Create button object
////////////////////////////////////////////////////////////////////////

var versionButton =
 
  new WNButton( "wn_versions.sml.gif", 
		lang.showversions, 
	        CONTEXT_BROWSE,
	        .001
		);



////////////////////////////////////////////////////////////////////////
// Step 2.  Define behavior functions
////////////////////////////////////////////////////////////////////////

function versionCheckPermission(file, userInfo) {
  return (!file.isadir && file.hasversions);
}

function versionGetAnchorProperties(file, userInfo, args, context) {
  var result = "HREF='/webnative/imageinfo?-v+" + file.path + "' ";

  /* look for a target in the arg array, which we'll use if we can
     find it.
  */
  if( args && args['target'] ) {
    result += "TARGET='"+target+"' ";
  }

  /* get house mouse-over instructions.  if it can't determine
     where to send them, the function will return an empty
     string
   */
  if( args ) {
    result += this.getHouseMouseOverProperties(args, lang.showversions);
  }

  return result;
}



////////////////////////////////////////////////////////////////////////
// Step 3.  Register behavior functions
////////////////////////////////////////////////////////////////////////

versionButton.registerCheckPermission( versionCheckPermission );
versionButton.registerGetAnchorProperties( versionGetAnchorProperties );



////////////////////////////////////////////////////////////////////////
// Step 4.  Register our button with the button manager
////////////////////////////////////////////////////////////////////////

wnButtonManager.addButton( versionButton );

