/*
 * Project:     zdk-portal
 *
 * Copyright:   Copyright (c) 2007
 * Company:     SecureNet GmbH
 * Created:     Sep 09, 2007
 * Author:      Florian Lindauer, fl@securenet.de (fl)
 * Version:     1.0
 *
 * SVN-Info:    $Revision:: 801    $ by $Author:: ks    $
 *              $LastChangedDate:: 2008-12-17 17:39:01 #$
 */

/***********************************************************************************************************************
 * Prototype.js based ZDK js stuff
 **********************************************************************************************************************/
var disableToggleStarFlag = false;

/** 
 * Toggle highlight / hover of voting stars. 
 */
function toggleStar(idPrefix, idNo, switchOn)
{
  if (disableToggleStarFlag)
  {
    return false;
  }
  
  for(var i=idNo; i>0; i--)
  {
    if (switchOn)
    {
      $(idPrefix + i).addClassName('starOn')
    }
    else
    {
      $(idPrefix + i).removeClassName('starOn')
    }
  }
  return true;
}

/** 
 * Toggle highlight / hover of voting stars. 
 */
function disableToggleStar(switchOn)
{ 
  disableToggleStarFlag = switchOn;
}


/** Switch on / show spinner div */
function spinnerOn() 
{
  var dim = document.viewport.getDimensions();
  var scroll = document.viewport.getScrollOffsets();

  $("spinner").setStyle({visibility: 'visible',
                         position:   'absolute',
                         left:       '0px',
                         top:        '0px',
                         width:      (scroll['left']+dim['width']) +'px',
                         height:     (scroll['top']+dim['height']) +'px',
                         backgroundPosition: (scroll['left']-50+Math.round(dim['width']/2)) +'px '
                                             + (scroll['top']-50+Math.round(dim['height']/2)) +'px'                    
                        });
}

/** Switch off / hide spinner div */
function spinnerOff() 
{
  $("spinner").setStyle({visibility: 'hidden'});
}

// -- eof --------------------------------------------------------------------------------------------------------------