﻿function headerSetHeightlightItem(name)
{
    var ul1 = document.getElementById("HeaderNavUl");
    var atagList = ul1.getElementsByTagName("a");
    for(var i=0; i < atagList.length; i++)
    {
        var innerTxt = atagList[i].innerHTML;
        innerTxt = innerTxt.replace(/\s+/g,"");
        if(innerTxt == name)
        {
            atagList[i].className = "selected";
            atagList[i].onclick = function()
            {
                return false;
            }
        }
    }
    
    ul1 = document.getElementById("HeaderUnderNavUl");
    atagList = ul1.getElementsByTagName("a");
    for(var i=0; i < atagList.length; i++)
    {
        var innerTxt = atagList[i].innerHTML;
        innerTxt = innerTxt.replace(/\s+/g,"");
        if(innerTxt == name)
        {
            atagList[i].className = "selected";
            atagList[i].onclick = function()
            {
                return false;
            }
        }
    }
    
}



var userCardIframe = null;

function gx_group(ca_id,cook_ids,food_id,id)
{
    if(window.attachEvent)
    {
        document.getElementById("guanbi").click();
    }
    else
    {
        var ev = document.createEvent('MouseEvents');
        ev.initEvent('click', false, true);
        document.getElementById("guanbi").dispatchEvent(ev);
    }
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop + 170)+"px";
      
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
       
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        //userCardIframe.style.backgroundColor = "#C1C1C1";
        userCardIframe.style.borderStyle = "none";
        userCardIframe.style.width = "526px";
        userCardIframe.style.height = '454px';
        userCardIframe.style.zIndex = "10";
        document.body.appendChild(userCardIframe);
    }
   
    if(food_id=="0")
    {
     userCardIframe.src = "group_cashbox_money.aspx?ca_id="+ca_id+"&&cook_ids="+cook_ids+"&&id="+id
    }
    if(cook_ids=="0")
    {
    userCardIframe.src = "group_cashbox_money.aspx?ca_id="+ca_id+"&&food_id="+food_id+"&&id="+id
    }
    if(food_id=="0"&&cook_ids=="0")
    {
    userCardIframe.src = "group_cashbox_money.aspx?ca_id="+ca_id+"&&id="+id
    }
   
}

function closeUserCardWindow()//关闭用户名片窗口
{
    if(userCardIframe)
    {
        if(userCardIframe.parentNode)
        {
            window.setTimeout(function()
            {
                userCardIframe.parentNode.removeChild(userCardIframe);
                userCardIframe = null;
            },1);//新启线程进行关闭，否则会产生脚本错误。
        }
    }
}