;(function($){
	//提示
	if('close'==$.ftxia.util.getCookie('leftimg')){
		$('.tips_goods').css('display','none');
	}else{
		$('.tips_goods').css('display','block');
	}
	$('.iknow').live('click', function(){
		$('.tips_goods').css('display','none');
		$.ftxia.util.setCookie('leftimg', 'close');
		$('.tips_goods').remove();
	});

	//报名查询
	$('.chaxun').live('click', function(){
		if(!$.ftxia.dialog.islogin()) return !1;
		$.getJSON(FTXIAER.chaxunurl, function(result){
			if(result.status == 1){
				$.dialog({id:'check_item', title:lang.chaxun, content:result.data, padding:'', fixed:true, lock:true});
				$.ftxia.item.check_form($('#J_check_item'));
			}else{
				$.ftxia.tip({content:result.msg, icon:'error'});
			}
		});
	});
	flag = true;
	$(window).resize(function() {
        $('.white_dh #fold').css('right', ($(window).width() - $(".wrapper").width()) / 2 - 34);
    });
    $(window).bind("scroll", 
    function() {
        if ($('.double_main').size() == 1) {
            var temp = '408';
        } else {
            var temp = '159';
        }
        if (flag == true && $(document).scrollTop() > temp) {
            flag = false;
            $('.bar_line').css('display', 'block');
			
            if ("fold" == $.ftxia.util.getCookie("fold")) {
				$('.white_dh #fold').attr('class', 'filter-unfold');
            } else {
				$('.daohang').css({
                    'position': 'fixed',
                    'top': '0px',
                    'margin-top': '0px'
                });                
            }
            $('.white_dh #fold').css('display', 'block');
            $('.white_dh #fold').css('right', ($(window).width() - $(".wrapper").width()) / 2 - 34);
        }
        if (flag == false && $(document).scrollTop() <= temp) {
            flag = true;
            $('.daohang').css('position', '');
            $('.white_dh #fold').css('display', 'none');
            $('.bar_line').css('display', 'none');
        }
    });
    $('.filter-fold').live('click', 
    function() {
        $('.daohang').css('position', 'static');
        $('.white_dh #fold').attr('class', 'filter-unfold');
        $.ftxia.util.setCookie("fold", 'fold');
    });
    $('.filter-unfold').live('click', 
    function() {
        $('.daohang').css({
            'position': 'fixed',
            'top': '0px',
            'margin-top': '0px'
        });
        $('.white_dh #fold').attr('class', 'filter-fold');
        $.ftxia.util.setCookie("fold", '');
    });
	
	 //order
	$('#stateid').mouseenter(function(){$(this).addClass('hover');});
	$('#stateid').mouseleave(function(){$(this).removeClass('hover');});
	$('#orderid').mouseenter(function(){$(this).addClass('hover');});
	$('#orderid').mouseleave(function(){$(this).removeClass('hover');});
	$('.barmenu').mouseenter(function(){$(this).addClass('menu-hover');});
	$('.barmenu').mouseleave(function(){$(this).removeClass('menu-hover');});

	$('#key').focus(function() {
        if ($('#key').attr('value') == $('#key').attr('def-val')) {
            $('#key').attr('value', '')
        }
    });
    $('#key').focusout(function() {
        if ($('#key').attr('value') == '') {
            $('#key').attr('value', $('#key').attr('def-val'))
        }
    });
    $("#searchform").submit(function() {
        if ($('#key').attr('value') == $('#key').attr('def-val')) {
            alert($('#key').attr('def-val'));
            return false
        }
    });

	$('.add_qq').live('click', function(){
		window.open('http://shuqian.qq.com/post?from=3&jumpback=2&noui=1&uri=' + encodeURIComponent(document.location.href) + '&title=' + encodeURIComponent(document.title), '', 'width=930,height=570,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		void(0);
	});

	$('.add_col').live('click', function(){
		var sURL = document.location.href;
		var sTitle = document.title;
		try{
			window.external.addFavorite(sURL, sTitle);
		}catch(e){
			try{
				window.sidebar.addPanel(sTitle, sURL, "");
			}catch(e){
				alert("加入收藏失败，请使用Ctrl+D进行添加");
			}
		}
	});

})(jQuery);