// JavaScript Document
var pic_curIndex=0;
function Pic_Show(index)
{
	if(pic_curIndex==index || index>=pic_pageCount || index<0)
		return;
	//var ctlB=document.getElementById('PicB_'+index);
	//var ctlCurB=document.getElementById('PicB_'+pic_curIndex);
	var ctlMenuItem=document.getElementById('Pic_Menu_'+index);
	var ctlCurMenuItem=document.getElementById('Pic_Menu_'+pic_curIndex);
	
	//if(ctlCurB)
		//ctlCurB.style.display='none';
	if(ctlCurMenuItem)
		ctlCurMenuItem.innerHTML = '<img src="http://img.7m.cn/s_img/pix_uns.gif">';
	//ctlB.style.display='';
	ctlMenuItem.innerHTML='<img src="http://img.7m.cn/s_img/pix_sed.gif">';
	
	var isLeft=pic_curIndex>index?true:false;
	pic_curIndex=index;
	pic_page=index+1;
	if(isLeft)
		pic_prev();
	else
		pic_next();
}

function pic_slide(p)
{
	if(p==0)
	{
		pic_subCtn.style.width=pic_itemWidth*pic_pageCount+'px';
	}
	else if(p<0)
	{
		if(pic_page>1)
		{
			pic_page--;
			Pic_Show(pic_page-1);
		}
	}
	else
	{
		if(pic_page<pic_pageCount)
		{
			pic_page++;
			Pic_Show(pic_page-1);
		}
	}
}
 
function pic_prev()
{
	var left=(pic_page-1)*pic_itemWidth;
	//alert('left='+left+'&scrollLeft='+pic_ctn.scrollLeft+'&style.left='+pic_ctn.style.left);
	if(pic_ctn.scrollLeft>left)
	{
		//alert(pic_ul.style.left);
		var a=pic_ctn.scrollLeft-10;
		a=Math.max(a,left);
		pic_ctn.scrollLeft=a;
		//alert(pic_ctn.scrollLeft);
		if(pic_timer)
			clearTimeout(pic_timer);
		setTimeout("pic_prev()",pic_timer);
		//pic_next();
	}
	else
	{
		//pic_ul.scrollLeft=left;
	}
}
 
function pic_next()
{
	var left=(pic_page-1)*pic_itemWidth;
	//alert('left='+left+'&scrollLeft='+pic_ctn.scrollLeft+'&style.left='+pic_ctn.style.left);
	if(pic_ctn.scrollLeft<left)
	{
		//alert(pic_ul.style.left);
		var a=pic_ctn.scrollLeft+10;
		a=Math.min(a,left);
		pic_ctn.scrollLeft=a;
		//alert(pic_ctn.scrollLeft);
		if(pic_timer)
			clearTimeout(pic_timer);
		setTimeout("pic_next()",pic_timer);
		//pic_next();
	}
	else
	{
		//pic_ctn.offsetLeft=left;
		//alert('over');
	}
}
 
var pic_autoTimer=null;
var pic_direction=1;
var pic_autoDelay=10000;
function pic_auto()
{
	//alert(pic_direction);
	if(pic_page==1)
		pic_direction=2;
	else if(pic_page==pic_pageCount)
		pic_direction=1;
	if(pic_direction==1)
		pic_slide(-1);
	else
		pic_slide(1);
	pic_autoTimer=setTimeout('pic_auto()',pic_autoDelay);
}
 
function pic_autoStart()
{
	if(pic_autoTimer)
		clearTimeout(pic_autoTimer);
	pic_autoTimer=setTimeout('pic_auto()',pic_autoDelay);
}
 
function pic_autoStop()
{
	if(pic_autoTimer)
		clearTimeout(pic_autoTimer);
}




var news_pic_curIndex=0;
function News_pic_Show(index)
{
	if(news_pic_curIndex==index || index>=news_pic_pageCount || index<0)
		return;
	var ctlMenuItem=document.getElementById('News_pic_Menu_'+index);
	var ctlCurMenuItem=document.getElementById('News_pic_Menu_'+news_pic_curIndex);
	
	if(ctlCurMenuItem)
		ctlCurMenuItem.innerHTML = '<img src="http://img.7m.cn/s_img/pix_uns.gif">';
		
	ctlMenuItem.innerHTML='<img src="http://img.7m.cn/s_img/pix_sed.gif">';
	
	var isLeft=news_pic_curIndex>index?true:false;
	news_pic_curIndex=index;
	news_pic_page=index+1;
	if(isLeft)
		news_pic_prev();
	else
		news_pic_next();
}

function news_pic_slide(p)
{
	if(p==0)
	{
		news_pic_subCtn.style.width=news_pic_itemWidth*news_pic_pageCount+'px';
	}
	else if(p<0)
	{
		if(news_pic_page>1)
		{
			news_pic_page--;
			News_pic_Show(news_pic_page-1);
		}
	}
	else
	{
		if(news_pic_page<news_pic_pageCount)
		{
			news_pic_page++;
			News_pic_Show(news_pic_page-1);
		}
	}
}
 
function news_pic_prev()
{
	var left=(news_pic_page-1)*news_pic_itemWidth;
	if(news_pic_ctn.scrollLeft>left)
	{
		//alert(news_pic_ul.style.left);
		var a=news_pic_ctn.scrollLeft-10;
		a=Math.max(a,left);
		news_pic_ctn.scrollLeft=a;
		if(news_pic_timer)
			clearTimeout(news_pic_timer);
		setTimeout("news_pic_prev()",news_pic_timer);
		//news_pic_next();
	}
	else
	{
		//news_pic_ul.scrollLeft=left;
	}
}
 
function news_pic_next()
{
	var left=(news_pic_page-1)*news_pic_itemWidth;
	//alert('left='+left+'&scrollLeft='+news_pic_ctn.scrollLeft+'&style.left='+news_pic_ctn.style.left);
	if(news_pic_ctn.scrollLeft<left)
	{
		//alert(news_pic_ul.style.left);
		var a=news_pic_ctn.scrollLeft+10;
		a=Math.min(a,left);
		news_pic_ctn.scrollLeft=a;
		//alert(news_pic_ctn.scrollLeft);
		if(news_pic_timer)
			clearTimeout(news_pic_timer);
		setTimeout("news_pic_next()",news_pic_timer);
		//news_pic_next();
	}
	else
	{
		//news_pic_ctn.offsetLeft=left;
		//alert('over');
	}
}
 
var news_pic_autoTimer=null;
var news_pic_direction=1;
var news_pic_autoDelay=10000;
function news_pic_auto()
{
	//alert(news_pic_direction);
	if(news_pic_page==1)
		news_pic_direction=2;
	else if(news_pic_page==news_pic_pageCount)
		news_pic_direction=1;
	if(news_pic_direction==1)
		news_pic_slide(-1);
	else
		news_pic_slide(1);
	news_pic_autoTimer=setTimeout('news_pic_auto()',news_pic_autoDelay);
}
 
function news_pic_autoStart()
{
	if(news_pic_autoTimer)
		clearTimeout(news_pic_autoTimer);
	news_pic_autoTimer=setTimeout('news_pic_auto()',news_pic_autoDelay);
}
 
function news_pic_autoStop()
{
	if(news_pic_autoTimer)
		clearTimeout(news_pic_autoTimer);
}


