var timeFocus=null;
var timeHeadLine=null;
var timeRightLineA=null;
var timeRightLineB=null;
var timeRightLineC=null;
var timeRightLineD=null;
//滚动新闻
function Marquee1(){
	if(demo2.offsetLeft-demo.scrollLeft<=0)
	{
	    demo.scrollLeft-=demo1.offsetWidth 
	}
	else
	{
	    demo.scrollLeft=demo.scrollLeft+1
	}
}
//切换
function SwitchCtrl(name,count,index)
{
	for(var i=0;i<=count;i++)
	{
		var objCtrl=document.getElementById(name+'_Ctrl_'+i);
		var objCont=document.getElementById(name+'_Cont_'+i);
		if(index==i)
		{
			objCtrl.className=name+"_Select";
			objCont.style.display="block";
		}
		else
		{
			objCtrl.className=name+"_Default";
			objCont.style.display="none";
		}
	}
}
//焦点切换
function ChangeFocusPic(iIndex)
{
	window.clearTimeout(timeFocus);
	try
	{
	var obj=document.getElementById('HeadPhoto_Cont_'+iIndex);
	obj.filters[0].apply();
	obj.filters[0].play();
	}
	catch(ex)
	{
	}	
	SwitchCtrl('HeadPhoto',2,iIndex);
	iIndex++;
	if(iIndex>2)iIndex=0;
	timeFocus=window.setTimeout("ChangeFocusPic("+iIndex+")",5000);
}
//头条切换，注意，增加切换项时要调整数字
function ChangeHeadLine(iIndex)
{
    window.clearTimeout(timeHeadLine);
	SwitchCtrl('NewsSwitch',2,iIndex);
	iIndex++;
	if(iIndex>2)iIndex=0;
	timeHeadLine=window.setTimeout("ChangeHeadLine("+iIndex+")",30000);
}
//右A切换，注意，增加切换项时要调整数字
function ChangeRightLineA(iIndex)
{
    window.clearTimeout(timeRightLineA);
	SwitchCtrl('RightLineA',1,iIndex);
	iIndex++;
	if(iIndex>1)iIndex=0;
	timeRightLineA=window.setTimeout("ChangeRightLineA("+iIndex+")",10000);
}
//右B切换，注意，增加切换项时要调整数字
function ChangeRightLineB(iIndex)
{
    window.clearTimeout(timeRightLineB);
	SwitchCtrl('RightLineB',2,iIndex);
	iIndex++;
	if(iIndex>2)iIndex=0;
	timeRightLineB=window.setTimeout("ChangeRightLineB("+iIndex+")",10000);
}
//右C切换，注意，增加切换项时要调整数字
function ChangeRightLineC(iIndex)
{
    window.clearTimeout(timeRightLineC);
	SwitchCtrl('RightLineC',2,iIndex);
	iIndex++;
	if(iIndex>2)iIndex=0;
	timeRightLineC=window.setTimeout("ChangeRightLineC("+iIndex+")",10000);
}
//右D切换，注意，增加切换项时要调整数字
function ChangeRightLineD(iIndex)
{
    window.clearTimeout(timeRightLineD);
	SwitchCtrl('RightLineD',2,iIndex);
	iIndex++;
	if(iIndex>2)iIndex=0;
	timeRightLineD=window.setTimeout("ChangeRightLineD("+iIndex+")",10000);
}
//图片大小
function ChangePhotoSize(imgID,widthLimit,heightLimit,count)
{
	/*
	count++;
	var imgObj=document.getElementById(imgID);
	var randomSpan=Math.random()*1000;
	try
	{
		if(imgObj.height>heightLimit)
		{
			var newWidth=(imgObj.width)*heightLimit/imgObj.height;
			imgObj.height=heightLimit;
			imgObj.style.height=heightLimit+'px';
			imgObj.width=newWidth;
			imgObj.style.width=newWidth+'px';
		}
		if(imgObj.width>widthLimit)
		{
			var newHeight=(imgObj.height)*widthLimit/imgObj.width;
			imgObj.width=widthLimit;
			imgObj.style.width=widthLimit+'px';
			imgObj.height=newHeight;
			imgObj.style.height=newHeight+'px';
		}
		if(count<5)setTimeout("ChangePhotoSize('"+imgID+"',"+widthLimit+","+heightLimit+","+count+")",1000+randomSpan);
	}
	catch(ex)
	{
		if(count<5)setTimeout("ChangePhotoSize('"+imgID+"',"+widthLimit+","+heightLimit+","+count+")",1000+randomSpan);
	}
	*/
}