﻿// JScript File
var xpnder;

function resizeFavorites(expheight, direction, rate)
{
    var functionRef;
    functionRef = "delayit(" + expheight + ", '" + direction + "', " + rate + ")";
    setTimeout(functionRef, 2000);

    if(direction=='shrink')
    {
        //functionRef = "resizeIt(" + expheight + ", '" + direction + "', " + rate + ")";
        if (xpnder != null)
        {
            //clearInterval(xpnder);
        }
        //alert(functionRef)
        //xpnder= setInterval(functionRef, 1);
    }
    else
    {
        //functionRef = "delayit(" + expheight + ", '" + direction + "', " + rate + ")";
        //setTimeout(functionRef, 1000);
    }

}

function delayit(expheight, direction, rate)
{
    var functionRef = "resizeIt(" + expheight + ", '" + direction + "', " + rate + ")";
    if (xpnder != null)
    {
        clearInterval(xpnder);
    }
    //alert(functionRef)
    xpnder= setInterval(functionRef, 1);
}
function resizeIt(expheight, direction, rate)
{
    try
    {
        var ExpDiv = document.getElementById('FavoriteListContainer');
        var ExpTD1 = document.getElementById('FavoriteListOuterContainer1');
        var ExpTD2 = document.getElementById('FavoriteListOuterContainer2');
        var ExpTD3 = document.getElementById('FavoriteListOuterContainer3');
        var currHeight;
        currHeight= ExpDiv.style.height;

        //alert(currHeight);  
        if(currHeight.length > 2)
        {
            currHeight = parseInt(currHeight.substring(0, (currHeight.length - 2)));
        }
        if(direction=='grow')
        {
            currHeight = parseInt(currHeight)+parseInt(rate);
            //alert('grow - ' + currHeight); 
           if(currHeight>=expheight)
            {
                //alert('done grow');  
                currHeight = expheight;
                clearInterval(xpnder); 
            }
        }
        else if(direction=='shrink')
        {
            //alert('shrink - ' + currHeight); 
            currHeight = parseInt(currHeight)-parseInt(rate);
            if(currHeight<=expheight)
            {
                //alert('done shrink');  
                currHeight = expheight;
                clearInterval(xpnder); 
            }
        }
        else
        {
            alert('nada');
        }
        //alert('height: ' + currHeight);  
        browserdetect=ExpTD3.filters? "ie" : typeof ExpTD3.style.MozOpacity=="string"? "mozilla" : "";
        if (browserdetect=="mozilla"){
            ExpTD1.height = currHeight.toString() + 'px';
            ExpTD2.height = currHeight.toString() + 'px';
            ExpTD3.height = currHeight.toString() + 'px';
            ExpTD1.style.height = currHeight.toString() + 'px';
            ExpTD2.style.height = currHeight.toString() + 'px';
            ExpTD3.style.height = currHeight.toString() + 'px';
        }
        else if (browserdetect=="ie"){
            ExpTD1.height = currHeight.toString() + 'px';
            ExpTD2.height = currHeight.toString() + 'px';
            ExpTD3.height = currHeight.toString() + 'px';
            ExpDiv.height = currHeight.toString() + 'px';
            ExpTD1.style.height = currHeight.toString() + 'px';
            ExpTD2.style.height = currHeight.toString() + 'px';
            ExpTD3.style.height = currHeight.toString() + 'px';
        }
        ExpDiv.style.height = currHeight.toString() + 'px';
        //alert(ExpDiv.style.height);  
        //alert(ExpTD.style.height);  
    }
    catch(err)
    {
        clearInterval(xpnder); 
       alert('error'); 
    }

}

function setInitialFavoriteHeight(startheight)
{
    var ExpDiv = document.getElementById('FavoriteListContainer');
    var ExpTD1 = document.getElementById('FavoriteListOuterContainer1');
    var ExpTD2 = document.getElementById('FavoriteListOuterContainer2');
    var ExpTD3 = document.getElementById('FavoriteListOuterContainer3');
    browserdetect=ExpTD3.filters? "ie" : typeof ExpTD3.style.MozOpacity=="string"? "mozilla" : "";
    if (browserdetect=="mozilla"){
        ExpTD1.height = startheight + "px";
        ExpTD2.height = startheight + "px";
        ExpTD3.height = startheight + "px";
    }
    else if (browserdetect=="ie"){
        ExpTD1.style.height = startheight + "px";
        ExpTD2.style.height = startheight + "px";
        ExpTD3.style.height = startheight + "px";
       //alert(ExpDiv.style.height); 
    }
    ExpDiv.style.height = startheight + "px";
    try
    {
        ExpTD1.height = startheight + "px";
        ExpTD2.height = startheight + "px";
        ExpTD3.height = startheight + "px";
        ExpDiv.height = startheight + "px";
        ExpTD1.style.height = startheight + "px";
        ExpTD2.style.height = startheight + "px";
        ExpTD3.style.height = startheight + "px";
    }
    catch(err)
    {
        alert('err');
    }
    //alert(ExpTD.height);  
    //alert(ExpTD.height); 


}
