var DISABLE_AUTO_SUGGEST; var IS_DEBUG = false; var DISABLE_AUTO_HIDE = false; var autoSuggestConfig = { panelId: "sw_as", debug: IS_DEBUG, inputId: "sh", formId: "sf", closedIndicatorId: "as_indicator_closed", openedIndicatorId: "as_indicator_opened", messagePanelHeight: 25, disableTxt: "Turn off", enableTxt: "Turn Auto Suggestion on", maxSug: 8, typeDel: 50, expDays: 60, market: "en-au", apiUrl: "http://api.bing.com/qson.aspx?FORM=ASMSNA", animate: true }; var QS_AS = '&qs=n'; $(document).ready(function() { attachAS2Main(); executeAutoSuggest(); }); function attachAS2Main() {
    try { var contentsPanel = document.getElementById("hd_middle"); var wrapperPanel = document.createElement("div"); wrapperPanel.id = "auto_suggestion_wrapper"; var suggestionPanel = document.createElement("div"); suggestionPanel.id = autoSuggestConfig.panelId; wrapperPanel.appendChild(suggestionPanel); var indicatorPanel = document.createElement("div"); indicatorPanel.id = autoSuggestConfig.closedIndicatorId; wrapperPanel.appendChild(indicatorPanel); contentsPanel.appendChild(wrapperPanel); promoTopAdjust('increase', 'auto_suggestion_wrapper'); }
    catch (error) { if (IS_DEBUG) { alert("attachAS2Main:" + error); }; };
}; var autoSuggestInstance; function autoSuggest(config) {
    var pc = window, m = document, ib = undefined, yc = location.search, Pb = m.getElementsByTagName("head")[0], pb = navigator.userAgent.indexOf("MSIE") > -1, kc = pb && !window.XMLHttpRequest, e, R = {}, wb = {}, K = -1, J = 1, vb = 2, Rb = 3, sb = 8, tb = 15, xb = 65, Sb = 128, Fb = 35, To = 50, ec = "firstChild", y = "innerHTML", c = "appendChild", F = "className", o = "div", l = "style", Z = "onreadystatechange", Lb = "onload", Kb = "onerror", nb = "value", u = "length", jb = "height", U = "display", wc = "indexOf", Db = "nextSibling", yb = "previousSibling", O = "readyState", kb = "loaded", gb = "onmousedown", G = "mouseout", Q = "mouseover", fb = "offsetHeight", ob = "href", Hb = "0", qc = "ul", qb = "li", rb = "a", tc = "AutoSugg", fc = "sa_sg", Mb = "as_sc", containerId = "sa_as", i = this, V = false,  nc = new RegExp("^\\s*|\\s*$", "g"), Xb = new RegExp("\\s+", "g"), vc = m.body.innerText != ib ? "innerText" : "textContent", hc = config.animBounce && config.animate, disabled, panelOpened, form, input, container, arrowPanel, mainPanel, listPanel, messagePanel, indicatorPanelOpened, indicatorPanelClosed, onMessageClick, hb, ab, Ab, mb, lb, D, uc, xc, Qb, M, I, f, Cb, z, eb, Gb, j, C, db, v, t, h, Jb, b, bb, cb, p; eb = j = C = db = v = t = 0; this.init = function(i) {
        try {
            QS_AS = '&qs=n'; cookieName = "search_as"; disabled = mc(); form = X(config.formId); input = X(config.inputId); input.blur(); input.setAttribute("autocomplete", (disabled ? "on" : "off"));if(JS_ENABLE_SEARCHFOCUS.toLowerCase()!='false')input.focus(); var j = X(config.panelId); f = config.enableHist ? true : false; Cb = config.hitHigh ? true : false; if (kc) {
                try { m.execCommand("BackgroundImageCache", false, true); }
                catch (k) { };
            }; container = X(containerId); if (container) { container.parentNode.removeChild(container); }; container = d(o, containerId); Gb = container[l].left; j[c](container); var e = d(o, "", "sw_b3"); container[c](e); var h = d(o, "", "sw_b2"); e[c](h); mainPanel = d(o, "sa_as3", "sw_b1"); h[c](mainPanel); Ab = i; listPanel = d(o, "sa_drw"); if (f) { p = new HistSuggest; if (!(f = p.init())) { setLocalCookie("search_as", '1', true, 0); }; }; mainPanel[c](listPanel); messagePanel = d(o, "sa_om"); var b = d(qc); mb = d(qb, "sa_tf"); _anchorTurnOff = d(rb); _anchorTurnOff[y] = disabled ? config.enableTxt : config.disableTxt; _anchorTurnOff[gb] = onMessageClick; _anchorTurnOff[ob] = "javascript:void(null);"; mb[c](_anchorTurnOff); b[c](mb); if (config.optTxt != ib) { lb = d(qb, "sa_ol"); D = d(rb); D[ob] = config.optUrl + "&sh=4"; D[y] = config.optTxt; D[gb] = Zb; lb[c](D); b[c](lb); }; if (config.helpTxt != ib) { _help = d(qb, "sa_hl"); _anchorHelp = d(rb); _anchorHelp[ob] = config.helpUrl; _anchorHelp.target = "_blank"; _anchorHelp[y] = config.helpTxt; _anchorHelp[gb] = dc; _anchorHelp.onmouseup = jc; _help[c](_anchorHelp); b[c](_help); }; messagePanel[c](b); mainPanel[c](messagePanel); Qb = ""; M = config.maxSug; I = 1; apiUrl = config.apiUrl + "?market=" + config.market.Mkt + "&options=EnableSuggestionType" + (Cb ? "+EnableHighlighting" : "") + "&JsonType=callback&JsonCallback=" + Ab + ".setData"; var topMenu = $("#cat_hl_161779"); if (topMenu.length > 0) { attachEvent(topMenu[0], "mouseover", closePanel); }; if (config.outofScope) { appendIndicator(); }
            else {
                this.attachEvents2Form(); if (disabled) { disableAS(); }
                else { enableAS(); };
            }; swapIndicator(); onMessageClick = false;
        }
        catch (error) { if (IS_DEBUG) { alert("init:" + error); }; };
    }; this.attachEvents2Form = function() { attachEvent(form, "submit", onSubmit); attachEvent(input, "keyup", onKeyup); attachEvent(input, "click", onClick); attachEvent(input, "blur", onBlur) }; this.createSuggestion = function(l, p, m, n) {
        try {
            var j = listPanel.childNodes; if (n) { for (var h = 0; h < j.length; h++) { if (j[h] && (j[h].tid == m)) { break; }; }; }
            else if (j[h] && (j[h].sug == l.Text)) { return null; }; var b = d(o, "", p); attachEvent(b, "mousedown", i.onMouseDownSuggestion); attachEvent(b, Q, Vb); attachEvent(b, G, Ub); attachEvent(b, "mousemove", ub); var k = d(o, "", "sa_tm"); b.tid = k.tid = m; b[c](k); var e = l.Text; b.sug = e; if (f && config.enableMetaData && e.length > Fb) { e = e.substring(0, Fb) + "..."; }; k[y] = e; listPanel[c](b);
        }
        catch (error) { if (IS_DEBUG) { alert("createSuggestion:" + error); }; }; return b;
    }; this.setData = function(d) {
        var a = "", b = []; --v; try {
            a = lc(d.SearchSuggestion.Query); if (!(b = d.SearchSuggestion.Section)) { b = []; }; var c = Hb + a; if (b.length == 0) { wb[c] = true; }
            else if (!R[c] && eb < Sb) { R[c] = d; eb++; }; N(); if (a != h.toLowerCase()) { if (v > 0) { L(); }; return; };
        }
        catch (e) { i.buildSuggestions("", "", true); return; }; i.buildSuggestions(b, a);
    }; this.getSelectedSug = function() { return bb; }; this.getHistCont = function() { return p; }; this.showDropDown = function() { swapIndicator(true); }; this.buildSuggestions = function(a, e, d) {
        try { listPanel[y] = ""; if (f) { C = db = p.buildHistorySuggestionList(d ? M : M - a[u]); }; if (!d) { var b = Math.min(a[u], M - db); for (var c = 0; c < b; c++) { if (!i.createSuggestion(a[c], fc, 1, f)) { b < a[u] ? ++b : ""; }; }; C = listPanel.childNodes.length; }; if (C == 0) { ab = setTimeout(Y(closePanel, true), To); return; }; if (!disabled) { openPanel(); }; }
        catch (error) { if (IS_DEBUG) { alert("buildSuggestion:" + error); }; };
    }; this.getCurrentQuery = function() { return h; }; this.doFetch = function(a) {
        try {
            if (e) {
                e.src = a; Jb = h; if (pb) { e[Z] = i.onBeforeFetchComplete; }
                else { e[O] = kb; e[Lb] = e[Kb] = Bb; i.onBeforeFetchComplete(); };
            };
        }
        catch (error) { if (IS_DEBUG) { alert("doFetch:" + error); }; };
    }; this.onBeforeFetchComplete = function() {
        try { if (e[O] == kb || e[O] == "complete") { e[Z] = Bb; var a = X(Mb); if (a) { Pb.removeChild(a); }; Pb[c](e); }; }
        catch (error) { if (IS_DEBUG) { alert("onBeforeFetchComplete:" + error); }; };
    }; function X(a) { return m.getElementById(a); }; function attachEvent(a, d, b, c) {
        if (a.addEventListener) { a.addEventListener(d, b, c); }
        else if (a.attachEvent && !c) { a.attachEvent("on" + d, b); }
        else if (a.setAttribute && !c) { a.setAttribute("on" + d, b); };
    }; function removeEvent(a, d, b, c) {
        if (a.removeEventListener) { a.removeEventListener(d, b, c); }
        else if (a.detachEvent && !c) { a.detachEvent("on" + d, b); };
    }; function s(e, c, b) {
        var a; try {
            if (pb) {
                if (b) { a = m.createEventObject(); a.sourceElement = b; e.fireEvent("on" + c, a) }
                else { e.fireEvent("on" + c); };
            }
            else {
                var d = "HTMLEvents"; if (c != "submit") { d = "MouseEvents"; a = m.createEvent(d); a.initEvent(c, true, true, pc, 0, 0, 0, 0, 0, false, false, false, false, 0, b) }
                else { a = m.createEvent(d); a.initEvent(c, true, true) }
                if (b) a.sourceElement = b; e.dispatchEvent(a)
            };
        }
        catch (error) { if (IS_DEBUG) { alert("s:" + error); }; };
    }; function d(d, c, b) {
        try { var a = m.createElement(d); if (c) { a.id = c; }; if (b) { a["className"] = b; }; }
        catch (error) { if (IS_DEBUG) { alert("d:" + error); }; }; return a;
    }; function Y(c) {
        try { var b = new Array; for (var i = 1; i < arguments.length; i++) { b[i - 1] = arguments[i]; }; }
        catch (error) { if (IS_DEBUG) { alert("Y:" + error); }; }; return function() { c.apply(null, b); };
    }; function sc(a) { return a.replace(nc, "").replace(Xb, " "); }; function T(b) {
        try { var a = b.srcElement ? b.srcElement : b.target; if (a[F] == "sa_tm") { a = a.parentNode; }; }
        catch (error) { if (IS_DEBUG) { alert("T:" + error); }; }; return a;
    }; function ub(b) {
        try { var a = T(b); if (z) { z = false; s(a, Q, a); removeEvent(a, "mousemove", ub); }; }
        catch (error) { if (IS_DEBUG) { alert("ub:" + error); }; };
    }; this.onMouseDownSuggestion = function(a) {
        try { var b = T(a); cb = b; }
        catch (error) { if (IS_DEBUG) { alert("onMouseDownSuggestion:" + error); }; };
    }; function Vb(c) {
        try { var a = T(c); if (z) { return; }; if (b) { s(b, G, a); }; if (!a.hover) { a[F] = a[F] + " sa_hv"; a.hover = true; b = a; }; }
        catch (error) { if (IS_DEBUG) { alert("Vb:" + error); }; };
    }; function Ub(c) {
        try { var a = T(c); if (a.hover) { a[F] = a[F].replace(" sa_hv", ""); a.hover = false; b = null; }; }
        catch (error) { if (IS_DEBUG) { alert("Ub:" + error); }; };
    }; function onMessageClick() {
        try {
            onMessageClick = true; if (disabled) {
                if (h == "") { listPanel[y] = ""; }; enableAS(); AdTrack.t('http://msn.co.nz/', 'NH_SEARCH_AS_INT', 2); panelOpened = false; onClick(); if (isListExist()) { displayMainPanel(); }
                else { onCloseCompleted(); };
            }
            else { swapIndicator(false); disableAS(); AdTrack.t('http://msn.co.nz/', 'NH_SEARCH_AS_INT', 3); closePanel(); hideMainPanel(); setTimeout(displayMainPanel, To * 10); }; this[y] = disabled ? config.enableTxt : config.disableTxt;
        }
        catch (error) { if (IS_DEBUG) { alert("onMessageClick:" + error); }; };
    }; function Zb() { V = true; }; function dc() { V = true; }; function jc() { V = false; closePanel(); }; function mc() {
        var enabled; if (GetCookie("search_as") === '0') { enabled = true; }
        else { enabled = false; }
        return enabled;
    }; function x(c, d, e, b) {
        try {
            if (!b) { b = Rb; }; if (config.animate && Math.abs(c - d) > tb) { c += tb * e; setHeight(c); setTimeout(Y(x, c, d, e, b), b); }
            else { onOpenCompleted(d, e, b); };
        }
        catch (error) { if (IS_DEBUG) { alert("x:" + error); }; };
    }; function onOpenCompleted(a, c, b) {
        try {
            setHeight(a); if (hc && t < vb) {
                if (c == J) { setTimeout(Y(x, a, j - (xb - xb / vb * t), K, sb * (t + 2)), b); }
                else { setTimeout(Y(x, a, j, J, sb * (t + 1)), b); t++; };
            }
            else if (c == K && a == 0) { onCloseCompleted(); };
        }
        catch (error) { if (IS_DEBUG) { alert("onOpenCompleted:" + error); }; };
    }; function setHeight(height) {
        try { mainPanel[l][jb] = (disabled ? config.messagePanelHeight : parseInt(height)) + "px"; }
        catch (error) { if (IS_DEBUG) { alert("setHeight[" + height + "]:" + error); }; };
    }; function openPanel() {
        try {
            if (disabled || (isListExist() && (h != ""))) {
                z = true; if (!panelOpened) { container[l].left = "-1000px"; container[l][U] = "block"; }; var b = disabled ? config.messagePanelHeight : Math.max(listPanel.childNodes[0][fb] * C, 102); var a = j; j = b + messagePanel[fb]; listPanel[l][jb] = b + "px"; if (f) { p.resizeUI(listPanel[fb]); }; container[l][jb] = 0; if (!panelOpened) { container[l].left = Gb; }; if (!panelOpened) { panelOpened = true; t = 0; x(0, j, J); i.showDropDown(); }
                else if (a != j) { x(a, j, a < j ? J : K); };
            } 
        }
        catch (error) { if (IS_DEBUG) { alert("openPanel:" + error); }; };
    }; function closePanel() {
        try { if (panelOpened) { if (!DISABLE_AUTO_HIDE) { if (f) { p.hideUI(); }; x(j, 0, K); panelOpened = false }; }; appendIndicator(); if (h == "") { }; }
        catch (error) { if (IS_DEBUG) { alert("closePanel:" + error); }; };
    }; function onCloseCompleted() {
        try { if (!DISABLE_AUTO_HIDE) { container[l][U] = "none"; panelOpened = false; }; swapIndicator(false); if (h == "") { }; }
        catch (error) { if (IS_DEBUG) { alert("onCloseCompleted:" + error); }; };
    }; function onBlur() {
        try {
            if (cb) { E(cb); s(form, "submit"); }
            else if (!V) {


                if (onMessageClick) { onMessageClick = false; }
                else { closePanel(); };
            };
        }
        catch (error) { if (IS_DEBUG) { alert("onBlur:" + error); }; };
    }; function onSubmit() { Eb(); onCloseCompleted(); }; function onClick() {
        try {
            if (!panelOpened) {
                N(); if (h[u] >= I) { L(); }
                else if (f) { i.buildSuggestions("", "", true); }; b = null;
            };
        }
        catch (error) { if (IS_DEBUG) { alert("onClick:" + error); }; };
    }; function onKeyup(d) {
        try {
            z = false; switch (d.keyCode) {
                case 9: case 13: case 16: case 17: case 37: case 39: break; case 27: closePanel(); break; case 38: var c = null; if (b && b[yb]) { c = b[yb]; }
                    else if (b) { s(b, G, null); E(); break; }
                    else if (panelOpened) { c = listPanel.lastChild; }; s(c, Q, b); E(c); break; case 40: var c = null; if (!panelOpened) {
                        N(); if (h[u] >= I) { L(); }
                        else if (f) { i.buildSuggestions("", "", true); }; return;
                    }; if (b && b[Db]) { c = b[Db]; }
                    else if (b) { s(b, G, null); E(); if (f) { p.hideUI(); }; break; }
                    else { c = listPanel[ec]; }; s(c, Q, c); E(c); break; default: z = true; if (b) { s(b, G); b = null; }; if (f) { p.hideUI(); }; if (ab) { clearTimeout(ab); }; Eb(); N(); if (h[u] < I) { closePanel(); return; }; if (v < 2) { hb = setTimeout(L, config.typeDel); };
            };
        }
        catch (error) { if (IS_DEBUG) { alert("onKeyup:" + error); }; };
    }; function E(a) {
        try {
            if (!a) { input[nb] = h; bb = null; QS_AS = '&qs=n' }
            else { input[nb] = a.sug; bb = a; QS_AS = '&qs=AS' } 
        }
        catch (error) { if (IS_DEBUG) { alert("E:" + error); }; };
    }; function N() { h = sc(input[nb]); }; function Eb() { if (hb) { clearTimeout(hb); }; }; function L() {
        try { if (v && Jb == h || h[u] < I) { return; }; var c = h.toLowerCase(), a = Hb + c; ++v; if (R[a]) { i.setData(R[a]); return; }; e = d("script", Mb); var b = apiUrl + "&query=" + encodeURIComponent(c); if (wb[a]) { b = b + "&qt=" + (new Date).getTime(); }; i.doFetch(b); }
        catch (error) { if (IS_DEBUG) { alert("L:" + error); }; };
    }; function Bb() { if (e[O] == kb) { e[Z] = e[Lb] = e[Kb] = null; }; }; function lc(a) { return a.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/'/g, "'").replace(/"/g, '"'); }; function enableAS() {
        try { disabled = false; input.setAttribute("autocomplete", "off"); setLocalCookie("search_as", '1', true, 0); appendIndicator(); }
        catch (error) { if (IS_DEBUG) { alert("enableAS:" + error); }; };
    }; function disableAS() {
        try { disabled = true; input.setAttribute("autocomplete", "on"); setLocalCookie("search_as", '0', false, 30); appendIndicator(); }
        catch (error) { if (IS_DEBUG) { alert("disableAS:" + error); }; };
    }; function hideMainPanel() { mainPanel[l][U] = "none"; }; function displayMainPanel() { mainPanel[l][U] = "block"; }; function isListExist() { return listPanel && (listPanel.childNodes.length > 0); }; function appendIndicator() {
        try {
            indicatorPanelClosed = X(config.closedIndicatorId); indicatorPanelClosed.className = "as-indicator indicator-closed" + (disabled ? " as-disabled" : " as-enabled"); if (disabled) { attachEvent(indicatorPanelClosed, "click", openPanel); indicatorPanelClosed[l]["cursor"] = "pointer"; }
            else {
                if (isListExist() && (h != "")) { attachEvent(indicatorPanelClosed, "click", onClick); indicatorPanelClosed[l]["cursor"] = "pointer"; }
                else { removeEvent(indicatorPanelClosed, "click", onClick); indicatorPanelClosed[l]["cursor"] = "auto"; };
            }; indicatorPanelOpened = X(config.openedIndicatorId); if (!indicatorPanelOpened) { indicatorPanelOpened = d(o, config.openedIndicatorId); container[c](indicatorPanelOpened); attachEvent(indicatorPanelOpened, "click", closePanel); }; indicatorPanelOpened.className = "as-indicator indicator-opened" + (disabled ? " as-disabled" : " as-enabled"); listPanel[l][U] = disabled ? "none" : "block";
        }
        catch (error) { if (IS_DEBUG) { alert("appendIndicator:" + error); }; };
    }; function swapIndicator(isOn) {
        try { indicatorPanelOpened[l][U] = isOn && !config.outofScope ? "block" : "none"; indicatorPanelClosed[l][U] = isOn || config.outofScope ? "none" : "block"; }
        catch (error) { if (IS_DEBUG) { alert("swapIndicator:" + error); }; };
    };
}; function executeAutoSuggest(outofScope) {
    try { if (!DISABLE_AUTO_SUGGEST) { autoSuggestConfig.outofScope = outofScope; autoSuggestInstance = new autoSuggest(autoSuggestConfig); autoSuggestInstance.init("autoSuggestInstance"); }; }
    catch (error) { if (IS_DEBUG) { alert("executeAutoSuggest:" + error); }; };
};





// added
function GetCookie(lookupCookieName) {
    var a_all_cookies = document.cookie.split(';');
    var a_temp_cookie = '';
    var b_cookie_found = false;
    var cookie_name = '';
    var cookie_value = '';

    for (i = 0; i < a_all_cookies.length; i++) {
        a_temp_cookie = a_all_cookies[i].split('=');
        cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

        if (cookie_name === lookupCookieName) {
            b_cookie_found = true;
            cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ''));
            return cookie_value;
            break;
        }
        a_temp_cookie = null;
        cookie_name = '';
    }

    if (!b_cookie_found) {
        return null;
    }
}

function promoTopAdjust(state, elms) {
    var promoTopAdjustBy = null;
    var elmsToUpdate = null;
    var singleElm = null;
    var currElm = null;
    var currElmPos = null;

    if (document.getElementById('top_promo') != null) {
        promoTopAdjustBy = parseInt(document.getElementById('top_promo').offsetHeight);

        if (promoTopAdjustBy > 0) {
            promoTopAdjustBy = promoTopAdjustBy + 2;
        }

        elmsToUpdate = elms.split(':');

        for (i = 0; i < elmsToUpdate.length; i++) {
            singleElm = elmsToUpdate[i];

            currElm = jQuery("#" + singleElm);
            currElmPos = parseInt(currElm.css('top'));

            if (isNaN(promoTopAdjustBy)) {
                promoTopAdjustBy = 0;
            }

            if (isNaN(currElmPos)) {
                currElmPos = 0;
            }

            if (state === 'reduce') {
                currElm.css('top', currElmPos - promoTopAdjustBy + 'px');
            }
            else {
                currElm.css('top', currElmPos + promoTopAdjustBy + 'px');
            }
        }
    }
}

function days_between(date1, date2) {
    var ONE_DAY = 1000 * 60 * 60 * 24
    var date1_ms = date1.getTime()
    var date2_ms = date2.getTime()
    var difference_ms = Math.abs(date1_ms - date2_ms)
    return Math.round(difference_ms / ONE_DAY)
}



function setLocalCookie(cookieName, cookieValue, cookieDispose, expDays) {
    var cookieExpiresOn = new Date();
    var cookieDomain = document.domain;

    if (cookieDispose) {
        cookieExpiresOn.setFullYear(2000, 1, 01);
    }

    cookieExpiresOn.setTime(cookieExpiresOn.getTime() + (expDays * 1140 * 60 * 1000));
    cookieExpiresOn = cookieExpiresOn.toGMTString();
    document.cookie = cookieName + '=' + cookieValue + ";expires=" + cookieExpiresOn + ";path=/" + ";domain=" + cookieDomain;
    return false;
}

//function submit_form() {
//    var arrArgs = submit_form.arguments;
//    var oForm = arrArgs[0];
//    var strParam = arrArgs[1];
//    var strInput, strType;

//    if (strParam == 'rs') {
//        if ("[" + typeof (oForm.query.value) + "]" != "[undefined]") {
//            strInput = oForm.query.value
//        } else {
//            strInput = '';
//        }

//        window.parent.location.href = "http://recipefinder.msn.co.nz/recipesearch/searchresults.aspx?collection=AllNZRecipe&query=" + strInput;

//    }
//    return false;
//}

function parsePCtoBing(b) {
    if (b != "") {
        b = b.substring(1).split("&");
        for (var a = 0; a < b.length; a++) if (b[a].toLowerCase().indexOf("pc=") != -1) return "&" + b[a]
    }
    return ""
}

function submit_form() {
var e = "";
    if (!arguments[2]) { if (QS_AS == '&qs=AS') arguments[2] = 'sw'; else arguments[2] = 'spy'; }
    var arrArgs = submit_form.arguments; var oForm = arrArgs[0]; var strParam = arrArgs[1]; var strInput; var strRF = ""; var strScope = ""; var strFormCode = ""; var haveSearchTerm = true; var strSrch = ""; if (strParam == 'web0') {
        strInput = oForm.q.value; if (strInput === null) { haveSearchTerm = false; }
        if (strInput === '') { haveSearchTerm = false; }
        if (oForm.action == 'http://shopping.ninemsn.com.au/results.aspx') { window.location.href = "http://a.ninemsn.com.au/b.aspx?URL=" + encodeURL(oForm.action + "?text=" + encodeURL(strInput)) + "&_p=282_3084_0&_m=NH_SCH_" + strParam.toUpperCase() + "&_l=200&_x=1"; }
        else if (oForm.action == 'http://mylocal.ninemsn.com.au/') {
            if (document.getElementsByName("t").length > 0) {
                if (oForm.t[0].checked) { strRF = "0"; }
                else if (oForm.t[1].checked) { strRF = "1"; }
            }
            if ($("#sh_b_1").attr("value") === BIZZ_NAME_D_TXT) { strInput = ''; }
            else { strInput = $("#sh_b_1").attr("value"); }
            if ($("#sh_b_2").attr("value") === BIZZ_PLACE_D_TXT) { strInputWhere = ''; }
            else { strInputWhere = $("#sh_b_2").attr("value"); }
            if (strInputWhere === "" && strInput === "") { window.location.href = "http://a.ninemsn.com.au/b.aspx?URL=" + encodeURL("http://mylocal.ninemsn.com.au/") + "&_p=282_3084_0&_m=NH_SCH_" + strParam.toUpperCase() + "&_l=205&_x=1"; }
            else { window.location.href = "http://a.ninemsn.com.au/b.aspx?URL=" + encodeURL("http://mylocal.ninemsn.com.au/search.aspx?action=search&what=" + encodeURL(strInput) + "&where=" + strInputWhere + "&type=" + strRF) + "&_p=282_3084_0&_m=NH_SCH_" + strParam.toUpperCase() + "&_l=205&_x=1"; }
        }
        else if (oForm.action == 'http://maps.ninemsn.com.au/index.aspx') { window.location.href = "http://a.ninemsn.com.au/b.aspx?URL=" + encodeURL("http://maps.ninemsn.com.au/index.aspx?action=location&location=" + strInput + "&form=MSNZHP") + "&_p=282_3084_0&_m=NH_SCH_" + strParam.toUpperCase() + "&_l=200&_x=1"; }
        else {
            if (oForm.className == 'sa1') {
                if (haveSearchTerm) { strSrch = 'search?q=' + encodeURL(strInput) + '&form=MSNZHP&mkt=en-nz' + QS_AS; }
                else {
                    if (arguments[2] == 'logo') { strSrch = '?form=MSNZHP&mkt=en-nz'; }
                    else { strSrch = 'search?q=msn+nz&form=MSNZHP&mkt=en-nz'; }
                }
            }
            if (oForm.className == 'sa6') {
                if (haveSearchTerm) { strSrch = 'search?q=' + encodeURL(strInput) + '&form=MSNZHP&mkt=en-nz&scope=msn' + QS_AS; }
                else {
                    if (arguments[2] == 'logo') { strSrch = '?form=MSNZHP&mkt=en-nz'; }
                    else { strSrch = 'search?q=msn+nz&form=MSNZHP&mkt=en-nz'; }
                }
            }
            if (oForm.className == 'sa2') {
                if (haveSearchTerm) { strSrch = 'search?q=' + encodeURL(strInput) + '&form=MSNZHP&mkt=en-nz' + QS_AS; }
                else { strSrch = '?form=MSNZHP&mkt=en-nz'; }
            }
            if (oForm.className == 'sa7') {
                if (haveSearchTerm) { strSrch = 'search?q=' + encodeURL(strInput) + '&form=MSNZHP&mkt=en-nz' + QS_AS; }
                else { strFormCode = 'search?q=&form=MSNZHP&mkt=en-nz'; }
            }
e += parsePCtoBing(location.search);
            window.location.href = "http://a.ninemsn.com.au/b.aspx?URL=" + encodeURL(oForm.action + strSrch + e) + "&_p=282_3084_0&_m=NH_SCH_" + strParam.toUpperCase() + "&_l=200&_x=1";
        }
    }
    else if (strParam == 'finance') {
        strInput = document.getElementById("txtbox_quote").value; if (strInput === null) { strInput = ''; }
        window.location.href = "http://a.ninemsn.com.au/b.aspx?URL=" + encodeURL("http://money.ninemsn.com.au/shares-and-funds/research-a-company/overview.aspx?ctry=AX&inforeq=Quotes&code=" + strInput) + "&_p=282_3084_0&_m=NH_FIN&_l=200&_x=1";
    }
    else if (strParam == 'shopping') {
        strInput = oForm.txtbox_shopping.value; if (strInput === null) { strInput = ''; }
        window.location.href = "http://a.ninemsn.com.au/b.aspx?URL=" + encodeURL("http://shopping.ninemsn.com.au/results.aspx?text=" + strInput) + "&_p=282_3084_0&_m=NH_SHO&_l=200&_x=1";
    }
    else if (strParam == 'vote') { window.open('http://a.ninemsn.com.au/b.aspx?URL=' + encodeURL("http://news.ninemsn.com.au/vote.aspx?voteid=9") + '&_p=282_3084_0&_m=NH_VOTE&_l=1', 'vote_site', 'height=300,width=300,status=no,toolbar=no,menubar=no,location=no'); }
    else if (strParam == 'pic') { window.open('http://a.ninemsn.com.au/b.aspx?URL=' + encodeURL("http://ninemsn.com.au/popup.aspx?imgname=" + arrArgs[2] + "&imgurl=" + arrArgs[3]) + '&_p=282_3084_0&_m=NH_NEWS_PIC_ENLG&_l=1&_x=1', 'large_pic', 'height=354,width=350,status=no,toolbar=no,menubar=no,location=no'); }
    else if (strParam == 'media') { window.open('http://a.ninemsn.com.au/b.aspx?URL=' + encodeURL("http://news.ninemsn.com.au/mediapopup.aspx?" + arrArgs[2]) + '&_p=282_3084_0&_m=NH_NEWS_PIC_MEDIA&_l=1&_x=1', 'media_pop', 'height=470,width=690,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=1,toolbar=0'); }
}

function onEnter(form, e, strParam) {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if (keycode == 13) {
        submit_form(form, strParam);
        return false;
    } else return true;
}








