﻿
//$(document).ready(function(){
//liuxinjun2010-9-1注释
//    var category= $("#maintab .category");
//    category.eq(0).css("background","#9C231B").css("color","#FCECE8");

//    var tabProduct=$('#p_category_content');
//    var loadID=category.eq(0).attr("lang");
//    
//    $.ajax({
//        url: '/loadPage/ProductsType.aspx?tid='+loadID,
//        timeout: 9000,
//        success: function(xmlData){
//            category.eq(0).data("productList",xmlData);
//            $('item',xmlData).each(function(index){
//                var newDiv=$('<div class="list_item"></div>');
//                
//                $('<a target="_blank" class="img" id="'+$(this).attr('bm')+'"  href="/cosmetic/' + $(this).attr('bm') + '.aspx"><img alt="" src="' + $(this).attr('img') + '" width="159" height="159" /></a>').appendTo(newDiv);
//                $('<div class="list_item_text"><a target="_blank" href="/cosmetic/' + $(this).attr('bm') + '.aspx">'+$(this).attr('name')+'</a><br /><span class="height">卉舍价：'+$(this).attr('price')+'</span><br /><span class="lower">商场价：'+$(this).attr('ls')+'</span></div>').appendTo(newDiv);
//                newDiv.appendTo(tabProduct);
//            });
//            $.mouseFunction(4);
//        }
//    });  


         


//订单滚动
(function($){
$.fn.extend({
        Scroll:function(opt,callback){
                //参数初始化
                if(!opt) var opt={};
                var _this=this.eq(0).find("ul:first");
                var        lineH=_this.find("li:first").height(), //获取行高
                        line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数，默认为一屏，即父容器高度
                        speed=opt.speed?parseInt(opt.speed,10):1000, //卷动速度，数值越大，速度越慢（毫秒）
                        timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔（毫秒）
                if(line==0) line=1;
                var upHeight=0-line*lineH;
                //滚动函数
                scrollUp=function(){
                        _this.animate({
                                marginTop:upHeight
                        },speed,function(){
                                for(i=1;i<=line;i++){
                                        _this.find("li:first").appendTo(_this);
                                }
                                _this.css({marginTop:0});
                        });
                }
                //鼠标事件绑定
                _this.hover(function(){
                        clearInterval(timerID);
                },function(){
                        timerID=setInterval("scrollUp()",timer);
                }).mouseout();
        }        
})
})(jQuery);
 
$(document).ready(function(){
        $("#scrollDiv").Scroll({line:5,speed:1000,timer:3000});
      
        $("div.item ul").last().css("border","none");
        var listNum=$('#specProduct ul .first');
        listNum.addClass('number');
        listNum.slice(3).css('background-color','#666');
        //特价区脚本控制
        var width;
        var height;
          $(".s_item_l").hover(function()
         {
             width = $(this).width();
             height = $(this).height();
             $(this).width(parseInt($(this).width())-4);
            $(this).height(parseInt($(this).height())-4);
            $(this).css("border","solid 2px rgb(156,35,27)");
         },
         function()
         {
            $(this).width(parseInt(width));
            $(this).height(parseInt(height));
            $(this).css("border","none");
         });
        var width_b;
        var height_b;
        $(".s_item").hover(function()
         {
             width_b = $(this).width();
             height_b = $(this).height();
             $(this).width(parseInt($(this).width())-4);
            $(this).height(parseInt($(this).height())-4);
            $(this).css("border","solid 2px rgb(156,35,27)");
         },
         function()
         {
            $(this).width(parseInt(width_b));
            $(this).height(parseInt(height_b));
            $(this).css("border","none");
         });
         
         $(".s_item_l").click(function()
         {
        
             if($(this).attr("lang")!=null)
             {
                var url = "/cosmetic/"+$(this).attr("lang")+".aspx";
        
                window.open(url,'_blank');
             }
           
         });
         $(".s_item").click(function()
         {
              if($(this).attr("lang")!=null)
             {
                var url = "/cosmetic/"+$(this).attr("lang")+".aspx";
        
                window.open(url,'_blank');
             }
         });
});





//liuxinjun2010-9-1注释	
//	var timeoutID;
//    category.each(function(index){
//        $(this).mouseover(function(){
//            category.css("background","#DEDEDC").css("color","#53524D");
//            $(this).css("background","#9C231B").css("color","#ffffff");
//            
//            loadID=category.eq(index).attr("lang");
//            timeoutID=setTimeout(function(){
//                tabProduct.empty();
//                if( !category.eq(index).data("productList") ){
//                    $.ajax({
//                        url: '/loadPage/ProductsType.aspx?tid='+loadID,
//                        timeout: 9000,
//                        success: function(xmlData){
//                            category.eq(index).data("productList",xmlData);
//                            $('item',xmlData).each(function(index){
//                                var newDiv=$('<div class="list_item"></div>');
//                                $('<a class="img" id="'+$(this).attr('bm')+'" href="/cosmetic/' + $(this).attr('bm') + '.aspx"><img alt="" src="' + $(this).attr('img') + '" width="159" height="159" /></a>').appendTo(newDiv);
//                                $('<div class="list_item_text"><a href="/cosmetic/' + $(this).attr('bm') + '.aspx">'+$(this).attr('name')+'</a><br /><span class="height">卉舍价：'+$(this).attr('price')+'</span><br /><span class="lower">商场价：'+$(this).attr('ls')+'</span></div>').appendTo(newDiv);
//                                newDiv.appendTo(tabProduct);
//                            });
//                            $.mouseFunction(4);
//                        }
//                    });  
//                }
//                else{
//                    var xmlData=category.eq(index).data("productList");
//                    $('item',xmlData).each(function(index){
//                        var newDiv=$('<div class="list_item"></div>');
//                        $('<a class="img" id="'+$(this).attr('bm')+'" href="/cosmetic/' + $(this).attr('bm') + '.aspx"><img alt="" src="' + $(this).attr('img') + '" width="159" height="159" /></a>').appendTo(newDiv);
//                        $('<div class="list_item_text"><a href="/cosmetic/' + $(this).attr('bm') + '.aspx">'+$(this).attr('name')+'</a><br /><span class="height">卉舍价：'+$(this).attr('price')+'</span><br /><span class="lower">商场价：'+$(this).attr('ls')+'</span></div>').appendTo(newDiv);
//                        newDiv.appendTo(tabProduct);
//                    });
//                    $.mouseFunction(4);
//                }
//            },300);
//        }).mouseout(function(){
//            clearTimeout(timeoutID);
//        });
//    });
	
//	$.ajax({
//        url: '/loadPage/SalesTop.aspx',
//        timeout: 4000,
//        success: function(xmlData){
//            var newUL=$('<ul></ul>');
//            newUL.appendTo($('#specProduct'));

//            $('item',xmlData).each(function(index){
//                $('<li><span class="first">'+$(this).attr('index')+'</span><a href="/cosmetic/'+$(this).attr('bm')+'.aspx" target="_blank"><img width="50" height="50" src="'+$(this).attr('imgpath')+'" alt="" /></a><span class="last"><a href="/cosmetic/'+$(this).attr('bm')+'.aspx" target="_blank">'+$(this).attr('name')+'</a></span></li>').appendTo(newUL);
//            });
//            var listNum=$('#specProduct ul .first');
//            listNum.addClass('number');
//            listNum.slice(3).css('background-color','#666');
//        }
//    });  
    
   
        

$(document).ready(function()
{
//脚本生成HTML liuxinjun2010-9-13
//    var indexHtml = "";
//    $.get('Config/indexCategory.xml', function(d){   
//           indexHtml="";
//           clkBrandHtml="";
//           $(d).find('Category').each(function(){   
//                var proDivList = "";
//                var clkBrandHtml = "";
//                var i=0;
//                var $category = $(this);     
//                var c_id = $category.attr("id");   
//                var c_name = $category.attr("name");  
//                indexHtml +="<div class='mid_menu'><span class='b_title'>"+c_name+"</span>";
//                clkBrandHtml +="<div class='mid_menu_2' id='c_brd_list_" + c_id + "'>";
//                var DefaultId = "";
//                var firstSpanId = "";
//     
//                $category.find('Brand').each(function(){
//                    var b_id = $(this).attr("id");
//                    var b_name = $(this).attr("name");
//                    

//                    if(i==0)
//                    {
//                          proDivList = "<iframe class='loadFrm' frameBorder='0' src='"+"/loadPage/BrandProductList.aspx?c_id="+c_id+"&b_id="+b_id+"' id='loadFrm_"+c_id+"' scrolling='no' height='260' name='loadFrm_"+c_id+"'></iframe>";
//                       
//                    }
//                    indexHtml += "<span class='brand_nav2'></span><span class='brand_item'> <a href='/Brand/" + b_id + "/1.aspx' target='_blank'>" + b_name + "</a></span>";
//                    if(i==0)
//                    {
//                        clkBrandHtml += "<span class='brand_nav'></span><span class='brand_tit' id='brand_" + c_id + "_" + b_id + "' lang='1'><span>" + b_name + "</span></span>";
//                    }else
//                    {
//                        clkBrandHtml += "<span class='brand_nav'></span><span class='brand_item_2' id='brand_" + c_id + "_" + b_id + "'><span>" + b_name + "</span></span>";
//                    }
//                    i++;
//                });
//          
//                clkBrandHtml +="</div>";
//                if(i>6)
//                {
//                    indexHtml+="<span class='more2'><a href='/Brand/list.aspx'>更多>></a></span>";
//                }
//                indexHtml +="</div>";
//                
//                indexHtml += clkBrandHtml;
//                indexHtml += proDivList;
//                    


//            });  
//          
//            
//            $("#cntDiv").html(indexHtml); 
//          
  
            
            $("li[id^='brand_']").click(function(){
            
                    
 
                    
                    var oldEle = $(this).siblings().filter(".brand_tit"); 
                    if(oldEle.attr("id")==null)
                    {
                        return;
                    }
                    var oldIds = oldEle.attr("id").split('_');
                   
                    var hideDivId = "#brand_"+oldIds[1]+"_"+oldIds[2]+"_BP";
                    var id="brand_"+oldIds[1]+"_"+oldIds[2]+"_BP";
                    var frmName = "loadFrm_"+oldIds[1];
                    var frmId = frmName;
                    
                    //alert($(window.frames[frmName].document.getElementById(id)));
                    
                    
                   
                   if(window.frames.length>0&&window.frames[frmName]!=null&&window.frames[frmName].document.getElementById(id)!=null&&$(this).attr("lang")!="1")
                   {
                      $($(window.frames[frmName].document.getElementById(id)).parent().html()).appendTo($("#hiddenContent"));
                 
                   }
                    
                    
                    
                    //改变相应品牌列表项的样式    
                    $(this).siblings().not(".brand_nav").removeClass();
                    $(this).siblings().not(".brand_nav").addClass("brand_item_2");
                    $(this).removeClass();
                    $(this).addClass("brand_tit");
                    
                    //获得点击品牌时要获取的Div的内容
                    var ids = $(this).attr("id").split('_');
                    var loadDivId = "#brand_"+ids[1]+"_"+ids[2]+"_BP";
                    var currBrandListId = "#c_brd_list_"+ids[1];
                    var imgId = "c_"+ids[1];
                    
                    if($(this).attr("lang")=="1"&&$(loadDivId).html()!=null)
                    {
                     
                        $(currBrandListId).next().css("display","none");
                        $("#"+frmId).css("display","none");
                        $(loadDivId).insertAfter($(currBrandListId));
                        $(loadDivId).css("display","block");
                        
                    }else
                    {
                        $(this).attr("lang","1");
                        $(currBrandListId).next().hide();
                      
                       
                        var finish=$('<div></div>').css({'position':'relative','width':'100%','height':'48px','z-index':'99','padding-top':'100px','text-align':'center',',padding-left':'450px','display':'block'});
                        var loadImg=$('<img/>').attr('src','/images/LoadingImg.gif').attr('alt','数据加载中....');
                        loadImg.appendTo(finish);
                       if(window.frames.length>0&&window.frames[frmName]!=null&&window.frames[frmName].document.getElementById(id)!=null)
                       {
                         var wrap = $("<div id='wrap'></div>");
                         finish.appendTo(wrap);
                         window.frames[frmName].document.getElementById(id).innerHTML = wrap.html();
                       }
                    
                        
                    
                        $("#"+frmId).attr("src","/loadPage/BrandProductList.aspx?c_id="+ids[1]+"&b_id="+ids[2]);
                        $("#"+frmId).css("display","block");
                    }
          
                
               
            });
    });
  
  
    


