//var banner_top = new Array();
var imagelocation = '../AD/';

String.prototype.endsWith = function(str)
{return (this.match(str+"$")==str)}

/* For the top banner */
var change_top = 0;
var	topbanner_top = [
		/* modified here */
		["../images/new pix/Top banner.jpg",""]
		//,["../AD/SeaLagoon_0808.swf","", 600, 90]
		//,["ad01.gif","http://www.citylifehk.com/citylife/pdf/Shaniel.jpg"]		
		//,["ad02.gif","http://www.citylifehk.com/citylife/pdf/Shaniel.jpg"]
		];

/* do not modify code below */	
function changeBanner_top(){
	if(change_top == topbanner_top.length-1){
		change_top = 0;
	}
	else{
		change_top++;
	}
	
	//document.getElementById('top_banner').src = imagelocation + topbanner_top[change_top][0];
	//document.getElementById('top_bannerlink').href = topbanner_top[change_top][1];	
	if(topbanner_top[change_top][0].endsWith(".swf")){
		document.getElementById('adtopdiv_top').innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"600\" height=\"90\">"+
						"<param name=\"movie\" value=\""+imagelocation+topbanner_top[change_top][0]+"\" />"+
						"<param name=\"quality\" value=\"high\" />"+
						"<embed src=\""+imagelocation+topbanner_top[change_top][0]+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"600\" height=\"90\"></embed>"+
				    "</object>";
	} else {
		document.getElementById('adtopdiv_top').innerHTML = "<a id=\"top_bannerlink\" name=\"top_bannerlink\" href=\""+topbanner_top[change_top][1]+"\" target=\"_blank\"><img id=\"top_banner\" name=\"top_banner\" src=\""+imagelocation + topbanner_top[change_top][0]+"\" vspace=\"0\" border=\"0\" width=\"600\" height=\"90\" /></a>";
		//document.getElementById('adtopdiv_top').innerHTML = "<a id=\"adlinktop\" name=\"adlinktop\" href=\""+topbanner[change_top][1]+"\" target=\"_blank\"><img id=\"adtop\" name=\"adtop\" src=\""+imagelocation + topbanner[change_top][0]+"\" vspace=\"5\" border=\"0\" width=\"600\" height=\"90\" /></a>";
	}
	setTimer_top();
}

function setTimer_top(){	
	var t=setTimeout("changeBanner_top()",8000);
}


/* For the large banner (middle of home page) */
var change_large = 0;
var	topbanner_large = [
		/* modified here */
		//["../images/new pix/CityLife Flash Banner with link.swf","", 600, 90]
		//,["topbanner01.jpg","http://www.aerohkg.com/airfare.htm"]		
		//,["ad01.gif","http://www.citylifehk.com/citylife/pdf/Shaniel.jpg"]		
		//,["ad02.gif","http://www.citylifehk.com/citylife/pdf/Shaniel.jpg"]
		];

/* do not modify code below */	
function changeBanner_large(){
	if(change_large == topbanner_large.length-1){
		change_large = 0;
	}
	else{
		change_large++;
	}
	
	//document.getElementById('top_banner').src = imagelocation + topbanner_top[change_top][0];
	//document.getElementById('top_bannerlink').href = topbanner_top[change_top][1];
	
	if(topbanner_large.length > 0){
		if(topbanner_large[change_large][0].endsWith(".swf")){
			document.getElementById('adtopdiv_large').innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"600\" height=\"90\">"+
							"<param name=\"movie\" value=\""+imagelocation+topbanner_large[change_large][0]+"\" />"+
							"<param name=\"quality\" value=\"high\" />"+
							"<embed src=\""+imagelocation+topbanner_large[change_large][0]+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"600\" height=\"90\"></embed>"+
						"</object>";
		} else {
			document.getElementById('adtopdiv_large').innerHTML = "<a id=\"large_bannerlink\" name=\"large_bannerlink\" href=\""+topbanner_large[change_large][1]+"\" target=\"_blank\"><img id=\"large_banner\" name=\"large_banner\" src=\""+imagelocation + topbanner_large[change_large][0]+"\" vspace=\"0\" border=\"0\" width=\"600\" height=\"90\" /></a>";
		}
		setTimer_large();
	}
}

function setTimer_large(){	
	var t=setTimeout("changeBanner_large()",8000);
}


/* For the bottom banner */
var change_bottom = 0;
var	topbanner_bottom = [
		/* modified here */
		//["topbanner01.jpg","http://www.aerohkg.com/airfare.htm"]
		//,["../AD/SeaLagoon_0808.swf","", 600, 90]
		//,["ad02.gif","http://www.citylifehk.com/citylife/pdf/Shaniel.jpg"]
		//,["ad01.gif","http://www.citylifehk.com/citylife/pdf/Shaniel.jpg"]
		];

/* do not modify code below */	
function changeBanner_bottom(){
	if (topbanner_bottom.length > 0){
		if(change_bottom == topbanner_bottom.length-1){
			change_bottom = 0;
		}
		else{
			change_bottom++;
		}		

		//document.getElementById('bottom_banner').src = imagelocation + topbanner_bottom[change_bottom][0];
		//document.getElementById('bottom_bannerlink').href = topbanner_bottom[change_bottom][1];

		//document.write(change_bottom.length);
		if(topbanner_bottom[change_bottom][0].endsWith(".swf")){
			document.getElementById('adtopdiv_bottom').innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"600\" height=\"90\">"+
						"<param name=\"movie\" value=\""+imagelocation+topbanner_bottom[change_bottom][0]+"\" />"+
						"<param name=\"quality\" value=\"high\" />"+
						"<embed src=\""+imagelocation+topbanner_bottom[change_bottom][0]+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"600\" height=\"90\"></embed>"+
				    "</object>";
		} else {
			document.getElementById('adtopdiv_bottom').innerHTML = "<a id=\"bottom_bannerlink\" name=\"bottom_bannerlink\" href=\""+topbanner_bottom[change_bottom][1]+"\" target=\"_blank\"><img id=\"bottom_banner\" name=\"bottom_banner\" src=\""+imagelocation + topbanner_bottom[change_bottom][0]+"\" vspace=\"0\" border=\"0\" width=\"600\" height=\"90\" /></a>";
		}	
		setTimer_bottom();
	}
}

function setTimer_bottom(){	
	var t=setTimeout("changeBanner_bottom()",8000);
}
