﻿var boolLoaded=false;
var bool1On=false;
var bool2On=false;
var bool3On=false;
var bool4On=false;
var bool5On=false;
var bool6On=false;
var bool7On=false;
var bool8On=false;
var bool9On=false;
var strCurrentIconOver='';

function FadeItem(strItem, intStart, intEnd, intDuration){
    var objTrans;
    document.getElementById(strItem).style.visibility = '';
    objTrans = new OpacityTween(document.getElementById(strItem),Tween.regularEaseInOut, intStart, intEnd, intDuration);
    objTrans.onMotionStarted = function(){}            
    objTrans.onMotionFinished = function(){}            
    objTrans.start();
    objTrans=null;
}

function MoveItemY(strItem, intStart, intEnd, intDuration){
    var objTrans;
    objTrans = new Tween(document.getElementById(strItem).style,'top',Tween.regularEaseInOut,intStart,intEnd,intDuration,'px');
    objTrans.onMotionStarted = function(){};        
    objTrans.onMotionFinished = function(){};        
    objTrans.start();
    objTrans=null;
}    

function MoveItemX(strItem, intStart, intEnd, intDuration){
    var objTrans;
    objTrans = new Tween(document.getElementById(strItem).style,'left',Tween.regularEaseInOut,intStart,intEnd,intDuration,'px');
    objTrans.onMotionStarted = function(){};        
    objTrans.onMotionFinished = function(){};        
    objTrans.start();
    objTrans=null;
}    


function ScaleItem(strItem, intStartWidth, intEndWidth, intStartHeight, intEndHeight, intDuration){
    var objTrans;
    objTrans = new Tween(document.getElementById(strItem).style,'width',Tween.regularEaseInOut,intStartWidth,intEndWidth,intDuration,'px');
    objTrans.onMotionStarted = function(){};        
    objTrans.onMotionFinished = function(){};        
    objTrans.start();
    objTrans = new Tween(document.getElementById(strItem).style,'height',Tween.regularEaseInOut,intStartHeight,intEndHeight,intDuration,'px');
    objTrans.onMotionStarted = function(){};        
    objTrans.onMotionFinished = function(){};        
    objTrans.start();
    objTrans=null;
}    

function FadeInLogo(){
   FadeItem("divLogo", 0, 100, 0.5);
   //FadeItem("divChooseChannel", 0, 100, 0.5);
   FadeInThumbs();
}

function FadeInThumbs(){
    var intFadeDuration = 0.4;
    var intSlideDuration = 0.4;
    var objTrans;
    document.getElementById("divWWIcon").style.visibility = '';
    objTrans = new OpacityTween(document.getElementById("divWWIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
    objTrans.onMotionStarted = function(){}            
    objTrans.onMotionFinished = function(){
        //show the headers
        document.getElementById("divWWTitle").style.visibility='';
        document.getElementById("divWWPlay").style.visibility='';
        MoveItemY("divWWTitle", 84, 100, intSlideDuration);
        MoveItemY("divWWPlay", 84, 100, intSlideDuration);
        document.getElementById("divSIcon").style.visibility = '';
        objTrans = new OpacityTween(document.getElementById("divSIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
        objTrans.onMotionStarted = function(){}            
        objTrans.onMotionFinished = function(){
            //show the headers
            document.getElementById("divSTitle").style.visibility='';
            document.getElementById("divSPlay").style.visibility='';
            MoveItemY("divSTitle", 84, 100, intSlideDuration);
            MoveItemY("divSPlay", 84, 100, intSlideDuration);
            document.getElementById("divMIcon").style.visibility = '';
            objTrans = new OpacityTween(document.getElementById("divMIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
            objTrans.onMotionStarted = function(){}            
            objTrans.onMotionFinished = function(){
                //show the headers
                document.getElementById("divMTitle").style.visibility='';
                document.getElementById("divMPlay").style.visibility='';
                MoveItemY("divMTitle", 84, 100, intSlideDuration);
                MoveItemY("divMPlay", 84, 100, intSlideDuration);
                document.getElementById("divSWIcon").style.visibility = '';
                objTrans = new OpacityTween(document.getElementById("divSWIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                objTrans.onMotionStarted = function(){}            
                objTrans.onMotionFinished = function(){
                    //show the headers
                    document.getElementById("divSWTitle").style.visibility='';
                    document.getElementById("divSWPlay").style.visibility='';
                    MoveItemY("divSWTitle", 84, 100, intSlideDuration);
                    MoveItemY("divSWPlay", 84, 100, intSlideDuration);
                    document.getElementById("divLIcon").style.visibility = '';
                    objTrans = new OpacityTween(document.getElementById("divLIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                    objTrans.onMotionStarted = function(){}            
                    objTrans.onMotionFinished = function(){
                        //show the headers
                        document.getElementById("divLTitle").style.visibility='';
                        document.getElementById("divLPlay").style.visibility='';
                        MoveItemY("divLTitle", 84, 100, intSlideDuration);
                        MoveItemY("divLPlay", 84, 100, intSlideDuration);
                        document.getElementById("divFIcon").style.visibility = '';
                        objTrans = new OpacityTween(document.getElementById("divFIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                        objTrans.onMotionStarted = function(){}            
                        objTrans.onMotionFinished = function(){
                            //show the headers
                            document.getElementById("divFTitle").style.visibility='';
                            document.getElementById("divFPlay").style.visibility='';
                            MoveItemY("divFTitle", 84, 100, intSlideDuration);
                            MoveItemY("divFPlay", 84, 100, intSlideDuration);
                            document.getElementById("divHIcon").style.visibility = '';
                            objTrans = new OpacityTween(document.getElementById("divHIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                            objTrans.onMotionStarted = function(){}            
                            objTrans.onMotionFinished = function(){
                                //show the headers
                                document.getElementById("divHTitle").style.visibility='';
                                document.getElementById("divHPlay").style.visibility='';
                                MoveItemY("divHTitle", 84, 100, intSlideDuration);
                                MoveItemY("divHPlay", 84, 100, intSlideDuration);
                                document.getElementById("divWIcon").style.visibility = '';
                                objTrans = new OpacityTween(document.getElementById("divWIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                                objTrans.onMotionStarted = function(){}            
                                objTrans.onMotionFinished = function(){
                                    //show the headers
                                    document.getElementById("divWTitle").style.visibility='';
                                    document.getElementById("divWPlay").style.visibility='';
                                    MoveItemY("divWTitle", 84, 100, intSlideDuration);
                                    MoveItemY("divWPlay", 84, 100, intSlideDuration);
                                    document.getElementById("divNIcon").style.visibility = '';
                                    objTrans = new OpacityTween(document.getElementById("divNIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                                    objTrans.onMotionStarted = function(){}            
                                    objTrans.onMotionFinished = function(){
                                        //show the headers
                                        document.getElementById("divNTitle").style.visibility='';
                                        document.getElementById("divNPlay").style.visibility='';
                                        MoveItemY("divNTitle", 84, 100, intSlideDuration);
                                        MoveItemY("divNPlay", 84, 100, intSlideDuration);
                                        boolLoaded = true;
                                    }            
                                    objTrans.start();
                                }            
                                objTrans.start();
                            }            
                            objTrans.start();
                        }            
                        objTrans.start();
                    }            
                    objTrans.start();
                }            
                objTrans.start();
            }            
            objTrans.start();
        }            
        objTrans.start();
    }            
    objTrans.start();
    objTrans=null;
}



function FadeInThumbs_old(){
    var intFadeDuration = 0.4;
    var intSlideDuration = 0.4;
    var objTrans;
    document.getElementById("divWWIcon").style.visibility = '';
    objTrans = new OpacityTween(document.getElementById("divWWIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
    objTrans.onMotionStarted = function(){}            
    objTrans.onMotionFinished = function(){
        //show the headers
        document.getElementById("divWWTitle").style.visibility='';
        document.getElementById("divWWPlay").style.visibility='';
        MoveItemY("divWWTitle", 84, 100, intSlideDuration);
        MoveItemY("divWWPlay", 84, 100, intSlideDuration);
        document.getElementById("divLIcon").style.visibility = '';
        objTrans = new OpacityTween(document.getElementById("divLIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
        objTrans.onMotionStarted = function(){}            
        objTrans.onMotionFinished = function(){
            //show the headers
            document.getElementById("divLTitle").style.visibility='';
            document.getElementById("divLPlay").style.visibility='';
            MoveItemY("divLTitle", 84, 100, intSlideDuration);
            MoveItemY("divLPlay", 84, 100, intSlideDuration);
            document.getElementById("divMIcon").style.visibility = '';
            objTrans = new OpacityTween(document.getElementById("divMIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
            objTrans.onMotionStarted = function(){}            
            objTrans.onMotionFinished = function(){
                //show the headers
                document.getElementById("divMTitle").style.visibility='';
                document.getElementById("divMPlay").style.visibility='';
                MoveItemY("divMTitle", 84, 100, intSlideDuration);
                MoveItemY("divMPlay", 84, 100, intSlideDuration);
                document.getElementById("divSWIcon").style.visibility = '';
                objTrans = new OpacityTween(document.getElementById("divSWIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                objTrans.onMotionStarted = function(){}            
                objTrans.onMotionFinished = function(){
                    //show the headers
                    document.getElementById("divSWTitle").style.visibility='';
                    document.getElementById("divSWPlay").style.visibility='';
                    MoveItemY("divSWTitle", 84, 100, intSlideDuration);
                    MoveItemY("divSWPlay", 84, 100, intSlideDuration);
                    document.getElementById("divWIcon").style.visibility = '';
                    objTrans = new OpacityTween(document.getElementById("divWIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                    objTrans.onMotionStarted = function(){}            
                    objTrans.onMotionFinished = function(){
                        //show the headers
                        document.getElementById("divWTitle").style.visibility='';
                        document.getElementById("divWPlay").style.visibility='';
                        MoveItemY("divWTitle", 84, 100, intSlideDuration);
                        MoveItemY("divWPlay", 84, 100, intSlideDuration);
                        document.getElementById("divFIcon").style.visibility = '';
                        objTrans = new OpacityTween(document.getElementById("divFIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                        objTrans.onMotionStarted = function(){}            
                        objTrans.onMotionFinished = function(){
                            //show the headers
                            document.getElementById("divFTitle").style.visibility='';
                            document.getElementById("divFPlay").style.visibility='';
                            MoveItemY("divFTitle", 84, 100, intSlideDuration);
                            MoveItemY("divFPlay", 84, 100, intSlideDuration);
                            document.getElementById("divHIcon").style.visibility = '';
                            objTrans = new OpacityTween(document.getElementById("divHIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                            objTrans.onMotionStarted = function(){}            
                            objTrans.onMotionFinished = function(){
                                //show the headers
                                document.getElementById("divHTitle").style.visibility='';
                                document.getElementById("divHPlay").style.visibility='';
                                MoveItemY("divHTitle", 84, 100, intSlideDuration);
                                MoveItemY("divHPlay", 84, 100, intSlideDuration);
                                document.getElementById("divSIcon").style.visibility = '';
                                objTrans = new OpacityTween(document.getElementById("divSIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                                objTrans.onMotionStarted = function(){}            
                                objTrans.onMotionFinished = function(){
                                    //show the headers
                                    document.getElementById("divSTitle").style.visibility='';
                                    document.getElementById("divSPlay").style.visibility='';
                                    MoveItemY("divSTitle", 84, 100, intSlideDuration);
                                    MoveItemY("divSPlay", 84, 100, intSlideDuration);
                                    document.getElementById("divNIcon").style.visibility = '';
                                    objTrans = new OpacityTween(document.getElementById("divNIcon"),Tween.regularEaseInOut, 0, 100, intFadeDuration);
                                    objTrans.onMotionStarted = function(){}            
                                    objTrans.onMotionFinished = function(){
                                        //show the headers
                                        document.getElementById("divNTitle").style.visibility='';
                                        document.getElementById("divNPlay").style.visibility='';
                                        MoveItemY("divNTitle", 84, 100, intSlideDuration);
                                        MoveItemY("divNPlay", 84, 100, intSlideDuration);
                                        boolLoaded = true;
                                    }            
                                    objTrans.start();
                                }            
                                objTrans.start();
                            }            
                            objTrans.start();
                        }            
                        objTrans.start();
                    }            
                    objTrans.start();
                }            
                objTrans.start();
            }            
            objTrans.start();
        }            
        objTrans.start();
    }            
    objTrans.start();
    objTrans=null;
}

function CheckAllFadedOut(){
    if (bool1On==true){
        MouseOutThumb("divWWIconOver");
    }    
    if (bool2On==true){
        MouseOutThumb("divLIconOver");
    }    
    if (bool3On==true){
        MouseOutThumb("divMIconOver");
    }    
    if (bool4On==true){
        MouseOutThumb("divSWIconOver");
    }    
    if (bool5On==true){
        MouseOutThumb("divWIconOver");
    }    
    if (bool6On==true){
        MouseOutThumb("divFIconOver");
    }    
    if (bool7On==true){
        MouseOutThumb("divHIconOver");
    }    
    if (bool8On==true){
        MouseOutThumb("divSIconOver");
    }    
    if (bool9On==true){
        MouseOutThumb("divNIconOver");
    }    
}



function MouseOutThumb(strItemToFadeDown){
    var objTrans;
    if (boolLoaded==true){    
        //fade out the icon
        strCurrentIconOver = '';
        var objTrans;
        document.getElementById(strItemToFadeDown).style.visibility = '';
        objTrans = new OpacityTween(document.getElementById(strItemToFadeDown),Tween.regularEaseInOut, 90, 0, .1);
        objTrans.onMotionStarted = function(){}            
        objTrans.onMotionFinished = function(){
            if (strItemToFadeDown=='divWWIconOver'){
                bool1On=false;
            }else if(strItemToFadeDown=='divLIconOver'){
                bool2On=false;
            }else if(strItemToFadeDown=='divMIconOver'){
                bool3On=false;
            }else if(strItemToFadeDown=='divSWIconOver'){
                bool4On=false;
            }else if(strItemToFadeDown=='divWIconOver'){
                bool5On=false;
            }else if(strItemToFadeDown=='divFIconOver'){
                bool6On=false;
            }else if(strItemToFadeDown=='divHIconOver'){
                bool7On=false;
            }else if(strItemToFadeDown=='divSIconOver'){
                bool8On=false;
            }else if(strItemToFadeDown=='divNIconOver'){
                bool9On=false;
            }        
        }            
        objTrans.start();
        objTrans=null;
        //FadeItem(strItemToFadeDown, 100, 0, .3);
    }
}


function MouseOverThumb(strItemToFadeUp){
    var objTrans;
    var intStartAt;
    if (boolLoaded==true){
        //fade up the icon
        strCurrentIconOver = strItemToFadeUp;
        var objTrans;
        document.getElementById(strItemToFadeUp).style.visibility = '';
        intStartAt = document.getElementById(strItemToFadeUp).style.Alpha;
        objTrans = new OpacityTween(document.getElementById(strItemToFadeUp),Tween.regularEaseInOut, 0, 100, .1);
        objTrans.onMotionStarted = function(){}            
        objTrans.onMotionFinished = function(){
            if (strItemToFadeUp=='divWWIconOver'){
                bool1On=true;
            }else if(strItemToFadeUp=='divLIconOver'){
                bool2On=true;
            }else if(strItemToFadeUp=='divMIconOver'){
                bool3On=true;
            }else if(strItemToFadeUp=='divSWIconOver'){
                bool4On=true;
            }else if(strItemToFadeUp=='divWIconOver'){
                bool5On=true;
            }else if(strItemToFadeUp=='divFIconOver'){
                bool6On=true;
            }else if(strItemToFadeUp=='divHIconOver'){
                bool7On=true;
            }else if(strItemToFadeUp=='divSIconOver'){
                bool8On=true;
            }else if(strItemToFadeUp=='divNIconOver'){
                bool9On=true;
            }        
        }            
        objTrans.start();
        objTrans=null;
        //FadeItem(strItemToFadeUp, 0, 100, .3);
    }
}


function MouseOverThumb_old(strItemToGrow, strItemToMove, strItemToHide1, strItemToHide2, intStartX, intStartY){
    var objTrans;
    if (boolLoaded==true){
        //swap the image first
        if (strItemToGrow=='imgWWIcon'){
            document.getElementById('imgWWIcon').src='images/landing/womenswear_pl.jpg';
        }
        if (strItemToGrow=='imgLIcon'){
            document.getElementById('imgLIcon').src='images/landing/lingerie_pl.jpg';
        }
        if (strItemToGrow=='imgMIcon'){
            document.getElementById('imgMIcon').src='images/landing/menswear_pl.jpg';
        }
        if (strItemToGrow=='imgSWIcon'){
            document.getElementById('imgSWIcon').src='images/landing/schoolwear_pl.jpg';
        }
        if (strItemToGrow=='imgWIcon'){
            document.getElementById('imgWIcon').src='images/landing/wine_pl.jpg';
        }
        if (strItemToGrow=='imgFIcon'){
            document.getElementById('imgFIcon').src='images/landing/food_pl.jpg';
        }
        if (strItemToGrow=='imgHIcon'){
            document.getElementById('imgHIcon').src='images/landing/home_pl.jpg';
        }
        if (strItemToGrow=='imgSIcon'){
            document.getElementById('imgSIcon').src='images/landing/valentines_pl.jpg';
        }
        if (strItemToGrow=='imgNIcon'){
            document.getElementById('imgNIcon').src='images/landing/archive_pl.jpg';
        }
    
        //grow the icon
        ScaleItem(strItemToGrow, 167, 175, 94, 99, 0.1);
        //move the icon
        MoveItemX(strItemToMove, intStartX, intStartX - 4, 0.1);
        MoveItemY(strItemToMove, intStartY, intStartY - 2, 0.1);
    }
}

function MouseOutThumb_old(strItemToGrow, strItemToMove, strItemToShow1, strItemToShow2, intStartX, intStartY){
    var objTrans;
    if (boolLoaded==true){
        //swap the image first
        if (strItemToGrow=='imgWWIcon'){
            document.getElementById('imgWWIcon').src='images/landing/womenswear.jpg';
        }
        if (strItemToGrow=='imgLIcon'){
            document.getElementById('imgLIcon').src='images/landing/lingerie.jpg';
        }
        if (strItemToGrow=='imgMIcon'){
            document.getElementById('imgMIcon').src='images/landing/menswear.jpg';
        }
        if (strItemToGrow=='imgSWIcon'){
            document.getElementById('imgSWIcon').src='images/landing/schoolwear.jpg';
        }
        if (strItemToGrow=='imgWIcon'){
            document.getElementById('imgWIcon').src='images/landing/wine.jpg';
        }
        if (strItemToGrow=='imgFIcon'){
            document.getElementById('imgFIcon').src='images/landing/food.jpg';
        }
        if (strItemToGrow=='imgHIcon'){
            document.getElementById('imgHIcon').src='images/landing/home.jpg';
        }
        if (strItemToGrow=='imgSIcon'){
            document.getElementById('imgSIcon').src='images/landing/valentines.jpg';
        }
        if (strItemToGrow=='imgNIcon'){
            document.getElementById('imgNIcon').src='images/landing/archive.jpg';
        }

        //shrink the icon
        ScaleItem(strItemToGrow, 175, 167, 99, 94, 0.1);
        //move the icon
        MoveItemX(strItemToMove, intStartX, intStartX + 4, 0.1);
        MoveItemY(strItemToMove, intStartY, intStartY + 2, 0.1);
    }
}

function FadeOut(intLink){
    //fade out all of the items to close
    var intFadeOutDuration;
    
    if (boolLoaded==true){
        boolLoaded = false;
        intFadeOutDuration = 1;
        FadeItem("divLogo", 100, 0, intFadeOutDuration);
        //FadeItem("divChooseChannel", 100, 0, intFadeOutDuration);
        document.getElementById("divChooseChannel").style.visibility='hidden';
        if (strCurrentIconOver.length>0){
            FadeItem(strCurrentIconOver, 100, 0, intFadeOutDuration);        
        }
        FadeItem("divWWPlay", 100, 0, intFadeOutDuration);
        FadeItem("divWWIcon", 100, 0, intFadeOutDuration);
        FadeItem("divWWTitle", 100, 0, intFadeOutDuration);
        FadeItem("divLPlay", 100, 0, intFadeOutDuration);
        FadeItem("divLIcon", 100, 0, intFadeOutDuration);
        FadeItem("divLTitle", 100, 0, intFadeOutDuration);
        FadeItem("divMPlay", 100, 0, intFadeOutDuration);
        FadeItem("divMIcon", 100, 0, intFadeOutDuration);
        FadeItem("divMTitle", 100, 0, intFadeOutDuration);
        FadeItem("divSWPlay", 100, 0, intFadeOutDuration);
        FadeItem("divSWIcon", 100, 0, intFadeOutDuration);
        FadeItem("divSWTitle", 100, 0, intFadeOutDuration);
        FadeItem("divWPlay", 100, 0, intFadeOutDuration);
        FadeItem("divWIcon", 100, 0, intFadeOutDuration);
        FadeItem("divWTitle", 100, 0, intFadeOutDuration);
        FadeItem("divFPlay", 100, 0, intFadeOutDuration);
        FadeItem("divFIcon", 100, 0, intFadeOutDuration);
        FadeItem("divFTitle", 100, 0, intFadeOutDuration);
        FadeItem("divHPlay", 100, 0, intFadeOutDuration);
        FadeItem("divHIcon", 100, 0, intFadeOutDuration);
        FadeItem("divHTitle", 100, 0, intFadeOutDuration);
        FadeItem("divSPlay", 100, 0, intFadeOutDuration);
        FadeItem("divSIcon", 100, 0, intFadeOutDuration);
        FadeItem("divSTitle", 100, 0, intFadeOutDuration);
        FadeItem("divNPlay", 100, 0, intFadeOutDuration);
        FadeItem("divNIcon", 100, 0, intFadeOutDuration);
        FadeItem("divNTitle", 100, 0, intFadeOutDuration);
        var objTrans;
        document.getElementById("divNTitle").style.visibility = '';
        objTrans = new OpacityTween(document.getElementById("divNTitle"),Tween.regularEaseInOut, 100, 0, intFadeOutDuration);
        objTrans.onMotionStarted = function(){}            
        objTrans.onMotionFinished = function(){
            window.location='player.htm?bclid=' + intLink;
        }            
        objTrans.start();
        objTrans=null;    
    }
}

