function ad(imgSource1,imgSource2,url,type) {
   this.imgSource1 = imgSource1;
   this.imgSource2 = imgSource2;
   this.url = url;
   this.type = type;
}
function sub(url){
	window.open(url,'','width=400 height=235,resizable=yes');
}
function displayAd() {
	with (this)
	switch (type){
		case "img":
			document.write("<A HREF='#' onclick=sub('"+ url + "')><IMG SRC='" + imgSource1 + "' width='248' height='198' border='0'></A>");
			break;
		case "img1":
			document.write("<A HREF='" + url + "' ><IMG SRC='" + imgSource1 + "' width='203' height='34' border='0'></A>");
			break;
		case "news1":
			document.write("<a href='" + url + "' ><font color='#FFFFFF'>" + imgSource1 + "</font></a>");
			break;
		case "news2":
			document.write("<a href='" + url + "' ><font color='#FFFFFF'>" + imgSource1 + "</font></a><br>");
            document.write("<a href='" + url + "' ><font color='#FFFFFF'>" + imgSource2 + "</font></a>");
			break;
		case "flash":
			document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='727' height='152'>");
			document.write("    <param name='movie' value='" + imgSource1 + "'> ");
      document.write("    <param name='quality' value='high'> ");
      document.write("    <embed src='" + imgSource1 + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='727' height='152'></embed></object>");
			break;
		default:
			document.write("");
	}
}

ad.prototype.display = displayAd;
flash = new Array();
news = new Array();
wapnews = new Array();
pics = new Array();
button = new Array();

news[0] = new ad("10:23 黎巴嫩南部的联合国观察员办事处25日被以色列炮火击中，四名观察员丧生，包括一名中国观察员…","","javascript:opensmswindow();","news1");
news[1] = new ad("10:55 哈马斯首次表态称加沙武装愿接受一项与以色列的停火协议，并释放所俘获的以色列士兵沙利特…","","javascript:opensmswindow();","news1");
news[2] = new ad("15:32 王菲退出歌坛的消息，一下子搅动了“菲迷”的情绪。昨日就有激动的歌迷连续发帖称王菲退出，我就自杀…","","javascript:opensmswindow();","news1");
news[3] = new ad("07:05 “办公室真人秀”是俄罗斯一电视台节目,经常以床上示范吸引观众。日前该节目演员在现场表演中竟假戏真做，被人搞大了肚子…","","javascript:opensmswindow();","news1");

wapnews[0] = new ad("民航总局称国内航空公司上半年亏25.7亿…", "重庆将规定同性性交易以卖淫嫖娼论…","javascript:openwapwindow();","news2");
wapnews[1] = new ad("朝鲜与伊朗表示将发展议会友好关系…", "湖南卫视将举行赈灾义演筹集洪灾捐款…","javascript:openwapwindow();","news2");
wapnews[2] = new ad("成龙醉酒爆粗，李宗盛忍到极限曝其爱出风头…", "张学友：也曾年少轻狂…","javascript:openwapwindow();","news2");
wapnews[3] = new ad("广州警方开9枪果断击毙持刀抢劫歹徒…", "甩脂减肥无依据，消协警示：慎购甩脂机…","javascript:openwapwindow();","news2");

pics[0] = new ad("http://smsimg.126.net/news/top.jpg","","http://sms.163.com/sub/mulservice_sub.php?services=1001&link=http://news.163.com/06/0726/07/2MULUN3B0001124J.html","img");
pics[1] = new ad("http://smsimg.126.net/news/hot.jpg","","http://sms.163.com/sub/mulservice_sub.php?services=1009&link=http://news.163.com/06/0726/07/2MUM0V340001121M.html","img");
pics[2] = new ad("http://smsimg.126.net/news/ent.gif","","http://sms.163.com/sub/mulservice_sub.php?services=1016&link=http://ent.163.com/06/0714/08/2LVR1SIL00031H2L.html","img");
pics[3] = new ad("http://smsimg.126.net/news/soc.jpg","","http://sms.163.com/sub/mulservice_sub.php?services=1015&link=http://news.163.com/06/0725/18/2MT6N7MU00011229.html","img");

button[0] = new ad("http://smsimg.126.net/special/jump/news/images/news_20.gif","","javascript:opensmswindow();","img1");
button[1] = new ad("http://smsimg.126.net/special/jump/news/images/news_40.gif","","javascript:opensmswindow();","img1");
button[2] = new ad("http://smsimg.126.net/special/jump/news/images/news_43.gif","","javascript:opensmswindow();","img1");
button[3] = new ad("http://smsimg.126.net/special/jump/news/images/news_45.gif","","javascript:opensmswindow();","img1");

flash[0] = new ad("http://smsimg.126.net/special/jump/news/images/toutiao.swf","","","flash");
flash[1] = new ad("http://smsimg.126.net/special/jump/news/images/redian.swf","","","flash");
flash[2] = new ad("http://smsimg.126.net/special/jump/news/images/yule.swf","","","flash");
flash[3] = new ad("http://smsimg.126.net/special/jump/news/images/zonghe.swf","","","flash");

function adDisplay(pageIndex, newsIndex){
	if (newsIndex == 0) {
		news[pageIndex].display();
	}
	if (newsIndex == 1) {
		wapnews[pageIndex].display();
	}
	if (newsIndex == 2) {
		pics[pageIndex].display();
	}
	if (newsIndex == 3) {
	    button[pageIndex].display();
	}
	if (newsIndex == 4) {
	    flash[pageIndex].display();
	}
}

//adDisplay();
