// JavaScript Document
//菜单切换
function Show_Tabs(tab_name,tab_index,tab_count)
{	
	for(var i=1;i<tab_count+1;i++)
		{
			document.getElementById(tab_name+i).style.left="-9999px";
			document.getElementById(tab_name+"_"+i).className=""+(i==4?" lst":"");
		}
	document.getElementById(tab_name+tab_index).style.left="0px";
	
	document.getElementById(tab_name+"_"+tab_index).className=" current"+(tab_index==4?" lst":"");
}
 
 
 if(document.getElementById('left')) {
window.onload=function height(){
var l,r;
l=document.getElementById('left');
r=document.getElementById('right');
l.clientHeight>r.clientHeight?r.style.height=(l.clientHeight-30)+'px':l.style.height=(r.clientHeight-20)+'px';
}}

//向上滚动
function startmarquee(lh,speed,delay,index){
var t;
var p=false;
var o=document.getElementById("marquee"+index);
o.innerHTML+=o.innerHTML;
o.onmouseover=function(){p=true}
o.onmouseout=function(){p=false}
o.scrollTop = 0;
function start(){
t=setInterval(scrolling,speed);
if(!p) o.scrollTop += 2;
}
function scrolling(){
if(o.scrollTop%lh!=0){
o.scrollTop += 2;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}






//等比例缩放图片，样式为imgbox
function imgFix( widthRestriction,  heightRestriction) { 
  //定义要限制的图片宽高,这个宽高要同style里面定义的相同，小于限定高宽的图片不操作 
  //var widthRestriction = 500; 
 // var heightRestriction = 350; 
  var allElements = document.getElementsByTagName('*')   
  for (var i = 0; i < allElements.length; i++) 
  { 
    
    if (allElements[i].className.indexOf('imgBox') >= 0) 
        { 
      var imgElements = allElements[i].getElementsByTagName('img'); 
	  
      for (var j=0; j < imgElements.length; j++) 
          { 
	
		imgElements[j].onclick=function(){window.open(this.src,"n","")}
   	imgElements[j].title="点击查看大图"
    	imgElements[j].style.cursor="pointer";
		  
        if ( imgElements[j].width > widthRestriction || imgElements[j].height > heightRestriction ) 
                { 
          if ( imgElements[j].width > imgElements[j].height) 
                  { 
            imgElements[j].height = imgElements[j].height*(widthRestriction/imgElements[j].width); 
            imgElements[j].width = widthRestriction; 
          } else 
                  { 
            imgElements[j].width = imgElements[j].width*(heightRestriction/imgElements[j].height); 
            imgElements[j].height = heightRestriction; 
          } 
        } 
                if ( imgElements[j].height < heightRestriction ) 
                { 
                  imgElements[j].style.paddingTop = ( heightRestriction -imgElements[j].height ) /2 + "px"; 
                } 
      } /*for j*/ 
    } 
  }/*for i*/ 
} 

