/// <reference path="jquery-1.3.2-vsdoc.js"/> 
/*********************
Secret JS V1
*********************/
jQuery(document).ready(function() {
    navigationHover(); //Load Navigation Hover
    subnavHover();
    $('#searchBox input').focus(searchInput);
    $('#searchBox input').blur(offSearch);
    
});

function searchInput()
{
    var searchValue = $(this).val();
    if(searchValue == "Search")
    {
        $(this).val('');
    }
    else
    {
        return false;
    }
}

function offSearch()
{
    var searchValue = $(this).val();
    if(searchValue == "Search" || searchValue == "")
    {
        $(this).val('Search');
    }
    else
    {
        return false;
    }
}

$('#countrySelector').change(function()
{
    var country = $(this).val();
    switch(country)
    {
        case "US":
        window.location = "http://www.secret.com/";
        break;
        
        case "CAE":
	 window.location = "http://www.secret.com/en-ca/Default.aspx";
        break;
        
        case "CAF":
//      window.location = "http://www.secret.com/fr_ca/Secret.do";
        window.location = "http://www.secret.com/fr-ca/Default.aspx"
        break;
        
        default:
        window.location = "http://www.secret.com";
    }
    
});

function navigationHover() {
    if (!document.getElementById('navigation')) return false;
    $('#navigation ul li#productsNav').hover(function() {
        $(this).children('div').show();
    }, function() {
        $(this).children('div').hide();
    });
$('#navigation ul li#sweatNav').hover(function() {
        $(this).children('div').show();
    }, function() {
        $(this).children('div').hide();
    });


}

function subnavHover(){
    $('a#protectionTab, #wantTab').css({'text-indent':'0', 'font-size':'18px','padding-top':'5px', 'opacity':'0'});
    $('a#protectionTab, #wantTab').bind('mouseover', function(){
        var container = $(this).attr('href');
        $('#protectionSubnav, #wantDeodorantSubnav').hide();
        $(container).show();
        
        switch(container)
        {
            case "#protectionSubnav":
            $('#subNavigation').css('background','url(/Images/Navigation/bkgdSubnavProtection.png) no-repeat');
            break;
            
            case "#wantDeodorantSubnav":
            $('#subNavigation').css('background','url(/Images/Navigation/bkgdSubnavWant.png) no-repeat');
            break;
            
            default:
            $('#subNavigation').css('background','url(/Images/Navigation/bkgdSubnavProtection.png) no-repeat');
            break;
        }
    });
}
