﻿/********************************************************************
*                                                                   *
*               Ji'an of China WebSite v2006                        *
*               With all best Wishes for HanJuan                    *
*                                                                   *
*               videonews.js,  2009/07/08, NetFeng                  *
*                                                                   *
********************************************************************/


function CE(T) {return document.createElement(T)}

function G(ID, W) {
	try {
		return ( W || window ).document.getElementById(ID);
	}
	catch( e ) {
		return null;
	}
}

var videoWindow = null
function showVideo(URI)
{       
  if (! videoWindow || videoWindow.closed)
  {
    videoWindow = window.open(URI,"nf_video","toolbar=no,resizable=no,status=no,menuba=no,scrollbars=no,dependent,width=619,height=418,top=0,left=0");
  }else
  {
     videoWindow.focus();
   }
}

function videoList(n) {
	var aDate = new Date();
	var H     = aDate.getHours();
	if (H < 20) {                            //每天的新闻要在20:00之后才能录制完成
		aDate.setDate(aDate.getDate()-1);
	}
	var LaterDate;
	var TB1 = G("nf_videolist");
	var TY1 = CE("tbody");
	TY1.id = "nf_tbody";
	TB1.style.margin = "6px 0px 0px 0px";
	for (i=0; i<n; i++) {
		var TR1 = CE("tr"), TD1 = CE("td"), TD2 = CE("td"), SP1 = CE("span");
		var D = aDate.getDate(), M = aDate.getMonth()+1, Y = aDate.getFullYear();
		TD1.width = "84%";
		TD1.className = "xuxian";
		videoDate = Y.toString() + (M>9 ? M:"0"+M.toString()).toString()+(D>9 ? D:"0"+D.toString()).toString();
		var videoLink = 'showVideo(\'videonews/videonews.html?mms://218.64.81.4:9186/videonews/' + videoDate + '-1.wmv\');';
		TD1.innerHTML = '&nbsp;&middot;<a href="javascript:' + videoLink + '" class="zw">' + M + '月' + D + '日吉安视频新闻</a>';
		TD2.className = "xuxian";
		SP1.className = "zw1";
		SP1.innerHTML = (M>9 ? M:"0"+M)+ "-" + (D>9 ? D:"0"+D);
		TD2.appendChild(SP1);
		TR1.appendChild(TD1);
		TR1.appendChild(TD2);
		TY1.appendChild(TR1);
		LaterDate = aDate.getDate()-1;
		aDate.setDate(LaterDate);
	}
	TB1.appendChild(TY1);
}


function initVideo() {
	videoList(9);
}


window.onload = initVideo;
