/*  Javascript News.com.au
	
	index ->	
			dropdown nav
			tertiary nav
			aegis quote box
			tab-o-matic
			popups	
			SWFObject
			Accipiter rewrite
			Federal Election 07
*/

/* requiers cleanup */
function getElementsByClassNameHBX(clss, prnt, tg) {
    var elements = [];
    tg = tg || '*';
    prnt = prnt || document;
    var list = prnt.getElementsByTagName(tg);
	var sscA = "[\\s]" + clss + "[\\s]";
	var sscB = "[\\s]" + clss + "$";
	var sscC = "^" + clss + "[\\s]";
	var sscD = "^" + clss + "$";
	var cA = new RegExp(sscA);
	var cB = new RegExp(sscB);
	var cC = new RegExp(sscC);
	var cD = new RegExp(sscD);
    for (var i = 0; i < list.length; ++i) {
        if ((cA.test(list[i].className)) ||(cB.test(list[i].className)) || (cC.test(list[i].className)) || (cD.test(list[i].className))) {
            elements.push(list[i]);
        }
    }
	return elements;
}

function renderAd(divName, aambTag) {
    var invObj = 'INV' + divName;
	var isMotif = 0;
	var templateKick = "<script type=\"text/javascript\">var inDapIF = true;</script>";    
    try { 
	    var aamCode = templateKick + eval(aambTag); 
		if(aamCode.indexOf('doubleclick') >= 0) {
		   isMotif = 1;
		}
		if(aamCode.indexOf("buster_url=" > 0)) {
		    aamCode = aamCode.replace("buster_url=", "buster_url=http://www.foxsports.com.au/atlas_rm.html");
		}
		aamCode += "<script type=\"text/javascript\">document.writeln('<scr' + 'ipt language=\"javascript\" defer=\"yes\">document.close();</scr' + 'ipt>'); </script>";

	}
    catch(aamErr) { }
      
    if (typeof(aamCode) != 'undefined') {   
        var msieIdx = navigator.userAgent.indexOf('MSIE');
        if(msieIdx > -1) {
            
            // IE
            var ifrString = '<iframe name="' + invObj + '" width="0" height="0" frameborder="0" AAM_EVENT="javascript:try { document.getElementById(\'' + divName + '\').insertAdjacentElement(\'beforeEnd\', window.frames[\'' + invObj + '\'].document.getElementById(\'adDiv\')) } catch(aamErr) { }"></iframe>';
               
            if(parseInt(navigator.userAgent.substring(msieIdx + 5).split(' ')[0]) < 7) {

                // IE6
				if(isMotif == 1) {
					    document.getElementById(divName).innerHTML += ifrString.replace(/AAM_EVENT/, 'onload');
				} else {
                   document.getElementById(divName).innerHTML += ifrString.replace(/AAM_EVENT/, 'onreadystatechange');
				}
                window.frames[invObj].document.writeln('<div id="adDiv">' + aamCode);

            } else {        
                // IE7 
                document.getElementById(divName).innerHTML += '<div id="TMP' + divName + '" style="display:none">' + escape('<body><div id="adDiv">' + aamCode + '</div>') + '</div>' + ifrString.replace(/AAM_EVENT/, 'onload');
                window.frames[invObj].document.location = 'javascript:unescape(parent.document.getElementById(\'TMP' + divName + '\').innerHTML)';
            }
               
            // Not IE         
        } else document.writeln('<div id="' + invObj + '" style="display:none">' + aamCode + '<script type="text/javascript" defer="true">document.getElementById(\'' + divName + '\').innerHTML = document.getElementById(\'' + invObj + '\').innerHTML;document.getElementById(\'' + invObj + '\').innerHTML = \'\';</scr' + 'ipt></div>');
    }
}


adsPainted = false;

function aamAppendNewIframes() {
	if (/firefox\/[12][.]/.test(navigator.userAgent.toLowerCase())) { 
		document.close();
		var allIframes = document.getElementsByTagName('iframe');
		var currIframe = [];
		for (a = 0; a < allIframes.length; a++)
		   currIframe[currIframe.length] = allIframes[a];         
		
		for (c = 0; c < currIframe.length; c++) {
		   var newIframe = document.createElement('iframe');
		   
		   newIframe.width = currIframe[c].width; 
		   newIframe.height = currIframe[c].height;            
		   newIframe.frameBorder = 0;
		   newIframe.scrolling = 'no';
		   newIframe.marginWidth = 0;
		   newIframe.marginHeight = 0;
		   newIframe.style.display = 'none';
		
		   currIframe[c].parentNode.appendChild(newIframe);
		   var newIframeDocument = newIframe.contentWindow.document;
		   newIframeDocument.open();
		   newIframeDocument.writeln('<html><head></head><body></body></html>');
		   newIframeDocument.close();
		}
	}                          
}


window.onpageshow = function() {
    aamAppendNewIframes();
}


function isDefined(myObject) {
    return (typeof(myObject) != "undefined");
}


function selectedValue(nodeList) {
	for (var i=0; i<nodeList.length; i++) {
		if (nodeList[i].checked) {
		    return nodeList[i].value;
		}
	}
	
	return null;
}

function checkSiteVar() {
    niSearchForm = document.getElementById("ni-search");
	niSearchTerm = document.getElementById("ninnsearch");
	if(document.getElementById("local-search").checked) {
	    niSearchForm.setAttribute("action", "http://www.truelocal.com.au/oneBoxSearch.do");
		niSearchTerm.setAttribute("name", "term");
		niSearchForm.setAttribute("method", "get");
    } else {
	    //niSearchForm.setAttribute("action", "http://searchresults.news.com.au/servlet/Search");
		niSearchTerm.setAttribute("name", "queryterm");
		niSearchForm.setAttribute("method", "get");
	}
	niSearchForm.submit();
}


function pollSubmit(pollForm) {
	var option = selectedValue(pollForm.option);
	var addr   = pollForm.action + "?option="+option;

	window.open(addr, 'nipoll', 'width=550, height=450'); 
		
	return false;
}

/* ---- =aegis stock box ---- */
/* -------------------------- */

// pull stock quote form data and append to url
function goStockUrl() {
	var quoteID = document.getElementById('quote').value;
	window.location.href = "http://markets.news.com.au/newscorp/entry.aspx?secid=" + quoteID;
}

function linkStockUrl(v) {
	// For some reason directly linking to a stock page does not work.  So I have been requested to make set the window location in js
	window.open("http://markets.news.com.au/newscorp/entry.aspx?secid="+v);
}


/* popups
----------------------*/
function getStyle( elem, name ) {
    // If the property exists in style[], then it¿s been set recently (and is current)
    if (elem.style[name])
        return elem.style[name];
    // Otherwise, try to use IE¿s method
    else if (elem.currentStyle)
        return elem.currentStyle[name];
    // Or the W3C¿s method, if it exists
    else if (document.defaultView && document.defaultView.getComputedStyle) {
        // It uses the traditional `text-align¿ style of rule writing, instead of textAlign
        name = name.replace(/([A-Z])/g,"-$1");
        name = name.toLowerCase();
        // Get the style object and get the value of the property (if it exists)
        var s = document.defaultView.getComputedStyle(elem,"");
        return s && s.getPropertyValue(name);

    // Otherwise, we¿re using some other browser
    } else
        return null;
}

Popup = function ( node ) {
	// set popup trigger
	this.trigger = node;
	// get popup type from rel		
	this.type = this.trigger.getAttribute('rel') || '';
	// default height
	this.height = 800;
	// set base
	this.bars = 'yes';
	// default width
	this.width = 800;
	// create pop ref
	this.dispWindow = document.createElement('div');
	// build window
	this.build();
}

Popup.prototype.build = function () {
	// object refernce for closures
	var obj = this;
	// css driven popup
	if (this.type.indexOf('custom') === -1 && this.type) {
		// add classname
		this.dispWindow.className = 'popup';
		// hide from client
		this.dispWindow.style.display = 'none';
		//add to dom
		this.dispWindow = document.body.appendChild(this.dispWindow);
		// window
		// set classname
		this.dispWindow.className += ' ' + this.type;
		// get height from css class
		this.height = parseInt(getStyle(this.dispWindow, 'height' ));
		// get width from css class
		this.width 	= parseInt(getStyle(this.dispWindow, 'width' ));
		// get scroll bars from css class, if result is scroll set bars to yes
		this.bars	= (getStyle(this.dispWindow, 'overflow' ) == 'scroll') ? 
			this.bars = 'yes' : this.bars = 'no';
	// custom popup
	} else if (this.type) {
		// get dimensions
		var custom 	= this.custom({width: '', height:''});
	}
	
	this.trigger.onclick =  function(){
		// show popup
		obj.show();
		// cancel default
		return(false);
	}
}
	
Popup.prototype.custom = function (options) {
	// object reference for closures
	var obj = this;
	// holds formatted type
	var formatted = this.type;
	// loops through options obj (height, width)
	for (var i in options) { (
		function () {
			// regular expression that matches first integer set in string
			formatted = formatted.replace(/[0-9]{1,}/,
			// method that deals with match
			function(thematch){
				// sets option property equal to match
				obj[i] = thematch;
			});
		})();
	}
}
	
Popup.prototype.show = function () {
	window.open(this.trigger.getAttribute('href'), '',
	'width=' + this.width + ',height=' + this.height + ' ,scrollbars=' + this.bars + 
	',status=yes,toolbar=no,menubar=no,location=no,resizable=yes');
}

function pop_preview() {
	/* given from MAST-226 */
	newwindow=window.open('https://shop.bubble.com/preview/weekahead/?ref=newscomau','name','height=560,width=650');
	if (window.focus) {newwindow.focus()} return false;
}



/* font size change 
------------------- */

var curFontSize = 1; 	
var fontModifier = 0.1; 	

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) {
	    endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate(date) {
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0)  {
		date.setTime (date.getTime() - skew);
	}
}

function GetCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i=0;
	while (i < clen) {	
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
		    return getCookieVal (j);
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i === 0) {
		    break;
		}
	}
	return null;
}

function SetCookie(name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape (value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}

/* insert hi-res logo and call window print */
function printStoryPage() {
	 if (document.getElementById("print-logo")){
         document.getElementById("print-logo").setAttribute("src", "/images/print/print-logo.jpg");
	     window.print();
	 }
}

function fontSize(act) {
    if (document.getElementById) {
        storyBody = document.getElementById("text-big");
		storyComments = document.getElementById("story-comments");
        if (act === 1) {
            curFontSize += fontModifier;
            curFontSize = Math.min(curFontSize, 1.4);
        } else if (act === 0) {
            curFontSize -= fontModifier;
            curFontSize = Math.max(curFontSize, 1);
        }
        storyBody.style.fontSize = curFontSize + "em";
		
		if(storyComments !== null) {
		    for (v = 0; v < storyComments.getElementsByTagName("blockquote").length; v++) {
		       storyComments.getElementsByTagName("blockquote")[v].style.fontSize = curFontSize + "em";
		    }
		}
    }
	
	// set cookie with font size
	var expdate = new Date();
	FixCookieDate (expdate);
	expdate.setTime (expdate.getTime() + (672*60*60*1000)); // 4 weeks
	SetCookie("userfontc",curFontSize,expdate);		
	
	return(false);
}


function sizeImageCaption() {
	var galleryImgSize = document.getElementById("gallery-image").offsetWidth;
	document.getElementById("image-border").style.width = galleryImgSize + "px";
	document.getElementById("image-border").style.visibility = "visible";
	document.getElementById("image-border").style.border = "1px solid #cfcfcf";
	galleryImgSize += 4;
	document.getElementById("gallery").style.width = galleryImgSize + "px";
	document.getElementById("gallery").style.visibility = "visible";
	document.getElementById("gallery-image-caption").style.display = "block";
}

function sizedPopUp(url, width, height, bars, isResizable) {
    var setResizable = "yes";
    if(isResizable != null) {
	    if(isResizable === "no");
	    setResizable = "no";
	}
	window.open(url, '',
	'width=' + width + ',height=' + height + ' ,scrollbars=' + bars + 
	    ',status=yes,toolbar=no,menubar=no,location=no,resizable='+setResizable);
}


function popUp(type,winURL) {
	var wndReference = null;
    suffixedType = type+"";
	switch (type) {
	case "poll":
		wndReference = window.open(winURL,suffixedType,"height=352, width=442");
		break;
	case "gallery":
	    
	    if(suffixedType === "galleryadelaidenow") {
		   wndReference = window.open(winURL,suffixedType,"height=750, width=750");
		} else {
		    wndReference = window.open(winURL,suffixedType,"height=700, width=750");
		}
        
		break;
	case "gallery2":
		wndReference = window.open(winURL,suffixedType,"height=750, width=750");
		break;
	case "gallery3":
		wndReference = window.open(winURL,suffixedType,"height=630, width=625");
		break;
	case "cartoongallery":
		wndReference = window.open(winURL,suffixedType,"height=600, width=750");
		break;
	case "weather":
		wndReference = window.open(winURL, suffixedType, 'width=236,height=350,resizable=yes');
		break;
	case "stateweather":
		wndReference = window.open(winURL, suffixedType, 'width=945,height=640,scrollbars=yes');
		break;
	case "currentweather":
		wndReference = window.open(winURL, suffixedType, 'width=1024,height=650,scrollbars=yes');
		break;
	case "subscribe":
		wndReference = window.open(winURL, suffixedType, 'width=765,height=610,scrollbars=yes');
		break;
	case "stopstart":
		wndReference = window.open(winURL, suffixedType, 'width=785,scrollbars=yes');
		break;
	case "showbuzz":
		wndReference = window.open(winURL, suffixedType, 'width=710,height=610,scrollbars=yes');
		break;
	case "showbuzzhires":
		wndReference = window.open(winURL, suffixedType, 'width=752,height=700,resizable=yes,scrollbars=yes');
		break;
	case "addresschange":
		wndReference = window.open(winURL, suffixedType, 'width=500,scrollbars=yes');
		break;
	case "video":
		wndReference = window.open(winURL, suffixedType, 'toolbar=no,location=no,scrolling=auto,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=760,height=660');
		break;
	case "email":
		wndReference = window.open(winURL, suffixedType, 'width=585,height=700,resizable=yes,scrollbars=yes');
		break;
	case "sendLetter":
		wndReference = window.open(winURL, suffixedType, 'width=450,height=820,resizable=yes,scrollbars=yes');
		break;
	case "event":
		wndReference = window.open(winURL, suffixedType, 'width=510,height=700,resizable=yes,scrollbars=no');
		break;
	case "pguide":
		wndReference = window.open(winURL, suffixedType, 'width=442,height=500,resizable=no,scrollbars=yes');
		break;
	case "nipoll":
	    wndReference = window.open(winURL, type, 'width=550, height=500,resizable=yes,scrollbars=yes');
		break;
	case "footy":
		wndReference = window.open(winURL, suffixedType, 'width=800,height=600,resizable=yes,scrollbars=yes');
		break;
	case "interactive":
		wndReference = window.open(winURL, suffixedType, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=700,height=420');
		break;
	default:
		wndReference = window.open(winURL);
	}
	
	if ((wndReference !== null) && (wndReference !== "")) {
		wndReference.focus();
	}
}

/* it's ugly */
function getHBXPathFromNav() {
    var p = "";
    var candidates = getElementsByClassNameHBX("active", document.getElementById("nav"));
	if(document.getElementById("tertiary-nav")) {
        candidates = candidates.concat(getElementsByClassNameHBX("over", document.getElementById("tertiary-nav")));
        candidates = candidates.concat(getElementsByClassNameHBX("current", document.getElementById("tertiary-nav")));
        candidates = candidates.concat(getElementsByClassNameHBX("active", document.getElementById("tertiary-nav")));
	}
	if(document.getElementById("quaternary-nav")) {
	    candidates = candidates.concat(getElementsByClassNameHBX("current", document.getElementById("quaternary-nav")));
		candidates = candidates.concat(getElementsByClassNameHBX("active", document.getElementById("quaternary-nav")));
	}
	var loc = window.location.href;
	loc = loc.replace(/[01],,,00.html/gi, "");
	loc = loc.replace(/(couriermail|dailytelegraph|sundaytelegraph|sundaymail|perthnow|adelaidenow|mercury|heraldsun|sundayheraldsun)/gi, "");
    loc = loc.replace(/\/\/$/gi, "/Home/");
	loc = loc.replace(/\/\//gi, "/");
	loc = loc.substring((loc.indexOf(".au/")+3), loc.length);
	loc = loc.replace(/\/$/g, "");
	if(typeof(pathSectionMap) != "undefined") {
		for(npath in pathSectionMap) {
    		if(npath.replace(/\/$/g, "") === loc) {
        		loc = (pathSectionMap[npath]);
				return loc;
    		}
		}
	}
	if(candidates.length === 0) {
	    return loc;
	}
    for(var i = 0; i != candidates.length; i++) {
        if(typeof(candidates[i]) != "undefined") {
            if((candidates[i] != null) && (candidates[i].nodeName)) {
                if(candidates[i].nodeName.toLowerCase() === "a") {
                    if(candidates[i].innerHTML.length > 0) {
					    var tmps = candidates[i].innerHTML.replace(/<(.|\n)+?>/gi, "");
                        p += "/" + tmps.replace(/[^a-zA-Z0-9\s]/gi, "");
                    }
                } else {
                    for(var j = 0; j != candidates[i].childNodes.length; j++) {
                        if((candidates[i].childNodes[j].nodeName.toLowerCase() === "a") && (!candidates[i].childNodes[j].className.match(/.*(active|over|current).*/gi))) {
						    var tmps = candidates[i].innerHTML.replace(/<(.|\n)+?>/gi, "");
                            p += "/" + tmps.replace(/[^a-zA-Z0-9\s]/gi, "");
                        }
                    }
                }
            }
        }
    }
    p = p.replace(/\s/gi, "+");
	if(window.location.href.indexOf("/story/") >= 0) {
	    p += "/story";
	}
    
	return p;
}


function linkDropSelect(select) {
	var selectedURL = select.options[select.selectedIndex].value;
	window.location.href = selectedURL;
}

function linkDropSelectButton(form) {
var selectedURL = form.getElementsByTagName("SELECT")[0].value;	
	window.location = selectedURL;
	return(false);
}

/* for yahoo content matching */
function showListings(parentElementId, ulClassName) {
    var i=6;	
	var newUL = document.createElement("ul");
	newUL.className = ulClassName;
	if(typeof(zSr) == "undefined") {
	    return false;
	}
    while (i < zSr.length) {
        var descr = zSr[i++]; // listing description
		if(descr.length > 100) {
		    descr = descr.substring(0, 100) + "\u2026";
		}
        var unused1 = zSr[i++]; // (ignore)
        var clickURL = zSr[i++]; // listing link
        var title = zSr[i++]; // listing title
        var sitehost = zSr[i++]; // advertiser's domain name
        var unused2 = zSr[i++]; // (ignore)
	    var newLI = document.createElement("li");
		var newA = document.createElement("a");
		newLI.appendChild(newA);
		newA.setAttribute("target", "_new");
		newA.setAttribute("href", clickURL);
		var newSpan = document.createElement("span");
		newA.appendChild(newSpan);
		var newStrong = document.createElement("strong");
		newSpan.appendChild(newStrong);
		var newTextTitle = document.createTextNode(title);
		newStrong.appendChild(newTextTitle);
		var newBr = document.createElement("br");
		newSpan.appendChild(newBr);
		var newTextDescr = document.createTextNode(descr);
	    newSpan.appendChild(newTextDescr);
		newUL.appendChild(newLI);
	}
	document.getElementById(parentElementId).innerHTML += "&nbsp;";
	document.getElementById(parentElementId).appendChild(newUL);
	
}

/* =dropdowns/hover for ie - 
needs to be called with the root 
----------------- */

// IE only function
startList = function(elementId) {
	if (document.all && document.getElementById) {
	    navRoot = document.getElementById(elementId);
	    if (!navRoot) {
	        return(false);
	    }
		for (i=0; i<navRoot.childNodes.length; i++) {
		    node = navRoot.childNodes[i];
			if ( (node.nodeName=="LI") || (node.nodeName=="DL") || (node.nodeName=="DD") || (node.nodeName=="DT") ) {
				node.onmouseover = function() {
				    this.className+=" over";
				}
				node.onmouseout = function() {
				    this.className=this.className.replace(" over", "");
				}
			}
		}
	}
} 



/* =tab-o-matic
--------------- */
function hasParent(e, id) {
	if (!e.parentNode) {
	    return false;
	}
	if (e.parentNode.id == id) {
	    return e.parentNode;
	}
	
	return hasParent(e.parentNode, id);
}

// right hand nav tab function
function showCBox(e) {  // show divs and active tab for each id (tab and div)
  var eNews = hasParent(e, 'classifieds');
  
  if (eNews) {
    eNews.className = e.id;
  }

  var sid = window.location.href.split(",")[2];
  _hbSet("cv.c14", sid + "-" + hbx.mlc + "|" + hbx.pn);
  _hbSend();
}


// homepage state news tab function
function showSBox(e) {  
  var eNews = hasParent(e, 'states');
  
  if (eNews) {
    eNews.className = e.id;
  }
}


// local tv/movie guide tab function
function showLocDiv(e) {  
  var eNews = hasParent(e, 'guide');
  if (eNews) {
    eNews.className = e.id;
  }
  var sid = window.location.href.split(",")[2];
  _hbSet("cv.c13", sid + "-" + hbx.mlc + "|" + hbx.pn);
  _hbSend();
}

// music charts
function showChartDiv(e) {  
  var eNews = hasParent(e, 'music-charts');
  if (eNews) {
    eNews.className = e.id;
  }
}


// ent charts
function showEntChartDiv(e) {  
  var eNews = hasParent(e, 'ent-charts');
  if (eNews) {
    eNews.className = e.id;
  }
}

// market data last updated
function showLuMd(e) {  
  var eNews = hasParent(e, 'market-data-tables');
  if (eNews) {
    eNews.className = e.id;
  }
}

// fox sports drop zones
function showBNDiv(e) { 
  var eNews = hasParent(e, 'thumb-toggle');
  if (eNews) {
    eNews.className = e.id;
	}
}

// currencies last updated
function showLuCurr(e) {  
  var eNews = hasParent(e, 'currencies-tables');
  if (eNews) {
    eNews.className = e.id;
  }
}

/* sigh */
function showMostX(e) {  
  var eNews = hasParent(e, 'wide-pop-list');
  if (eNews) {
    eNews.className = e.id;
  }
  var sid = window.location.href.split(",")[2];
  _hbSet("cv.c10", sid + "-" + hbx.mlc + "|" + hbx.pn);
  _hbSend();
}


/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = objects.length - 1; i >= 0; i--) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	deconcept.SWFObjectUtil.prepUnload = function() {
		__flash_unloadHandler = function(){};
		__flash_savedUnloadHandler = function(){};
		window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
	}
	window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

/** 
@function overlabels 
@param {object} form
-------------------------*/
var appendOverlabels = function() {
	settings = {classNm : 'overlabel'}
	getOverLabels = function(form) {
		var overLabels = [];
		var labels = form.getElementsByTagName('label');
		
		for (var i=0; i < labels.length; i++) {
			if (labels[i].className.indexOf(settings.classNm) !== -1) {
				overLabels.push(labels[i]);
			}
		}		
		return overLabels;
	}	
	appendBehaviour = function(labels) {
		hide = function(label) {
			label.style.textIndent = '-9999px';
		}
		show = function(label,input) {
			label.style.left = input.offsetLeft + 5 + 'px';
			label.style.top = input.offsetTop + 'px';
			label.style.marginTop = input.offsetHeight/2 - label.offsetHeight/2 + 'px';
			label.style.textIndent = '0';
		}	
		for (var i=0; i < labels.length; i++) {
			labels[i].parentNode.style.position = 'relative';		
			assignEventHandlers = function (label) {		
				var input = document.getElementById(label.getAttribute('for') || label.htmlFor);
				if (input && label) {
					if (input.value === '') {
						show(label,input);
					}
					input.onfocus = function() {
						hide(label);
					}
					input.onblur = function() {
						if (this.value === '') {
							show(label,this);
						}					
					}
					label.onclick = function() {
						input.focus();
					}
				}
			}	
			assignEventHandlers(labels[i]);
		}
	}
	return function(form) {
		appendBehaviour(getOverLabels(form));
	}
}();


/* =onload functions
-------------------= */

// strikes again
var cmbDone = 0;

function init() {

    // quit if this function has already been called
	if (arguments.callee.done) {
	    return;
	}
	
	_hbCookie("hbx.hrf",document.referrer);
	
	addRelClickListener();
		
	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;
		
	// kill the timer
	if (_timer) {
	    clearInterval(_timer);
		_timer = null;
	}
	
		
	ts = document.getElementById("sections");
	if(typeof(Ninbar) != "undefined") {
	    ninbar = new Ninbar();
		if(ninbar.headlineTicker != null) {
		    setTimeout("ninbar.headlineTicker.nextHeadline(1, 0)", 300 );
		} else {
		    if(ts) {
			    ts.style.display = "none";
			}
		}
	} else {
	    if(ts) {
		   ts.style.display = "none";
		}
	}
	
	if (typeof('Popup') != 'undefined') {
		// get all links in document
		var links = document.getElementsByTagName('A');	
		// loop through links
		for (var i=0; i < links.length; i++) {
			// check for links with particular class
			if (links[i].className === 'link-popup') {
				// store reference of matched link
				var node = links[i];
				// create instance of popup
				node = new Popup (node);
			}
		}
	}
	
	if(typeof(initScrollers) != "undefined") {
	    initScrollers();
	}

	
	if(typeof(myCounterInit) != "undefined") {
	    myCounterInit();
	}
	
	
	
	if(typeof(extInit) != "undefined") {
	    extInit();
	}

	if(typeof(addBookmarkLink) != "undefined") {
        addBookmarkLink();
    }
	
	if(typeof(moshtixBootstrap) != "undefined") {
        moshtixBootstrap();
    }
	
	var skipPlotr = 0;
	/*@cc_on @*/
    /*@if (@_win32)
	skipPlotr = 1;
	/*@end @*/
	
	if(skipPlotr == 0) {
		if(typeof(plotrInit) != "undefined") {
		    plotrInit();
		}
		
		if((typeof(zSr) != "undefined")) {
		    if(zSr != null) {
		        if(typeof(contentMatchBootstrap) != "undefined") {
		            contentMatchBootstrap();
				    cmbDone = 1;
		        }
			}
		}
	}
	
};
	
/* for Mozilla */
if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", init, null);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
	document.write("<script id=__ie_onload defer src=javascript:void(0)></script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState == "complete") {
			init(); // call the onload handler
		}
	};
/*@end @*/
	
/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			init(); // call the onload handler
		}
	}, 10);
}

/* for other browsers */
window.onload = function() {
init();
/*@cc_on @*/
/*@if (@_win32)

	elems=document.getElementsByTagName("noscript");
  	for(i=elems.length-1;elem=elems[i];i--) {
    	if(elem.className=="clickfix") {
      		elem.outerHTML = elem.innerHTML; 
		}
	}

    try {
        document.execCommand("BackgroundImageCache", false, true);
	    if(typeof(initScrollers) != "undefined") {
	        initScrollers();
	    }
	} catch(e) {
	    // do nothing
	}
	
	if(typeof(myCounterInit) != "undefined") {
	    myCounterInit();
	}
	
	if(typeof(plotrInit) != "undefined") {
	    plotrInit();
	}
	
	if(typeof(addBookmarkLink) != "undefined") {
        addBookmarkLink();
    }
	
	
	/*@end @*/
	
	if(cmbDone == 0) {
	    if(typeof(contentMatchBootstrap) != "undefined") {
	        contentMatchBootstrap();
	    }
	}
	
}



/**** General functions */

function addLoadEvent(func) {
	/* from Patt */
	
    var oldonload = window.onload;
    if (typeof window.onload != "function") {
        window.onload = func;
    } else {
        window.onload = function(){
            oldonload();
            func();
        }
    }

}

addLoadEvent(function() {
	if (document.getElementById("popularity-listing")) {
		ndm.controls.tabadabado.init(document.getElementById("popularity-listing"));
	}
	
	if(typeof(cycloMaticInit) != "undefined") {
	    if (typeof TOTAL_IMAGES != "undefined") {
	        if(TOTAL_IMAGES > 0) {
	            cycloMaticInit();
	        }
	    }
	}
	
});


function getChildrenByTagName(nList, nType) {

	/* For the nodeList, select it's children that have type nType */
	var a = new Array();
	for(var i=0; i<nList.length; i++) {
		if (nList[i].nodeName==nType) a.push(nList[i]);
	}
	return a;

}


/**** CollapseOMatic */

function selectCollapseOMatic(id, n) {

	/* Select the Nth li tag in a CollapseOMatic, the rest are set as unselected */
	var liA = document.getElementById(id).getElementsByTagName('ul')[0].childNodes;
	var liA = getChildrenByTagName(liA, "LI");
	liA[n].className = "selected-newdev";
    for(var i=0;i<liA.length;i++) if (i!=n) liA[i].className="";

}

function initCollapseOMatic(id) {

	/* We are looking for a structure like this: <div><ul><li></li></ul></div> */
	var liA = document.getElementById(id).getElementsByTagName('ul')[0].childNodes;
	var liA = getChildrenByTagName(liA, "LI");

	/* Set up the onclicks for each li */
	for(var i=0; i<liA.length; i++) {
		var f="selectCollapseOMatic('"+ id +"', "+i+");"
		liA[i].onclick = new Function(f);
	}

	/* Select a random li by default (ie: make one visible) */
	selectCollapseOMatic(id, Math.floor(Math.random()*liA.length));
}


function _hbCookie(a,b){
document.cookie = a + "=" + b + ";path=/;";
}


/* Google Sponsored Ads */

function google_ad_request_done(google_ads) {
    var s = '';
    var i;
	
    if (google_ads.length == 0) {
        return;
    }
	
	if (google_ads.length >= 1) {
	    s += 	'<div class="network sponsors alt">' +
					'<h4><span>Ads By Google</span></h4>' +
						'<ul class="article-link-list">'
				            for(i=0; i < google_ads.length; ++i) {
				                s += '<li><a href="' + google_ads[i].url + '" ' +
				                'onmouseout="window.status=\'\'" ' +
				                'onmouseover="window.status=\'go to ' +
				                google_ads[i].visible_url + '\'">' +
				                '<h5>' + google_ads[i].line1 + '</h5>' +
				                '<p>' + google_ads[i].line2 + ' ' +
				                google_ads[i].line3 + '</p>' +
				                '<p class="link-url">' + google_ads[i].visible_url + '</p>' +
								'</a></li>';
						}
			          s += '</ul>' +
				'</div>';
        }
		
    document.write(s);
    return;
}

/* end Google Sponsored Ads */

// find nodes
findNodes = function  ( string, parent ) {
    var node = false;
    // set context
    var parent = parent || document;
    // try to get by id first
    node = document.getElementById(string, parent);
    // now try by classname
    if (!node) node = getElementsByClassNameHBX(string, parent);
    //return node
    return node;
}

/** Tabs bundle - portable package of tabs and supporting functins
If available the NDM standard library should be used instead of this
@author Scott Harwood
@version 1.0
@function _global_.@namespace
@function ndm.controls.tabs.init
@function ndm.dom.getEventTarget
@function ndm.dom.getElementsByClassName
*/



/** @namespace _global_ */
if (typeof _global_ === "undefined") {
    _global_ = {
        /** @scope _global_ */

        /**
         * @function ['@namespace']
         * @param {string} str - dot separated namespace identifier
         * Example:
         * _global_["@namespace"]("foo.bar.something");
         * foo.bar.something.else = function() {};
         */
        "@namespace": function namespace(str) {
            var a = str.split(".");
            var o = window;
            for(var i=0; i < a.length; i++) {
                if (!o[a[i]]) {
                    o[a[i]] = {};
                }
                o = o[a[i]];
            }
        }
	}
}


_global_["@namespace"]("ndm.dom");

ndm.dom.getEventTarget = function(e) {
	var targ;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) {
		targ = targ.parentNode;
	}
	return targ;
}

ndm.dom.getElementsByClassName = function() {
    // native
    if (document.getElementsByClassName)
    {
        return function(className, nodeName, parentElement)
        {
            var s = (parentElement || document).getElementsByClassName(className);

            if (nodeName && nodeName != '*')
            {
                nodeName = nodeName.toUpperCase();
                return Array.filter(s, function(el) { return el.nodeName == nodeName; });
            }
            else
                return [].slice.call(s, 0);
        }
    }

    // xpath
    if (document.evaluate)
    {
        return  function(className, nodeName, parentElement)
        {
            if (!nodeName) nodeName = '*';
            if (!parentElement) parentElement = document;

            var results = [], s, i = 0, element;

            s = document.evaluate(
                ".//" + nodeName + "[contains(concat(' ', @class, ' '), ' " + className + " ')]",
                parentElement,
                null,
                XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
                null
            );

            while ((element = s.snapshotItem(i++)))
                results.push(element);

            return results;
        }
    }

    // generic
    return function getElementsByClassName(className, tag, elm){
		var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
		var tag = tag || "*";
		var elm = elm || document;
		var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
		var returnElements = [];
		var current;
		var length = elements.length;
		for(var i=0; i<length; i++){
			current = elements[i];
			if(testClass.test(current.className)){
				returnElements.push(current);
			}
		}
		return returnElements;
	}
}();



_global_["@namespace"]("ndm.controls");

/** 
 * handles all instances of tabbers
 * @function ['ndm.controls.tabManager']
 */
ndm.controls.tabadabado = { 
	
	settings : {trigger : 'onclick', tabContentClass: 'module-item', tabTriggerClass: 'tab-list'},
	
	charKeys : {'54' : 'next', '52' : 'previous'},

	active: null,

	init: function (node,settings) {

		if (settings) {
			this.applyCustomSettings(settings);
		}
		this.eventHandler(node);
	},
	
	applyCustomSettings: function(userSettings) {
		for (type in userSettings) {
			if (this.settings[type]) {
				this.settings[type] = userSettings[type];
			}
		}
	},
	
	eventHandler: function(parent) {	
		var owner = this;
		var tablist = ndm.dom.getElementsByClassName(this.settings.tabTriggerClass,'ul',parent)[0];
		var contentNodes = ndm.dom.getElementsByClassName(this.settings.tabContentClass,'div',parent);		
		tablist[this.settings.trigger] = function(e) {
			// event object(e) must come first
			owner.tab(e,this,contentNodes);
			return false;
		}
	},
	
	tab: function(e,tablist,contentNodes) {
		var e = e || window.event;
		this.active = ndm.dom.getEventTarget(e);	
		if (this.active.nodeName !== 'A') {
			this.active = this.active.parentNode;
		}
		if (this.active.nodeName === 'A') {
			this.makeActive(tablist, contentNodes);
		} 
	},
	
	makeActive: function(tabList, contentNodes) {

		this.clearActive(tabList.getElementsByTagName('li'), contentNodes);
		this.active.parentNode.className += ' active';
		
		
		
		var contentNode = document.getElementById(this.active.href.substring(this.active.href.indexOf('#') + 1, this.active.href.length));
		contentNode.className += ' active';
	},
	
	clearActive: function(tabs, contentNodes) {
		
		for (var i=0; i < contentNodes.length; i++) {
			if (tabs[i]) {
				if (tabs[i].className.indexOf('active') !== -1) {
					tabs[i].className = tabs[i].className.replace('active','');
				}
			}
			if (contentNodes[i].nodeName === 'DIV') {
				if (contentNodes[i].className.indexOf('active') !== -1) {
					contentNodes[i].className = contentNodes[i].className.replace('active','');
				}
			}
		}
	
	}
}


/* removed temporarily - pl
 * addLoadEvent(tabCreate);
 */
 
function addRelClickListener() {
    var old = function() {};
    if (typeof document.onclick === "function") {
        old = document.onclick;
    }
    
    document.onclick = function(e) {
        var e = e || window.event;
        var targ = e.target || e.srcElement; 
        if (targ.nodeType == 3) { 
            // defeat Safari bug 
            targ = targ.parentNode; 
        } 
        var rel = targ.getAttribute("rel");
        var url = targ.getAttribute("href");
        if (/track/.test(rel)) {
		    var s = rel.replace(/track-([a-zA-Z0-9]*)/gi, "$1") + "|" + encodeURI(window.location) + "-" + encodeURI(url);
            s = s.replace(/,/gi, "&#44;");
			_hbSet("cv.c9", s);
        	_hbSend();
		}
        old();
    };
}
 
/* ---- Federal Election 07 ---- */
	function validateElectionFinder07(){
		var intPostcode = document.getElementById("txtElectionFinder07Postcode").value;
		var numericExpression = /^([28][0-9]{2}$|[0-9]{4}$)/
		if (intPostcode.match(numericExpression)) {
				window.open("http://media.news.com.au/multimedia/2007/09/10_election/map/index.html?postcode=" + intPostcode + "", "ElectionFinder07", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=810,height=675");
		}	
		else{		
			alert("Please enter a valid Australian postcode");
			document.getElementById("txtElectionFinder07Postcode").value ="";
			document.getElementById("txtElectionFinder07Postcode").focus();		
			}
	}	
	function openBrowseElectorate(){
		window.open("http://media.news.com.au/multimedia/2007/09/10_election/map/index.html", "BrowseElectorate", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=810,height=675");	
	}
  /* decide tracking code */

var refr=escape(document.referrer); /* get the http referer and encode it */
var dom=location.hostname; /* get the host domain */
var stURL="http://link.decideinteractive.com/n/23445/23721/www.news.com.au/e0dce9fe002503000000000600000000034ccf0c0000000000000000000000000000000100/i/c?0&1pixgif&referer="
+ refr;
if ( (refr && refr.search(dom) == -1) && (location.href.toUpperCase().indexOf("247SEO=N") == -1) ) /* if the referrer is external preload the image request and does not contain 247SEO argument = "N" */
{
imageTR = new Image();
imageTR.src = stURL;
}

/* end decide tracking code */

// homepage state news tab function
function showStateBox(e) {  
  var eNews = hasParent(e, 'states');
  
  if (eNews) {
    if (eNews.className != e.id) {
      eNews.className = e.id;
      document.getElementById("state-links").className = eNews.className.substring(0,(eNews.className.indexOf("-"))) + "-link";
    } else {
      switch (e.id) {
        case 'nsw-tab': window.location.href = "/index/0,23601,1242,00.html"; break;
        case 'qld-tab': window.location.href = "/index/0,23601,1248,00.html"; break;
        case 'vic-tab': window.location.href = "/index/0,23601,1243,00.html"; break;
        case 'sa-tab':  window.location.href = "/index/0,23601,1246,00.html"; break;
        case 'wa-tab':  window.location.href = "/index/0,23601,1245,00.html"; break;
        case 'tas-tab': window.location.href = "/index/0,23601,1244,00.html"; break;
      }
    }
  }
  var sid = window.location.href.split(",")[2];
  _hbSet("cv.c12", sid + "-" + hbx.mlc + "|" + hbx.pn);
  _hbSend();
}


function showBnPopDiv(e) {
  var eNews = hasParent(e, 'bnews-popularity');
  if (eNews) {
    eNews.className = e.id;
  }

  var sid = window.location.href.split(",")[2];
  _hbSet("cv.c11", sid + "-" + hbx.mlc + "|" + hbx.pn);
  _hbSend();
}


function showBnPopDivWide(e) {
  var eNews = hasParent(e, 'bnews-popularity-wide');
  if (eNews) {
    eNews.className = e.id;
  }
  var sid = window.location.href.split(",")[2];
  _hbSet("cv.c11", sid + "-" + hbx.mlc + "|" + hbx.pn);
  _hbSend();
}

// IE needs this
function initWeatherDrop() {
    weatherDropDown = document.getElementById("weather-drop");
    weatherDropDown.onmouseover = function() {
	    this.className = "over";
	}
	weatherDropDown.onmouseout = function() {
	    this.className = "";
	}
	
	for (i=0; i<weatherDropDown.childNodes.length; i++) {
		node = weatherDropDown.childNodes[i];
		if (node.nodeName=="DD") {
			node.onmouseover=function() {
				this.className+=" over";
			}
			node.onmouseout=function() {
				this.className=this.className.replace(" over", "");
			}
		}
	}
}

function getHBXPathFromNavForNews() {
 
	var loc = window.location.href;	
	loc = loc.replace(/Interactives/ , "");
	return loc;
	}


removeGoogleLogo = function() {
	    if(document.getElementById("local-search").checked) {
	    	document.getElementById("ni-google").style.display = "none";
	    }
	}
showGoogleLogo = function() {
	    document.getElementById("ni-google").style.display = "block";
	}

// Google Sponsored Ads

google_ad_client = 'ca-nd-news_js';
google_ad_channel = 'other';
google_ad_output = 'js';
google_max_num_ads = '3';
google_ad_type = 'text';
google_language = 'en';
google_encoding = 'utf8';
google_safe = 'high';
