// JavaScript Document

	/* $(document).ready(function(){
		var currentMenu=null;
		$(".typeTitle").each(function(i){
				$(this).data("ID",i)
				if($(this).next().css("display")=="block")
				{	currentMenu=$(this)
					currentMenu.css("background-image","url(Public/img/whiteTag2.gif)")
					}
			})
		
		$(".typeTitle").click(function(){
									   	
			var status=$(this).next().css("display");
			if(status=="none")
			{
				$(this).next().slideDown("slow")
				$(this).css("background-image","url(Public/img/whiteTag2.gif)")
			}
			else
			{
				return;
			}
			if(currentMenu!=null)
			{
				currentMenu.next().slideUp("fast")
				currentMenu.css("background-image","url(Public/img/whiteTag.gif)")
			}
			currentMenu=$(this)
		})
	})*/
	 
	 
 $(document).ready(function(){
			var x=0;
            $(".menu1").hover(function(){
									   
									   
				$(".menu ul").each(function(i){
					$(this).css("display","none");
				
				})
			
				x=$(this).position().left
				$(this).find("ul").css("display","block")

				if($(this).find("ul").attr("pleft")==null)
				{
					$(this).find("ul").css("left",x+"px")
				}
				else
				{
					x=x-$(this).find("ul").attr("pleft");
					$(this).find("ul").css("left",x+"px")
				}
				
            },function(){
                $(this).find("ul").css("display","none")
            })
		
			
			jQuery.extend({
				setPageHeadWidth:function(){
					var rObj=$(".Pagehead");
					var rObj_width=rObj.width();
					var pageW = $(document.body).width();
					if(pageW<980)
					{
						pageW=980;
					}
					else{
						pageW=$(document.body).width();
					}
					$(".Pagehead").width(pageW)
					$(".indexPage").width(pageW)
					$(".banner").width(pageW)

		
				}
			})
			
				$.setPageHeadWidth();
			
			$(window).resize(function(){
				
					$.setPageHeadWidth();
				
					
			})
			
			
             $("#indextypeList li img").each(function(i){
                        $(this).data("img1",$(this).attr("src"));
                        var e=$($("#re li img").get(i)).attr("src")
                        $(this).data("img2",e);
                    });

                    $("#indextypeList li").hover(function(){
						
						var ishow=$(this).attr("isShow")
						var str=$($(this).attr("str")).html();
						if(ishow=="yes")
						{
							//添加浮层
							var divstr="<div class='showPic'>"+str+"</div>";	
								$(this).append(divstr);
							var obj=$(".showPic");
							var xpos=$(this).position().left;
							var ypos=$(this).position().top+$(this).height()-obj.height();
								obj.css("left",xpos)
								obj.css("top",ypos+"px")
							
						}
                        var sc=$(this).find("img").data("img2")
                        $(this).find("img").attr("src",sc);

                    },function(){
                        $(this).find("img").attr("src",$(this).find("img").data("img1"))
						var obj=$(".showPic");//删除浮层
						obj.detach();
                    }
                )			
			
        })	
 
 
                            $(function(){
                                var i=0;
                                var isTween=false;
                                var cData=0;
                                var currentObj=$($(".rjcp").get(0));

                                $.each($(".hot li"), function() {
                                    $(this).data("orderID",i);
                                    i++;
                                });

                                $(".hot li").click(function(){
                                    clearInterval(interval)
                                    if(!isTween)
                                    {
                                        if($(this).data("orderID")==cData)
                                        {
                                            return
                                        }
                                        isTween=true;
                                        currentObj.slideUp("slow");//隐藏
                                        var currentId=$(this).data("orderID");
                                        cData=currentId
										
										
                                        $($(".rjcp").get(currentId)).slideDown("slow",function(){
										
											isTween=false
                                            interval=setInterval(scrollNews,5000);
                                            ip=cData
											

                                        });//显示
										

                                        $.each($(".hot li"), function() {
                                            $(this).removeClass();
                                        });

                                        currentObj=$($(".rjcp").get(currentId))
                                        $(this).removeClass();
                                        $(this).addClass("select");
										
										
                                    }
                                })
                            })

                            var interval=setInterval(scrollNews,5000);
                            var ip=0;
                            function scrollNews(){
                                var len=$($(".hot li")).length;
                                ip=ip+1;
                                if(ip>len-1)
                                {
                                    ip=0;
                                }
                                $($(".hot li").get(ip)).click();
                            } 
 
 
 
                $(window).load(function(){
                    var initNum=0
                    var w=306;
                    var cLen=0;
                    var currentObj=$($(".adContainer div").eq(initNum));
                    $(".tips").html(currentObj.find("span").html())
                    var isTween=false;
                    currentObj.css("left","0px")
                    cLen=$(".adContainer div").size();

                    function fc(){
                        isTween=false;
                        removeTimer();
                        addTimer();
                    }

                    jQuery.fn.extend({
                        toRight:function(current,next){
                            $(".tips").html(current.find("span").html())

                            current.css("left",-w+"px")
                            current.animate({left: 0+"px"}, "slow","",fc);
                            next.css("left",0+"px")
                            next.animate({left: w+"px"}, "slow","",fc);
							
							
							$("#changeButton div").each(function(i){
									if(i==initNum)
										$(this).addClass("getLine")
									else
										$(this).removeClass("getLine")
																	
							})
							
							
                        },

                        toLeft:function(current,next){
                              $(".tips").html(current.find("span").html())

                            current.css("left",-w+"px")
                            current.animate({left: 0+"px"}, "slow","",fc);
                            next.css("left",0+"px")
                            next.animate({left: w+"px"}, "slow","",fc);
							
							
							$("#changeButton div").each(function(i){
									if(i==initNum)
										$(this).addClass("getLine")
									else
										$(this).removeClass("getLine")
																	
							})
							
							
                        }
						
						
						
                    })

                    $("#preButton").click(function(){
                        removeTimer()
                        if(!isTween)
                        {
                            isTween=true;
                            initNum=initNum-1;
                            if(initNum<0)
                            {
                                initNum=cLen-1;
                            }
                            nextObj=currentObj
                            currentObj=$($(".adContainer div").eq(initNum));

                            $(document).toRight(currentObj,nextObj)
                        }
                    })
                    $("#nextButton").click(function(){
                        removeTimer();
                        if(!isTween)
                        {
                            isTween=true;
                            initNum=initNum+1;
                            if(initNum>=cLen)
                            {
                                initNum=0;
                            }
                            nextObj=currentObj
                            currentObj=$($(".adContainer div").eq(initNum));
                            $(document).toLeft(currentObj,nextObj)
                        }
                    })
					
					
					
                    $(window).resize(function(){
                        var c=$(".adBottom");
						if(c.size()!=0)
						{
							var cx=c.offset().left;
							var cy=c.offset().top-$(".adContainer").height();
							$(".adContainer").css("left",cx)
							$(".adContainer").css("top",cy)
							$(".adContainer").css("display","block")
						}
					
                    })
                        var c=$(".adBottom");
						if(c.size()!=0)
						{
							$(window).resize();
                   		 	var timer;
                    		addTimer();
						}
					
                    function autoPlay(){
                        $("#nextButton").click();
                    }
                    function removeTimer(){
                        clearInterval(timer);
                    }
                    function addTimer(){
                        timer=setInterval(autoPlay,5000)
                    }
					
					
					$("#changeButton a").click(function(){
						if($(this).attr("index")==initNum)
						{
							return;	
						}
						removeTimer()
                        if(!isTween)
                        {
                            isTween=true;
                            initNum=$(this).attr("index")
                            if(initNum<0)
                            {
                                initNum=cLen-1;
                            }
                            nextObj=currentObj
                            currentObj=$($(".adContainer div").eq(initNum));

                            $(document).toRight(currentObj,nextObj)
                        }								
														
					})
					
					
					
                })	 
       
	   $(".productPropButton ul li a").click(function(){
		
             var a=$(this).parent().siblings();
              a.each(function(i){
                  $(this).removeClass("select")
                  $(this).removeClass("unselect")
                  $(this).addClass("unselect")
               })
             $(this).parent().addClass("select")
             $(this).parent().removeClass("unselect")
          })
 
 
         	function setHeight(h){
				var n=parseInt(h)+20
				$("#container").css("height",n+"px")
			}
			

$(document).ready(function(){

			jQuery.extend({
					ArrayShift:function(){
						return newsArray.shift();
					},//删除原数组第一项，并返回删除元素的值；如果数组为空则返回undefined 
					ArrayPush:function(obj){
						return newsArray.push(obj);
						
					},//将参数添加到原数组末尾，并返回数组的长度 
					
					objMove:function(){
						topNum=-51
						objShow.animate({"top":topNum+"px"},"slow",function(){
							$.ArrayPush(objShow.find("li").first());
							
							objShow.find("li").first().remove()
							objShow.css("top","0px")
						})
						
						var news=$.ArrayShift();
						objShow.append(news);
					},
					
					addDottedLine:function(){
						var len=$(".downLoadType").size();
						for(var i=0;i<len;i++){
						
							clen=$($(".downUL").eq(i)).find("li").size();
							if(clen%2==1)
							{
								var hh=$($(".downUL").eq(i)).find("li").last();
								//var ts='<li class="downItem">asdasdasd</li>'
								hh.after('<li class="downItem"><table class="leftD"><tr><td></td></tr></table><table class="rightD"><tr><td></td></table><div class="dashedLine init"></div></li>')
							}
						}
    
						
					}
					
			})

		
		var newsArray=new Array()
		var objHidden=$("#companyNewsHidden");
		var objShow=$("#companyNewsShow");
		var showLen=4;
		var topNum=0;
		var iheight=51;
		var nmu=4-$(".cpContainer2").find("li").size();
		var numH=nmu*iheight;
		$(".cpContainer").height(numH+"px")
		
		
		
		var objHiddenLen=objHidden.find("li").size();
		/*首页滚 动新闻*/

			
		for(var i=0;i<objHiddenLen;i++)
		{
			newsArray[i]=$(objHidden.find("li").eq(i))
		}
		
		
		for(i=0;i<showLen;i++)
		{
			objShow.append($.ArrayShift(newsArray))
		}
				
		var newsInterval=setInterval($.objMove,2000)
		
		$(window).resize(function(){
			if($("#absoluteNews").size()>0)
			{
				var px=$("#absoluteNews").position().left
				var py=$(".cpContainer2").position().top+$(".cpContainer2").height()+10
				$(".cpContainer").css("left",px+"px")
				$(".cpContainer").css("top",py+"px")						
			}
		})
	
				   
})

	
/*$(document).ready(function(){
	var i=33.33
	var size=$(".jibengongnegContainer table ").find("td img").size()
	if(size>3)
	{
		size=3	
	}
	var gwidth=size*i;
	$(".jibengongnegContainer table").css("width",gwidth+"%")
	

})
*/
/*
$(document).ready(function(){
	
	$(".testTable table").each(function(){
			var imgWidth=$(this).find("img").width();
			$(this).find("td:first").width(imgWidth+"px")
			var letterWidth=$(this).parent().width()-imgWidth;
			$(this).find("td:last").width(letterWidth+"px")
			$(this).find("td:last").css("padding-left","10px")
							
		})
						   
})*/
$(document).ready(function(){
	
	$(".propTable").attr("cellPadding","5")

})
	

			
			
			
			
			
			
