/**
 * @author Songtao
 */
$(function(){

    /*
    搜索框用的js
    */
	$(".search").focus(function(){
		$(".search").val('');
	});
	$(".search").blur(function(){
		if($(".search").val() == ''){
			$(".search").val('搜索');
		}
	});
	
	 /*
    首页图片轮动
    */
    sc = $('#slide-container');
    $(sc).cycle({
        prev: '#hero-left-arrow',
        next: '#hero-right-arrow',
        pager: '#slide-pager',
        pause: 1,
        sync: 1,
        timeout: 5000
    });
    $('.slide').find('*').click(pauseSlides);
    $('.slide-nav a').click(pauseSlides);
                
    function pauseSlides(){
        $(sc).cycle('pause');
    }
	 
    /*
    二级菜单显示和隐藏
    */
    $(".navLink").hover(function(){
                    $(this).find("ul").show();
                }, function(){
                    $(this).find("ul").hide();
                });
                
                
   /*
    二级菜单被选中后背景颜色改变
    */
    var itenNum = $(".wrapper").attr("title");
    if(itenNum == 0)
    {
       $(".fristKind").eq(itenNum).css({"background-position": "0 -43px",width:"115px"});
    }
    else
    {
       $(".fristKind").eq(itenNum).css({"background-position": "-115px -43px"});
    }
	
	/*
    卷页
    */
    if(itenNum != 'no')
    {	
       $("body").append('<div class="phone400"><div class="pageflip"><img src="images/page_flip.png" alt="" /><div class="msg_block"></div></div></div>');
    }
                $(".pageflip").hover(function(){ //On hover...
                    $(".pageflip img , .msg_block").stop().animate({ //Animate and expand the image and the msg_block (Width + height)
                        width: '220px',
                        height: '228px'
                    }, 500);
                }, function(){
                    $(".pageflip img").stop() //On hover out, go back to original size 50x52
            .animate({
                        width: '100px',
                        height: '104px'
                    }, 220);
                    $(".msg_block").stop() //On hover out, go back to original size 50x50
            .animate({
                        width: '100px',
                        height: '100px'
                    }, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
                });	
                		
                
     /*
    关于我们滑动块样式
    */
    $(".inner2 .tabOn").click(function(){
                    $(".inner2 li.selected").removeClass("selected");
                    $(this).addClass("selected");
                    var liNum = $(this).index() - 1;
                    
                    $(".inner2 div.tabonDiv").removeClass("tabonDiv");
                    $(".inner2 div.blogPost").eq(liNum).addClass("tabonDiv");
                });
                   
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
})
