/*
(C) copyright 2009 by jeff clemmer, chris sehenuk, and detour sites.

all rights reserved.

http://detoursites.com/
*/

var whatIsButEnabled=false;
var howToPlayButEnabled=false;
var whereToBuyButEnabled=false;

var curWhatIsButFrame=0;
var curHowToPlayButFrame=0;
var curWhereToBuyButFrame=0;
var curid="";

function buttonOn(id)
{
 
    if (id=="whatisbut" && whatIsButEnabled==false) {
        
        curWhatIsButFrame=0;
        whatIsButEnabled=true;
        assocAnimation("whatistext", "whatis01", 1);
    
    }

    if (id=="howtoplaybut" && howToPlayButEnabled==false) {
        
        curHowToPlayButFrame=0;
        howToPlayButEnabled=true;
        assocAnimation("howtoplaytext", "howtoplay01", 1);
        
    }
    
    if (id=="wheretobuybut" && whereToBuyButEnabled==false) {
        
        curWhereToBuyButFrame=0;
        whereToBuyButEnabled=true;
        assocAnimation("wheretobuytext", "wheretobuy01", 1);
        
    }
        
    doButAnim();
    
}

function buttonOff(id)
{
    
    if (id=="whatisbut") {
    
        whatIsButEnabled=false;
        assocAnimation("whatistext", "whatis01", 0);
    
    }
    
    if (id=="howtoplaybut") {
    
        howToPlayButEnabled=false;
        assocAnimation("howtoplaytext", "howtoplay01", 0);
    
    }
    
    if (id=="wheretobuybut") {
        
        whereToBuyButEnabled=false;
        assocAnimation("wheretobuytext", "wheretobuy01", 0)
        
    }
    
    stopButAnim();

}

function doButAnim()
{
    var sw=false;

    if (whatIsButEnabled==true && curWhatIsButFrame < 23) {
    
        curWhatIsButFrame++;
        
        assocAnimation("whatisbut", "button01", curWhatIsButFrame);
        
        sw=true;
        
    }
    
    if (howToPlayButEnabled==true && curHowToPlayButFrame < 23) {
    
        curHowToPlayButFrame++;
        
        assocAnimation("howtoplaybut", "button01", curHowToPlayButFrame);
        
        sw=true;
        
    }
    
    if (whereToBuyButEnabled==true && curWhereToBuyButFrame < 23) {
    
        curWhereToBuyButFrame++;
        
        assocAnimation("wheretobuybut", "button01", curWhereToBuyButFrame);
        
        sw=true;
        
    }
    
    if (sw==true)
        
        setTimeout(doButAnim, 40);
    
}

function stopButAnim()
{
    var sw=false;

    if (whatIsButEnabled==false && curWhatIsButFrame > 0) {
    
        curWhatIsButFrame--;
        
        assocAnimation("whatisbut", "button01", curWhatIsButFrame);
        
        sw=true;
        
    }
    
    if (howToPlayButEnabled==false && curHowToPlayButFrame > 0) {
    
        curHowToPlayButFrame--;
        
        assocAnimation("howtoplaybut", "button01", curHowToPlayButFrame);
        
        sw=true;
        
    }
    
    if (whereToBuyButEnabled==false && curWhereToBuyButFrame > 0) {
    
        curWhereToBuyButFrame--;
        
        assocAnimation("wheretobuybut", "button01", curWhereToBuyButFrame);
        
        sw=true;
        
    }
    
    if (sw==true)
        
        setTimeout(stopButAnim, 40);
    
}

