/*
 * Copyright (c) 2002-2007 Julien WILK (http://LDDb.com/)
 * Not to be modified/reused without authorization.
 */

var CurrentMRx = 'op_early';

var ShopTimerRunning = false;
var ShopTimerID = null;
var ShopBackup = '';

function update_MRx(tab)
{
  if(CurrentMRx != tab)
  {
    $(CurrentMRx+"_selected").className = 'boxed_white';
    $(CurrentMRx).style.display = 'none';
    
    CurrentMRx = tab;
    $(CurrentMRx+"_selected").className = 'boxed_white_selected';
    $(CurrentMRx).style.display = '';
  }
}

function shop_offer_cb(contents)
{
  //Timeout handling
	if(ShopTimerRunning)
	{
	  clearTimeout(ShopTimerID);	
    ShopTimerRunning = false;

    $("shop_offer").innerHTML = contents;
    $("shop_offer_refresh").style.display = '';
    $("shop_offer_loading").style.display = 'none';
//    new Effect.Appear('shop_offer', {duration:2.0,queue:{position:'end', scope:'shop'},beforeStart:function(){$("shop_offer").innerHTML = contents;} });
    new Effect.BlindDown('shop_offer', {duration:1.5,queue:{position:'end', scope:'shop'},beforeStart:function(){$("shop_offer").innerHTML = contents;} });
    new Effect.Fade("loading");
  }
}

function shop_offer(qty)
{
  //Timeout handling
  ShopBackup = $("shop_offer").innerHTML;
  
  $("loading").style.display = '';
  $("shop_offer_refresh").style.display = 'none';
  new Effect.BlindUp('shop_offer', {duration:1.5, queue:{position:'end', scope:'shop'},afterFinish:function(){sajax_shop_offer(qty,mode,shop_offer_cb);} });

  $("shop_offer_loading").style.display = '';

  //Timeout handling
  ShopTimerID = setTimeout('shop_offer_cb(ShopBackup);',5000);
  ShopTimerRunning = true;
}

