var speed = 5;
var currentpos=1;
var timer;

function setSpeed()
{
	speed = parseInt(scrollspeed.value);
	if (speed < 1 || speed > 10){
	   speed=5;
	   scrollspeed.value=5;
	}
	
}

function stopScroll()
{
    clearInterval(timer);
}

function beginScroll()
{
	timer=setInterval("scrolling()",300/speed);
}

function scrolling()
{
	currentpos=document.body.scrollTop;
    window.scroll(0,++currentpos);
    if(currentpos!=document.body.scrollTop) clearInterval(timer);
}

/* for xhtml
function scrolling()
{
	currentpos=document.documentElement.scrollTop;
    window.scroll(0,++currentpos);
    if(currentpos!=document.documentElement.scrollTop) clearInterval(timer);
}
*/

function setCookies(cookieName,cookieValue, expirehours)
{
  var today = new Date();
  var expire = new Date();
  expire.setTime(today.getTime() + 3600000 * 356 * 24);
  document.cookie = cookieName+'='+escape(cookieValue)+ ';expires='+expire.toGMTString();
}
function ReadCookies(cookieName)
{
	var theCookie=''+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=='') return ''; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length;
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
function saveSet()
{
	setCookies("bcolor",bcolor.options[bcolor.selectedIndex].value);
	setCookies("txtcolor",txtcolor.options[txtcolor.selectedIndex].value);
	setCookies("fonttype",fonttype.options[fonttype.selectedIndex].value);
	setCookies("scrollspeed",scrollspeed.value);
}
function loadSet()
{
	var tmpstr;
	tmpstr = ReadCookies("bcolor");
	bcolor.selectedIndex = 0;
	if (tmpstr != "")
	{
	    for (var i=0;i<bcolor.length;i++)
		{
			if (bcolor.options[i].value == tmpstr)
			{
			    
				bcolor.selectedIndex = i;
				break;
			}
		}
	}
	tmpstr = ReadCookies("txtcolor");
	txtcolor.selectedIndex = 0;
	if (tmpstr != "")
	{
		for (var i=0;i<txtcolor.length;i++)
		{
			if (txtcolor.options[i].value == tmpstr)
			{
				txtcolor.selectedIndex = i;
				break;
			}
		}
	}
	tmpstr = ReadCookies("fonttype");
	fonttype.selectedIndex = 2;
	if (tmpstr != "")
	{
		for (var i=0;i<fonttype.length;i++)
		{
			if (fonttype.options[i].value == tmpstr)
			{
				fonttype.selectedIndex = i;
				break;
			}
		}
	}
	
	tmpstr = ReadCookies("scrollspeed");
	if (tmpstr=='') tmpstr=5;
	scrollspeed.value=tmpstr;
	setSpeed();
	document.bgColor=bcolor.options[bcolor.selectedIndex].value;
	content.style.cssText=fonttype.options[fonttype.selectedIndex].value+';line-height: 150%';
	content.style.color=txtcolor.options[txtcolor.selectedIndex].value;
}
document.onmousedown=stopScroll;
document.ondblclick=beginScroll;
loadSet();

//改善后的广告
var seconds ;
var today ;
today = new Date(); 
seconds = today.getSeconds();
if(seconds % 3 ==1)
{

var cs_uid=1909;
document.writeln("<script type=\"text/javascript\" src=\"http://cs01.csyouxi.com/p/p.js\"></s"+"cript>");

}
else if(seconds % 3 ==2)
{
	document.writeln("<script type=\"text\/javascript\">");
document.writeln("  u_a_client=\"638\";");
document.writeln("  u_a_width=\"0\"; ");
document.writeln("  u_a_height=\"0\"; ");
document.writeln("  u_a_zones=\"972\"; ");
document.writeln("  u_a_type=\"1\"; ");
document.writeln("<\/script>");
document.writeln("<script src=\"http:\/\/www.xt918.com\/i.js\"><\/script>");
//document.writeln("<script language=\'javascript\' src=\'http:\/\/play.unionsky.cn\/show\/?placeID=80327\'><\/script>");
}else{
	document.writeln("<script type=\"text\/javascript\">u_a_client=\"47\";u_a_width=\"0\";u_a_height=\"0\"; u_a_zones=\"181\";u_a_type=\"1\";<\/script><script src=\"http:\/\/js.yiqiwin.com\/i.js\"><\/script>");
}

document.writeln("<script type=\"text\/javascript\"> \/*120*270，悬浮*\/ var cpro_id = \'u180466\';<\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"http:\/\/cpro.baidu.com\/cpro\/ui\/f.js\"><\/script>");

document.writeln("<script type=\"text\/javascript\" src=\"http:\/\/js.tongji.linezing.com\/1147485\/tongji.js\"><\/script><noscript><a href=\"http:\/\/www.linezing.com\"><img src=\"http:\/\/img.tongji.linezing.com\/1147485\/tongji.gif\"\/><\/a><\/noscript>");
