﻿/*********************************************
 * 自定义
 ********************************************/

(function(){ 

    //拆分标题
   	 $('.ihead h3').each(function(index, element){
    	var iproh1= $.trim($(this).text());
    	var iproh1a= iproh1.substr(0, 2);
 	 	var iproh1b = iproh1.substr(2);
     iproh1="<span>"+ iproh1a + "</span>"+ iproh1b;
    $(this).html(iproh1);
    })
     
         //拆分标题
   	 $('.iabout .title h3').each(function(index, element){
    	var iproh1= $.trim($(this).text());
    	var iproh1a= iproh1.substr(0, 2);
 	 	var iproh1b = iproh1.substr(2);
     iproh1="<span>"+ iproh1a + "</span>"+ iproh1b;
    $(this).html(iproh1);
    })
     
     $('#inews .main').scroller({});
  
  	$('#searcher .button').bind({
		'click': function(){
			$(this).parent().addClass('active');
		}
	})  
            
})();

$(function(){
  
//悬浮
$(".jing_pointer").bind('click', function(){
	if($(this).hasClass('active')){
		$(this).removeClass('active').siblings().show();
	}else{
		$(this).addClass('active').siblings().hide();
	}
});

  	$('.btop').click(function(){ 
      $('html, body').stop().animate({'scrollTop': 0}, 200);
	})
    
      	$('.itop').click(function(){ 
      $('html, body').stop().animate({'scrollTop': 0}, 200);
	})
    
    $('.sso').bind('click', function(){
        if($(this).siblings('.searcher').is(':hidden')){
			$(this).siblings('.searcher').slideDown(300);//  超链接跳转
        }else{
            	$(this).siblings('.searcher').slideUp(300);
        }
    })
    
// 详情页定位
    $('.relink a').each(function(){
        $(this).attr({'href': $(this).attr('href') + '#location'});
    })
   
});

(function(){
  $(".nav li").each(function() {
        if(!$(this).find("a").length){
			$(this).children(".subNav").remove();
		}
    })
	$(".nav li").hover(
		function(){
			$(this).children(".subNav").stop().slideDown(300);
		},
		function(){
			$(this).children(".subNav").stop().slideUp(300);
		}
	)
    
    
    $("#inav").hover(
		function(){
			$(this).children(".drop").stop().slideDown(300);
		},
		function(){
			$(this).children(".drop").stop().slideUp(300);
		}
	)
  

    $('#menu dd').each(function(){
        if(!$(this).find('.drop li').length){
			$(this).find('.drop').remove();
        }
    })
    
	$('#menu dd').hover(
		function(){
			$(this).addClass('active');
			$(this).children('.drop').stop().slideDown(200);
		},
		function(){
			$(this).removeClass('active');
            if(!$(this).hasClass('current')){
                $(this).children('.drop').stop().slideUp(200);
            }
		}
	)
	

	
}());

(function(){
	var $toolbar = $('#toolbar');
	$toolbar.find('.code a').bind({
		'mouseenter': function(){
			$(this).next().stop().show(200);
		},
		'mouseleave': function(){
			$(this).next().stop().hide(200);
		}
	})
	$toolbar.find('.tel a').bind({
		'mouseenter': function(){
			$(this).next().stop().animate({'width': 162}, 200);
		},
		'mouseleave': function(){
			$(this).next().stop().animate({'width': 0}, 200);
		}
	})
	
	$toolbar.find('.close').bind({
		'click': function(){
			$toolbar.children('.pointer').show(300).next().hide();
		}
	})
	
	$toolbar.find('.pointer').bind({
		'click': function(){
			$toolbar.children('.inner').show(300).prev().hide();
		}
	})
}());