﻿
function ViewMoreProduts(kindID, containerID) {
    var flag = GetProductTabFlag(containerID);
    var url = "ProductOffers.aspx?kindID=" + kindID;
    if (flag == 1) url += "&InfoKind=qj";
    document.location = url;
}
function GoToPublishProduct(kindID, containerID) {
    var flag = GetProductTabFlag(containerID);
    var url = "UserCenterMain.aspx?kindID=" + kindID;
    if (flag == 1)
        url += "&action=qj";
    else
        url += "&action=gy";
    window.open(url);
}

function GetProductTabFlag(containerID) {
    var flag = 1;
    var container = $(containerID);
    var arrDiv = container.getElementsByTagName('div');
    for (var i = 0; i < arrDiv.length; i++) {
        var name = arrDiv[i].getAttribute('name');
        if (name != null) {
            if (name == "content1" && arrDiv[i].style.display == "") {
                flag = 1; break;
            }

            if (name == "content2" && arrDiv[i].style.display == "") {
                flag = 2; break;
            }
        }
    }
    return flag;
}

function ProPanleTabOver(obj, containerID) {
    var container = $(containerID);
    obj.className = 'contentTable_MaskTitle';
    var tab1 = null;
    var tab2 = null;
    var content1 = null;
    var content2 = null;
    var arrDiv = container.getElementsByTagName('div');
    for (var i = 0; i < arrDiv.length; i++) {
        var name = arrDiv[i].getAttribute('name');
        if (name != null) {
            if (name == "tab1")
                tab1 = arrDiv[i];
            else if (name == "tab2")
                tab2 = arrDiv[i];
            else if (name == "content1")
                content1 = arrDiv[i];
            else if (name == "content2")
                content2 = arrDiv[i];
            if (tab1 != null && tab2 != null && content1 != null && content2 != null)
                break;
        }
    }


    if (obj.getAttribute('name') == "tab1") {
        tab2.className = '';
        if (content1 != null)
            content1.style.display = "";
        if (content2 != null)
            content2.style.display = "none";
    }
    else {
        tab1.className = '';
        if (content1 != null)
            content1.style.display = "none";
        if (content2 != null)
            content2.style.display = "";
    }

}

function ViewProductName(pName) {
    document.location = "ProductOffers.aspx?keyword=" + escape(pName);
}
function ViewProductNames(kindID) {
    document.location = "ProductNames.aspx?kindID=" + kindID;
}