﻿// JavaScript Document
var cpage = 0;								//当前页
var tpages = 0;								//总页数

function writeNewsList(ViewNum,PageCur) {
var newtmp = new Array();
var newlst = new Array();
var htmstr = "<ul>"						//输出HTML
var nstart = 0;								//选择启始新闻

if(ViewNum <= 0) ViewNum = 10;


newlst[0] = "TORIN DRIVE&rsquo;s Test Tower&rsquo;s roof covering ceremony|Aug., 12, 2007|"
newlst[1] = "Our in-depth development of European Strategy|Sep.19, 2007|"
newlst[2] = "Our Team attends Interlft&rsquo;07 Germany|Oct.16, 2007|"
newlst[3] = "We awarded China Non-governmental Technology &ldquo;Dual Excellence&rdquo;|Dec., 2007|"
newlst[4] = "TORIN DRIVE&rsquo;s establishment meeting|Nov. 28, 2007|"
newlst[5] = "TORIN DRIVE&rsquo;s wholly owed subsidiary established.|Dec., 2007|"
newlst[6] = "People-oriented, TORIN DRIVE strives to build the harmonious company|Dec., 2007|"
newlst[7] = "TORIN DRIVE&rsquo;s QCC activity|Dec., 2007|"
newlst[8] = "2008 Overseas Strategic Partners Conference of TORIN DRIVE|Jan. 17, 2008|"
newlst[9] = "TORIN DRIVE at World Elevator &amp; Escalator Expo&rsquo;08, China|April, 2008|"
newlst[10] = "Drafting group of a national standard items editing has been established.|May 10, 2008|"
newlst[11] = "TORIN DRIVE gives our hands to Sichuan earthquake victims.|May 16, 2008|"
newlst[12] = "Welcome the Olympics with civility, TORIN DRIVE held Test Tower-climbing contest.|June 27, 2008|"
newlst[13] = "Torin Drive\'s output and sales volume of traction machines rank first in China.|Jul.07, 2008|"
newlst[14] = "Torin Drive\'s productions are successfully used in \"The Bird's Nest\" and serve Beijing Olympic Games.|Aug.06, 2008|"
newlst[15] = "Torin Drive honored with \"China Elevator Enterprise with High-level Social Responsibility Award\".|Sep.24, 2008|"
newlst[16] = "Torin Drive lays the foundation of a new factory with 40000t precision castings.|Sep.26, 2008|"
newlst[17] = "Torin Drive honored with \"Jiangsu Excellent Cultural Enterprise in Machinery Industry\".|Nov.05, 2008|"
newlst[18] = "Torin Drive honored with \"Jiangsu AAAA-level Enterprise with High Quality and Good Faith\".|Nov.25, 2008|"
newlst[19] = "Torin Drive is honored with \"China Customer Satisfaction\" awarded by National Construction Machinery Equipment Customer Committee.|Dec.01, 2008|"
newlst[20] = "Torin Drive\'s team building in Yellow Mountain.|Mar.15, 2009|"
newlst[21] = "Torin Drive honored with \"2008 AAA-level Good Faith Enterprise in Machinery Industry\".|Mar.31, 2009|"
newlst[22] = "Torin Drive\'s group at \"11th International Lift Exhibition\" in Turkey.|Apr.12, 2009|"

//添加新闻在这里
//新闻数据格式：标题|时间|URL

newlst = newlst.reverse();
tpages = Math.ceil((newlst.length - 1) / ViewNum) - 1;			//0起计算

if(PageCur == 0) cpage = 0;							//首页
if(PageCur == -1) cpage = cpage - 1;		//上页
if(PageCur == 1) cpage = cpage + 1;			//下载
if(PageCur == 2) cpage = tpages;				//尾页

if(cpage < 0) cpage = 0;
if(cpage > tpages) cpage = tpages;

nstart = ViewNum * cpage;
for(var i = nstart; i < ViewNum + nstart; i ++){
	if(i < newlst.length){
		newtmp = newlst[i].split("|");
		htmstr += "<li>";
		if(newtmp[2] != ""){
			htmstr += "<a href=\"" + newtmp[2] + "\" target=\"_blank\">" + newtmp[0] + "</a>";
		}else{
			htmstr += newtmp[0];
		}
		htmstr += "&nbsp;&nbsp;<span style=\"color:#666\">(" + newtmp[1] + ")</span>" + "</li>";
	}
}
htmstr += "</ul>";
document.getElementById("newsContent").innerHTML = htmstr;
if(document.getElementById("cPage")) document.getElementById("cPage").innerHTML = cpage + 1;

}

function writePage(){
var htmstr = "<div style=\"text-align:center; height: 50px;\">CURRENT PAGE <span id=\"cPage\"><strong>" + (cpage + 1) + "</strong></span> / TOTAL <strong>" + (tpages + 1) + "</strong>&nbsp;&nbsp;&nbsp;";
htmstr += "<a href=\"####\" onclick=\"javascript:writeNewsList(" + ViewNum + ",0)" + "\">FIRST" + "</a>&nbsp;&nbsp;&nbsp;";
htmstr += "<a href=\"####\" onclick=\"javascript:writeNewsList(" + ViewNum + ",-1)" + "\">FORWARD" + "</a>&nbsp;&nbsp;&nbsp;";
htmstr += "<a href=\"####\" onclick=\"javascript:writeNewsList(" + ViewNum + ",1)" + "\">NEXT" + "</a>&nbsp;&nbsp;&nbsp;";
htmstr += "<a href=\"####\" onclick=\"javascript:writeNewsList(" + ViewNum + ",2)" + "\">LAST" + "</a></div>";
document.write(htmstr);
}