﻿var $dom = function(id){
	return document.getElementById(id);
  };
function ShowAllChannel(_this,id,bgleft,bgtop1,bgtop2){
  $dom(id).style.display="block";
  var bgpos1 = bgleft + " " + bgtop1;
  var bgpos2 = bgleft + " " + bgtop2;
  $dom(id).onmouseover=function(){this.style.display="block";_this.style.backgroundPosition=bgpos1;}
  $dom(id).onmouseout=function(){this.style.display="none";_this.style.backgroundPosition=bgpos2;}
  _this.style.backgroundPosition=bgpos1;
  _this.onmouseout=function(){$dom(id).style.display="none";_this.style.backgroundPosition=bgpos2;}
}
//友情链接滑动门  
function scrollDoor(){
}
scrollDoor.prototype = {
	sd : function(menus,divs,openClass,closeClass,setting){
		var _this = this;
		var t;
		//var setting = setting||{"autoRun":true,"time":"3000"}

		if(menus.length != divs.length)
		{
			alert("菜单层数量和内容层数量不一样!");
			return false;
		}				
		for(var i = 0 ; i < menus.length ; i++)
		{	
		 if($dom(menus[i])!=null)
		 {
			    _this.$dom(menus[i]).value = i;				
			    _this.$dom(menus[i]).onmouseover = function(){
				    for(var j = 0 ; j < menus.length ; j++)
				    {						
					    _this.$dom(menus[j]).className = closeClass;
					    _this.$dom(divs[j]).style.display = "none";
				    }
				    _this.$dom(menus[this.value]).className = openClass;	
				    _this.$dom(divs[this.value]).style.display = "block";
				   if(setting)
				   {
				       if(setting.autoRun)
				       {
				            if(t)
				            {
				            clearInterval(t);
				            }
				       }
				   }	
			    }
			    _this.$dom(menus[i]).onmouseout=function()
			    {
			     if(setting)
				 {
			           if(setting.autoRun)
				       {
				            t=setInterval(function(){_this.auto(menus,divs,openClass,closeClass)},setting.time)
				       }
				 }
			    }
		  }
		  
		}
		if(setting)
		{
		    if(setting.autoRun)
		    {
		        t=setInterval(function(){_this.auto(menus,divs,openClass,closeClass)},setting.time);
		    }
		}
		},
	$dom : function(oid){
		if(typeof(oid) == "string")
		return document.getElementById(oid);
		return oid;
	},
	auto:function(menus,divs,openClass,closeClass){
	    var currentIndex=0;
        if($dom(menus[currentIndex])!=null)
        {
            for(var j = 0 ; j < menus.length ; j++)
	        {	
	            if(this.$dom(menus[j]).className == openClass)
	            {
	                currentIndex = j;
	            }
		        this.$dom(menus[j]).className = closeClass;
		        this.$dom(divs[j]).style.display = "none";
	        }
	        currentIndex++;
	        if(currentIndex==menus.length)currentIndex=0;
	        this.$dom(menus[currentIndex]).className = openClass;	
	        this.$dom(divs[currentIndex]).style.display = "block";
        }
	}
}
//重置图片大小
function ResizeIMG(width,height,picURl,defaultValue)
{
    var resizeWidth=0,resizeHeight=0;
   if (width > height)
    {
            resizeWidth = defaultValue;
            resizeHeight = resizeWidth * height / width;
    }
    else
    {
            resizeHeight = defaultValue;
            resizeWidth = resizeHeight * width / height;
    }
    document.write( '<img src="'+picURl+'" width="'+resizeWidth+'" height="'+resizeHeight+'" />');
} 

/*
滑动门切换
*/
jQuery.fn.switchTab = function(settings) {
	settings = jQuery.extend({//可配置参数
		defaultIndex: 0,
		titOnClassName: "on",
		titCell: "dt span",
		mainCell: "dd",
		delayTime: 250,
		interTime: 0,
		trigger: "click",
		effect: "",
		omitLinks: false,
		debug: ""
	},
	settings,
	{//插件信息
		version: 120
	});

	this.each(function() {
		var st;
		var curTagIndex = -1;
		var obj = jQuery(this);
		if(settings.omitLinks){
			settings.titCell = settings.titCell + "[href^='#']";
		}
		var oTit = obj.find(settings.titCell);
		var oMain = obj.find(settings.mainCell);
		var cellCount = oTit.length;//可切换个数
		var ShowSTCon = function (oi){
			if(oi != curTagIndex){
				oTit.eq(curTagIndex).removeClass(settings.titOnClassName);
				oMain.hide();
				obj.find(settings.titCell + ":eq(" + oi + ")").addClass(settings.titOnClassName);
				if(settings.delayTime <250 && settings.effect != "")settings.effect = "";
				if(settings.effect == "fade"){
					obj.find(settings.mainCell + ":eq(" + oi + ")").fadeIn({queue: false, duration: 250});
				}else if(settings.effect == "slide"){
					obj.find(settings.mainCell + ":eq(" + oi + ")").slideDown({queue: false, duration: 250});
				}else{
					obj.find(settings.mainCell + ":eq(" + oi + ")").show();
				}
				curTagIndex = oi;
			}
		};
		
		var ShowNext = function (){
			oTit.eq(curTagIndex).removeClass(settings.titOnClassName);
			oMain.hide();
			if(++curTagIndex >= cellCount)curTagIndex = 0;
			oTit.eq(curTagIndex).addClass(settings.titOnClassName);
			oMain.eq(curTagIndex).show();
			//ShowSTCon(curTagIndex);
		};
		
		//根据defaultIndex初始化
		ShowSTCon(settings.defaultIndex);

		//
		if(settings.interTime > 0){
			var sInterval = setInterval(function(){
				ShowNext();
			}, settings.interTime);
		}

		//处理交互事件
		oTit.each(function(i, ele){
			if(settings.trigger=="click"){
				jQuery(ele).click(function(){
					ShowSTCon(i);
					return false;//若有链接而选择了click模式, 链接不起作用
				});
			}else if(settings.delayTime > 0){
				jQuery(ele).hover(function(){
					st = setTimeout(function(){//延时触发
						ShowSTCon(i);
						st = null;
					}, settings.delayTime);
				},function(){
					if(st!=null)clearTimeout(st);
				});
			}else{
				jQuery(ele).mouseover(function(){
					ShowSTCon(i);
				});
			}
		});
	});
	if(settings.debug!="")alert(settings[settings.debug]);
	return this;
};

/*
首页广告轮换
*/
function switchPic()
{
	var t = n = 0, count = $(".playShow a").size();
	$(".playShow a:not(:first-child)").hide();
	$(".playText").html($(".playShow a:first-child").find("img").attr('alt'));
	$(".playNum a:first").css({"background":"#FFD116",'color':'#A8471C'});
	
	$(".playNum a").click(function() {
	   var i = $(this).text() - 1;
	   n = i;
	   if (i >= count) return;
	   $(".playShow a").filter(":visible").hide().parent().children().eq(i).fadeIn(1200);
	   $(this).css({"background":"#FFD116",'color':'#A8471C'}).siblings().css({"background":"#D7D6D7",'color':'#000'});
	});
	t = setInterval(function(){
			n = n >= (count - 1) ? 0 : ++n;
			$(".playNum a").eq(n).trigger('click');
		}, 4000);
	$(".play").hover(function(){clearInterval(t)}, function(){t = setInterval(function(){
			n = n >= (count - 1) ? 0 : ++n;
			$(".playNum a").eq(n).trigger('click');
		}, 4000);});
}
/*
    分享按钮
*/
function wkShareTo(type,content,pic,channelType)
{
    if(channelType)
    {
        if(channelType==1)
        content="我在 中国网库 发现了一条非常不错的资讯："+content+"。分享一下"
    }
    else
    {
        content="我在 中国网库 发现了一个非常不错的商品："+content+"。分享一下"
    }
    switch(type)
    {
        case "Sina":
            url="http://v.t.sina.com.cn/share/share.php?";  
            url=url+"title="+content+"&pic="+pic+"&url="+location.href; 
            window.open(url);
        break;
        case "Qzone":
            url="http://v.t.qq.com/share/share.php?";  
            url=url+"title="+content+"&pic="+pic+"&url="+encodeURIComponent(location.href);  
            window.open(url);
        break;
        case "Douban":
            url="http://www.douban.com/recommend/?";
            url=url + "title=" + content + "&comment=" + content +"&pic="+pic+"&url="+encodeURIComponent(location.href);  
            window.open(url);
        break;
        case "QQ":
        case "BangBang":
            var curNode=document.getElementById("copyDetail");
            if(curNode.style.display=="none")
            {
                curNode.style.display="block";
                //var curNode = document.elementFromPoint(event.clientX,event.clientY);
                 curNode.innerHTML ='<h3>复制下面的内容后通过 帮帮 或 QQ 发送给好友：</h3><p><input  type="text" class="ly_text" value="'+location.href+'" /><a href="javascript:;" class="ly_btn" onclick="$W.setData(\''+location.href+'\')">复制</a></p>';
            }
            else
            {
                curNode.style.display="none";
            }
        break;
       case "RenRen":
            url="http://share.renren.com/share/buttonshare/post/1004?";
            url = url + "title=" + content +"&content="+ content + "&pic=" + pic + "&url=" + encodeURIComponent(location.href);
            window.open(url);
       break;
       case "KaiXin":
            url="http://www.kaixin001.com/repaste/share.php?";
            url = url + "rtitle=" + content + "&rcontent=" + content + "&rurl=" + encodeURIComponent(location.href);
            window.open(url);
       break;
    
    }
}

/*
异步退出
*/
function loginOut()
{
    jQuery.ajax({
            url:'/Ajax/Login.ashx',
            type: 'get',
            data: "action=ajaxLogin&&type=2&time=" + Math.random(),
            timeout: 5000,
            error: function(){},
            beforeSend:function(){},
            success: function(result){
               $("#topLogin").html('您好, 欢迎来到中国网库 <a href="http://login.99114.com" title="请登录" target="_blank">[请登录]</a> <a href="http://login.99114.com" title="免费注册" class="GoToRegister" target="_blank">[免费注册]</a>');
            }
    });
}
/*
异步退出
*/
function loginOutCallBack(callback)
{
    jQuery.ajax({
            url:'/Ajax/Login.ashx',
            type: 'get',
            data: "action=ajaxLogin&&type=2&time=" + Math.random(),
            timeout: 5000,
            error: function(){},
            beforeSend:function(){},
            success: callback
    });
}
/*
   jquery静态扩展
*/
jQuery.WK={
    goTopFull:function(){
        var domWidth=$(window).width();
        var bodyWidth=950,boxWidth=132;
        var floatBox =[];
            floatBox.push('<div class="FU_box" id="FU_box">');
            
            floatBox.push('<div class="FU_box_main_L">');
            
            floatBox.push('<div class="FU_box_L"></div>');
          
            floatBox.push('<div class="FU_box_M"><dl>');
            floatBox.push('<dd class="FU_nav FU_red01 FU_width01" id="ddUserStatus">');
            var noLoginStr='【<a href="http://reg.99114.com/Register/a/" target="_blank">注册</a> <a href="http://login.99114.com" target="_blank">登录</a>】';
            $.getJSON("http://www.99114.com/Ajax/Login.ashx?action=ajaxLoginJsonp&time="+parseInt(Math.random() * 1000)+"&jsoncallback=?",function(result){
            if(result.userInfo&&result.userInfo[0]&&result.userInfo[0].ID>0)
            {
                $("#ddUserStatus").html('<a href="http://login.99114.com/default/index.aspx" title="我的商务中心" target="_blank">'+result.userInfo[0].Account+'</a>，<a href="javascript:;" id="UserOnline">[退出]</a>');
                //头部用户登录显示
                $("#topLogin").html("您好"+result.userInfo[0].Account+", 欢迎来到中国网库 <a href=\"javascript:;\" title=\"退出\" onclick=\"loginOut()\">[退出]</a>");
                $("#UserOnline").click(function(){
                    loginOutCallBack($('#ddUserStatus').html(noLoginStr));}
                )
            }
            else
            {
                $("#ddUserStatus").html(noLoginStr);
            }
        });
            floatBox.push('</dd>');
        var channel=[];
            channel.push({name:"首页",url:"/",title:"首页"});
//            channel.push({name:"报价",url:"/Quotation/",title:"报价"});
            channel.push({name:"采购",url:"/buy/",title:"采购"});
            channel.push({name:"特色产业带",url:"/Industrial/Channel.shtml",title:"特色产业带"});
            channel.push({name:"公司",url:"/Corporation/",title:"公司"});
            channel.push({name:"招商",url:"/Information/",title:"招商"});
            channel.push({name:"团购",url:"http://www.my114.com.cn",title:"团购"});
            channel.push({name:"网库学院",url:"/tool/",title:"网库学院"});
            channel.push({name:"展会",url:"http://expo.99114.com",title:"展会"});
            channel.push({name:"资讯",url:"/Article/",title:"资讯"});
            
        var arrItems = new Array();
            arrItems[0] = new Array("供应",true,"请输入您感兴趣的内容","/Supply/List.shtml?k={KEY}","supply");
            arrItems[1] = new Array("求购",true,"请输入您感兴趣的内容","/Buy/List.shtml?k={KEY}","buy","buy");
            arrItems[2] = new Array("公司",true,"请输入您感兴趣的内容","/Corporation/List.Shtml?k={KEY}","corporation");
            arrItems[3] = new Array("招商",true,"请输入您感兴趣的内容","/Information/List.Shtml?k={KEY}","information");
            
            floatBox.push('<dt class="FU_a FU_width02">');
            for(var leg=0;leg<channel.length;leg++)
            {
                floatBox.push('<a href="'+channel[leg].url+'">'+channel[leg].name+'</a>|')
            }
            floatBox.push('</dt>');
            floatBox.push('<dd class="FU_width03">');
          var tempKey="";
            floatBox.push('<input type="text" class="FU_text" value="'+tempKey+'" style="float:left;" id="FU_text"/>');
            floatBox.push('<span class="select" ><div><select id="floatSearch">');
            
            for(var i =0;i<arrItems.length;i++)
            {
                 floatBox.push('<option value="'+i+'" >'+arrItems[i][0]+'</option>');
                
            }
            floatBox.push("</select></div></span>");
            floatBox.push('<input name="" type="button"  class="FU_but01" id="FU_but01" /></dd>');
            floatBox.push('</dl></div>');
            
            floatBox.push('</div>');
            
            floatBox.push('<div class="FU_box_R"><span><a href="javascript:;" onFocus="this.blur()"><img src="http://www.99114.com/images/v1/fuNav_122.gif" id="floatBoxOpen" /></a></span><a href="javascript:;"  id="ToTop" onFocus="this.blur()"><img src="http://www.99114.com/images/v1/fuNav_14.gif" width="24" height="22" /></a></div>');
            floatBox.push('</div>');
            
            $(floatBox.join('')).appendTo('body');
            $("#FU_box").css({"left":(domWidth-bodyWidth)/2});
            var marLeft=bodyWidth-boxWidth-1;
            $(".FU_box_main_L").css({"margin-left":marLeft+"px"});
            $(".FU_box_R").css({"left":marLeft+$(".FU_box_L").width(),"position":"absolute"});
            $("#floatBoxOpen").toggle(function(){
                $(".FU_box_main_L").css("width","825px").animate({"marginLeft":"0"},"400",function(){
                    $("#floatBoxOpen").attr("src","http://www.99114.com/images/v1/fuNav_12.gif");
                });
                
            },function(){
                $(".FU_box_main_L").animate({"marginLeft":marLeft},"400",function()
                {
                    $(this).css("width","8px");
                    $("#floatBoxOpen").attr("src","http://www.99114.com/images/v1/fuNav_122.gif");
                });
            });
            var $backToTopEle = $('#ToTop').click(function() {
                $("html, body").animate({ scrollTop: 0 }, 200);
            }),$allToTop=$('#FU_box'),$backToTopFun = function() {
                var st = $(document).scrollTop(), winh = $(window).height();
                (st > 350)? $allToTop.css("display","").fadeIn("slow"): $allToTop.fadeOut("slow");
                (st > 350)? $(".FU_box_R").css("display","").fadeIn("slow"): $(".FU_box_R").fadeOut("slow");
            };
            $(window).bind("scroll", $backToTopFun);
            $(function() { $backToTopFun(); });
            $("#FU_but01").bind("click",function(){
                var currentIndex=parseInt($("#floatSearch").val());
                var searchText =$("#FU_text");
                if(searchText.val()==""||searchText.val().indexOf("请输入您感兴趣的内容")>=0)
                {
                    if(currentIndex==0)
                    {
                        location.href="http://www.99114.com/Category/Category_0_0.shtml";
                    }
                    else
                    {
                        alert(arrItems[currentIndex][2]);
                        return false;
                    }
                }
                else
                {
                    location.href="http://www.99114.com"+arrItems[currentIndex][3].replace("{KEY}",searchText.val());
                }
            });
    },
    goTopSimple:function(){
        $('<a title="返回顶部" href="javascript:;" class="backToTop" id="ToTop" ></a>').appendTo('body');
        var $backToTopTxt = "返回顶部", $backToTopEle = $('#ToTop').attr("title", $backToTopTxt).click(function() {
                $("html, body").animate({ scrollTop: 0 }, 200);
        }), $backToTopFun = function() {
            var st = $(document).scrollTop(), winh = $(window).height();
            (st > 350)? $backToTopEle.css("display","block").fadeIn("slow"): $backToTopEle.fadeOut("slow");
            if (!window.XMLHttpRequest) {
                $backToTopEle.css("top", st + winh - 166);	
            }
        };
        $(window).bind("scroll", $backToTopFun);
        $(function() { $backToTopFun(); });
    },
    alert:function(config){
        var _html="";
        _html+='<div class="inforTan_box">'
          _html+='<div class="inforTan">'
            _html+='<div class="title">'
              _html+='<h1>提示:</h1>'
              _html+='<span><img src="../images/v1/cha_03.gif" /></span> </div>'
            _html+='<div class="text">此会员未绑定QQ，请点击以下按钮进行洽谈或留言<br />'
              _html+='<a href="#"><img src="../images/v1/bang_10.gif" /></a></div>'
          _html+='</div>'
          _html+='<div style="clear:both;"></div>'
        _html+='</div>'
    },
    getTodayNum:function(){
        jQuery.ajax({
            url:'/Ajax/Ajax.ashx',
            type:'GET',
            data: "action=getMemberAndProductNum&time="+parseInt(Math.random() * 1000),
            error: function(){},
            onwait : "正在加载数据，请稍候...",
            success:function(result)
            {
                if(result.split('|').length>=2) {
                    $(".city p span:first-child").html(result.split('|')[0]);
                    $(".city p span:last-child").html(result.split('|')[1]);
                }
            }
        });
    
    }
}
/*
返回顶部
*/
$(document).ready(function()
{
    var reg= new RegExp("([^/\.]+)\.(shtml|aspx|html)(?=\\?|$)");
    var regChannel=new RegExp("http://www\.99114\.com/?([a-zA-z]+)/?");
    var match = reg.exec(location.href);
    var matchChannel=regChannel.exec(location.href);
    var pageName="";
    if(match&&matchChannel)
    {
        if(match&&match[1].toLowerCase()=="supply"&&match[1].toLowerCase()=="detail")
        {
            pageName=match[1].replace(/_\d+_\d+/ig,"").toLowerCase();
        }
        else
        {
            $.WK.goTopFull();
        }
    }
    else
    {
        $.WK.goTopFull();
    }
    $.WK.getTodayNum();
})  
/*
重写FireFox event方法
*/
function __firefox()
{ 
HTMLElement.prototype.__defineGetter__("runtimeStyle", __element_style); 
window.constructor.prototype.__defineGetter__("event", __window_event); 
Event.prototype.__defineGetter__("srcElement", __event_srcElement); 
} 

function __element_style()
{ 
return this.style; 
} 

function __window_event()
{ 
return __window_event_constructor(); 
} 
function __event_srcElement()
{ 
return this.target; 
} 
function __window_event_constructor()
{ 
if(document.all)
{ 
   return window.event; 
} 
var _caller = __window_event_constructor.caller; 
while(_caller!=null)
{ 
   var _argument = _caller.arguments[0]; 
   if(_argument)
   { 
    var _temp = _argument.constructor; 
    if(_temp.toString().indexOf("Event")!=-1)
    { 
     return _argument; 
    } 
   } 
   _caller = _caller.caller; 
} 
return null; 
} 

if(window.addEventListener)
{ 
__firefox(); 
}

/*
    为string添加截取方法
*/
String.prototype.sub =  function (n) {
    var  r = /[^\x00-\xff]/g;
    if ( this .replace(r,  "mm" ).length <= n)  return   this ;       
    // n = n - 3;
    var  m = Math.floor(n/2);
    for ( var  i=m; i< this .length; i++) {
        if ( this .substr(0, i).replace(r,  "mm" ).length>=n)
        {
        return   this .substr(0, i) + ".." ; 
        }
    }  return   this ;       
};  
/*
    jquery插件
*/
$.fn.extend({
    /*
    公司页图片轮换
    */
    CorpScroll:function(setting){
        var _this=this;
        var autoInterval;
        var trigers = $(_this).find("LI");
        var sheets = $(_this).find("DIV");
        if(trigers.length<0) return;
        if(trigers.length!=sheets.length) return;
        $(sheets[0]).css("display","block");
        $(trigers[0]).addClass("current");
        
        function ImgVisible(i)
        {
            $(_this).find("DIV").each(function(){$(this).css("display","none")});
            $(sheets[i]).show();
        };
        if(setting.auto)
        {
            function Auto(){
                var currentObj=$(".current");
                $(_this).find("LI").each(function(i,obj){
                    if($(obj).attr("id")==$(".current").attr("id"))
                    {
                        if(currentObj.next().attr("tagName")=="LI")
	                    {
	                        currentObj.removeClass("current");
	                        currentObj.next().addClass("current");
	                        ImgVisible(i+1);
	                    }
	                    else
	                    {
	                        currentObj.removeClass("current");
	                        $(trigers[0]).addClass("current");
	                        ImgVisible(0);
	                    }
	                    return false;
                    }
                })
            }
            autoInterval=setInterval(Auto,setting.timer);
        }
        
        
        $(this).find("LI").each(function(i,obj){
         	$(obj).bind(setting.eventType,function(){
         	     if(autoInterval) clearInterval(autoInterval);
         		 $(".current").removeClass("current");
         		 $(obj).addClass("current");
         		 ImgVisible(i);
         		 if(setting.auto)
         		 {
         		    autoInterval=setInterval(Auto,setting.timer);
         		 }
         	});
        });
        $("#"+setting.prev+",#"+setting.next).each(function(i,objP){
            $(objP).bind(setting.eventType,function(){
                $(trigers).each(function(i,obj){     
    		        if($(obj).attr("id")==$(".current").attr("id"))
    		        {
    		            if(autoInterval) clearInterval(autoInterval);
			            var currentObj=$(".current");
			            if($(objP).attr("point")=="next")
			            {
			                if(currentObj.next().attr("tagName")=="LI")
			                {
			                    currentObj.removeClass("current");
			                    currentObj.next().addClass("current");
			                    ImgVisible(i+1);
			                }
			            }
			            else if($(objP).attr("point")=="prev")
			            {
			               if(currentObj.prev().attr("tagName")=="LI")
			               {
			                   currentObj.removeClass("current");
			                   currentObj.prev().addClass("current");
			                   ImgVisible(i-1);
			               }
			            }
			            if(setting.auto)
 		                {
 		                    autoInterval=setInterval(Auto,setting.timer);
 		                }
    			        return false;
    		        }
    	        });
            })
        })
    },
    /*
        公司页滚动跑马灯
    */
    CorpMarquee:function(setting){
        var _this=this;
        //alert("AutoInterval"+setting.AutoInterval+"MovInterval"+setting.MovInterval);
    	var marquee={
            GoLeft:function(){
            /*clearInterval(MovInterval);*/
	            if(!setting.MoveFlag){
		            return;
	            }
	            clearInterval(setting.AutoInterval);
	            setting.MoveWay="right";
	            this.RunLeft();
	            setting.MovInterval=setInterval(function(){marquee.RunLeft()},setting.Speed)
            },
            StopLeft:function(){
	            if(setting.MoveWay == "left"){return};
	            clearInterval(setting.MovInterval);
	            if($(_this).scrollLeft()%setting.PageWidth!=0)
	            {
			            setting.Comp=setting.PageWidth-$(_this).scrollLeft()%setting.PageWidth;
			            this.CommonRun()
	            }else{
		            setting.MoveFlag=true
	            }
	            this.Auto()
            },
            RunLeft:function(){
	            if($(_this).scrollLeft()>=$(_this).find(".List2_1").attr("scrollWidth")){
		            $(_this).scrollLeft($(_this).scrollLeft()-$(_this).find(".List2_1").attr("scrollWidth"))
	            }
	            $(_this).scrollLeft($(_this).scrollLeft()+setting.Space)
            },
            GoRight:function(){
	            if(!setting.MoveFlag)return;
	            clearInterval(setting.AutoInterval);
	            setting.MoveWay="left";
	            setting.MovInterval=setInterval(function(){marquee.RunRight()},setting.Speed);
            },
            StopRight:function(){
	            if(setting.MoveWay == "right"){return};
	            clearInterval(setting.MovInterval);
	            if($(_this).scrollLeft()%setting.PageWidth!=0){
		            setting.Comp=-$(_this).scrollLeft()%setting.PageWidth;
		            this.CommonRun()
	            }else{
		            setting.MoveFlag=true
	            }
	            this.Auto()
            },
            RunRight:function(){
	            if($(_this).scrollLeft()<=0){
		            $(_this).scrollLeft($(_this).scrollLeft()+$(_this).find(".List2_1").attr("offsetWidth"))
	            }
	            $(_this).scrollLeft($(_this).scrollLeft()-setting.Space)
            },
            CommonRun:function(){
	            if(setting.Comp==0){
	            setting.MoveFlag=true;
	            return
	            }
	            var num,TempSpeed=setting.Speed,TempSpace=setting.Space;
	            if(Math.abs(setting.Comp)<setting.PageWidth/2){
		            TempSpace=Math.round(Math.abs(setting.Comp/setting.Space));
		            if(TempSpace<1){
			            TempSpace=1
		            }
	            }
	            //alert("TempSpeed---"+TempSpeed+"TempSpace---"+TempSpace);
	            //向右移动
	            if(setting.Comp<0){
		            if(setting.Comp<-TempSpace){
			            setting.Comp+=TempSpace;
			            num=TempSpace
		            }
		            else{
			            num=-setting.Comp;
			            setting.Comp=0
		            }
		            $(_this).scrollLeft($(_this).scrollLeft()-num);
		            setTimeout(function(){marquee.CommonRun()},TempSpeed)
	            }
                //向左移动
	            else{
		            if(setting.Comp>TempSpace){
			            setting.Comp-=TempSpace;
			            num=TempSpace
		            }else{
			            num=setting.Comp;
			            setting.Comp=0
		            }
		            $(_this).scrollLeft($(_this).scrollLeft()+num);
	                setTimeout(function(){marquee.CommonRun()},TempSpeed)
	            }
            },
            Auto:function(){
                clearInterval(setting.AutoInterval);
                clearInterval(setting.MovInterval);
                setting.AutoInterval=setInterval(function(){marquee.GoLeft();marquee.StopLeft();},setting.timer)
            }
    	}
    	$(_this).find(".List2_1").html($(_this).find(".List1_1").html());
    	$(_this).bind("mouseover",function(){clearInterval(setting.AutoInterval)}).bind("onmouseout",function(){marquee.Auto();})
        $(_this).parent().find(".LeftBotton").mousedown(function(){
            marquee.GoRight();
        }).mouseup(function(){marquee.StopRight()}).mouseout(function(){marquee.StopRight()})
        $(_this).parent().find(".RightBotton").mousedown(function(){
            marquee.GoLeft();
        }).mouseup(function(){marquee.StopLeft()}).mouseout(function(){marquee.StopLeft()})
    	marquee.Auto();
    },
     /*
    资讯频道首页图片轮换
    */
    ArticleScroll:function(){
        var _this=this;
        var dataArray=[];
        var tagHtml="";
        var mainPushNum=0;
        $(_this).find("#mainPush A").each(function(i,obj){
            dataArray.push({"img":$(obj).find("IMG").attr("src"),"href":$(obj).attr("href"),"title":$(obj).attr("title")});
        })
        for(var i=0;i<dataArray.length;i++)
        {
            tagHtml+='<a href="'+dataArray[i].href+'" id="linkPush'+i+'" target="_blank" IdTag="'+i+'"><img src="/images/v1/push'+i+'.gif"></a>';
        }
        $(_this).find("#linkPush").html(tagHtml);
        $(_this).find("#linkPush A").each(function(){
            $(this).mouseover(function(){showPushLink($(this).attr("IdTag"))})
        })
        $("#linkPush0").addClass("linkPushHere");
        $("#mainPush").html('<a href="'+dataArray[0].href+'" target="_blank" id="pushImgLink" ><img src="'+dataArray[0].img+'" name="pushImg" width="503" height="201" id="pushImg" alt="'+dataArray[0].title+'" /></a>').find("#pushImgLink").mouseout(function(){
            showAtTime();
        });
        function showPushLink(num){
            clearInterval(rollId);
            if(!num&&num!=0){
                mainPushNum++;
                if(mainPushNum>3) mainPushNum=0;
                num=mainPushNum;
            }
            for(i=0;i<4;i++){
                $("#linkPush"+i).attr("class","").html("<img src='/images/v1/push"+i+".gif'>");
            }
            $("#linkPush"+num).addClass("linkPushHere");
            $("#pushImg").attr({"src":dataArray[num].img,"alt":dataArray[num].title});
            $("#pushImgLink").attr("href",dataArray[num].href);
        }
        var rollId=setInterval(function(){showPushLink()},5000);
        function showAtTime(){
            showPushLink();
            rollId=setInterval(function(){showPushLink()},5000);
        }
    }
})

//修正IE6下PNG图片显示问题
function correctPNG()
{
   if($.browser.msie&&$.browser.version<=6)
    {
//        var scriptDom=document.createElement("SCRIPT");
//        scriptDom.src="http://www.99114.com/js/jQuery/jquery.pngFix.pack.js";
//        document.body.appendChild(scriptDom); 
//        $(document).ready(function(){
//		    $(document).pngFix();
//	    });
    }
}
