﻿window.onload=FirstTime
var IdLastBrand = 0;

function ShowBrand(IdBrand)
{
    PageMethods.GetBrand(IdBrand, GetBrand_OK, GetBrand_Error, null);
    if (IdLastBrand!= 0)
        document.getElementById("link_" + IdLastBrand).className = "";
    document.getElementById("link_" + IdBrand).className = "activeLink";
    IdLastBrand = IdBrand;
}


function MouseOver(td)
{
    td.style.color = "#b9519d";
    td.style.fontWeight = "bold";
}

function MouseOut(td)
{
    td.style.color = "#BBB";
    td.style.fontWeight = "";
}

function ShowMe(IdCategory)
{
    var div = document.getElementById("divBrands_" + IdCategory);
    if (div.style.display == "")
    {
        div.style.display = "none";
        document.getElementById("img" + IdCategory).src = "style/images/anchor-arrow.gif"
    }
    else
    {
        document.getElementById("img" + IdCategory).src = "style/images/anchor-arrow-down.gif"
        div.style.display = "";
    }
}

function FirstTime()
{
    ShowBrand(brand);
    ShowMe(category);
}

function GetBrand_Error(ex, ctx, methodName)
{
    alert("An error has ocurred " + ex + " " + methodName);
}

function GetBrand_OK(brand, ctx, methodName) {
    var innerHtml = "<div class=\"columnCenter\">";

    if (brand[5] != null && brand[5] != "") {
        innerHtml += "<div style=\"float:right; text-align:center; margin-left:25px; margin-right:40px; margin-bottom: 5px;\">";
        innerHtml += " <p class=\"position\"><a href=\"LeadershipProfile.aspx?Id=" + brand[8] + "\">";
        innerHtml += "<img src=\"Images/Management/" + brand[5] + "\">";
        innerHtml += "<br/><br/>" + brand[6] + "";
        innerHtml += "<br/>" + brand[7] + "";
        innerHtml += "</div>";
    }

    if (brand[3] != "") {
        innerHtml += "  <a style=\"padding-left:0px;\" href=\"#\" onclick=\"window.open('" + brand[3] + "')\"><img src=\"Images/Brand/" + ((brand[2] == null || brand[2] == "") ? brand[4] : brand[2]) + "\"></a>";
    }
    else {
        innerHtml += "  <img src=\"Images/Brand/" + ((brand[2] == null || brand[2] == "") ? brand[4] : brand[2]) + "\">";
    }

    innerHtml += "  <br/><br/><h4 class=\"talentTitle\">" + brand[0] + "</h4>";
    innerHtml += "  <a style=\"color: #619fd6;\" onclick=\"window.open('" + brand[3] + "')\" href=\"#\">" + brand[3] + " </a>";
    innerHtml += "  <p class=\"paragraph\">" + brand[1] + "</p>";
    innerHtml += "</div>";

    document.getElementById(divContent).innerHTML = innerHtml;
}