﻿
/*******************
   菜单JS
********************/


   function show(classId)
 {
           
			if (document.getElementById (classId).style.display == "none")
            document.getElementById (classId).style.display = "";
            else 
            document.getElementById (classId).style.display = "none";
			}
			function noshowa()
            {
			if (document.getElementById (classId).style.display == "")
            document.getElementById (classId).style.display = "none";
            else 
            document.getElementById (classId).style.display = "";
  }
			
function noshow(classId)
{
			if (document.getElementById (classId).style.display == "")
            document.getElementById (classId).style.display = "none";
            else 
            document.getElementById (classId).style.display = "";
}

//切换菜单
function setTab(name,cursel,n){

    for(i=1;i<=n;i++){
        var menu=document.getElementById(name+i);
        var con=document.getElementById("con1_"+name+"_"+i);
       
        menu.className=i==cursel?"hover":"";
        con.style.display=i==cursel?"block":"none";
    }
}



$(document).ready(function(){
        GetClass();
        //removeDiv();
});

function removeDiv(){
   $(".TipDiv").remove();
}

function GetClass(){
    //标题鼠标经过
     $(".meumJs a").mouseover(function(e){
            $(".TipDiv").remove();//若页面上有该元素，则移除该元素...0
            var x=e.originalEvent.x+10;//获取鼠标的x轴坐标            
            var y=e.originalEvent.y+$(document).scrollTop()+10;//获取鼠标的y轴坐标
            var num=$(this).attr("id");
            var imgs;
            var word;
            var name="";    
            var param={op:"1",pId:num}; 
            //alert(x+"**"+y);
              //window.status=x+"*****"+y;
            $.getJSON("/Handler.ashx?&math="+Math.random(),param,function(data){
                
                if(data!=0){
                   $.each(data, function(index, dataValue) {
                   //" + item.Id + "' class='hei4'>" + item .className+ "</a>
                          name+="<a href='/Product/cn/index.aspx?ClassId="+dataValue.Id+"' target='_blank'>";
                          name+=dataValue.Name;
                          name+="</a><br>";
                    });
                    
                    popDiv(name,x,y); 
                }else{
                
                }
            }); 
                
    });      
}

//随鼠标移动的信息框
function popDiv(name,xx,yy)
{
       var str="";
       str+="<div class='TipDiv' style=\"top:"+yy+"px;left:"+xx+"px\">";
       str+="<span>"+name+"</span><br />";;
       str+="<div>";
       $('body').append(str);
       //.css({"top":yy+"px","left":xx+"px"})
       $(".TipDiv").mouseleave(function(){
       $(".TipDiv").remove();
       });//设置该元素出现的位置（这里是出现在鼠标的右边和下边的偏离10px位置）
       //document.getElementById("name").value=str;
}

(function($){
	$.fn.extend({
		RollTitle: function(opt,callback){
			if(!opt) var opt={};
			var _this = this;
			_this.timer = null;
			_this.lineH = _this.find("li:first").height();
			_this.line=opt.line?parseInt(opt.line,15):parseInt(_this.height()/_this.lineH,10);
			_this.speed=opt.speed?parseInt(opt.speed,10):3000, //卷动速度，数值越大，速度越慢（毫秒
			_this.timespan=opt.timespan?parseInt(opt.timespan,13):5000; //滚动的时间间隔（毫秒
			if(_this.line==0) this.line=1;
			_this.upHeight=0-_this.line*_this.lineH+20;
			_this.scrollUp=function(){
				_this.animate({
					marginTop:_this.upHeight
					},_this.speed,function(){
						for(i=1;i<=_this.line;i++){
							_this.find("li:first").appendTo(_this);
					}
					_this.css({marginTop:0});
				});
			}
			_this.hover(function(){
					clearInterval(_this.timer);
				},function(){
					_this.timer=setInterval(function(){_this.scrollUp();},_this.timespan);
			}).mouseout();
		}
	})
})(jQuery);

