﻿// JScript File
<!--

var DDSPEED = 2;
var DDTIMER = 50;

function topBarOver(sender)
{
    if(sender.id.indexOf('ProductsMenuLink')>=0)
    {
        var x = document.getElementById("ProductsMenu");
        
        if(x==null)
        {
            var x = document.getElementById("ctl00_ProductsMenu");
            
            if(x==null)
            {
                var x = document.getElementById("_ctl0_ProductsMenu");
            }
        }
        
        x.style.display = 'block';
    }

    if(sender.id.indexOf('PDHeader')>=0)
    {
        var x = document.getElementById("PDMenu");
        
        if(x==null)
        {
            var x = document.getElementById("ctl00_PDMenu");
            
            if(x==null)
            {
                var x = document.getElementById("_ctl0_PDMenu");
            }
        }
        
        x.style.display = 'block';
    }
}

function topBarOut(sender)
{

    if(sender.id.indexOf('ProductsMenuLink')>=0)
    {
        var x = document.getElementById("ProductsMenu");
        
        if(x==null)
        {
            var x = document.getElementById("ctl00_ProductsMenu");
            
            if(x==null)
            {
                var x = document.getElementById("_ctl0_ProductsMenu");
            }
        }
        
        x.style.display = 'none';
    }
    
    if(sender.id.indexOf('PDHeader')>=0)
    {
        var x = document.getElementById("PDMenu");
        
        if(x==null)
        {
            var x = document.getElementById("ctl00_PDMenu");
            
            if(x==null)
            {
                var x = document.getElementById("_ctl0_PDMenu");
            }
        }
        
        x.style.display = 'none';
    }

}

function sideBarOver(sender)
{
    var btnimg = sender.childNodes[0];
    btnimg.src = btnimg.src.split('.jpg')[0] + '-ov.jpg';

    var img = document.getElementById("MainImage");

    if(sender.id=="DeliverySystemsButton")
    {
        var x = document.getElementById("DeliverySystemsDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        
        img.src = "images/Main-DeliverySystems.jpg";
    }
    if(sender.id=="RheologySystemsButton")
    {
        var x = document.getElementById("RheologySystemsDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        img.src = "images/Main-RheologySystems.jpg";
    }
    if(sender.id=="SkinCareButton")
    {
        var x = document.getElementById("SkinCareDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        img.src = "images/Main-SkinCare.jpg";
    }
    if(sender.id=="SunCareButton")
    {
        var x = document.getElementById("SunCareDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        img.src = "images/Main-SunCare.jpg";
    }
    if(sender.id=="WhiteLabelButton")
    {
        var x = document.getElementById("WhiteLabelDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        img.src = "images/Main-WhiteLabel.jpg";
    } 
    if(sender.id=="OralCareButton")
    {
        var x = document.getElementById("OralCareDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        img.src = "images/Main-OralCare.jpg";
    } 
    if(sender.id=="BathBodyButton")
    {
        var x = document.getElementById("BathBodyDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        img.src = "images/Main-BathBody.jpg";
    } 
    if(sender.id=="ColorCosmeticsButton")
    {
        var x = document.getElementById("ColorCosmeticsDescription");
        
        clearInterval(x.timer);
        clearTimeout(sender.timer);

        if(x.maxw && x.maxw <= x.offsetWidth)
        {
            return;
        }
        else if(!x.maxw)
        {
            x.style.display = 'block';
            //x.style.width = 'auto';
            x.maxw = x.offsetWidth;
            x.style.width = '0px';
        }
        
        x.timer = setInterval(function(){SlideDescription(x,1)}, DDTIMER);
        img.src = "images/Main-ColorCosmetics.jpg";
    } 
}

function sideBarOut(sender)
{
    var btnimg = sender.childNodes[0];
    if(btnimg.src.indexOf('-ov.') >= 0)
    {
        btnimg.src = btnimg.src.replace('-ov', '');
    }

    if(sender.id=="DeliverySystemsButton")
    {
        var x = document.getElementById("DeliverySystemsDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
    if(sender.id=="RheologySystemsButton")
    {
        var x = document.getElementById("RheologySystemsDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
    if(sender.id=="SkinCareButton")
    {
        var x = document.getElementById("SkinCareDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
    if(sender.id=="SunCareButton")
    {
        var x = document.getElementById("SunCareDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
    if(sender.id=="WhiteLabelButton")
    {
        var x = document.getElementById("WhiteLabelDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
    if(sender.id=="OralCareButton")
    {
        var x = document.getElementById("OralCareDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
    if(sender.id=="BathBodyButton")
    {
        var x = document.getElementById("BathBodyDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
    if(sender.id=="ColorCosmeticsButton")
    {
        var x = document.getElementById("ColorCosmeticsDescription");
        clearInterval(x.timer);
        sender.timer = setTimeout(function(){Collapse(x)},50);
    }
}

function sideBarOverMP(sender)
{
    var btnimg = sender.childNodes[0];
    btnimg.src = btnimg.src.split('.jpg')[0] + '-ov.jpg';
}

function sideBarOutMP(sender)
{
    var img = sender.childNodes[0];
    
    if(img.src.indexOf('-ov.') >= 0)
    {
        img.src = img.src.replace('-ov', '');
    }
}

function SlideDescription(x, dir)
{
    var currw = x.offsetWidth;
    var dist;
    if(dir == 1)
    {
        dist = (Math.round((x.maxw - currw) / DDSPEED));
    }
    else
    {
        dist = (Math.round(currw / DDSPEED));
    }
    if(dist < 1 && dir==1)
    {
        dist = 1;
    }
    x.style.width = currw + (dist * dir) + 'px';
    //c.style.opacity = currh / c.maxh;
    //c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
    if((currw < 2 && dir != 1) || (currw > 248 && dir == 1))
    {
        if(dir==1)
        {
            x.style.width='300px';
        }
        else
        {   
            x.style.width='0px';
        }
        clearInterval(x.timer);
    }
}

function Collapse(x)
{
    x.timer = setInterval(function(){SlideDescription(x,-1)},DDTIMER);
}

//-->
