﻿function MenuStyle(option)
{	
    if (option == 1)
    {
        document.getElementById('Tab1').style.display = 'block';
        //document.getElementById('Tab2').style.display = 'none';
        $('.divTab2').hide();
        document.getElementById('Tab3').style.display = 'none';
        document.getElementById('TheShoe').className = 'selected';
        document.getElementById('AlternativeViews').className = '';
        document.getElementById('ProductDetails').className = '';
        
    }
    else if (option == 2)
    {
        document.getElementById('Tab1').style.display = 'none';
        //document.getElementById('Tab2').style.display = 'block';
        $('.divTab2').show();
        document.getElementById('Tab3').style.display = 'none';
        document.getElementById('AlternativeViews').className = 'selected';
        document.getElementById('TheShoe').className = '';
        document.getElementById('ProductDetails').className = '';
    }
    else if (option == 3)
    {
        document.getElementById('Tab1').style.display = 'none';
        //document.getElementById('Tab2').style.display = 'none';
        $('.divTab2').hide();
        document.getElementById('Tab3').style.display = 'block';
        document.getElementById('ProductDetails').className = 'selected';
        document.getElementById('TheShoe').className = '';
        document.getElementById('AlternativeViews').className = '';
    }
	return false;
}
function ChangePanel(option) {	
    if (option == 1)
    {
        document.getElementById('SizeTab').style.display = 'block';
        try{
        document.getElementById('ColorTab0').style.display = 'none';
        } catch (err) { }
        try{
        document.getElementById('ColorTab1').style.display = 'none';
        }catch(err){}
        try{
        document.getElementById('ColorTab2').style.display = 'none';
        }
        catch(err){}
        document.getElementById('SizeGuidePopup').style.display = 'block';
           
    }
    else {

        document.getElementById('SizeTab').style.display = 'none';
        document.getElementById('SizeGuidePopup').style.display = 'none';
        switch (option)
        {
            case 2:
                try{
                document.getElementById('ColorTab0').style.display = 'block';  
                }
                catch(err){}
                break;
            case 3:
                try{
                document.getElementById('ColorTab1').style.display = 'block';  
                }
                catch(err){}
                break;
            case 4:
                try{
                document.getElementById('ColorTab2').style.display = 'block';  
                }catch(err){}
                break;
        }     
    }
   
	return false;
}
function CloseWindow()
{	
   
   document.getElementById('SizeGuidePopup').style.display = 'none';
    
   
	return false;
}

function RemovePanel()
{	
   
        document.getElementById('SizeTab').style.display = 'block';
        try {
            document.getElementById('ColorTab0').style.display = 'none';
        } catch (err) { }
        try {
            document.getElementById('ColorTab1').style.display = 'none';
        } catch (err) { }
        try {
            document.getElementById('ColorTab2').style.display = 'none';
        }
        catch (err) { }
        document.getElementById('SizeGuidePopup').style.display = 'none';
   
	return false;
}

window.onload = function() {

    setTimeout('SetCorrectSubNav()', 100);
}


function SetCorrectSubNav() {

    var maxZindex = 10000;
    var minZindex = -10000;
    var minTextIndent = "-3000px";
    var maxTextIndent = "0px";

    var aShoeSubNav = document.getElementById('shoessubnav');
    var aAboutsubnav = document.getElementById('aboutsubnav');
    var aContactsubnav = document.getElementById('contactsubnav');
    var aShoecaresubnav = document.getElementById('shoecaresubnav');

    switch (navtodisplay) {
        case "shoessubnav":

            if (aShoeSubNav != null) {

                aShoeSubNav.style.zIndex = maxZindex;
                aAboutsubnav.style.zIndex = minZindex;
                aContactsubnav.style.zIndex = minZindex;
                aShoecaresubnav.style.zIndex = minZindex;


                aShoeSubNav.style.textIndent = maxTextIndent;
                aAboutsubnav.style.textIndent = minTextIndent;
                aContactsubnav.style.textIndent = minTextIndent;
                aShoecaresubnav.style.textIndent = minTextIndent;

                $('#shoessubnav').show();
                $('#aboutsubnav').hide();
                $('#contactsubnav').hide();
                $('#shoecaresubnav').hide();

            }

            break;
        case "aboutsubnav":
if (aShoeSubNav != null) {

            aShoeSubNav.style.zIndex = minZindex;
            aAboutsubnav.style.zIndex = maxZindex;
            aContactsubnav.style.zIndex = minZindex;
            aShoecaresubnav.style.zIndex = minZindex;

            aShoeSubNav.style.textIndent = minTextIndent;
            aAboutsubnav.style.textIndent = maxTextIndent;
            aContactsubnav.style.textIndent = minTextIndent;
            aShoecaresubnav.style.textIndent = minTextIndent;


            $('#shoessubnav').hide();
            $('#aboutsubnav').show();
            $('#contactsubnav').hide();
            $('#shoecaresubnav').hide();
            }

            break;
        case "contactsubnav":
if (aShoeSubNav != null) {

            aShoeSubNav.style.zIndex = minZindex;
            aAboutsubnav.style.zIndex = minZindex;
            aContactsubnav.style.zIndex = maxZindex;
            aShoecaresubnav.style.zIndex = minZindex;
            
            aShoeSubNav.style.textIndent = minTextIndent;
            aAboutsubnav.style.textIndent = minTextIndent;
            aContactsubnav.style.textIndent = maxTextIndent;
            aShoecaresubnav.style.textIndent = minTextIndent;

            $('#shoessubnav').hide();
            $('#aboutsubnav').hide();
            $('#contactsubnav').show();
            $('#shoecaresubnav').hide();
}
            break;
        case "shoecaresubnav":

            if (aShoeSubNav != null) {
                aShoeSubNav.style.zIndex = minZindex;
                aAboutsubnav.style.zIndex = minZindex;
                aContactsubnav.style.zIndex = minZindex;
                aShoecaresubnav.style.zIndex = maxZindex;

                aShoeSubNav.style.textIndent = minTextIndent;
                aAboutsubnav.style.textIndent = minTextIndent;
                aContactsubnav.style.textIndent = minTextIndent;
                aShoecaresubnav.style.textIndent = maxTextIndent;

                $('#shoessubnav').hide();
                $('#aboutsubnav').hide();
                $('#contactsubnav').hide();
                $('#shoecaresubnav').show();
            }
            break;
    }

}

var LeaverTimer;
var EnterTimer;



function SubMenuPreview(subnavitem) {

    navtodisplay = subnavitem;

    EnterTimer = setTimeout("SetCorrectSubNav();",200);
}    

    function ReturnToCurrentNav() {

        navtodisplay = navdefault;

        clearTimeout(EnterTimer);
        clearInterval(LeaverTimer);
        clearTimeout(LeaverTimer);
        LeaverTimer = setTimeout("SetCorrectSubNav();", 100);

    }

    function SubItemOnMouserOver() {

        clearTimeout(EnterTimer);
        clearInterval(LeaverTimer);
        clearTimeout(LeaverTimer);
        LeaverTimer = setTimeout('null', 1);
    }

    function SubItemMouseOut() {
        navtodisplay = navdefault;
        LeaverTimer = setTimeout("SetCorrectSubNav();", 100);
    }

    function SetScrollImage(ProductURL, Name) {              
        
        var DisplayImage = document.getElementById('imgProductPreview');
        DisplayImage.src = ProductURL;
        document.getElementById('ProductPReviewLabel').innerHTML = Name;        
        document.onmousemove = follow;   
        
    }

    function SetScrollImageHide() {
        document.onmousemove = null;
        var hp = document.getElementById("ProductImageLarge");                
        var DisplayImage = document.getElementById('imgProductPreview');        
        hp.style.visibility = "hidden";
    }     

    function mouseX(evt) { if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX) return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); else return 0; }
    function mouseY(evt) { if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY) return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0; }
//    function mouseX(evt) { if (!evt) evt = window.event;if (evt.pageX) return evt.pageX; else if (evt.clientX) return evt.clientX; else return 0; }
//    function mouseY(evt) { if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY) return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0; }

    function follow(evt) {
        if (document.getElementById) {
            var xSubTraction = 0;
            var ClientWidth = document.body.clientWidth;
            var ClientHeight = GetScreenHeight();            
            var PopHeight = 0;
            
            
            
            var objRoot = document.getElementById('ProductImageLarge');

            if (ClientWidth > 970) {
                xSubTraction = ((ClientWidth - 970)/2);
            }
            else {
                xSubTraction = 0;
            }

            PopHeight = objRoot.clientHeight;
            

            var obj = document.getElementById('ProductImageLarge').style; obj.visibility = 'visible';                        
            obj.left = (parseInt(mouseX(evt) - xSubTraction) - 275) + 'px';                
            obj.top = (parseInt(mouseY(evt)) - (PopHeight/2)) + 'px';            
        }
    }

    function GetScreenHeight() {
        var h;    
        if(!window.innerWidth)
        {
             //strict mode
            if(!(document.documentElement.clientWidth == 0))
            {
                h = document.documentElement.clientHeight;
            }
            //quirks mode
            else
            {            
                h = document.body.clientHeight;
            }
        }
        //w3c
        else
        {    
            h = window.innerHeight;
        }
        return h;    
    }


    function setAlternativeView(ToeOrSole) {

        var lblCounter = document.getElementById('ctl00_MainContent_lblThumbCounter');
        var lblLabel = document.getElementById('ctl00_MainContent_lblThumbLabel');

        var linkToe = document.getElementById('lnkToe');
        var linkSole = document.getElementById('lnkSole');

        var imgToe = document.getElementById('pnlImageToe');
        var imgSole = document.getElementById('pnlImageSole');

        if (ToeOrSole == 'toe') {

            lblCounter.innerHTML = '1______';
            lblLabel.innerHTML = 'Toe View';
            linkToe.style.border = 'solid 2px #967e3a';
            linkSole.style.border = '2px solid #F4F3EF';
            imgToe.style.display = 'block';
            imgSole.style.display = 'none';

        }
        else {

            lblCounter.innerHTML = '2______';
            lblLabel.innerHTML = 'Sole View';
            linkToe.style.border = 'solid 2px #F4F3EF';
            linkSole.style.border = '2px solid #967e3a';
            imgToe.style.display = 'none';
            imgSole.style.display = 'block';
        }    
    }
    
                    