//***********************************************************/
/* 文件名：Scroll.js										*/
/* 功能：文字上下卷动										*/
/* Author:小美 (shiate@sina.com)							*/
/* Copyright 2005 Xiaomei Studio All rights reserved.		*/
/************************************************************/
var timer_1;
var timer_2;
var waiting_time = 1500;
var scroll_time = 3;
// contents oˉ&#33616;
var scroll_height = 40;			//文字高度
var show_content_num = 6;		//文字卷动行数

function WriteTableTop_1(n) {
	var str = "<div id='scroller"+n+"'  style='position: absolute; height:49; width:90; top:"+n*scroll_height*show_content_num+";'>";
	str += "<table border='0' cellpadding='0' cellspacing='1' width='90'>";
	return str;
}

function WriteTableBottom_1() {
	var str = "</table></div>";
	return str;
}

function WriteTableBody_1(n) {
	var str = "<tr height='"+(scroll_height-1)+"'>";
	str += "<td width='100%'><a href='"+con_1[n][1]+"' target='_blank'><img width=88 height=31 src='"+con_1[n][2]+"'></a>&nbsp;</td>";
	str += "</tr>";
	return str;
}

function WriteTable_1() {
	var str="";

	oScrollMain_1.style.height = scroll_height*show_content_num;

	str = WriteTableTop_1(0);
	for (var i=0; i < num_1; i++ ) {
		if ( i%show_content_num == 0 && i!=0)
		{
			str += WriteTableBottom_1();
			str += WriteTableTop_1(parseInt(i/show_content_num,14));
		}
		str += WriteTableBody_1(i);
	}
	str += WriteTableBottom_1();
	oScrollMain_1.innerHTML = str;
	mainFrame_1();
}

function mainFrame_1(){
	timer_1 = setTimeout("scrolling_1()", waiting_time);
}

function mainFrame2_1(){
	timer_1 = setTimeout("scrolling_1()", 1);
}

function scrolling_1() {
	var obj_1;
	for (var i=0; i < num_1/show_content_num; i++) {
		obj_1 = document.getElementById("scroller"+i);
		obj_1.style.top = parseInt(obj_1.style.top) - 1;
		
		if (parseInt(obj_1.style.top) == scroll_height*(num_1-show_content_num)*(-1)){
			obj_1.style.top = scroll_height*show_content_num;
		}
	}
		if (parseInt(obj_1.style.top)%scroll_height == 0) {
		/*if (parseInt(scroller0.style.top)%scroll_height == 0) {*/
			scrolling_stop_1();
			timer_1 = setTimeout("mainFrame_1()", 1);
			return;
		}
	timer_1 = setTimeout("scrolling_1()", scroll_time);
}

function scrolling_stop_1() {
	clearTimeout(timer_1);
}