
// JavaScript file for TVNZ - NZOOM.com Portal
// Created by Native Design Limited, 02/2000
// SUPPORTS JAVASCRIPT 1.2 and above....
// Notes: Sorry but the structure of creating includes and formatting text
// had to be done using tables and cells rather than <font> or css styles. This is
// because of the differences ways IE and NS handle styles. Line height and cell
// padding had to be removed and recreated with table cells ...

// Modified 1/3/2000, CBC: All FC menu links are to directory level only
// This includes onenews, onebusiness & technology

// Modified 23/03/2000 - Jump menus and various links (news - review) changed

// ==============================================================
// SITE WIDE SIDE NAVIGATION
// ==============================================================

function getServer(){
	//tempStr = document.URL;
	//tempStrOffset = tempStr.indexOf("/",7);
	//return(tempStr.slice(0,tempStrOffset+1));
	//return('http://<!--#echo var="SERVER_NAME"-->/');
	
	// comment/uncomment as needed
	// return('http://xnzoom/');
	return('http://nzoom.com/');
}

var RootSiteBaseURL = getServer();
var menuCount = 3; // how many main site sections there are

// DEFINE ARRAYS
// array count starts from 0
// naming convention : arMenu_"menuRef"_"menuSectionRef"_"subMenuSectionRef
// arrayName = new Array(display title, url, number of submenus)

//SITE MENUS
arMenu_0 = new menuObj("HOME","",15,"_top");
arMenu_1 = new menuObj("SERVICES",'#',4,"_top");
arMenu_2 = new menuObj("ABOUT NZOOM","",4,"_top");

//SECTION MENUS
arMenu_0_0 = new menuObj("ONE News","onenews/", 5,"_top");
arMenu_0_1 = new menuObj("ONE Sport","onesport/", 14,"_top");
arMenu_0_2 = new menuObj("ONE Weather","http://oneweather.nzoom.com/",5,"_top");
arMenu_0_3 = new menuObj("ONE Business","http://onebusiness.nzoom.com/",5,"_top");
arMenu_0_4 = new menuObj("Technology","technology/",6,"_top");
arMenu_0_5 = new menuObj("OnTV","ontv/",2,"_top");
arMenu_0_6 = new menuObj("TV ONE","http://tvone.nzoom.com/",0,"_top");
arMenu_0_7 = new menuObj("TV2","http://tv2.nzoom.com/",0,"_top");
arMenu_0_8 = new menuObj("Entertainment","entertainment/",6,"_top");
arMenu_0_9 = new menuObj("Travel","travel/",8,"_top");
arMenu_0_10 = new menuObj("Home & Garden","homeandgarden/",5,"_top");
arMenu_0_11 = new menuObj("Good Taste","goodtaste/",3,"_top");
arMenu_0_12 = new menuObj("Horoscopes","horoscopes/",5,"_top");
arMenu_0_13 = new menuObj("Jobs","jobs/index.html?seek.co.nz/tvnz/whatsnew.htm",3,"_top");
arMenu_0_14 = new menuObj("Competitions","http://nzoom.com/competitions" ,0,"_top");

arMenu_1_0 = new menuObj("nzoomail","http://nzoomail.com",0,"_top");
arMenu_1_1 = new menuObj("nzoom Direct","http://direct.nzoom.com",0,"_top");
arMenu_1_2 = new menuObj("NZ Directory",'http://search.nzoom.com',0,"_top");
arMenu_1_3 = new menuObj("Moving House?",'http://changemyaddress.co.nz',0,"_top");
//arMenu_1_3 = new menuObj("Desktop Direct","http://nzoomdirect.nzoom.com" ,0,"_top");

arMenu_2_0 = new menuObj("Help","about/help/",5,"_top");
arMenu_2_1 = new menuObj("Contact","about/contact/",0,"_top");
arMenu_2_2 = new menuObj("Sitemap","about/sitemap/",0,"_top");
arMenu_2_3 = new menuObj("Ad Info","about/adinfo/",0,"_top");

// SUB SECTION MENUS
// HOME:ONE News
arMenu_0_0_0 = new menuObj("national","onenews/national/",0,"_top");
arMenu_0_0_1 = new menuObj("world","onenews/world/",0,"_top");
arMenu_0_0_2 = new menuObj("politics","onenews/politics/",0,"_top");
arMenu_0_0_3 = new menuObj("review","onenews/review/",0,"_top");
arMenu_0_0_4 = new menuObj("health news","onenews/health/",0,"_top");
arMenu_0_0_5 = new menuObj("features","onenews/features/",0,"_top");

// HOME:ONE Sport
arMenu_0_1_0 = new menuObj("rugby","onesport/rugby/",0,"_top");
arMenu_0_1_1 = new menuObj("olympics","http://oneolympics.nzoom.com/",0,"_top");
arMenu_0_1_2 = new menuObj("netball","http://www.netballnz.co.nz",0,"_blank");
arMenu_0_1_3 = new menuObj("league","onesport/league/",0,"_top");
arMenu_0_1_4 = new menuObj("basketball","onesport/basketball/",0,"_top");
arMenu_0_1_5 = new menuObj("golf","onesport/golf/",0,"_top");
arMenu_0_1_6 = new menuObj("cricket","onesport/cricket/",0,"_top");
arMenu_0_1_7 = new menuObj("soccer","onesport/soccer/",0,"_top");
arMenu_0_1_8 = new menuObj("motor","onesport/motor/",0,"_top");
arMenu_0_1_9 = new menuObj("racing","onesport/racing/",0,"_top");
arMenu_0_1_10 = new menuObj("other sports","onesport/other/",0,"_top");
arMenu_0_1_11 = new menuObj("livescoring","onesport/livescoring/",0,"_top");
arMenu_0_1_12 = new menuObj("video","onesport/video/",0,"_top");
arMenu_0_1_13 = new menuObj("comment","onesport/comment/",0,"_top");

// HOME:ONE Weather
arMenu_0_2_0 = new menuObj("satellites","weather/story.html?story_satellites.inc",0,"_top");
arMenu_0_2_1 = new menuObj("jim's place","weather/story.html?story_jim.inc",0,"_top");
arMenu_0_2_2 = new menuObj("metservice","http://www.metservice.co.nz",0,"_blank");
arMenu_0_2_3 = new menuObj("surf.co.nz","http://www.surf.co.nz",0,"_blank");
arMenu_0_2_4 = new menuObj("snow.co.nz","http://www.snow.co.nz",0,"_blank");

// HOME:ONE Business
arMenu_0_3_0 = new menuObj("News","http://onebusiness.nzoom.com/business_subcategory/0,1249,3-13,00.html",0,"_top");
arMenu_0_3_1 = new menuObj("Video","http://onebusiness.nzoom.com/business_subcategory/0,1249,3-14,00.html",0,"_top");
arMenu_0_3_2 = new menuObj("Commentary","http://onebusiness.nzoom.com/business_subcategory/0,1249,3-10,00.html",0,"_top");
arMenu_0_3_3 = new menuObj("Markets","http://henley.nzoom.com/index.asp",0,"_top");
arMenu_0_3_4 = new menuObj("Links","http://onebusiness.nzoom.com/business_subcategory/0,1249,3-11,00.html",0,"_top");

// HOME:Technology
arMenu_0_4_0 = new menuObj("commentary","technology/commentary/",0,"_top");
arMenu_0_4_1 = new menuObj("e-commerce","technology/ecommerce/",0,"_top");
arMenu_0_4_2 = new menuObj("innternet","technology/internet/",0,"_top");
arMenu_0_4_3 = new menuObj("developments","technology/developments/",0,"_top");
arMenu_0_4_4 = new menuObj("communications","technology/communications/",0,"_top");
arMenu_0_4_5 = new menuObj("e-showcase","technology/eshowcase/",0,"_top");

// HOME:ON TV
// H Maddocks. 6/3/2000. Changed these links to point to shedule script.
arMenu_0_5_0 = new menuObj("tvone","scripts/nzoom/daylist.pl?ch=default_one",0,"_top");
arMenu_0_5_1 = new menuObj("tv2","scripts/nzoom/daylist.pl?ch=default_two",0,"_top");

// TVONE
arMenu_0_6_0 = new menuObj("tvone","http://tvone.nzoom.com/",0,"_top");

// TV 2
arMenu_0_7_0 = new menuObj("tv 2","http://tv2.nzoom.com/",0,"_top");

// HOME:ENTERTAINMENT
arMenu_0_8_0 = new menuObj("rant","entertainment/rant/",0,"_top");
arMenu_0_8_1 = new menuObj("film","entertainment/film/",0,"_top");
arMenu_0_8_2 = new menuObj("in print","entertainment/books/",0,"_top");
arMenu_0_8_3 = new menuObj("music","entertainment/music/",0,"_top");
arMenu_0_8_4 = new menuObj("style","entertainment/style/",0,"_top");
arMenu_0_8_5 = new menuObj("tv dinner","entertainment/tvdinner/",0,"_top");
arMenu_0_8_6 = new menuObj("kidzone","entertainment/kidzone/",0,"_top");

// HOME:Travel
arMenu_0_9_0 = new menuObj("travel news","travel/news/",0,"_top");
arMenu_0_9_1 = new menuObj("online booking","http://www3.travel.com.au/everestnz/index.cgi?e=runAssociate&associate_id=10001",0,"_top");
arMenu_0_9_2 = new menuObj("special deals","travel/deals/",0,"_top");
arMenu_0_9_3 = new menuObj("nz destinations","travel/newzealand/",0,"_top");
arMenu_0_9_4 = new menuObj("int. destinations","travel/international/",0,"_top");
arMenu_0_9_5 = new menuObj("int. destinations","travel/international/",0,"_top");
arMenu_0_9_6 = new menuObj("business travel","travel/business/",0,"_top");
arMenu_0_9_7 = new menuObj("transport","travel/transport/",0,"_top");
arMenu_0_9_8 = new menuObj("special interest","travel/special/",0,"_top");
arMenu_0_9_9 = new menuObj("services & tools","travel/services/",0,"_top");

// HOME:Home & Garden
arMenu_0_10_0 = new menuObj("real estate","homeandgarden/realestate/",0,"_top");
arMenu_0_10_1 = new menuObj("gardening","homeandgarden/gardening/",0,"_top");
arMenu_0_10_2 = new menuObj("landscaping","homeandgarden/landscaping/",0,"_top");
arMenu_0_10_3 = new menuObj("renovation","homeandgarden/renovations/",0,"_top");
arMenu_0_10_4 = new menuObj("interior design","homeandgarden/interior/",0,"_top");
arMenu_0_10_5 = new menuObj("building your home","homeandgarden/building/",0,"_top");

// Good Taste
arMenu_0_11_0 = new menuObj("Good Taste","goodtaste/",0,"_top");
arMenu_0_11_0 = new menuObj("Recipes","goodtaste/recipes/",0,"_top");
arMenu_0_11_0 = new menuObj("Food & Drink","goodtaste/fooddrink/",0,"_top");
arMenu_0_11_0 = new menuObj("Fashion & Style","goodtaste/style/",0,"_top");

// HOME:Horoscopes
arMenu_0_12_0 = new menuObj("daily","horoscopes/",0,"_top");
arMenu_0_12_1 = new menuObj("weekly","horoscopes/story.html?story_weekly_horoscopes.inc",0,"_top");
arMenu_0_12_2 = new menuObj("monthly","horoscopes/story.html?story_monthly_horoscopes.inc",0,"_top");

// HOME:Jobs
//changed - 05/04/2000 - CEM
arMenu_0_13_0 = new menuObj("New Zealand","jobs/index.html?seek.co.nz/tvnz/whatsnew.htm",0,"_top");
arMenu_0_13_1 = new menuObj("Australia","jobs/index.html?seek.co.nz/tvnz/whatsnew.htm",0,"_top");
arMenu_0_13_2 = new menuObj("jobs@nzoom.com","about/internal_jobs/",0,"_top");
//arMenu_0_10_2 = new menuObj("International","jobs/frames.html?www.futurestep.co.nz",0,"_top");
//arMenu_0_10_3 = new menuObj("employment consultants","http://www.seek.co.nz/users/compprofileslist.asp?ConsultantSearch=1",0,"main");
//arMenu_0_10_4 = new menuObj("virtual interviewer","http://www.seek.co.nz/if.asp?loc=interviewer",0,"main");
//arMenu_0_10_5 = new menuObj("advertiser centre","http://www.seek.co.nz/advertisers/AdvNavigation.asp",0,"main");

// ABOUT:Help
arMenu_2_0_0 = new menuObj("browser version","about/help/help_browser.html",0,"_top");
arMenu_2_0_1 = new menuObj("firewalls","about/help/help_fire.html",0,"_top");
arMenu_2_0_2 = new menuObj("enabling javaScript","about/help/help_java.html",0,"_top");
arMenu_2_0_3 = new menuObj("screen settings","about/help/help_screen.html",0,"_top");
arMenu_2_0_4 = new menuObj("make my home","about/help/home_screen.html",0,"_top");

	
// creates a menu object containing a display name, url and child count
function menuObj(displayName,urlLink,childCount,targetFrame) {
	this.name = displayName;
	this.url = urlLink;
	this.children = childCount;
	this.target = targetFrame;
}
	
// creates the include table using data stored in the above arrays
// executed from the html page
function displayMenu(menuSiteNum,sectionSiteNum,targetFrame) {
// menuSiteNum contains 0, 1, or 2 to target what menu index is current
// sectionSiteNum contains the number for the current active menu, or nothing if a site title
	var localURL = "";
	
/*	if(displayMenu.arguments.length > 3){
		localURL = displayMenu.arguments[3];
	}
	else{*/
		localURL = RootSiteBaseURL;
	//}
	
// Redundant variable - needs to be removed when FAT sites no longer call it
	var targetFrame
	if (targetFrame) {
		var targetFrame = targetFrame;
	}
	else {
		var targetFrame = "";
	}

	// define default colouring for menu index headers (HOME, FAVOURITES, ABOUT)
	menuColor = new Array("#CCCCFF","#CCCCFF","#CCCCFF"); // default color light blue
	if (sectionSiteNum == "nothing") { // if subsite is set to nothing else 0, 1, 2
		menuColor[menuSiteNum] = "#FFFFFF"; // color title white
	}
	
	// OUTPUT CONTENT TABLE
	document.write("<TABLE WIDTH=135 BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=#9999CC>");
	
  // SITE MENUS
	for (i = 0; i < menuCount; i++) {
	   // if the current site menu is not the first one then place cell padding to define site sections
	   if (i > 0) { document.write("<TR><TD height=10 colspan=2>&nbsp;</td></tr>");
	   }
	   // output table row and 2 table collums for the site menu
	   document.write("<TR BGCOLOR=" + menuColor[i] + ">");
	   document.write("<TD HEIGHT=18 WIDTH=15>&nbsp;</TD>");
	   if (i == 0){
		 	if((eval("arMenu_" + i).url).search("http") != -1){
				document.write("<TD HEIGHT=18 CLASS=navLeft valign='middle'> <a href='" + eval("arMenu_" + i).url + "' target='" + eval("arMenu_" + i).target + "'>" + eval("arMenu_" + i).name + "</a></TD>");
			}
			else{
				document.write("<TD HEIGHT=18 CLASS=navLeft valign='middle'> <a href='" + localURL + eval("arMenu_" + i).url + "' target='" + eval("arMenu_" + i).target + "'>" + eval("arMenu_" + i).name + "</a></TD>");
			}
		 }
		 else {
		 	document.write("<TD HEIGHT=18 valign='middle' height=20 CLASS=navLeft>" + eval("arMenu_" + i).name + "</a></TD>");
		 }
		 document.write("</TR>");
		 
	   // output section menus
		 for (j = 0; j <  eval("arMenu_" + i).children; j++) {
		 		sectionMenu(menuSiteNum, sectionSiteNum, i, j, localURL);
	 	 } // end for
		 
	} // end for
	
	//document.write('<TR BGCOLOR="#333366"><TD height=20 colspan=2 align="center">&nbsp;<br><img src="http://nzoom.com/images/site_month.gif" width="120" height="60" alt="" border="0"></td></tr>');
	//document.write('<TR BGCOLOR="#333366"><TD height=20 colspan=2 align="center">&nbsp;<br><img src="http://nzoom.com/images/tourism120.gif" alt="" border="0"></td></tr>');
	document.write("</TABLE>");

} // end function


// creates section menu with child links
function sectionMenu(tmNum, tsNum, cmNum, csNum, localURL) {
	// tmNum = the active site menu number
	// tsNum = the active section menu number
	// cmNum = the current site menu number
	// csNum = the current section menu number
	
	if((eval("arMenu_"+cmNum+"_"+csNum).url).search("http") != -1){
		siteURL = eval("arMenu_"+cmNum+"_"+csNum).url;
	}
	else{
		siteURL = localURL + eval("arMenu_"+cmNum+"_"+csNum).url;
	}
	
	document.write("<TR>");
	
  if (tmNum == cmNum) {
		if (tsNum == csNum) {
	    // output cell with white bg
			if (csNum == 0 ) { // if the first menu item put small space and set white
				document.write("<TD colspan=2 HEIGHT=1 BGCOLOR=#FFFFFF><IMG SRC='"+ localURL +"images/shim.gif' HEIGHT=1></TD></tr>");
			}
			else {// else put 5px space and set blue between menu items
				document.write("<TD colspan=2 HEIGHT=5 BGCOLOR=#9999CC><IMG SRC='"+ localURL +"images/shim.gif' HEIGHT=5></TD></tr>");
      }
			document.write("<TR>");
			document.write("<TD HEIGHT=18 BGCOLOR=#FFFFFF>&nbsp;</TD>");
			document.write("<TD HEIGHT=18 BGCOLOR=#FFFFFF CLASS=navLeft valign='middle'>");
			document.write("<a href='" + siteURL + "' target='_top'>" + eval("arMenu_"+cmNum+"_"+csNum).name + "</a><br>");
			document.write("</TD>");
			document.write("</TR>");
			
			// output children menus
			if (eval("arMenu_"+cmNum+"_"+csNum).children == 0 ) {
				// if no children exist then nothing
      document.write("<TR><TD colspan=2 HEIGHT=5 BGCOLOR=#9999CC><IMG SRC='"+ localURL +"images/shim.gif' HEIGHT=5></TD></TR>");
			}
			else { // else output children
				document.write("<TR BGCOLOR=#FFFFFF>");
				document.write("<TD>&nbsp</TD>");
				document.write("<TD>");
				document.write("<TABLE WIDTH=115 BORDER=0 CELLSPACING=0 CELLPADDING=0>");
				for (k = 0; k <  eval("arMenu_"+cmNum+"_"+csNum).children; k++) {
					if((eval("arMenu_"+cmNum+"_"+csNum+"_"+k).url).search("http") != -1){
						sectionURL = eval("arMenu_"+cmNum+"_"+csNum+"_"+k).url;
					}
					else{
						sectionURL = localURL + eval("arMenu_"+cmNum+"_"+csNum+"_"+k).url;
					}
					document.write("<TR>");
					document.write("<TD HEIGHT=17 WIDTH=5 ALIGN=LEFT>-</TD>");
					document.write("<TD WIDTH=2></TD>");
					document.write("<TD WIDTH=108 CLASS='textWhiteSub' valign='middle'>");
					document.write("<A HREF='" + sectionURL + "' target='" + eval("arMenu_"+cmNum+"_"+csNum+"_"+k).target + "'> " + eval("arMenu_"+cmNum+"_"+csNum+"_"+k).name + "</a><br>");
					document.write("</TD></TR>");
				} // end for
				document.write("</TABLE></TD></TR>");
	      document.write("<TR><TD colspan=2 HEIGHT=5 BGCOLOR=#FFFFFF><IMG SRC='"+ localURL +"images/shim.gif' HEIGHT=5></TD></TR>");
	      document.write("<TR><TD colspan=2 HEIGHT=5 BGCOLOR=#9999CC><IMG SRC='"+ localURL +"images/shim.gif' HEIGHT=5></TD></TR>");
			}
		}
		else { // else under the current active site menu but not the current active section menu
	 		document.write("<TD HEIGHT=18 >&nbsp;</TD>");
			document.write("<TD HEIGHT=18 CLASS='navLeft' valign='middle'>");
			document.write("<a href='" + siteURL + "' target='" + eval("arMenu_"+cmNum+"_"+csNum).target + "'>" + eval("arMenu_"+cmNum+"_"+csNum).name + "</a><br>");
			document.write("</TD>"); 
			document.write("</TR>");
		}
	}
	else { // else not under the current active site menu
		document.write("<TD HEIGHT=18 >&nbsp;</TD>");
		document.write("<TD HEIGHT=18 CLASS='navLeft' valign='middle'>");
		document.write("<a href='" + siteURL + "' target='" + eval("arMenu_"+cmNum+"_"+csNum).target + "'>" + eval("arMenu_"+cmNum+"_"+csNum).name + "</a><br>");
		document.write("</TD>"); 
		document.write("</TR>");
	}
}

// ==============================================================
// HOME AND GARDEN REALNZ DROP DOWN
// ==============================================================

// JumpMenu
function realnzJumpMenu(targ,selObj,restore,URL){ //v3.0
	//open the selected location in a new window
	window.open(eval('"'+URL+selObj.options[selObj.selectedIndex].value+'"'),"realnz");

  if (restore) selObj.selectedIndex=0;
}

// ==============================================================
// DATE FUNCTIONS
// ==============================================================

// Initialisies array for date
function isnArray() { 
	argnr = isnArray.arguments.length;
	for (var i = 0; i < argnr; i++) {
		this[i] = isnArray.arguments[i];
	}
}

// Function to display the date
function displayDate(wantYear) {
	//var months = new isnArray("","January","February","March","April","May","June","July","August","September","October","November","December");
	var months = new isnArray("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	var days = new isnArray("","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");				
	var dateObj = new Date(); // todays date
	var wday = days[dateObj.getDay() + 1];
	var lmonth = months[dateObj.getMonth() + 1];
	var date = dateObj.getDate();
	var fyear = dateObj.getYear();
	if (fyear < 2000) {
		fyear = fyear + 1900;
	}
	if(wantYear=='noyear'){
		return(wday + ", " + lmonth + " " + date);
	}
	else{
		return(wday + ", " + lmonth + " " + date + ", " + fyear);
	}
}


// ==============================================================
// MENU IN CONTENT FUNCTIONS
// ==============================================================
// creates the title banner with pic and color for any col header
// converts text to UPPERCASE
function makeHeader(colNum,colorWord,titleStr) {
	var localURL = "";
	
	if(makeHeader.arguments.length > 3){
		localURL = makeHeader.arguments[3];
	}
	else{
		localURL = RootSiteBaseURL;
	}
	
	// arrayName (col0, col1, col3)
	var arWidth = new Array("290","145","450","610")
	// find the color
	switch (colorWord.toUpperCase()) {
	case "ORANGE": valCol = "#FF9900"; break;
	case "GREEN": valCol = "#99CC33"; break;
	case "DKGREEN": valCol = "#336633"; break;
	case "BLUE": valCol = "#000066"; break;
	case "PURPLE": valCol = "#9999CC"; break;
	case "LTPURPLE": valCol = "#CCCCFF"; break;
	case "YELLOW": valCol = "#FFFFCF"; break;
	case "BROWN" : valCol = "#CC6600" ; break;
	case "GREY" : valCol = "#636363" ; break;
	case "RED" : valCol = "#A50000" ; break;
	case "DAWSONPURPLE" : valCol = "#660066" ; break;
	case "ENTBLUE" : valCol = "#996699" ; break;
	case "PIGGREEN" : valCol = "#999933" ; break;	
	case "PIGBLUE" : valCol = "#336699" ; break;	
	case "TECHLTBLUE" : valCol = "#99CCFF" ; break;	
	case "TECHMEDBLUE" : valCol = "#0099FF" ; break;	
	case "TECHDKBLUE" : valCol = "#333399" ; break;
	case "WEATHERRED" : valCol = "#990000" ; break;
	case "WEATHERBLUE" : valCol = "#333399" ; break;
	case "TV2GREEN" : valCol = "#CCFF66" ; break;
	case "TV2RED" : valCol = "#CC3333" ; break;	
	case "DIRDKBLUE" : valCol = "#333366" ; break;
	case "DIRBLUE" : valCol = "#0066CC" ; break;	
	case "GOLD": valCol = "#CC9966"; break;
	case "BLUEZOOM": valCol = "#3366CC"; break;
	case "REDZOOM": valCol = "#CC0033"; break;
	case "TRAVGREEN": valCol = "#006666"; break;
	case "TRAVTEAL": valCol = "#339999"; break;
	case "TRAVBLUE": valCol = "#006699"; break;
	case "GARDENRED": valCol = "#990033"; break;
	case "GARDENGREEN": valCol = "#339933"; break;
	case "GOLFDKGREEN": valCol = "#339900"; break;
	case "COMEDYBLUE": valCol = "#33CCCC"; break;		
	case "ONTVGOLD": valCol = "#CC9933"; break;		
	case "VIBRANTPURPLE": valCol = "#6600FF"; break;		
	case "ORANGEENT": valCol = "#FF6600"; break;
	case "BLUEENT": valCol = "#000099"; break;
	
	// business colors
	case "BISBLUE": valCol = "#000066" ; break;
	case "BISORANGE": valCol = "#FF6600" ; break;
	case "LTORANGE": valCol = "#FFCC66"; break;
	case "BIZBLUE": valCol = "#336699" ; break;
	case "DELRED": valCol = "#003366"; break;
	
	default : valCol = "#FF9900"; break; // orange
	}
	
	// write out with title in uppercase
	document.write ("<TR><TD COLSPAN=2>"); // colspan = 2 for adinfo
	document.write ("<TABLE WIDTH=" + arWidth[colNum] + " BORDER=0 CELLSPACING=0 CELLPADDING=0 VSPACE=0 HSPACE=0>");
	document.write ("<TR BGCOLOR=" + valCol + ">");
	document.write ("<TD BGCOLOR='#000000' WIDTH=15 VALIGN=CENTER><IMG SRC='" + localURL + "images/downarrow.gif' WIDTH=15 HEIGHT=15></TD>");
	document.write ("<TD WIDTH=5><IMG SRC='"+ localURL +"images/shim.gif' WIDTH=5></TD>");
	document.write ("<TD WIDTH=" + arWidth[colNum] + " CLASS='textWhite'>" + titleStr.toUpperCase() + "</TD>");
	document.write ("</TR>");
	document.write ("</TABLE>");
	document.write ("</TD></TR>");
}

// ==============================================================
// FUNCTIONS FOR ONE BUSINESS
// ==============================================================
// Function for launching the Stock Gallery Pop-up in a new undecorated window
function showQuote() {
	code = document.forms['QuoteForm'].elements['StockCode'].value;
	url = "http://tvnz.iguana.co.nz/popup.php?StockCode="+code;
	window.open(url, 'quote', "status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=501,height=300");
}
// script for handling video popup windows and market snapshots
function openAWindow( pageToLoad, winName, width, height, center, x, y) 
{ /* Script from Project Cool Inc.*/
		xposition=0; yposition=0;
		if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
			xposition = (screen.width - width) / 2;
			yposition = (screen.height - height) / 2;
		}
		args = "width=" + width + "," 
		+ "height=" + height + "," 
		+ "location=0," 
		+ "menubar=0,"
		+ "resizable=0,"
		+ "scrollbars=0,"
		+ "status=0," 
		+ "titlebar=1,"
		+ "toolbar=0,"
		+ "hotkeys=0,"
		+ "screenx=" + x + ","  //NN Only
		+ "screeny=" + y + ","  //NN Only
		+ "left=0" + xposition + ","     //IE Only
		+ "top=0" + yposition;           //IE Only
		
		//if(pageToLoad.search("video") != -1) {
		//	alert("Due to technical difficulties we are unble to show Video Content today.");
		//}
		//else{
			window.open( pageToLoad,winName,args );
		//}
}

// ==============================================================
// MISC FUNCTIONS
// ==============================================================
// Function for Opening a new window with external page inside
function openWindow(theURL,winName,features) {
			window.open(theURL,winName,features);
}

function get_version () {
	// Returns the version for netscape in multiples of 1000			
	return Math.round(parseFloat(navigator.appVersion) * 1000);
}

function openDesigner() {  
	// Opens designer in a window minus the browser gunk at the top
	if ( get_version() < 3000 ) {
		alert ("We are sorry, but to open the Bathroom Designer you will need a browser of version 3.x or later.");
	} else {
	if ( (navigator.appName.substring(0,9) == "Microsoft") && (navigator.appVersion.indexOf("Mac") > 0 ) ) {
		alert("Because of limitations in Internet Explorer for Macintosh, some features of this site may not work.");
	}	
	designerWin = window.open("http://comp.tvnz.co.nz/kitchen_designer/designer.htm", 'Designer', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=636,height=429,alwaysRaised=yes,dependent=no");	// bring the window to the front
	designerWin.focus();
	//return false;
	}
}

// ==============================================================
// FUNCTIONS FOR TRAVEL
// ==============================================================
// WindowOpener
var windowHandle = '';
function go(what) {
		//Changed by cem to prevent same page loading
		if (what[what.selectedIndex].value!="#") {
	    windowHandle = window.open(what[what.selectedIndex].value,'consulatePopup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=350,height=250');
		}
}

function myVoid() {}

//browser checker

// ==============================================================
// FUNCTIONS FOR ONE SPORT
// ==============================================================
// JumpMenu
function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
function newWindow(file,window) {
    msgWindow=open(file,window,'width=480,height=500,scrollbars=yes,resizeable=yes');
    if (msgWindow.opener == null) msgWindow.opener = self;
}
function load(file,target) {
    if (target != '')
        target.window.location.href = file;
    else
        window.location.href = file;
}

// ==============================================================
// MAKE MY HOMEPAGE FUNCTIONS
// ==============================================================
// Function for setting homepage
//Modified 20/03/00 - please be aware that nzoom.com has to be hard coded for use on the henley site

var bName = bName(); // get browser name
var bVer = parseFloat(navigator.appVersion); // get browser version
       
function bName() {
// return 1 for Internet Explorer
if (navigator.appName == "Microsoft Internet Explorer")
	 return 1;
// return 2 for Navigator
if (navigator.appName == "Netscape")
	return 2;
// return 0 for other browsers
	return 0;
}

function setMyHomePage(homeURL) {
if ((bName > 0 ) && (bVer >= 4)){ // if ie or netscape
	if (bName == 1) { // if ie checks version of ie
		
		if (navigator.userAgent.indexOf("IE 5")>-1 && navigator.platform.indexOf("Win16") == -1)
			return("<a HREF='#' onClick=\"this.style.behavior='url(#default#homepage)';this.setHomePage('http://nzoom.com');\">make this my homepage</a>");
		}
	else /// if netscape
		return("<a HREF='http://nzoom.com/about/help/home_screen.html'>make this my homepage</a>");
	}
else // if not ie or netscape
	dummy = 1;  //variable to make IE 4 work don't ask why this works - it just does
	return("<a HREF='http://nzoom.com/about/help/home_screen.html'>make this my homepage</a>");
}

// Opens a competition in the required windows etc
function openComp(compURL){
  compWin = window.open(compURL, "Competition", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=316,height=432,alwaysRaised=yes,dependent=no");
  compWin.focus();
}

// ==============================================================
// MAKE FOOTER FUNCTION
// ==============================================================

function makeFooter(){
	
	var footerStr = "";
	var localURL = "";
	
	if(makeFooter.arguments.length > 0){
		localURL = makeFooter.arguments[0];
	}
	else{
		localURL = RootSiteBaseURL;
	}
			
footerStr += "<!-- begin web directory table -->";
footerStr += "<!-- hide from search-engine -->";
footerStr += "<alkaline skip>";
footerStr += "<TABLE WIDTH=\"760\" CELLPADDING=\"0\" CELLSPACING=\"0\" BORDER=\"0\">";
footerStr += "<TR>";
footerStr += "<TD WIDTH=\"135\" BGCOLOR=\"#333366\"><A HREF=\"http://entertainment.nzoom.com/rant/story.html?story_nzoom_wins.inc\"><IMG SRC='"+ localURL +"images/nzoom_award.gif' WIDTH=\"135\" HEIGHT=\"64\" VSPACE=\"10\" BORDER=\"0\" ALT=\"Net Guide Site of the Year 2000\"></A></TD>";
footerStr += "<TD WIDTH=\"15\"><IMG SRC='"+ localURL +"images/shim.gif' WIDTH=\"15\" HEIGHT=\"15\"></TD>";
footerStr += "<TD WIDTH=\"610\" HEIGHT=\"30\" CLASS=\"textSmall\"><A HREF=\"" + localURL + "about/legal/story.html?story_copyright.inc\">&copy; nzoom.com</A> | ";
footerStr += "<A HREF=\"" + localURL + "about/legal/story.html?story_access.inc\">Access Conditions</A> | <A HREF=\"" + localURL + "about/legal/story.html?story_privacy.inc\">Privacy Policy</A> | ";
footerStr += "<A HREF=\"" + localURL + "jobs/internal_jobs/\">jobs@nzoom.com</A> | ";
footerStr += "<A HREF=\"http://mbu.nzoom.com\">Production Services</A>";
footerStr += "</TD>";
footerStr += "</TR>";
footerStr += "</FORM>";
footerStr += "</TABLE>";
footerStr += "</alkaline>";

	document.write(footerStr);

}

// ==============================================================
// MAKE BANNER FUNCTION
// ==============================================================
/*
THIS FUNCTIONALITY IS OBSOLETE DO NOT USE IN NEW PAGES!!! 
USE header.cgi INSTEAD
SEE \\animal\cgi-bin\nzoom\header.cgi FOR DETAILS
*/

function makeBanner(){

	var bannerStr = "";
	var localURL = "";
	
	/* this makes the default search scope 'nzoom.com' if we are at 
	 * an nzoom.com search/result page
	 * otherwise the default scope is 'the web'
	 * added by Nick Breen 02/02/2001
	 */
	var checked1 = " ";
	var checked2 = " checked ";
	if ( location.host.indexOf("search.nzoom.com") == 0 ) {
		checked1 = " checked ";
		checked2 = " ";
	}
	
/*	if(makeBanner.arguments.length > 0){
		localURL = makeBanner.arguments[0];
	}
	else{
*/
		localURL = RootSiteBaseURL;
//	}
		
bannerStr += "<!-- hide from search-engine -->";
bannerStr += "<alkaline skip>";
bannerStr += "<TABLE WIDTH=\"760\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">";
bannerStr += "<TR>";
bannerStr += "<TD WIDTH=\"292\"><A HREF=\"" + localURL + "\"><IMG SRC=\"" + localURL + "images/nzoom_logo_new.gif\" WIDTH=\"292\" HEIGHT=\"60\" BORDER=\"0\" ALT=\"nzoom.com - The Homepage for New Zealanders\"></A></TD>";
bannerStr += "<TD WIDTH=\"468\" BGCOLOR=\"#CCCCCC\" ALIGN=\"CENTER\">" + putBanner() + "</TD>"; 
bannerStr += "</TR>";
bannerStr += "<TR><TD COLSPAN=\"2\" HEIGHT=\"1\" BGCOLOR=\"#FFFFFF\"><IMG SRC=\"" + localURL + "images/search_shim.gif\" WIDTH=\"11\" HEIGHT=\"1\" ALT=\"\"></TD></TR>";
bannerStr += "<FORM NAME=\"searchFormHeader\" METHOD=\"get\" ACTION=\"http://nzoom.com/cgi-bin/nzoomsearch2.pl\">";
bannerStr += "<TR><TD COLSPAN=\"2\" BGCOLOR=\"#CECECE\">";
bannerStr += "<TABLE WIDTH=\"100%\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">";
bannerStr += "<TR>"; 
bannerStr += "<TD WIDTH=\"11\" BGCOLOR=\"#CCCCCC\"><IMG SRC=\"" + localURL + "images/search_curve.gif\" WIDTH=\"11\" HEIGHT=\"27\" ALT=\"\"></TD>";
bannerStr += "<TD BGCOLOR=\"#CCCCCC\" NOWRAP><B><FONT COLOR=\"#333366\">SEARCH :</FONT></B></TD>";
bannerStr += "<TD WIDTH=\"10\"BGCOLOR=\"#CCCCCC\"><IMG SRC=\"" + localURL + "images/shim.gif\" WIDTH=\"10\" HEIGHT=\"27\" ALT=\"\"></TD>";
bannerStr += "<TD WIDTH=\"25\" BGCOLOR=\"#CCCCCC\">"; 
bannerStr += "<INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"search=nz\" CLASS=\"radioButton\" onFocus=\"this.blur()\"" + checked1 + ">";
bannerStr += "</TD>";
bannerStr += "<TD WIDTH=\"45\" BGCOLOR=\"#CCCCCC\" NOWRAP>nz sites</TD>";
bannerStr += "<TD WIDTH=\"25\" BGCOLOR=\"#CCCCCC\">"; 
bannerStr += "<INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"search=nzoom\" CLASS=\"radioButton\" onFocus=\"this.blur()\"" + checked2 + ">";
bannerStr += "</TD>";
bannerStr += "<TD WIDTH=\"45\" BGCOLOR=\"#CCCCCC\" NOWRAP>nzoom</TD>";
bannerStr += "<TD WIDTH=\"10\"BGCOLOR=\"#CCCCCC\"><IMG SRC=\"" + localURL + "images/shim.gif\" WIDTH=\"10\" HEIGHT=\"27\" ALT=\"\"></TD>";
bannerStr += "<TD BGCOLOR=\"#CCCCCC\" NOWRAP ALIGN=\"right\"><B><FONT COLOR=\"#333366\">FOR :</FONT></B></TD>";
bannerStr += "<TD WIDTH=\"140\" BGCOLOR=\"#CCCCCC\" ALIGN=\"right\">"; 
bannerStr += "<INPUT TYPE=\"text\" NAME=\"keywords\" SIZE=\"20\" CLASS=\"dropdown\">";
//bannerStr += "<INPUT NAME=\"tag\" TYPE=\"hidden\" VALUE=\"st.sn.dirsb\">";
bannerStr += "</TD>";
bannerStr += "<TD BGCOLOR=\"#CCCCCC\"><IMG SRC=\"" + localURL + "images/shim.gif\" WIDTH=\"10\" HEIGHT=\"21\" ALT=\"\"><INPUT TYPE=\"image\" NAME=\"submit\" SRC=\"" + localURL + "images/search_go_alt.gif\" WIDTH=\"21\" HEIGHT=\"21\" BORDER=\"0\" ALT=\"go\" onFocus=\"this.blur()\"><IMG SRC=\"" + localURL + "images/shim.gif\" WIDTH=\"10\" HEIGHT=\"21\" ALT=\"\"></TD>";
bannerStr += "<TD WIDTH=\"1\" BGCOLOR=\"#FFFFFF\"><SPACER TYPE=\"block\" WIDTH=\"1\" HEIGHT=\"1\"></TD>";
bannerStr += "<TD WIDTH=\"10\"><SPACER TYPE=\"block\" WIDTH=\"10\" HEIGHT=\"1\"></TD>";
bannerStr += "<TD><B><FONT COLOR=\"#333366\">MORE SEARCH :</B></FONT></TD>";
bannerStr += "<TD><IMG SRC=\"" + localURL + "images/shim.gif\" WIDTH=\"5\" HEIGHT=\"5\" ALT=\"\"></TD>";
bannerStr += "<TD ALIGN=\"right\">";
bannerStr += "<SELECT NAME=\"NZOOMJumpMenu\" onChange=\"MM_jumpMenu(\'parent\',this,0)\" SIZE=\"1\" CLASS=\"dropdown\">";
bannerStr += "<OPTION VALUE=\"#\" SELECTED>Select...</OPTION>";
bannerStr += "<OPTION VALUE=\"#\">&nbsp;</OPTION>";
bannerStr += "<OPTION VALUE=\"http://nzoom.com/web_search.html\">- Web Search</OPTION>";
bannerStr += "<OPTION VALUE=\"http://www.bluemountain.com\">- Ecards</OPTION>";
bannerStr += "<OPTION VALUE=\"http://au.games.yahoo.com\">- Games</OPTION>";
bannerStr += "<OPTION VALUE=\"http://au.chat.yahoo.com/\">- Chat</OPTION>";
bannerStr += "<OPTION VALUE=\"http://www.whitepages.co.nz/\">- White Pages</OPTION>";
bannerStr += "<OPTION VALUE=\"http://www.yellowpages.co.nz/\">- Yellow Pages</OPTION>";
bannerStr += "</SELECT>";
bannerStr += "</TD>";
bannerStr += "</TR>";
bannerStr += "</TABLE>";
bannerStr += "</TD></TR>";
bannerStr += "</FORM>";
bannerStr += "<TR><TD COLSPAN=\"2\" HEIGHT=\"1\" BGCOLOR=\"#FFFFFF\"><SPACER TYPE=\"block\" WIDTH=\"1\" HEIGHT=\"1\"></TD></TR>";
bannerStr += "</TABLE>";
bannerStr += "<TABLE WIDTH=\"760\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">";
bannerStr += "<TR BGCOLOR=\"#333366\">";
bannerStr += "<TD WIDTH=\"165\" ROWSPAN=\"2\" COLSPAN=\"3\"><IMG SRC=\"" + localURL + "images/nzoom_logo_butt.gif\" WIDTH=\"165\" HEIGHT=\"33\" ALT=\"\"></TD>";
// Site functionality
// Redirect search anchor to Home#search in inside a frame Set
sPathSearch = "";
if (location != top.location) sPathSearch = localURL
bannerStr += "<TD WIDTH=\"20\"></TD>";
bannerStr +="<TD WIDTH=\"425\" HEIGHT=\"18\" CLASS=\"textWhite\">";
bannerStr += setMyHomePage();
bannerStr += "| <A HREF=\"http://search.nzoom.com\" TARGET='_top'>nz directory</A> | <A HREF=\"http://nzoom.com/web_search.html\" TARGET='_top'>web search</A> | <A HREF=\"http://www.nzoomail.com/\">nzoomail</A></TD>";
bannerStr += "<TD WIDTH=\"150\" ALIGN=\"right\" CLASS=\"textWhite\">" + displayDate() + "</TD>";
bannerStr += "</TR>";
bannerStr += "<TR>";
bannerStr += "<TD COLSPAN=\"4\" HEIGHT=\"15\"><SPACER TYPE=\"block\" WIDTH=\"20\" HEIGHT=\"15\"></TD>";
bannerStr += "</TR>";
bannerStr += "</TABLE>";
bannerStr += "</alkaline>";

	document.write(bannerStr);	       
	
}

// ==============================================================
// FUNCTION FOR HENLEY
// ==============================================================


function formHandler(form) {
	var windowprops = "height=411,width=480,location=no," + "scrollbars=no,menubars=no,toolbars=no,resizable=no";
	var URL = this.options[this.selectedIndex].value;
	popup = window.open(URL,"MenuPopup",windowprops);
}

// ==============================================================
// FUNCTION FOR MARKET SNAPSHOTS
// ==============================================================
function marketsHandler(form) {
var windowprops = "height=411,width=480,location=no,"
+ "scrollbars=no,menubars=no,toolbars=no,resizable=no";

var URL = form.site.options[form.site.selectedIndex].value;
popup = window.open(URL,"MenuPopup",windowprops);
}

// ==============================================================
// FUNCTION FOR POP UP WINDOW FOR REALPLAYER
// ==============================================================
function POP_UP() {
        window.open('http://nzoom.com/video_pop_up.html','VIDEO_POP_UP','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,copyhistory=no,scrollbars=no,width=565,height=475,top=100,left=100');
}

// ==============================================================
// FUNCTION FOR PULL DOWN MENUS ON TV PAGE
// ==============================================================
function openProgramme(theURL){
		if(theURL.indexOf(" ")==-1){
			window.open(theURL,'Window');
		}
		else{
			document.location = theURL;
		}
	}
	 
// ==============================================================
// FUNCTION FOR NZOOM POLL
// ==============================================================
function openVote()
{
	var search = "nzoomhwebjvotem=";
	
	if (document.cookie.length > 0)
	{
		// if there are any cookies
		offset = document.cookie.indexOf(search) 
      
		if (offset != -1)
		{
			// if cookie exists tell them sorry, can't vote twice.
			voteWindow = window.open( "http://nzoom.com/polls/webVote3.html", "", "scrollbars=no,resizeable=no,width=320,height=120");
			return;
		} 
	}	
	// Set the cookie to stop voting twice
	document.cookie = "nzoomhwebjvotem=" + escape("votedalready");

	// Open vote window.
	voteWindow = window.open( "/scripts/nzoom/polls/webVote2.pl", "", "scrollbars=no,resizeable=no,width=320,height=120");
	
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var windowHandle = null;
var globalImage = null;
var globalCaption = null;

function myOpen(localImage,localCaption,windowWidth,windowHeight,xPos,yPos) {
globalImage = localImage;
globalCaption = localCaption;
	
    windowHandle = window.open('../popup.html','popupPic','width=' + windowWidth + ',height=' + windowHeight + ',left=' + xPos + ',top=' + yPos + 'screenX=' + xPos + ',screenY=' + yPos);
    if (!windowHandle.opener)
        windowHandle.opener = self;
}

var windowHandle = null;
var globalLink = null;
var globalUrlReal = null;
var globalUrlWin = null;
var globalSect = null;

function popupVideo(localLink,localUrlReal,localUrlWin,localUrlAlt,localSect,windowWidth,windowHeight,xPos,yPos) {
globalLink = localLink;
globalUrlReal = localUrlReal;
globalUrlWin = localUrlWin;
globalUrlAlt = localUrlAlt;
globalSect = localSect;

    windowHandle = window.open('/common/popup','popupVideo','width=' + windowWidth + ',height=' + windowHeight + ',left=' + xPos + ',top=' + yPos + 'screenX=' + xPos + ',screenY=' + yPos);
    if (!windowHandle.opener)
        windowHandle.opener = self;
}

function myVoid() { }
