﻿// JScript 文件
 
    //alert(document.getElementById("footer").style.marginLeft);
    function ShowDv(o){
        //object.style.display=''
        //alert(o);
       if(document.getElementById(o).innerHTML!="")
        {
            document.getElementById(o).style.display='';
        }
    }
    function HideDv(o){   
       //var t = setTimeout("HideDvTimeOut('"+o+"')",2000);
       //document.getElementById(o).style.display='none';
       HideDvTimeOut(o);
    }
    function HideDvTimeOut(o){
        document.getElementById(o).style.display='none';
    }
    function ShowItemStyle(o){
        o.style.backgroundColor='#F5D674';   
    }
    function ShowItemStyle2(o){
        if(o.indexOf(',') > -1){
            for(var i =0;i< o.split(',').length;i++){
                
                var l = o.split(',');
                //alert(l[i]);
                if(document.getElementById(l[i])){
                document.getElementById(l[i]).style.backgroundColor='#F5D674'; 
                }
            }
        }
        else{
            document.getElementById(o).style.backgroundColor='#F5D674';   
        }
    }
    function RemoveItemStyle(o){
        o.style.backgroundColor=''; 
        o.style.border='';        
    }
    function RemoveItemStyle2(o){
        if(o.indexOf(',') > -1){
            for(var i =0;i< o.split(',').length;i++){
                
                var l = o.split(',');
                //alert(l[i]);
                if(document.getElementById(l[i])){
                document.getElementById(l[i]).style.backgroundColor=''; 
                }
            }
        }
        else{
            document.getElementById(o).style.backgroundColor='';   
        }
        
        //o.style.backgroundColor=''; 
        //o.style.border='';        
    }
    //显示购买菜单
    function ShowBuyDv(typeId,moreId,buyId,margintop,productId,powerID,fname,parentItemList){
         
        ShowDv(buyId);
        ShowDv(typeId);
        ShowDv(moreId);
        //document.getElementById(buyId).style.zIndex = 1;
        document.getElementById(buyId).style.marginTop=''+(parseInt(margintop)+6)+'px';

        //显示父层次
        document.getElementById(buyId).onmouseover=function(){
            ShowDv(buyId);
            ShowDv(typeId);
            ShowDv(moreId);
            
            //ShowItemStyle2(parentItemList);
            
        }
        //隐藏父层次
        document.getElementById(buyId).onmouseout=function(){
            HideDv(buyId);
            HideDv(typeId);
            HideDv(moreId);
            
            //RemoveItemStyle2(parentItemList);
        }
         
        document.getElementById(buyId).innerHTML="<div onmouseover=\"ShowItemStyle(this);ShowItemStyle2('"+parentItemList+"');\" style=' padding-left:30px;background: url(/images/dinggou.gif) no-repeat 5px -3px;vertical-align:top;height:24px;line-height:24px;' onmouseout=\"RemoveItemStyle(this);RemoveItemStyle2('"+parentItemList+"');\"><a href='javascript:;' onclick=\"Add2Buy("+productId+",'"+fname+"')\">立即购买</a></div>";
        //document.getElementById(buyId).innerHTML+="<div onmouseover=\"ShowItemStyle(this);ShowItemStyle2('"+parentItemList+"');\" style=' padding-left:30px;background: url(/images/gouwuche.gif) no-repeat 5px -3px;vertical-align:top;height:24px;line-height:24px;' onmouseout=\"RemoveItemStyle(this);RemoveItemStyle2('"+parentItemList+"');\"><a href='javascript:;' onclick=\"Add2Cart("+productId+",'"+fname+"')\">放入购物车</a></div>";
        //alert(document.getElementById(itemDv).style.height);
       
    }
    
   
 
