$(document).ready(
	function () {
		$("#main img").lazyload();
		$("#searchForm label").inFieldLabels();

		window.onscroll=window.onresize=navigation_float;
	}
);

function navigation_float(){
	var to_top_width = (document.documentElement.clientWidth-960)/2+970;
	var to_top_height = (document.documentElement.clientHeight-150);


	if ( document.documentElement.scrollTop < 150 )
	{
		$("#to_top").fadeOut();
	} else if ( $("#to_top").css("display") == "none" )
	{
		$("#to_top").css({left:to_top_width, top:to_top_height}).fadeIn();
	} else {
	}

	if ( $("#shop_category") )
	{
		var top=$(document).scrollTop();
		var n_height = $("#shop_category").offset().height;
		var l_height = $("#main").offset().height;


		if(($.browser.msie==true)&&($.browser.version==6.0)){ 
		}else{
			if((l_height-top-n_height)<0) {
				$("#shop_category").css({position:"relative",top:(l_height-n_height-156)});
			} else if(top>156) {
				$("#shop_category").css({'z-index':'99', position:"fixed",top:"-"&top+"px"}); 
			} else if(top<=156) {
				$("#shop_category").css({position:"static",top:0});
			}
		} 
	}

}

function AddFavorite(url, title)
{
	if( document.all ) {
        try
        {
            window.external.addFavorite(url, title);
        }
        catch (e1)
        {
            try

            {
                window.external.addToFavoritesBar(url, title);
            }
            catch (e2)
            {
                alert('加入收藏失败，请使用Ctrl+D进行添加')
                }
        }
    } else if (window.external) {
        window.sidebar.addPanel(title, url,"");
    } else {
        alert('加入收藏失败，请使用Ctrl+D进行添加')
    }
}
