/**
 +----------------------------------------------------------
 * å¤æ­é¡µé¢æ¯å¦å­å¨æä¸ªID
 +----------------------------------------------------------
*/

jQuery(document).ready(function(){
jQuery.getid = function(id)
{
    return document.getElementById(id) != null;
};

/**
 +----------------------------------------------------------
 * å¤æ­æ¯å¦IE6
 +----------------------------------------------------------
*/
jQuery.ie6 = $.browser.msie && $.browser.version < 7;


/**
 +----------------------------------------------------------
 * å¾çè½®æ­æä»¶
 * timer : æ§è¡æ¶é´
 * speed : åæ¢éåº¦
 +----------------------------------------------------------
*/
jQuery.HolaSlide = function(timer,speed)
{
    timer = timer || 2000;
    speed = speed || 600;

    var $img        = $('#ad_slide_img li'),
        $num        = $('#ad_slide_num>li'),
        count       = $img.size(),
        index       = 0,
        cTime;

    // å¾çè½®æ­
    var slidePlay = function(i)
    {
        $num.eq(i).addClass('on').siblings().removeClass('on');
        $img.eq(i).fadeIn(speed).siblings().fadeOut(speed);
    };

    // é¦æ¬¡æå¼é¡µé¢æ§è¡
    if (!cTime)
    {
        slidePlay(0);
    }

    // ç´¢å¼åå§å
    var slideInit = function()
    {
        slidePlay(index);
        index++;
        if(index == count)
        {
            index = 0;
        }
    };

    // èªå¨æ­æ¾
    cTime = setInterval(slideInit,timer);

    // é¼ æ ç§»å¨å°æ°å­äºä»¶
    $num.hover(
        function()
        {
            if(cTime)
            {
                clearInterval(cTime);
            }

            index  = $num.index(this);

            cTime = setTimeout(function(){
                $img.stop();
                slidePlay(index);
            } , 400);
        },
        function()
        {
            clearInterval(cTime);
            cTime = setInterval(slideInit, timer);
        }
    );

    // é¼ æ ç§»å¨å°å¾çäºä»¶
    $img.hover(
        function()
        {
            if(cTime)
            {
                clearInterval(cTime);
            }
        },
        function()
        {
            cTime = setInterval(slideInit, timer);
        }
    );
};

/**
 +----------------------------------------------------------
 * åºé¨å¼¹åºå±æä»¶
 +----------------------------------------------------------
*/
$.fn.HolaBar = function()
{
    var _this  = this,
        barH   = _this.outerHeight(true),
        $tab   = $('.bar_tab a',_this),
        $ctrl  = $('.bar_ctrl a',_this),
        $wrap  = $('#bar_content'),
        $box   = $('.bar_box','#bar_content'),
        $left  = $('.bar_left','#bar_content'),
        $right = $('.bar_right','#bar_content'),
        $list  = $box.children('.bar_list'),
        isShow = false;

    // ä»å¯¹ie6ææ è§£å³ie6ä¸selectæ ç­¾ä¸è½é®ççbug
    // åºé¨å¼¹åºå±æ¾ç½®çé¡µé¢ä»¥ä¸å±ä¸ºè®¡ï¼æå°æé¡¶å±æ¶å±å¹ä¸æ¹å¦æåå«æselectï¼è¯·å»æç¸å³æ³¨é
    // å¦åè¯·ä¿çæ³¨éï¼ä»¥åå½±åæ§è¡æç
    if ($.ie6)
    {
        _this.css('position','absolute');

        /* -------ä¿®æ­£select bug å¼å§------å»ææ­¤è¡----
        var $iframe = $('<iframe class="ie6mask" src="javascript:;" frameBorder=0></iframe>');
        $iframe.css({
            display : 'block',
            position: 'absolute',
            filter  : 'alpha(opacity=0)',
            width   : '100%',
            height  : barH+'px',
            left    : 0,
            top     : getTop(_this)+'px',
            zIndex  : _this.css('z-index')-1
        }).appendTo('body');
        -----------ä¿®æ­£select bug ç»æ-------å»ææ­¤è¡------ */

        // å¼¹åºå±ç½®åº
        $(window).scroll(function(){

            _this.css( 'top' , getTop() );

            /* -------ä¿®æ­£select bug----å»ææ­¤è¡------
            $iframe.css({top:getTop()+'px',height:barH});
            ----------å»ææ­¤è¡-------------- */
        });
    }

    // å±å¼æ¶ç¼©æ§å¶
    $ctrl.click(function(){
        $ctrl.blur();
        box_play();
        return false;
    });

    // tabæ§å¶
    $tab.each(function(i) {

        if (i === 3) return;

        $(this).bind('click',function(){

            $(this).blur();

            if (!isShow)
            {
                box_play(i);
            }

            $(this).parent().addClass('on').siblings().removeClass('on');

            $list.eq(i).fadeIn().siblings().fadeOut();

        });
    });

    // åä¸ªtabçè®°å½æ°éè·ååæ»å¨
    $list.each(function(i) {

        var $ul     = $(this).children('ul'),
            $li     = $ul.children('li'),
            count   = $li.size();

        $tab.eq(i).children('span').html(count);

        // å½è®°å½ä¸ªæ°è¶è¿8ä¸ªæ¶åè®¸ç¹å»æ»å¨
        if (count > 8)
        {
            // åå·¦æ»å¨
            $right.bind('click',function(){
                $ul.animate(
                    {left:'-118px'},
                    {duration:200,complete:function(){
                        $ul.append($ul.find('li:first'));
                        $ul.css('left','0');
                    }}
                );
            });

            // åå³æ»å¨
            $left.bind('click',function(){
                $ul.find('li:last').clone().prependTo($ul);
                $ul.css('left','-118px');
                $ul.animate(
                    {left:0},
                    {duration:200,complete:function(){
                        $ul.find('li:last').remove();
                    }}
                );
            });
        }

    });

    // ie6ä¸è·åæ»å¨é«åº¦
    function getTop()
    {
        return $(window).scrollTop() + $(window).height() - barH;
    }

    // çå­å¼¹åºä¸éèå¨ç»
    function box_play(n)
    {
        n = n || 0;
        isShow = !isShow;

        if (isShow)
        {
            $ctrl.addClass('down').attr('title','æ¶èµ·').html('æ¶èµ·');

            $tab.eq(n).parent().addClass('on');

            $list.eq(n).fadeIn().siblings().fadeOut();
        }
        else
        {
            $ctrl.removeClass('down').attr('title','å±å¼').html('å±å¼');

            $tab.parent().removeClass('on');

            $list.fadeOut();
        }

        $wrap.slideToggle('slow',function(){
            if ($.ie6)
            {
                barH = _this.outerHeight(true);

                _this.animate({top:getTop()},500);

                /* -------ä¿®æ­£select bug----------
                $iframe.css({top:getTop()+'px',height:barH});
                --------------------------------- */
            }
        });
    }

};

/**
 +----------------------------------------------------------
 * ååé¡µé¢å±ç¤ºä¸ç¨
 * æ¾å¤§éæ¾ç¤º
 * å°å¾çæ»å¨åé¼ æ ç§»å°å°å¾æ¾ç¤ºå¤§å¾
 +----------------------------------------------------------
 * åæ°è®¾ä¸ºtureæ1æä»»ä½å­ç¬¦ï¼ä¼å¯¹å°å¾åè¡¨å¯¹åºçå¤§å¾è¿è¡é¢å è½½
 +----------------------------------------------------------
*/

jQuery.goods_summary_init = function(cache)
{
    var $big  = $('#goods_img_big'),        // å·¦ä¾§å¤§å¾å±
        //$img  = $big.children('img'),       // å·¦ä¾§å¤§å¾
        $img  = $('#productMainImage'),       // å·¦ä¾§å¤§å¾
        $ul   = $('#goods_img_list ul'),    // å°å¾å®¹å¨
        count = $ul.children().size(),      // å°å¾åè¡¨ä¸ªæ°
        maxW  = Math.ceil(count*0.2)*360,   // å°å¾åè¡¨æ»å®½åº¦(ä¸ªæ°*72/360)*360
        $move = $('#zoom_move'),            // æ¾å¤§éæç¤ºå±
        $view = $('#zoom_view'),            // æ¾å¤§éæ¾ç¤ºå±
        v = {                               // åéå¯å­å¨
            bigL  : $big.offset().left,
            bigT  : $big.offset().top,
            x     : 0,
            y     : 0,
            moveW : 50,
            moveH : 50,
            alt   : ''
        };
    /* å¨æé¢å¤çåé¢è½½å¤§å¾ç */
    $ul.css('width',maxW+'px');
	
    $('#goods_img_small').children('p').addClass('no');
	
    set_zoom_img($img.attr('bigimgsrc'),$img.attr('alt'));
    $move.css('opacity','0.5');
    /* å°å¾å·¦å³ç§»å¨åæ¾ç¤ºå¤§å¾ */
    if (count > 5 )
    {
        var $left  = $('#ctrl_l'),
            $right = $('#ctrl_r'),
            _left  = 0;

        $right.removeClass('no');

        // å¾å·¦æ»å¨å¤ç
        $left.hover(function(){

            if(!_left)
            {
                return;
            }

            setTimeout(function(){
                _left = parseFloat($ul.css('left'))+360;
                _left = _left > 0 ? 0 : _left;

                $(this).removeClass('no');

                if(_left == -maxW + 360)
                {
                    $right.addClass('no');
                }
                else
                {
                    $right.removeClass('no');
                }

                $ul.animate(
                    {left:_left+'px'},
                    {duration:800,complete:function(){
                        if(!_left)
                        {
                            $left.addClass('no');
                        }
                    }}
                );
            },20);
        });
        // åå³æ»å¨å¤ç
        $right.hover(function(){
            if(_left-360 == -maxW)
            {
                return;
            }

             setTimeout(function(){
                _left -= 360;
                $ul.animate(
                    {left:_left+'px'},
                    {duration:800,complete:function(){
                        $left.removeClass('no');
                        if(_left == -maxW + 360)
                        {
                            $right.addClass('no');
                        }
                    }}
                );
             },20);
        });
    }

    /* é¼ æ ç§»å°å°å°å¾æ¾ç¤ºå¤§å¾ */
    $ul.children().each(function(i) {
        var $_this= $(this),
            $_img = $_this.find('img'),
            _src  = $_img.attr('src'),
            _alt  = $_img.attr('alt'),
            _bimg = $_img.attr('imgbig');

        /* ç¼å­ææå¤§å¾ */
        if(cache)
        {
            $('<div style="display:none"><img src="'+_src+'" alt="" /><img src="'+_bimg+'" alt="" /></div>').appendTo(this);
        }

        // äºä»¶ç»å®
        $_this.bind('mouseover',function(){
            setTimeout(function(){

                $_this.addClass('on').siblings().removeClass('on');

                $img.attr({
                    src: _src,
                    alt: _alt,
                    bigimgsrc: _bimg
                });

                set_zoom_img(_bimg,_alt);

            },20);

            //return false;
        });
    });

	/* æ¾å¤§éæ¾ç¤º */
    $big.bind('mouseenter',function(e){

        if($.ie6){ $('#goods_summary .goods_info_box p select').hide(); }

        $view.show();

        var $this  = $(this),
            $bimg  = $view.children('img');

        v.w   = $bimg.get(0).offsetWidth;
        v.h   = $bimg.get(0).offsetHeight;
        v.alt = $bimg.attr('alt');

        $bimg.attr('alt','');

        // æ¾å¤§éæç¤ºå±å¤§å°è®¡ç®
        $move.css({
            width : (v.moveW = parseFloat(80000/v.w)) +'px',
            height: (v.moveH = parseFloat(80000/v.h)) +'px'
        }).show();

		// é¦æ¬¡é¢å¤ç
        toZoom(e.pageX, e.pageY);

		// é¼ æ ç§»å¨å¤ç
        $this.bind('mousemove',function(e){
			setTimeout(function(){
				toZoom(e.pageX,e.pageY);
			},10);
		});

	}).bind('mouseleave',function(){

        $view.hide().children('img').attr('alt',v.alt);

        $move.hide();

        if($.ie6){ $('#goods_summary .goods_info_box p select').show();}

        $(this).unbind('mousemove');
	});
		
	/* æ¾å¤§éæ¾ç¤º */
    function toZoom(x,y)
    {
		v.x =  x - v.bigL - v.moveW/2;
		v.y =  y - v.bigT - v.moveH/2;

        if(v.x < 0) { v.x  =  0; }
        if(v.y < 0) { v.y  =  0; }

        if( v.x + v.moveW >= 400 )
        {
			v.x  = 400 - v.moveW;
		}

        if( v.y + v.moveH >= 400)
        {
			v.y  = 400 - v.moveH;
		}

		$move.css({left: v.x, top: v.y});
        $view.children('img').css({
            left : - v.x * parseFloat(v.w/400)+50,
            top  : - v.y * parseFloat(v.h/400)+50
        });
        //alert($view.children('img').css('left'));
	}


    /* è®¾ç½®å¤§å¾ */
    function set_zoom_img(src,alt)
    {
        $view.html('<img src="'+src+'" alt="'+alt+'" />');
    }

};


/**
 +----------------------------------------------------------
 * è´­ä¹°æ°éæ§å¶æä»¶
 +----------------------------------------------------------
*/
jQuery.fn.buy_count = function(options)
{
    if (!this)
    {
        return;
    }

    return this.each(function() {
        /* å¯ç¨è®¾ç½® */
        var opt = {
            input:'.text',                  // æ°å¼æ¾ç¤ºinputçidæclass
            del:'.count_del',               // åå°æé®
            add:'.count_add',               // å¢å æé®
            min:1,                          // æå°å¼
            max:99,                       // æå¤§å¼
            step:1                          // æ­¥è¿ææ­¥åå¼
        };

        if (options)
        {
            opt = $.extend(opt,options);
        }

        var $del = $(opt.del,this),
            $add = $(opt.add,this),
            $val = $(opt.input,this);

        // å¢å 
        $add.bind('click',function(){
            var num = $val.val();
            if (num < opt.max)
            {
            	if(num=='')num=0;
                $val.val(parseFloat(num)+opt.step);
            }
        });

        // åå°
        $del.bind('click',function(){
            var num = $val.val();
            if (num > opt.min)
            {
                $val.val(parseFloat(num)-opt.step);
            }
        });
    });
};

/**
 +----------------------------------------------------------
 * POPå¼¹åºå±æä»¶
 * ä»æ¯æäº§åä¿¡æ¯å¼¹åº å æç¤ºä¿¡æ¯å¼¹åº
 +----------------------------------------------------------
 * äº§åå¼¹åºä½¿ç¨onclick="$.Holapop({å±æ§1:è®¾ç½®å¼ï¼å±æ§2:è®¾ç½®å¼....});"
 * å·ä½å±æ§å¯¹åºåå®¹è¯·åèåéoptçæ³¨é
 + ---------------------------------------------------------
 * ä¿¡æ¯æç¤ºçä½¿ç¨ï¼å¨å¤æ­éè¦å¼¹åºåï¼ç´æ¥è°ç¨$.Holapop('htmlæ¨¡æ¿')åå¯
 * åç½®è®¾å®äºh5æ é¢æ ·å¼åpæ ç­¾åæ®µæ ·å¼ãä¾å¦ï¼
   if(æ¡ä»¶æç«)
   {
       $.Holapop('<h5>ä¿¡æ¯æç¤ºæ é¢</h5><p>ä¿¡æ¯æç¤ºåå®¹</p>');
   }
 * è¥ä¸ä½¿ç¨åç½®æ ·å¼ï¼å¯èªå®ä¹æ¨¡æ¿åå®¹ï¼ç´æ¥å¨æ¨¡æ¿ä¸­æ·»å æ ·å¼
 * éæ³¨æåæ°ä¸­å¯¹æ¨¡æ¿çå¼å·ä½¿ç¨ï¼ä»¥åäº§çhtmlèªèº«çå½±å
 +----------------------------------------------------------
*/

$.Holapop = function(settings)
{
    /* ä¿¡æ¯æç¤ºå¤ç */
    if (typeof settings == 'string')
    {
        box_show('<div class="p_tips">'+settings+'</div>');
    }
    else
    {
        /* è¯·èªè¡æ ¹æ®é¡¹ç®éè¦æ·»å é»è®¤å¼ */
        var opt = $.extend(true,{
                /* äº§åè®¾ç½® */
                img     : '', // äº§åå¾ç
                alt     : '', // å¾çaltå±æ§
                title   : '', // äº§åæ é¢
                price   : '', // äº§åä»·æ ¼
                pic     : '', // äº§ååä½
                number  : '', // äº§åç¼å·
                intro   : '', // äº§åç®ä»
                spec    : '', // äº§åç¸å³è§æ ¼éæ©ï¼å¤ä¸ªä»¥éå·åå¼
                color   : '', // äº§åé¢è²éæ©
                favorite: '', // æ·»å å°æ¶èå¤¹çurl
                href    : '', // ç«å³è´­ä¹°çurl
                /* å¶å®é»è®¤è®¾ç½® */
                _this     : null,    // å¦æè®¾ç½®äºè¯¥å±æ§ï¼åä¼ç¼å­æ°æ®æ¨¡æ¿ï¼å¯å å¿«éåº¦
                action    : '',      // formçactionå±æ§è¦å¡«çåå®¹ è¯·èªè¡è®¾
                method    : 'get',   // formçmethodå±æ§è¦å¡«çåå®¹ è¯·èªè¡è®¾
                name      : '',      // formçnameå±çè¦å¡«çåå®¹ è¯·èªè¡è®¾
                specName  : 'spec',  // é»è®¤è§æ ¼éæ©(selectæ ç­¾)çnameåidåç§°(ç¨æ·ä½éªéè¦)
                colorName : 'color', // é»è®¤é¢è²éæ©(selectæ ç­¾)çnameåidåç§°(ç¨æ·ä½éªéè¦)
                showCall  : null,    // å¼¹åºå±æ¾ç¤ºåçåè°å½æ°ï¼ä¾å¦è¦å¯¹ç¹å»ç«å³è´­ä¹°ç»å®äºä»¶
                removeCall: null     // å³é­å¼¹åºå±æ¶çåè°å½æ°
         },settings);

        // ç¼å­è¯¥äº§ååå®¹æ¨¡æ¿
        var tpl_cache = opt._this && $(opt._this).data('hola_pop') || null;

        if (!tpl_cache)
        {
            opt.spec  = build_option(opt.spec);
            opt.color = build_option(opt.color);

            // åå»ºåå®¹æ¨¡æ¿
            tpl_cache = '<dl class="p_goods_l"><dt><img src="'+opt.img+'" alt="'+opt.alt+'" /></dt><dd><em>ï¿¥'+opt.price+'/'+opt.pic+'</em></dd><dd><p class="favorite_link"><a href="'+opt.favorite+'" title="å å¥æ¶èå¤¹">å å¥æ¶èå¤¹</a></p></dd><dd><a href="'+opt.href+'" title="è´­ä¹°" class="btn btn_shop_small">ç«å³è´­ä¹°</a></dd></dl><dl class="p_goods_r"><dt>'+opt.title+'</dt><dd>ååç¼å· '+opt.number+'</dd><dd class="p_goods_intro">'+opt.intro+'</dd><dd><form action="'+opt.action+'" method="'+opt.method+'" name="'+opt.name+'"><div class="goods_buy_count"><p><label for="">æ°é</label></p><p class="count_del"><span class="icon_ctrl">å1</span></p><p><input name="" type="text" class="text" value="1" /></p><p class="count_add"><span class="icon_ctrl">å 1</span></p></div><div class="c"><label for="hola_'+opt.specName+'">è§æ ¼</label><select name="'+opt.specName+'" id="hola_'+opt.specName+'"><option value="">è¯·éæ©</option>'+opt.spec+'</select></div><div><label for="hola_'+opt.colorName+'">é¢è²</label><select name="'+opt.colorName+'" id="hola_'+opt.colorName+'"><option value="">è¯·éæ©</option>'+opt.color+'</select></div></form></dd></dl>';

            // å¦æè®¾ç½®äºaå¯¹è±¡
            if (opt._this)
            {
                $(opt._this).parent('li').data('hola_pop',tpl_cache);
            }
        }

        box_show(tpl_cache,opt);
    }

    /* å¼¹åºå±æ¾ç¤º */
    function box_show(tpl,conf)
    {
        // åå»ºpopåºæ¬æ¶æ
        var $pop = $('<div class="pop" id="pop"><p class="p_top"></p><div class="p_wrap"><div class="p_body">'+tpl+'</div><a href="javascript:void(0);" title="å³é­" class="p_close">å³é­</a></div><p class="p_btm"></p></div>').css('top',get_top()).appendTo('body');

        // ie6ä¸ä¿®æ­£
        if($.ie6)
        {
            $('#orders').hide();
        }

        $pop.slideDown(500);

        // å åæ°å¼äºä»¶ç»å®
        $('.goods_buy_count','#pop').buy_count();

        // å¼¹åºå±æ¾ç¤ºååè°å½æ°ç»å®
        if(conf && conf.showCall && $.isFunction(conf.showCall))
        {
            conf.showCall();
        }

        // å³é­äºä»¶
        $('.p_close','#pop').unbind('click.Holapop').bind('click.Holapop',function(){

            $pop.slideUp(300,function(){

                if(conf && conf.removeCall && $.isFunction(conf.removeCall))
                {
                    conf.removeCall();
                }

                if($.ie6)
                {
                    $('#orders').show();
                }

                $pop.remove();
            });

            return false;
        });
    }

    /* åå»ºoption æ¨¡æ¿ */
    function build_option(obj)
    {
        var _tpl = '';
        $.each(obj,function(i,n) {
            _tpl += '<option value="'+i+'">'+n+'</option>';
        });
        return _tpl;
    }

    /* è·åtopå¼ */
    function get_top()
    {
		var de = document.documentElement,t;

        t = de && de.scrollTop  || document.body.scrollTop;

        return t + parseFloat($(window).height()/4) +'px';
	}

};

/**
 +----------------------------------------------------------
 * å¼¹åºå³é­æ³¨ååè®®
 +----------------------------------------------------------
*/
jQuery.HolaAgree = function(isShow)
{
    var $agree = $('#agree');

    if(isShow)
    {
        $agree.fadeIn('slow');
    }
    else
    {
        $agree.fadeOut('slow');
    }
    return false;
};

/* ç¦ç¹äºä»¶ */
jQuery.fn.focus_ctrl = function()
{
      return this.each(function() {

            var defaults = this.value;

            $(this).focus(function(){
                if(this.value == defaults)
                {
                    this.value = '';
                }
            }).blur(function(){
                if(this.value == '')
                {
                    this.value = defaults;
                }
            });

      });
};

/* ä¸»é¢é¦äº§åå·¦å³ç§»å¨ */
jQuery.fn.HolaMoveGoods = function()
{
    var $this = $(this),
        $left = $this.find('p.show_l>span'),
        $right= $this.find('p.show_r>span'),
        $ul   = $this.find('ul'),
        $li   = $ul.children('li'),
        outerW= $li.outerWidth(true),
        count = $li.length;

    $ul.css('width',(count+1)*outerW+'px');

    // åå·¦æ»å¨
    $right.bind('click',function(){
    	$(this).css("display","none");
        $ul.animate(
            {left:'-'+outerW+'px'},
            {duration:500,complete:function(){
                $ul.append($ul.find('li:first'));
                $ul.css('left','0');
    			$right.css("display","");
            }}
        );
    });

    // åå³æ»å¨
    $left.bind('click',function(){
    	$(this).css("display","none");
		$ul.find('li:last').clone().prependTo($ul);
		$ul.css('left','-'+outerW+'px');
        $ul.animate(
            {left:0},
            {duration:500,complete:function(){
                $ul.find('li:last').remove();
    			$left.css("display","");
            }}
        );
    });

};
/**
* deal with birth day
*/
	jQuery.setBirthDayFromPage = function(dateObj,yearObj,monthObj,dayObj){
		if(yearObj.val() != '0' && monthObj.val()!='0' && dayObj.val()!='0'){
			value = yearObj.val()+"-"+monthObj.val()+"-"+dayObj.val();
			dateObj.val(value);
		}
	}
	jQuery.initBirthDayFromPage = function(dateObj,yearObj,monthObj,dayObj){
		if(dateObj.val() != null && dateObj.val() != ''){
			dateArray = dateObj.val().split("-");
			//
			yearObj.val(dateArray[0]);
			monthObj.val(dateArray[1]);
			dayObj.val(dateArray[2]);
		}
	}
	//products discount;
	jQuery.printProductDiscount = function(text){
		var size = $(text).children("a").size();
		var content = '';
		if(size>0){
			content += '<div class="goods_ads_hola">';
	        content += '<span></span>';
	        content +=         '<dl>';
	        if(size>3)
	        content +=         	'<marquee width=150 height=70 direction=up scrollamount=1 onmouseover="this.stop()" onmouseout="this.start()">';
			content += 				text;
			if(size>3)
			content += 			'</marquee>';
	        content +=         '</dl>';
           	content += 	 '</div>';
         }
        return content;
	}
/* 导航 主题馆下拉 */
jQuery.fn.Hola_submenu = function(imgDir)
{
	var ie6 = $.ie6;
	var num = 4;
    var $this  = $(this),
        suffix = ie6? '.gif' : '.png',
        ie6bug = ie6 && $.getid('address_table');

    $this.hover(
        function()
        {
            $this.css({background:'url('+imgDir+'images/hola/submenu'+suffix+') no-repeat'});

            $this.children('div').css({
                background:'url('+imgDir+'images/hola/submenu'+suffix+') no-repeat 0 100%'
            }).slideDown(300);

            if(ie6bug)
            {
                $('#address_table').find('select').hide();
            }
        },
        function()
        {
            if(ie6bug)
            {
                $('#address_table').find('select').show();
            }

            $this.children('div').slideUp(300,function(){
                $this.css({background:'none'});
            });
        }
    );
};
/**
 +----------------------------------------------------------
 * é¡µé¢å°±ç»ªäºä»¶ç»å®
 +----------------------------------------------------------
*/
	
    
    
    /* flash å®½åº¦ä¿®æ­£*/
    jQuery.getid = function(id){
    	return true;
	}
    if ($.getid('flash'))
    {
       $('#flash').css('width',$(window).width() > 1016 ? '1016px' : '100%');
    }


    /* å¾çè½®æ­ç»å® */
    if ($.getid('ad_slide'))
    {
        $.HolaSlide(2000);
    }

    /* è´­ä¹°æ°éå å */
    $('.goods_buy_count').buy_count();

    /* äº§åå¿«éæ¥çæé®ie6ä¿®æ­£ */
    if ($.ie6)
    {
        if ($.getid('goods_list') || $.getid('show_goods'))
        {
            $('#goods_list>li,#show_goods .show_goods_list>ul>li').each(function() {
                var $btn = $(this).children('a.btn_view');
                $(this).hover(
                    function()
                    {
                        $btn.show();
                    },
                    function()
                    {
                        $btn.hide();
                    }
                );
            });
        }
    }

    /* ååå±ç¤º */
    if ($.getid('goods_summary'))
    {
        $.goods_summary_init();//éè¦ç¼å­å åæ°true
    }

    /* åºé¨å¼¹åºå± */
    if ($.getid('bar'))
    {
        $('#bar').HolaBar();
    }

    /* ç´¢ååç¥¨ */
    if($.getid('need_invoice'))
    {
        $('#need_invoice').click(function(){
            var $this = $(this),
                $invoice = $this.parent().next('ul');
            if($this.is(':checked'))
            {
                $invoice.show();
            }
            else
            {
                $invoice.hide();
            }
        });
    }

    /* æç´¢æç¤ºæå­ç¦ç¹äºä»¶ */
    $('input.text_bg').focus_ctrl();

    /* dm hoveräºä»¶ */
    if($.getid('dm_list'))
    {
        $('#dm_list>li').each(function() {
            $(this).hover(
                function()
                {
                   $(this).css('background-position','-462px -360px');
                },
                function()
                {
                    $(this).css('background-position','0 -360px');
                }
            );
        });
    }

    /* ä¸»é¢é¦äº§ååè¡¨å·¦å³ç§»å¨ */
    if($.getid('show_goods'))
    {
        $('.show_box','#show_goods').each(function() {
            $(this).HolaMoveGoods();
        });
    }
    //footer first and last
    //$(".hola_vip_box").children("ul").children("li:first").addClass("first");
});