// JavaScript Document
$(document).ready(function(){

		//顶部选择城市
		$(".sbtn").live("click",function () {
			$(".selectCity").fadeIn();
			//背景
			$(".mainbox").prepend("<div class='hideBg' style='position:absolute;'></div>"); 
			$(".hideBg").height($(".mainbox").height());
			$(".hideBg").width($(".mainbox").width());
			$(".hideBg").css("display", "block");
			});
			
        $(".sbtn").live("click", function() {
            $(".selectCity1").fadeIn();
            //背景
            $(".mainbox").prepend("<div class='hideBg' style='position:absolute;'></div>");
            $(".hideBg").height($(".mainbox").height());
            $(".hideBg").width($(".mainbox").width());
            $(".hideBg").css("display", "block");
            });
		
		$(".indexTop > div[class='tselect'] > ul > div[class='left'] > span").live("click", function(){
			$(".indexLogin").fadeIn();
			//显示背景
			var offseta = $(".mainbox").offset();
			$(".mainbox").prepend("<div class='hideBg' style='position:absolute;'></div>"); 
			$(".hideBg").offset({ top: offseta.top, left: offseta.left }).height($(".mainbox").height()).width($(".mainbox").width()).css("display","block");
		});
		
	
		//隐藏背景
		$(".mainbox > div[class='hideBg']").live("click", function(){
			$(".indexLogin").fadeOut();
			$(".selectCity").fadeOut();
			$(this).remove();
			});
        $(".mainbox > div[class='hideBg']").live("click", function() {
            $(".indexLogin").fadeOut();
            $(".selectCity1").fadeOut();
            $(this).remove();
        });
		//首页   大类
		$(".indexBody > ul > li").hover(
			function () {
				$(this).parent().addClass('cur');
				$(this).parent().siblings().removeClass('cur');
			}			
		);
		//分类标题
		$(".indexBody > ul > li > ul > li").hover(
			function () {
				$(this).addClass('current');
			},
			function () {
				$(this).removeClass('current');
			}				
		);
		
		//main nav
//		$(".menu > div[class='menu_text']").hover(
//			function () {
//				$(this).addClass('m_on');
//			},
//			function () {
//				$(this).removeClass('m_on');
//			}				
//		);
		
		//动态新闻
		//动态信息 滑动卡
		var cateCard = $(".hotnews > div[class='title'] > div");
		var cateCardBox = $(".hotnews > div[class='hotnewsbox']");
		cateCard.slice(0, 3).hover(
			function () {
				$(this).attr('class','on');
				$(this).siblings('.on').attr('class','off');
				for(i = 0; i<3; i++){
					if($(this).html() == cateCard.eq(i).html()){
						cateCardBox.eq(i).css("display","block");
					}else{
						cateCardBox.eq(i).css("display","none");
					}
				}
			}			
		);
		
		$("#GridView1").find("tr").hover(
          function () {
            $(this).addClass("mover");
          },
          function () {
            $(this).removeClass("mover");
          }
        );
//        .toggle(
//          function () {
//            $(this).addClass("mover1");
//          },
//          function () {
//            $(this).removeClass("mover1");
//          }
//        ); 
        
        
//        $(".bodyc > div[class='left'] > div > div[class='title']").click(function(){
//            $(this).parent().addClass("lcate").removeClass("lcate2");
//            $(this).parent().siblings().addClass("lcate2").removeClass("lcate");
//        });

		

//        $(".serviceBox > div[class='sItemBox'] > ul").hover(
//			function () {
//				$(this).find("li[class='short']").addClass('hide');
//				//$(this).find("li[class='long hide']").slideDown("slow");
//				$(this).find("li[class='long hide']").stop(true,true).slideToggle(); 
//			},
//			function () {
//			    $(this).find("li[class='long hide']").stop(true,true).slideToggle(); 
//				//$(this).find("li[class='long hide']").slideUp("slow");
//				$(this).find("li[class='short hide']").removeClass('hide');
//			}
//		);

		//5大服务滑动效果
          $(".serviceBox > div[class='sItemBox'] > ul").each(function(index) {
            $(this).hover(function() {
                $(this).find("li[class='long']").animate({ top:0 }, "slow");
               // $(this).find("li[class='title']").css("line-height","28px");
                $(this).find("li[class='title']").animate({ top:8 }, "slow");

            },
		        function() {
                    $(this).find("li[class='long']").animate({top:130 }, "slow");
                   // $(this).find("li[class='title']").css("line-height","14px");
                    $(this).find("li[class='title']").animate({ top:0 }, "slow");
               });
               
         });
		
		$(".menu_search > input[class='intext']").focus(
		    function(){
		        if($(this).attr("value") == "Enter Your Search"){
		            $(this).attr("value","");
		        }
		    }
		).blur(
		    function(){
		        if($.trim($(this).attr("value")) == ""){
		            $(this).attr("value","Enter Your Search");
		        }
		    }
		);
		
		//工具箱事件
		$(".client > .tools > li").hover(
		    function () {
				$(this).addClass('hv');
			},
			function () {
					$(this).removeClass('hv');
			}
		
		);
		
		var curWidth = 1024;
		
		setInterval(function changeWidth(){
		    curWidth = $("body").width();
		    if(curWidth <= 1024){
		        $(".mainbox").width(1000);
		        $(".bottomBox").width(1000);
		    }else if(curWidth > 1024 && curWidth <= 1160){
		        $(".mainbox").width(1100);
		        $(".bottomBox").width(1100);
		    }else if(curWidth > 1160 && curWidth < 1281){
		        $(".mainbox").width(1200);
		        $(".bottomBox").width(1200);
		    }else if(curWidth >= 1281){
		        $(".mainbox").width(1200);
		        $(".bottomBox").width(1200);
		    }
		},1000);     
        
        
        //内容选项卡
       $(".contentList > .tagBox > li").each(function(index) {
            $(this).css("cursor","pointer");
            $(this).click(function() {
              $(this).addClass("on");
              $(this).removeClass("off");
              $(this).siblings().addClass("off");
              $(this).siblings().removeClass("on");
              $(".tagBoxView").css("display","none");
              $(".tagBoxView").eq(index).css("display","block");
              //$(".tagBoxView").eq(index).siblings().css("display","none");
            });
               
         });
		
	});
