if (typeof(zMSHasUtilFileBeenAlreadyLoaded) == "undefined") {
    var zMSRemarketingPercentage = 20;
    var zMSmobileCookieCalled = false;
    var zMSRefreshActive = false;
	var onebyoneCalled = false;
	var zMSdeactivateOneByOne = false;
    
    function writeIt(a){
        document.write(a);
    }
    
    function writeItln(a){
        document.writeln(a);
    }
    
    function readCookie(name){
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') 
                c = c.substring(1, c.length);
            if (c.indexOf(nameEQ) == 0) 
                return c.substring(nameEQ.length, c.length);
        }
        return null;
    }
    
    
    function zMSRand(){
        return Math.round(Math.abs(Math.sin((new Date()).getTime())) * 1000000000) % 10000000;
    }
    
    var zMSdomain = "http://media.sensis.com.au";
    var zMSsecureDomain = "https://media.sensis.com.au";
    var zMSlocation = window.location + "";
    if (zMSlocation.indexOf("https://") != -1) 
        var zMSHome = zMSsecureDomain;
    else 
        var zMSHome = zMSdomain;
    var zMSpagenum = zMSRand();
    
	//temp removal of remarketing for bp news
	if(zMSlocation.indexOf("bigpondnews") != -1)
	{
		zMSRemarketingPercentage = 0;
	}
	
    var zMSACCsite = "TEL.BIGPOND.PORTAL";
    var zMSACCarea = "ENTERTAINMENT.BIGPOND.OTHER";
    
    //temp fix for AFL dream team
    if ((zMSlocation.indexOf("afl.virtualsports.com.au") != -1) || (zMSlocation.indexOf("dreamteam") != -1)) {
        zMSACCsite = "TEL.AFL_HOME.SPORT";
        zMSACCarea = "SPORT.AFL_HOME.AFL_DREAMTEAM";
    }
    
    
    if (typeof(zMSsub_section) == 'undefined') 
        var zMSsub_section = '';
    
    //Define user reg variables
    if (typeof(zMStitle) == 'undefined' || zMStitle.length <= 0 || zMStitle == null) 
        var zMStitle = '';
    if (typeof(zMSage) == 'undefined' || zMSage.length <= 0 || zMSage == null) 
        var zMSage = '';
    if (typeof(zMSpostcode) == 'undefined' || zMSpostcode.length <= 0 || zMSpostcode == null) 
        var zMSpostcode = '';
    if (typeof(zMScustomer) == 'undefined' || zMScustomer.length <= 0 || zMScustomer == null) 
        var zMScustomer = '';
    
    
    //Refresh code
    if ((Math.random() * 100) < 0) {
        //if (zMSlocation.indexOf("bigpond.com/news") != -1 || zMSlocation.indexOf("bigpondmovies.com") != -1 || zMSlocation.indexOf("bigpondmusic.com") != -1) {
        if ((zMSlocation.indexOf("bigpond.com/news") != -1) || (zMSlocation.indexOf("bigpondsport.com/Home08") != -1)) {
            zMSRefreshActive = true;
            document.write('<scr' + 'ipt type="text/javascript" src="http://medrx.sensis.com.au/images/sensis/BigPond/bp_news_util.js"></scr' + 'ipt>');
            
        }
    }
    function zMSsecureMe(){
    }
    
    function zMSgetValue(zMSmyStr, zMStagline){
        zMSmyStr = zMSmyStr + "=";
        var zMSind = zMStagline.indexOf(zMSmyStr) + zMSmyStr.length;
        if (zMSind == (zMSmyStr.length - 1)) //test for myStr not found
            return "";
        zMStagline += "&";
        return zMStagline.substring(zMSind, zMStagline.indexOf("&", zMSind));
    }
    
    function zMSconvertSize(zMSsize, zMSposition){
        if (zMSposition == "text1") 
            return "0x1";
        if (zMSposition == "text2") 
            return "0x2";
        if (zMSposition == "text3") 
            return "0x3";
        if (zMSposition == "text4") 
            return "0x4";
        if (zMSposition == "text5") 
            return "0x5";
        if (zMSsize == "hariable") 
            return "728x90";
        if (zMSsize == "variable") 
            return "120x240/POSITION=1";
        if (/\d+x\d+/.test(zMSsize)) 
            return zMSsize;
        return "ERROR";
    }
    
    
    function zMSgetJS(zMSmyStr){

		
        zMSlocation = window.location + "";

		if(zMSlocation.indexOf("bigpondnews.com") != -1 && typeof(MediaSmart) == "object"){
			msSize = zMSgetValue("adsize", zMSmyStr);
			msWidth = msSize.split("x")[0];
			msHeight = msSize.split("x")[1];
			msPosition = zMSgetValue("position", zMSmyStr);
			msPosition = msPosition.replace("bppromo", "");

		
			if(msWidth=="300"&&msHeight=="70"){
				MediaSmart.bigpondPromotions.newAd({id: msSize+"_"+msPosition, width: msWidth, height: msHeight, position: msPosition});
			}else{
				MediaSmart.newAd({id: msSize+"_"+msPosition, width: msWidth, height: msHeight, position: msPosition});
			}
			return false;
		}	

		
		//remove old 194x55 ad calls
		if(zMSmyStr.indexOf("194x55") != -1){
			return false;
		}
		
		//temp fix for MediBank navbar
		if(zMSmyStr.indexOf("100x29")!= -1 && zMSlocation.indexOf("newcastleknights")!= -1){
			return false;
		}
		
		
        
		//remove excess 1x1 ad calls
		if(zMSmyStr.indexOf("adsize=1x1") != -1){
				if(onebyoneCalled == true){
					return false;
				}else{
					onebyoneCalled = true;
				}
		}
		
		//temp fix to remove 1x1 msv for hp otp buyout
		//zMSdate = new Date();
	//	var theDate = zMSdate.getDate();
		if(zMSlocation.indexOf("bigpond.com/home") != -1){
			if(zMSmyStr.indexOf("adsize=1x1") != -1){	
				//zMSmyStr = zMSmyStr.replace(/adsize=1x1/, "adsize=3x3");
				zMSRemarketingPercentage = 0;
				return false;
			}
		}
		
		if(zMSdeactivateOneByOne == true && zMSmyStr.indexOf("adsize=1x1") != -1){
			return false;
		}
		
		
		
        
        
        if ((zMSlocation.indexOf("https") != -1) && ((zMSmyStr.indexOf("100x29") != -1) || (zMSmyStr.indexOf("1x1") != -1))) {
            return true;
        }
        
        if ((zMSmyStr.indexOf("300x250") != -1 || zMSmyStr.indexOf("728x90") != -1 || zMSmyStr.indexOf("adsize=hariable") != -1 || zMSmyStr.indexOf("120x600") != -1 || zMSmyStr.indexOf("160x600") != -1) && zMSRefreshActive == true) {
            zMSMakeAdMarker(zMSmyStr);
            return true;
        }
        if (typeof(zMSsection) == "undefined") 
            zMSsection = "";
        if (zMSlocation.indexOf("http://www.bigpond.com/news/business/") != -1 && zMSmyStr.indexOf("300x250") != -1) {
            zMSgetJS("adsize=1x1&position=hidden", "businesscookie");
        }
        if ((zMSlocation.indexOf("www.bigpond.com/mobile/") != -1) && (zMSmobileCookieCalled != true)) {
            zMSmobileCookieCalled = true;
            zMSgetJS("adsize=1x1&position=hidden", "mobilecookie");
        }
        //make movies homepage to have iframe call
        if (zMSsection == "movies.home" && zMSmyStr.indexOf("hariable") != -1) {
            zMSgetIframe("position=leader&adsize=728x90");
        }
        
        var zMSposMod = "";
        //Check if ad is a second position
        if ((zMSmyStr.indexOf("position=1") != -1) || (zMSmyStr.indexOf("position=island") != -1) || (zMSmyStr.indexOf("hariable") != -1)) {
            zMSposMod = "/POSITION=1";
        }
        if ((zMSmyStr.indexOf("position=2") != -1) || (zMSmyStr.indexOf("position=island2") != -1) || (zMSmyStr.indexOf("position=head2") != -1)) {
            zMSposMod = "/POSITION=2";
        }
        else {
            if ((zMSmyStr.indexOf("position=2") != -1) || (zMSmyStr.indexOf("position=island2") != -1)) {
                zMSposMod = "/POSITION=2";
            }
            else {
                if (zMSmyStr.indexOf("position=3") != -1) {
                    zMSposMod = "/POSITION=3";
                }
                else {
                    if (zMSmyStr.indexOf("position=4") != -1) {
                        zMSposMod = "/POSITION=4";
                    }
                    else {
                        if (zMSmyStr.indexOf("position=5") != -1) {
                            zMSposMod = "/POSITION=5";
                        }
                        else {
                            if (zMSmyStr.indexOf("position=6") != -1) {
                                zMSposMod = "/POSITION=6";
                            }
                            else {
                                if (zMSmyStr.indexOf("position=7") != -1) {
                                    zMSposMod = "/POSITION=7";
                                }
                                else {
                                    if (zMSmyStr.indexOf("position=8") != -1) {
                                        zMSposMod = "/POSITION=8";
                                    }
                                    else {
                                        if (zMSmyStr.indexOf("position=9") != -1) {
                                            zMSposMod = "/POSITION=9";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        
        //Check if an advertorial position
        //Check if ad is a second position
        if (zMSmyStr.indexOf("position=advertorial") != -1) {
            zMSposMod = "/POSITION=ADVERTORIAL";
        }
        
        
        //Check if call is for a Big Blogs skin
        if (zMSsection == "blogs" && (zMSmyStr.indexOf("161x601") != -1)) {
            if (zMSmyStr.indexOf("position=1") != -1) {
                zMSposMod = "/POSITION=1";
            }
            if (zMSmyStr.indexOf("position=2") != -1) {
                zMSposMod = "/POSITION=2";
            }
        }
        
        //Check if call is for a Media Offer Microsite ad
        if (zMSsection == "custompages") {
            if (zMSmyStr.indexOf("position=1") != -1) {
                zMSposMod = "/POSITION=1";
            }
            if (zMSmyStr.indexOf("position=2") != -1) {
                zMSposMod = "/POSITION=2";
            }
        }
        //Game Arena Specific Code
        if (zMSsection == "games_channel") {
            if (zMSmyStr.indexOf("position=1") != -1) {
                zMSposMod = "/POSITION=1";
            }
            if (zMSmyStr.indexOf("position=2") != -1) {
                zMSposMod = "/POSITION=2";
            }
        }
        
        
        //Check if call is for a BP Promotions ad
        if (zMSmyStr.indexOf("300x70") != -1) {
            if (zMSmyStr.indexOf("position=bphp_net_1") != -1) {
                zMSposMod = "/POSITION=1";
            }
            if (zMSmyStr.indexOf("position=bphp_net_2") != -1) {
                zMSposMod = "/POSITION=2";
            }
        }
        //To eventually replace above BP Promotions code
        zmsSiteTemp = "";
        if (zMSmyStr.indexOf("position=bppromo") != -1) {
            zmsSiteTemp = zMSACCsite;
            zMSACCsite = zMSACCsite.replace(/BIGPOND/i, "BPPROMO");
            zms_temp_pos = zMSmyStr.indexOf("position=bppromo");
            zMSposMod = "/POSITION=" + zMSmyStr.charAt(zms_temp_pos + 16);
        }
        if (zMSmyStr.indexOf("position=moviespromo") != -1) {
            zmsSiteTemp = zMSACCsite;
            zMSACCsite = zMSACCsite.replace(/BIGPOND/i, "BPMOVIESPROMO");
            zms_temp_pos = zMSmyStr.indexOf("position=moviespromo");
            zMSposMod = "/POSITION=" + zMSmyStr.charAt(zms_temp_pos + 20);
        }        
        
        //Check if call is for a BP / Whereis microsite
        if (zMSsub_section == "mediaoffer1") {
            if (zMSmyStr.indexOf("position=1") != -1) {
                zMSposMod = "/POSITION=1";
            }
            if (zMSmyStr.indexOf("position=2") != -1) {
                zMSposMod = "/POSITION=2";
            }
        }
        
        //Third Island Position for GameArena
        if (zMSACCsite.indexOf("GAMEARENA") != -1 && zMSmyStr.indexOf("island3") != -1) {
            zMSposMod = "/POSITION=3";
        }
        
        if (zMSsection == "portal" || zMSsection == "news" || zMSmyStr.indexOf("134x1000") != -1) {
            zMSpos = zMSgetValue("position", zMSmyStr);
            if (zMSpos == "island") 
                zMSposMod = "/POSITION=1";
            if (zMSpos == "island2") 
                zMSposMod = "/POSITION=2";
            if (zMSpos == "island3") 
                zMSposMod = "/POSITION=3";
            if (zMSsection == "movie") {
                if (zMSpos == "left") 
                    zMSposMod = "/POSITION=LEFT";
                if (zMSpos == "right") 
                    zMSposMod = "/POSITION=RIGHT";
            }
        }
        var e = document.getElementsByTagName("div");
        var uname = "";
        if (zMSACCsite.indexOf("WEBMAIL") != -1 && e.length > 1) {
            uname = "/UNAME=" + e[1].innerHTML.substring(e[1].innerHTML.indexOf(">") + 1, e[1].innerHTML.indexOf("@")).replace(/\s/gi, "");
            uname = "";
            //Used to insert 1x1 to cookie business users on webmail
            if (zMSmyStr.indexOf("120x600") != -1) {
                if (zMScustomer.toUpperCase() == "BUSINESS") {
                    document.write("<scr" + "ipt src=\"" + zMSHome + "/jserver/acc_random=" + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + "/KEYWORD=PBCOOKIE/AAMSZ=1x1/PCODE=" + zMSpostcode + "/AGE=" + zMSage + "/TITLE=" + zMStitle.toUpperCase() + "/CUSTOMER=" + zMScustomer.toUpperCase() + "/pageid=" + zMSpagenum + " \">\n");
                    document.write("</scr" + "ipt>");
                }
                
                zMScookieSetRead = "<IFRAME title='Advertisement' SRC=\"http://ad.sensismediasmart.com.au/images/sensis/genAdsCookie.htm?name=age&value=" + zMSage + "&dur=90\" name=\"zSensisFrame2\" width=\"1\" height=\"1\" frameborder=\"0\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" SCROLLING=\"no\"></IFRAME>";
                zMScookieSetRead += "<IFRAME title='Advertisement' SRC=\"http://ad.sensismediasmart.com.au/images/sensis/genAdsCookie.htm?name=title&value=" + zMStitle.toUpperCase() + "&dur=90\" name=\"zSensisFrame2\" width=\"1\" height=\"1\" frameborder=\"0\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" SCROLLING=\"no\"></IFRAME>";

                var zMSdaVals = 'acc_random=' + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + "/KEYWORD=WEBMAILCOOKIE/AAMSZ=1x1/pageid=" + zMSpagenum;
                zMScookieSetRead += '<iframe title="Advertisement" src="http://ad.sensismediasmart.com.au/images/sensis/cookieFix.html?' + escape(zMSdaVals.replace(/\//gi, "&")) + '" allowtransparency="true" width=1 height=1 frameborder="no" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no">\n</iframe>\n';
                
                var zMSdaVals = 'acc_random=' + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + "/KEYWORD=WEBMAILCOOKIE/AAMSZ=1x7/pageid=" + zMSpagenum;
                zMScookieSetRead += '<iframe title="Advertisement" src="http://media.sensis.com.au/hserver/' + zMSdaVals + '" allowtransparency="true" width=1 height=1 frameborder="no" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no">\n</iframe>\n';
                
                document.write('<div style="width:1px;height:1px;">'+zMScookieSetRead+'</div>');
            }
        }
        
        zMSkey = "";
		zMSkey = "/KEYWORD=EXPANDABLE";
				
		//Manual moving home targeting
		if (zMSlocation.indexOf("mybigpond/movinghome") != -1){
			zMSkey = "/KEYWORD=MOVINGHOME";
		}
		
		
        if (arguments.length == 2) 
            zMSkey = "/KEYWORD=" + arguments[1].toUpperCase();
        if (zMSsection == "custompages") 
            zMSkey = "/KEYWORD=" + zMSsub_section.toUpperCase();
        if (zMSmyStr.indexOf("amex478sponsor") != -1) 
            zMSkey = "/KEYWORD=AMEX478SPONSOR";
        if (zMSmyStr.indexOf("confirmation") != -1) 
            zMSkey = "/KEYWORD=CONFIRMATION";
        if (zMSmyStr.indexOf("confirmation") != -1) 
            zMSkey = "/KEYWORD=CONFIRMATION";
        if (zMSkey.length == 9) 
            zMSkey = "";
        if (zMSlocation.indexOf("???") == -1) {
            if (zMSsection == "webmail" && zMSmyStr.indexOf("text1") == -1 && zMSmyStr.indexOf("text") != -1) {
                if (zMSgetValue("position", zMSmyStr) == "text2") 
                    document.writeln("<a href=\"http://media.sensis.com.au/ADCLICK/CID=0000194c0b6e845e00000000/acc_random=" + zMSRand() + "/SITE=TEL.BIGPOND.WEBMAIL.ENTERTAINMENT/AREA=ENTERTAINMENT.BIGPOND.WEBMAIL/AAMSZ=0x2/pageid=" + zMSRand() + "/relocate=http://sydneysymphony.bigpondmusic.com/\" target=\"_blank\">Watch Sydney Symphony</a>");
                if (zMSgetValue("position", zMSmyStr) == "text3") 
                    document.writeln("<a href=\"http://media.sensis.com.au/ADCLICK/CID=0000194d0b6e845e00000000/acc_random=" + zMSRand() + "/SITE=TEL.BIGPOND.WEBMAIL.ENTERTAINMENT/AREA=ENTERTAINMENT.BIGPOND.WEBMAIL/AAMSZ=0x3/pageid=" + zMSRand() + "/relocate=http://www1.autotrader.com.au/mellor/mellor.nsf/homepage/home?OpenDocument\" target=\"_blank\">Car reviews,prices,specs</a>");
                if (zMSgetValue("position", zMSmyStr) == "text4") 
                    document.writeln("<a href=\"http://media.sensis.com.au/adclick/CID=0000ac220000000000000000\" target=\"_blank\">ANZ. No monthly account</a>");
                //document.writeln("<a href=\"http://media.sensis.com.au/ADCLICK/CID=0000194e0b6e845e00000000/acc_random="+zMSRand()+"/SITE=TEL.BIGPOND.WEBMAIL.ENTERTAINMENT/AREA=ENTERTAINMENT.BIGPOND.WEBMAIL/AAMSZ=0x4/pageid="+zMSRand()+"/relocate=http://www.bigpond.com/internet-plans/additional/security/\" target=\"_blank\">Online Security Services</a>");	    
                if (zMSgetValue("position", zMSmyStr) == "text5") 
                    document.writeln("<a href=\"http://media.sensis.com.au/adclick/CID=0000ac220000000000000000\" target=\"_blank\">fee for 6 months</a>");
                //document.writeln("<a href=\"http://media.sensis.com.au/ADCLICK/CID=0000194f0b6e845e00000000/acc_random="+zMSRand()+"/SITE=TEL.BIGPOND.WEBMAIL.ENTERTAINMENT/AREA=ENTERTAINMENT.BIGPOND.WEBMAIL/AAMSZ=0x5/pageid="+zMSRand()+"/relocate=http://www.bigpond.com/callertones\" target=\"_blank\">BigPond Caller Tones Here</a>");
            }
            else 
                //add "ARTICLE" keyword for BP news article pages
                if (zMSlocation.indexOf("/articles/") != -1) {
                    if (zMSkey == "") {
                        zMSkey = "/KEYWORD=ARTICLE";
                    }
                    else {
                        zMSkey += "+ARTICLE";
                    }
                }
            if ((document.location + "").indexOf("?mstoothpaste") != -1) 
                zMSkey = "/KEYWORD=MSTOOTHPASTE";
            
            if (zMSmyStr.indexOf("navbar") != -1) {
                if (zMSmyStr.indexOf("100x29") != -1) {
                    document.write("<iframe title='Advertisement'  src=\"" + zMSHome + "/hserver/acc_random=" + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + "/AAMSZ=100x29?\" allowtransparency='true' width=100 height=29 frameborder='no' MARGINWIDTH='0' MARGINHEIGHT='0' SCROLLING='no'>\n");
                    document.write("</iframe>");
                }
                else {
                    document.write("<scr" + "ipt src=\"" + zMSHome + "/jserver/acc_random=" + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + "/AAMSZ=194x55?\">\n");
                    document.write("</scr" + "ipt>");
                }
            }
            else {
                if (zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)).indexOf("728x90") != -1 && Math.random() * 100 < 0 && zMSACCsite != "TEL.BIGPOND.NOWWEARETALKING.ENTERTAINMENT") {
                    var zMSdaVals = 'acc_random=' + zMSRand() + '/SITE=' + zMSACCsite + '/AREA=' + zMSACCarea + uname + '/AAMSZ=' + zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)) + zMSkey + "/PCODE=" + zMSpostcode + "/AGE=" + zMSage + "/TITLE=" + zMStitle.toUpperCase() + "/CUSTOMER=" + zMScustomer.toUpperCase() + '/pageid=' + zMSpagenum;
                    document.write("<scr" + "ipt src=\"" + zMSHome + "/jserver/acc_random=" + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + uname + "/AAMSZ=" + zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)) + zMSkey + "/pageid=" + zMSRand() + "\">\n");
                    document.write("</scr" + "ipt>");
                }
                else 
                    if (zMSmyStr.indexOf("300x250") != -1 && Math.random() * 100 < zMSRemarketingPercentage) {
                        //Island cookie percentage
                        
                        if (typeof(movie_key) != 'undefined' && movie_key != "") {
	                                zMSkey = zMSkey + "_" + movie_key;
                            	}    
                            	
						zMSkey = zMSkey.replace(/EXPANDABLE/, "");
						if(zMSkey == "/KEYWORD="){
							zMSkey = "";
						}
                        var zMSdaVals = 'acc_random=' + zMSRand() + '/SITE=' + zMSACCsite + '/AREA=' + zMSACCarea + uname + '/AAMSZ=' + zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)) + zMSkey + '/pageid=' + zMSpagenum + zMSposMod;
                        document.write('<iframe title="Advertisement" src="http://ad.sensismediasmart.com.au/images/sensis/cookieFix.html?' + escape(zMSdaVals.replace(/\//gi, "&")) + '" allowtransparency="true" width=300 height=250 frameborder="no" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no">\n</iframe>\n');
                    }
                    else 
                        if (((zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)).indexOf("728x90") != -1  || zMSmyStr.indexOf("120x600") != -1 || zMSmyStr.indexOf("160x600") != -1) && Math.random() * 100 < zMSRemarketingPercentage)|| (zMSmyStr.indexOf("728x90") != -1 && zMSsection == "news")) {
                            var zMSdaVals = 'acc_random=' + zMSRand() + '/SITE=' + zMSACCsite + '/AREA=' + zMSACCarea + zMSkey + uname + '/AAMSZ=' + zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)) + zMSkey + '/pageid=' + zMSpagenum + zMSposMod;
                            document.write('<iframe title="Advertisement" src="http://ad.sensismediasmart.com.au/images/sensis/cookieFix.html?' + escape(zMSdaVals.replace(/\//gi, "&")) + '" allowtransparency="true" width=728 height=90 frameborder="no" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no">\n</iframe>\n');
                        }
                        else 
                            if (zMSACCsite.indexOf("WEBMAIL") != -1) {
                                if (zMSkey.length < 1) 
                                    zMSkey = "/KEYWORD=EXPANDABLE";
                                //Targeting for old webmail
								var zmsreferer = document.referrer + "";
                                if (zMSlocation.indexOf("webmail.bigpond.com") != -1 || zmsreferer.indexOf("webmail.bigpond.com") != -1) {
                                    if (zMSkey.length < 1) {
                                        zMSkey = "/KEYWORD=OLDWEBMAIL";
                                    }
                                    else {
                                        zMSkey = zMSkey + "+OLDWEBMAIL";
                                    }
                                }
                                document.write("<scr" + "ipt src=\"" + zMSHome + "/jserver/acc_random=" + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + uname + "/AAMSZ=" + zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)) + zMSkey + "/PCODE=" + zMSpostcode + "/AGE=" + zMSage + "/TITLE=" + zMStitle.toUpperCase() + "/CUSTOMER=" + zMScustomer.toUpperCase() + "/pageid=" + zMSpagenum + zMSposMod + "\">\n");
                                document.write("</scr" + "ipt>");
                            }
                            else {
	                           
                                if (zMSACCsite.indexOf("GAMEARENA") != -1 && zMSmyStr.indexOf("2x1") != -1) {
                                    zMSmyStr = "adsize=300x250&position=island2";
                                    zMSposMod = "/POSITION=2";
                                }
                                
                                //temp fix for bigpond movie issues
                                if (typeof(movie_key) != 'undefined' && movie_key != "") {
	                                zMSkey = zMSkey + "_" + movie_key;
                            	}    
                                                                                                                    
               		   
                                if (zMSkey.length < 1) {
                                    zMSkey = "/KEYWORD=EXPANDABLE";
                                                    				                            
                                    //temp fix for layout issues with expandables on BP Music - Top Albums
                                    if (zMSlocation.indexOf("bigpondmusic.com/TopAlbums") && zMSmyStr.indexOf("300x250")) {
                                        zMSkey = "";
                                    }
                                }
                                document.write("<scr" + "ipt src=\"" + zMSHome + "/jserver/acc_random=" + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + uname + "/AAMSZ=" + zMSconvertSize(zMSgetValue("adsize", zMSmyStr), zMSgetValue("position", zMSmyStr)) + zMSkey + "/pageid=" + zMSpagenum + zMSposMod + "\">\n");
                                document.write("</scr" + "ipt>");
                            }
            }
        }
        if (zmsSiteTemp != "") {
            zMSACCsite = zmsSiteTemp;
        }
    }
    
    function zMSgetIframe(zMSmyStr){
		if(zMSlocation.indexOf("shop.bigpond.com") != -1){
			zMSgetJS(zMSmyStr);
			return true;
		}
        zMSkey = "";
        if (arguments.length == 2) 
            zMSkey = "/KEYWORD=" + arguments[1];
        if (zMSlocation.indexOf("???") == -1) {
            if (typeof(zMSmyStr) == 'undefined') 
                var zMSmyStr = '';
            zMSmySize = zMSconvertSize(zMSgetValue("adsize", zMSmyStr)); //get adsize
            if (zMSmyStr.length > 0) 
                zMSmyStr += '&';
            zMSmySize = zMSmySize.toLowerCase();
            var zMSwidth = zMSmySize.substring(0, zMSmySize.indexOf("x") ? zMSmySize.indexOf("x") : 0); //get width
            var zMSheight = zMSmySize.substring(zMSmySize.indexOf("x") + 1, zMSmySize.length); //get height
            var zMSdim = "";
            if (zMSwidth != "" && (zMSwidth * 1) > 0) //test that adsize is in correct format
                zMSdim = "width=" + zMSwidth + " height=" + zMSheight;
            if (zMSwidth == "194") {
                document.write('<IFRAME title="Advertisement" src="' + zMSHome + "/hserver/acc_random=" + zMSRand() + "/SITE=" + zMSACCsite + "/AREA=" + zMSACCarea + zMSkey + "/AAMSZ=" + zMSconvertSize(zMSgetValue("adsize", zMSmyStr)) + "/pageid=" + zMSpagenum + '" ' + zMSdim + ' frameborder="no" border=0 marginwidth=0 marginheight=0 scrolling="no">\n');
                document.write('</IFRAME>\n');
            }
        }
    }
    
    function zMSgetTower(){
        if (arguments.length >= 1 && arguments[0].indexOf("position") != -1){
	        zMSgetJS(arguments[0]);
        }else{
	        var zMSmyColour;
	        if (arguments.length < 1)//no arguments entered i.e. use existing bgcolour of page.
	            zMSmyColour = 'bgcolor="' + document.bgColor + '"';
	        else 
	            zMSmyColour = 'bgcolor="' + arguments[0] + '"';
	            
	        document.write('<iframe title="Advertisement" src="http://medrx.sensis.com.au/images/sensis/' + zMSsite + '/genericTower2.html?' + escape(zMSmyColour + '&' + escape('&SITE=' + zMSACCsite + '&AREA=' + zMSACCarea + '&pageid=' + zMSpagenum)) + '" width="160" height="600" frameborder="no" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no" id="towerFrame">\n');
	        document.write("</iframe>\n");
    	}
    }
    
    function zMScallGeneric(){
		//fix for Webmail Navbar
		if(zMSsection == "UMConsumer"){
			zMSsection = "WEBMAIL";
		}
		if(zMSsection == "office"){
			zMSsite_id="ThinkFree";
			zMSsection="home";

		}
        // see if page is BP music homepage
        if ((zMSlocation == "http://bigpondmusic.com/") || (zMSlocation == "http://www.bigpondmusic.com/") || (zMSlocation == "http://bigpondmusic.com/Default.aspx") || (zMSlocation == "http://bigpondmusic.com/?ref=Net-Head-Music")) {
            zMSsub_section = "HOME";
        }
		
	

        //Manual BP Sport - Cricket Targeting
		if (zMSlocation.indexOf("Cricket/ashes/ashespreview/tabid/") != -1){
			zMSsub_section = "CRICKET";
		}
        
        if (zMSlocation.indexOf("mondaynightlive") != -1) {
            zMSsub_section = "MNL";
            
        }
        
        if (zMSlocation.indexOf("memberoffers.bigpond.com") != -1) 
            zMSsection = "memberoffers";
        if (zMSlocation.indexOf("/ladders") != -1) 
            gasubsection = "ladders";
        
        if (zMSsite == "BigPond" && zMSsection != "games_channel") {
            zMSACCsite = "TEL.BIGPOND.PORTAL.ENTERTAINMENT";
            if (zMSsection != "") {
                zMSACCarea = "ENTERTAINMENT.BIGPOND." + zMSsection.toUpperCase();
                if (zMSsub_section != "") {
	                
	                //added the if section to repair the bigpond movies site
	                var movie_string = zMSsection.substring(0,5);

	                if ( movie_string.match("movie")) {
						movie_key = zMSsub_section.toUpperCase().replace(/%27/, "");	                
		            } 
	                else {
                    	zMSACCarea = zMSACCarea + "." + zMSsub_section.toUpperCase();
                    }
                }
            }
            
            if (zMSsection == "movies" || zMSsection == "movies.home") 
                zMSsection = "movie";
            if (zMSsection == "guide") 
                zMSsection = "tv";
            if (zMSsection == "games") 
                zMSsection = "gaming";
            if (zMSsection == "game_now") 
                zMSsection = "gamesnow";
            if (zMSsection == "homepage" || zMSsection == "memberoffers") 
                zMSsection = "portal";
            if (zMSsection == "kids") {
                zMSACCsite = "TEL.BIGPOND.KIDS";
                zMSACCarea = "KIDS.BIGPOND.KIDS";
                
            }
            else 
                if (zMSsection == "news") {
                    zMSACCsite = "TEL.BIGPOND.NEWS.NEWS_WEATHER";
                    if (zMSsub_section != "") 
                        zMSACCarea = "NEWS_WEATHER.BIGPOND.NEWS." + zMSsub_section.toUpperCase().replace(/_/, "");
                    else 
                        zMSACCarea = "NEWS_WEATHER.BIGPOND.NEWS";
                }
                
                else 
                    if (zMSsection == "games_shop") {
                        if (typeof(zMSgasubsection) != undefined && zMSgasubsection != null && zMSgasubsection.length > 0) 
                            zMSgasubsection2 = "." + zMSgasubsection.toUpperCase();
                        else 
                            zMSgasubsection2 = ""
                        
                        zMSACCsite = "TEL.BIGPOND.GAMES_SHOP.ENTERTAINMENT";
                        zMSACCarea = "ENTERTAINMENT.BIGPOND.GAMES_SHOP" + zMSgasubsection2;
                    }
                    else 
                        if (zMSsection == "weather") {
                            zMSACCsite = "TEL.BIGPOND.WEATHER.NEWS_WEATHER";
                            zMSACCarea = "NEWS_WEATHER.BIGPOND.WEATHER";
                        }
                        else 
                            if (zMSsection == "protopage") {
                                zMSACCsite = "TEL.BIGPOND.PROTOPAGE.ENTERTAINMENT";
                                zMSACCarea = "ENTERTAINMENT.BIGPOND.PROTOPAGE.OTHER";
                            }
                            else 
                                if (zMSsection == "shopping") {
                                    zMSACCsite = "TEL.BIGPOND.SHOPPING";
                                    zMSACCarea = "TEL.BIGPOND.SHOPPING." + zMSsub_section.toUpperCase();
                                }
                                else 
                                    if (zMSsection == "everest") {
                                        zMSACCsite = "TEL.BIGPOND.EVEREST.ENTERTAINMENT";
                                        zMSACCarea = "TEL.BIGPOND.EVEREST." + zMSsub_section.toUpperCase();
                                    }
                                    else 
                                        if (zMSsection == "sport") {
                                            zMSACCsite = "TEL.BIGPOND.SPORT";
                                            if (zMSlocation.indexOf("SurfLifesaving") != -1) {
                                                zMSsub_section = "SURF_LIFESAVING";
                                            }
                                            if (zMSsub_section != "" && zMSsub_section.indexOf("?") == -1) 
                                                zMSACCarea = "SPORT.BIGPOND." + zMSsub_section.toUpperCase() + ".SPORT";
                                            else 
                                                zMSACCarea = "SPORT.BIGPOND.OTHER";
                                        }
                                        else 
                                            if (zMSsection.indexOf("movies.") != -1) {
                                                zMSACCsite = "TEL.BIGPOND.MOVIE.ENTERTAINMENT";
                                            }
                                            else 
                                                zMSACCsite = "TEL.BIGPOND." + zMSsection.toUpperCase() + ".ENTERTAINMENT";
        }
        else 
            if (zMSsection == "games_channel") {
                if (zMSgasubsection == "homepage") 
                    zMSgasubsection = "home"
                if (zMSgasubsection == "") 
                    zMSgasubsection = "other"
                if (zMSuser_type == "") 
                    zMSuser_type = "allplatforms";
                zMSACCsite = "TEL.BIGPOND.GAMEARENA.GAMING";
                zMSACCarea = "GAMING.GAMEARENA." + zMSuser_type.toUpperCase() + "." + zMSgasubsection.toUpperCase();
            }
        
        if (zMSsection.indexOf("music") != -1 && zMSlocation.indexOf("https") == -1) 
            zMSgetJS("adsize=1x1&position=hidden");
        if (typeof(zMScountry) != "undefined" && zMScountry.indexOf("NZ") != -1) {
            zMSACCsite = zMSACCsite.replace(/BIGPOND/, "BIGPOND.NZ");
            zMSACCarea = zMSACCarea.replace(/BIGPOND/, "BIGPOND.NZ");
        }
        
        if (typeof(zMSsite_id) != "undefined" && zMSsite_id.toLowerCase().indexOf("girl_friday") != -1) {
            zMSACCsite = "TEL.BIGPOND.GIRL_FRIDAY.WOMEN";
            zMSACCarea = "WOMEN.BIGPOND.GIRL_FRIDAY.OTHER";
        }
        if (typeof(zMSsite_id) != "undefined" && zMSsite_id.toLowerCase().indexOf("thinkfree") != -1) {
            zMSACCsite = "TEL.BIGPOND.THINKFREE";
            zMSACCarea = "OFFICE.BIGPOND.THINKFREE.OTHER";
        }

        //DoubleClick Testing
        if (zMSlocation.indexOf("doubleclick_testingenvironment_jscript182") != -1) {
            zMSACCarea = "MOBILE.BOOMERANG.OTHER";
            zMSACCsite = "Z_ZORRO";
        }
        if (zMSlocation.indexOf("doubleclick_testingenvironment_iframe182") != -1) {
            zMSACCarea = "MOBILE.BOOMERANG.CHEAPMOBILES";
            zMSACCsite = "Z_ZORRO";
        }
        if (zMSlocation.indexOf("pond/secondlife") != -1) {
            zMSACCarea = "ENTERTAINMENT.BIGPOND.SECONDLIFE";
            zMSACCsite = "TEL.BIGPOND.SECONDLIFE.ENTERTAINMENT";
        }
        if (zMSlocation.indexOf("bigpondvideo.com") != -1) {
            zMSACCarea = "ENTERTAINMENT.BIGPOND.TV";
            zMSACCsite = "TEL.BIGPOND.TV.ENTERTAINMENT";
        }
        if (zMSlocation.indexOf("bigpond.com/mobile") != -1) {
            zMSACCarea = "ENTERTAINMENT.BIGPOND.MOBILE";
            zMSACCsite = "TEL.BIGPOND.MOBILE.ENTERTAINMENT";
        }
        if (zMSlocation.indexOf("community.bigpond.com/tlst") != -1) {
            zMSACCsite = "TEL.BIGPOND.FORUM";
        }
        if (zMSsite == "BigPond" && zMSsection == "olympics") {
            zMSACCsite = "BIGPOND.SPORT.OLYMPICS";
            if (zMSsub_section == "forum") {
                zMSACCarea = "SPORT.BIGPOND.OLYMPICS.FORUM";
            }
            else {
                zMSACCarea = "SPORT.BIGPOND.OLYMPICS.OTHER";
            }
        }
        //BP Movies Australia "mini-site"
        if (zMSsite == "BigPondMovies_Australia") {
            zMSACCsite = "TEL.BIGPOND.MOVIE.ENTERTAINMENT.AUSTRALIAMOVIE";
            zMSACCarea = "ENTERTAINMENT.BIGPOND." + zMSsection.toUpperCase();
        }
        
        //Temp BP Sport New targeting
        if (zMSlocation.indexOf("bigpondsport.com/Home08/NewsArticleNew") != -1) {
            zMSACCarea = "SPORT.BIGPOND.NEWS";
        }
        
        //Temp fix for bp sport homepage targeting
        if ((zMSlocation == "http://www.bigpondsport.com/default.aspx") || (zMSlocation.indexOf("bigpondsport.com/?") != -1)) {
            zMSACCarea = "SPORT.BIGPOND.HOMEPAGE.SPORT";
        }
        
        zMSACCarea = zMSACCarea.replace("-", "");
        
        //adelaidefilmfestival
        if (zMSsection == "adelaidefilmfestival") {
            zMSACCarea = "TEL.BIGPOND.ADELAIDEFILMFESTIVAL";
        }
        
        if (((zMSlocation.indexOf("http://webmail") != -1) && (zMSlocation.indexOf("bigpond.com/webedge") != -1)) || zMSlocation.indexOf("webedge.bigpond.com") != -1) {
            zMSACCarea = "ENTERTAINMENT.BIGPOND.OLDWEBMAIL";
        }
        
		//Temp fix for bp news rss targeting
        if (zMSlocation.indexOf("bigpondnews.com/rss") != -1) {
            zMSACCarea = "NEWS_WEATHER.BIGPOND.NEWS.RSS";
        }		
		
        //Fix for bp weather targeting
        if (zMSlocation.indexOf("bigpond.com/weather") != -1) {
            zMSACCsite = "TEL.BIGPOND.WEATHER.NEWS_WEATHER";
        }
        // see if page is BP Kids -> Movies
        if (zMSlocation.indexOf("bigpond.com/kids/movies") != -1) {
            zMSACCarea = "KIDS.BIGPOND.KIDS.MOVIES";
        }
        // see if page is BP Kids -> Music
        if (zMSlocation.indexOf("bigpond.com/kids/music") != -1) {
            zMSACCarea = "KIDS.BIGPOND.KIDS.MUSIC";
        }
        // see if page is BP Kids -> Games
        if (zMSlocation.indexOf("bigpond.com/kids/games") != -1) {
            zMSACCarea = "KIDS.BIGPOND.KIDS.GAMES";
        }
		
		
		//Check if Bigpond Movies Confirmation
		if (zMSlocation.indexOf("PurchaseAction") != -1) {
            zMSACCarea = "ENTERTAINMENT.BIGPOND.MOVIES.PURCHASE";
        }		
		
		
		//Testing environment
		if (zMSlocation.indexOf("zmstestingenvironment375") != -1) {
            zMSACCarea = "MOB.TEST.DEMO";
            zMSACCsite = "Z_ZORRO";
        }
		//Toothpaste
		if (zMSlocation.indexOf("?mstoothpaste") != -1){
			zMSkey = "/KEYWORD=MSTOOTHPASTE";
		}
                
		//manual bigpond racing targeting
		if(zMSlocation.indexOf("horseracing.bigpond.com") != -1){
			zMSACCarea = "SPORT.BIGPOND.HORSERACING.SPORT.BIGPONDRACING";
		}
    }
    
}

document.write("<scr"+"ipt src='//medrx.sensis.com.au/images/sensis/BigPond/Sha.js'></scr"+"ipt>");

function zMSsetId(zMSid){
    var zMShashed = (sha1Hash(zMSid.toLowerCase())).toUpperCase();
	//alert(zMShashed);
	document.write('<iframe title="" src="https://media.sensis.com.au/hserver/SITE=Z_ZORRO/AAMSZ=1x8/HASHED=' + zMShashed + '/KEYWORD=URUSER?name=GUID&value=' + zMShashed + '&duration=90" name="userReg" width="0" height="0" frameborder="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no">\n');
	document.write("</iframe>\n");

}


zMSHasUtilFileBeenAlreadyLoaded = true;