
/*************************************
//	ASTO 
//	2010-11-16   hetao138@gmail.com
**************************************/



/*
**************************************
//Company Quote  scroll 
// 企业报价 间隔轮换
**************************************
*/



(function($){
$.fn.extend({
        Scroll:function(opt,callback){
                //参数初始化
                if(!opt) var opt={};
                var _this=this.eq(0).find("ul:first");
                var lineH=_this.find("li:first").height(), //获取行高
                        line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10),
                        speed=opt.speed?parseInt(opt.speed,10):5000, //卷动速度，数值越大，速度越慢（毫秒）
                        timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔（毫秒）
                if(line==0) line=1;
                var upHeight=0-line*lineH;
                //滚动函数
                scrollUp=function(){
                        _this.animate({
                                marginTop:upHeight
                        },speed,function(){
                                for(i=1;i<=line;i++){
                                        _this.find("li:first").appendTo(_this);
                                }
                                _this.css({marginTop:0});
                        });
                }
                //鼠标事件绑定
                _this.hover(function(){
                        clearInterval(timerID);
                },function(){
                        timerID=setInterval("scrollUp()",timer);
                }).mouseout();
        }       
})
})(jQuery);

function Marquee(){
  this.ID=document.getElementById(arguments[0]);
  this.Direction=arguments[1];
  this.Step=arguments[2];
  this.Width=arguments[3];
  this.Height=arguments[4];
  this.Timer=arguments[5];
  this.WaitTime=arguments[6];
  this.StopTime=arguments[7];
  if(arguments[8]){this.ScrollStep=arguments[8];}else{this.ScrollStep=this.Direction>1?this.Width:this.Height;}
  this.CTL=this.StartID=this.Stop=this.MouseOver=0;
  this.ID.style.overflowX=this.ID.style.overflowY="hidden";
  this.ID.noWrap=true;
  this.ID.style.width=this.Width;
  this.ID.style.height=this.Height;
  this.ClientScroll=this.Direction>1?this.ID.scrollWidth:this.ID.scrollHeight;
  this.ID.innerHTML+=this.ID.innerHTML;
  this.Start(this,this.Timer,this.WaitTime,this.StopTime);
  }
Marquee.prototype.Start=function(msobj,timer,waittime,stoptime){
  msobj.StartID=function(){msobj.Scroll();}
  msobj.Continue=function(){
    if(msobj.MouseOver==1){setTimeout(msobj.Continue,waittime);}
    else{clearInterval(msobj.TimerID); msobj.CTL=msobj.Stop=0; msobj.TimerID=setInterval(msobj.StartID,timer);}
    }
  msobj.Pause=function(){msobj.Stop=1; clearInterval(msobj.TimerID); setTimeout(msobj.Continue,waittime);}
  msobj.Begin=function(){
    msobj.TimerID=setInterval(msobj.StartID,timer);
    msobj.ID.onmouseover=function(){msobj.MouseOver=1; clearInterval(msobj.TimerID);}
    msobj.ID.onmouseout=function(){msobj.MouseOver=0; if(msobj.Stop==0){clearInterval(msobj.TimerID); msobj.TimerID=setInterval(msobj.StartID,timer);}}
    }
  setTimeout(msobj.Begin,stoptime);
  }
Marquee.prototype.Scroll=function(){
  switch(this.Direction){
    case 0:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollTop+=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollTop>=this.ClientScroll) this.ID.scrollTop-=this.ClientScroll; this.ID.scrollTop+=this.Step;}
      break;
    case 1:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollTop-=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollTop<=0) this.ID.scrollTop+=this.ClientScroll; this.ID.scrollTop-=this.Step;}
      break;
    case 2:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollLeft+=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollLeft>=this.ClientScroll) this.ID.scrollLeft-=this.ClientScroll; this.ID.scrollLeft+=this.Step;}
      break;
    case 3:
      this.CTL+=this.Step;
      if(this.CTL>=this.ScrollStep&&this.WaitTime>0){this.ID.scrollLeft-=this.ScrollStep+this.Step-this.CTL; this.Pause(); return;}
      else{if(this.ID.scrollLeft<=0) this.ID.scrollLeft+=this.ClientScroll; this.ID.scrollLeft-=this.Step;}
      break;
    }
  }

$(document).ready(function(){
	new Marquee(
    "topscroll3",  //容器ID<br />
    0,  //向上滚动(0向上 1向下 2向左 3向右)<br />
    1,  //滚动的步长<br />
    210,  //容器可视宽度<br />
    200,  //容器可视高度<br />
    10,  //定时器 数值越小，滚动的速度越快(1000=1秒,建议不小于20)<br />
    2000,  //间歇停顿时间(0为不停顿,1000=1秒)<br />
    1000,  //开始时的等待时间(0为不等待,1000=1秒)<br />
    20 //间歇滚动间距(可选)<br />
    );
  new Marquee(
    "topscroll4",  //容器ID<br />
    0,  //向上滚动(0向上 1向下 2向左 3向右)<br />
    1,  //滚动的步长<br />
    230,  //容器可视宽度<br />
    138,  //容器可视高度<br />
    10,  //定时器 数值越小，滚动的速度越快(1000=1秒,建议不小于20)<br />
    5000,  //间歇停顿时间(0为不停顿,1000=1秒)<br />
    1000,  //开始时的等待时间(0为不等待,1000=1秒)<br />
    20 //间歇滚动间距(可选)<br />
    );
  new Marquee(
    "upAndDownUlContainerSupply",  //容器ID<br />
    0,  //向上滚动(0向上 1向下 2向左 3向右)<br />
    1,  //滚动的步长<br />
    230,  //容器可视宽度<br />
    162,  //容器可视高度<br />
    10,  //定时器 数值越小，滚动的速度越快(1000=1秒,建议不小于20)<br />
    5000,  //间歇停顿时间(0为不停顿,1000=1秒)<br />
    1000,  //开始时的等待时间(0为不等待,1000=1秒)<br />
    21 //间歇滚动间距(可选)<br />
    );
	new Marquee(
    "upAndDownUlContainerBuy",  //容器ID<br />
    0,  //向上滚动(0向上 1向下 2向左 3向右)<br />
    1,  //滚动的步长<br />
    230,  //容器可视宽度<br />
    162,  //容器可视高度<br />
    10,  //定时器 数值越小，滚动的速度越快(1000=1秒,建议不小于20)<br />
    5000,  //间歇停顿时间(0为不停顿,1000=1秒)<br />
    1000,  //开始时的等待时间(0为不等待,1000=1秒)<br />
    21 //间歇滚动间距(可选)<br />
    );
	
	//new ScrollUtil({element:jQuery("#topscroll3"),line:5,speed:500,timer:3000});
        $("#scrollDiv").Scroll({line:5,speed:500,timer:3000});
//        $("#topscroll3").Scroll({line:5,speed:500,timer:3000});
//        $("#topscroll4").Scroll({line:5,speed:500,timer:3000});
});

/*
**************************************
//  Look for business opportunities Register tab
//  寻找商机 会员注册 tab
**************************************
*/
(function($){
		$.jtabber = function(params){
				
				// parameters
				var navDiv = params.mainLinkTag;
				var selectedClass = params.activeLinkClass;
				var hiddenContentDiv = params.hiddenContentClass;
				var showDefaultTab = params.showDefaultTab;
				var showErrors = params.showErrors;
				var effect = params.effect;
				var effectSpeed = params.effectSpeed;
				
				// If error checking is enabled
				if(showErrors){
					if(!$(navDiv).attr('title')){
						alert("ERROR: 在您的mainLinkTag paramater的元素需要一个'标题'属性. \n ("+navDiv+")");	
						return false;
					}
					else if(!$("."+hiddenContentDiv).attr('id')){
						alert("ERROR:在您的hiddenContentClass paramater的元素需要有一个id. \n (."+hiddenContentDiv+")");	
						return false;
					}
				}
				
				// If we want to show the first block of content when the page loads
				if(!isNaN(showDefaultTab)){
					showDefaultTab--;
					$("."+hiddenContentDiv+":eq("+showDefaultTab+")").css('display','block');
					$(navDiv+":eq("+showDefaultTab+")").addClass(selectedClass);	
				}
				
				// each anchor
				$(navDiv).each(function(){
										
					$(this).mouseover(function(){
						// once clicked, remove all classes
						$(navDiv).each(function(){
							$(this).removeClass();
						})
						// hide all content
						$("."+hiddenContentDiv).css('display','none');
						
						// now lets show the desired information
						$(this).addClass(selectedClass);
						var contentDivId = $(this).attr('title');
						
						if(effect != null){
							
							switch(effect){
								
								case 'slide':
								$("#"+contentDivId).slideDown(effectSpeed);
								break;
								case 'fade':
								$("#"+contentDivId).fadeIn(effectSpeed);
								break;
								
							}
								
						}
						else {
							$("#"+contentDivId).css('display','block');
						}
						return false;
					})
				})
			
			}
	
})(jQuery);	

//初始化

$(document).ready(function(){
		
		$.jtabber({
			mainLinkTag: ".opporRegTit a", // much like a css selector, you must have a 'title' attribute that links to the div id name
			activeLinkClass: "selected", // class that is applied to the tab once it's clicked
			hiddenContentClass: "opporReghiddencontent", // the class of the content you are hiding until the tab is clicked
			showDefaultTab: 1, // 1 will open the first tab, 2 will open the second etc.  null will open nothing by default
			showErrors: true, // true/false - if you want errors to be alerted to you
			effect: 'slide', // null, 'slide' or 'fade' - do you want your content to fade in or slide in?
			effectSpeed: 'fast' // 'slow', 'medium' or 'fast' - the speed of the effect
		})
		
	})
	


/*
**************************************
// sortslist turn  bgcolor 
// 产品分类列表  颜色背景切换
**************************************
*/


$(function(){
		$('.sortsBlock').hover(function(){
				//$(this).addClass('sortsListOver');
				//$(this).css('padding','1px');
				$(this).css('border','1px solid #a00');
				$(this).css('background-color','#FaFcFc');		
			},function(){
				//$(this).removeClass('sortsListOver');	
				//$(this).css('padding','1px');
				$(this).css('border','1px solid #dbdbdb');
				$(this).css('background-color','#FFF');
			}
		);
		
		$('.sortsBlockNarrow').hover(function(){
				//$(this).addClass('sortsListOver');
				//$(this).css('padding','1px');
				$(this).css('border','1px solid #a00');
				$(this).css('background-color','#FaFcFc');		
			},function(){
				//$(this).removeClass('sortsListOver');	
				//$(this).css('padding','1px');
				$(this).css('border','1px solid #dbdbdb');
				$(this).css('background-color','#FFF');
			}
		);
		
		$('.sortsBlockShort').hover(function(){
				//$(this).addClass('sortsListOver');
				//$(this).css('padding','1px');
				$(this).css('border','1px solid #a00');
				$(this).css('background-color','#FaFcFc');		
			},function(){
				//$(this).removeClass('sortsListOver');	
				//$(this).css('padding','1px');
				$(this).css('border','1px solid #dbdbdb');
				$(this).css('background-color','#FFF');
			}
		);
		
		$('.aClassification').hover(function(){
				$(this).css('background-color','#DAD0B1');
			},function(){
				$(this).css('background-color','#F9F7EC');
			}
		);
		$('.aClassificationNarrow').hover(function(){
				$(this).css('background-color','#DAD0B1');
			},function(){
				$(this).css('background-color','#F9F7EC');
			}
		);
		$('.aClassificationShort').hover(function(){
				$(this).css('background-color','#DAD0B1');
			},function(){
				$(this).css('background-color','#F9F7EC');
			}
		);
	});
	


