﻿
var oSendMenuToBackTimerId = -1;


function pageLoaded()
{
    defaultMenuState();
}

function insertFlashObject(ctlId, src, width, height, wmode)
{
    if (ctlId == "")
    {
        document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" align=\"middle\">");
    }
    else
    {
        document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + ctlId + "\" align=\"middle\">");
    }
    document.write("	<param name=\"allowScriptAccess\" value=\"always\" />");
    document.write("	<param name=\"movie\" value=\"" + src + "\" />");
    document.write("	<param name=\"quality\" value=\"high\" />");
    document.write("	<param name=\"bgcolor\" value=\"#FFFFFF\" />");
    document.write("	<param name=\"wmode\" value=\"" + wmode + "\" />");
    if (ctlId == "")
    {
        document.write("	<embed src=\"" + src + "\" width=\"" + width + "\" height=\"" + height + "\" align=\"middle\" quality=\"high\" bgcolor=\"#ff0000\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"" + wmode + "\" />");
    }
    else
    {
        document.write("	<embed src=\"" + src + "\" id=\"" + ctlId + "Embed\" width=\"" + width + "\" height=\"" + height + "\" align=\"middle\" quality=\"high\" bgcolor=\"#ff0000\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" name=\"" + ctlId + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"" + wmode + "\" />");
    }
    document.write("</object>");
}


function getSwf(objectCtlId, embedCtlId)
{
    var res;
    
    if (navigator.appName.indexOf("Microsoft Internet") == -1)
    {
        res = document.getElementById(embedCtlId);
    }
    else
    {
        res = document.getElementById(objectCtlId);
    }
    return (res);
}

function getMenuSwf()
{
    return (getSwf("Menu", "MenuEmbed"));
}

function hideFlashMenus()
{
    var swf;
    
    swf = getMenuSwf();
    if (swf.PercentLoaded() == 100)
    {
        //alert(swf.GetVariable("oForceOutOfBounds"));
        swf.SetVariable("oForceOutOfBounds", "true");
        //document.title = swf.GetVariable("oForceOutOfBounds");
    }        
        
}

function defaultMenuState()
{
    var app;
    
    app = window.navigator.appName;
    if (app.indexOf("Microsoft") != -1)
    {
        document.getElementById("SiteContentDiv").style.zIndex = 1;
    }
}

//is triggered by the menu swf
function menuEvent_TrackingState(enabled)
{
    var app;
    
    if (enabled == true)
    {
        if (oSendMenuToBackTimerId != -1)
        {
            window.clearTimeout(oSendMenuToBackTimerId);
            oSendMenuToBackTimerId = -1;
        }
        
        //document.title = "ENABLED";
        document.getElementById("SiteContentDiv").style.zIndex = 1;
    }
    else
    {        
        app = window.navigator.appName;
        if (app.indexOf("Microsoft") == -1)
        {
            oSendMenuToBackTimerId = window.setTimeout("sendMenuToBack();", 500);
        }
    }
}

function sendMenuToBack()
{
    //document.title = "DISABLED";
    document.getElementById("SiteContentDiv").style.zIndex = 3;
    oSendMenuToBackTimerId = -1;
}


function openPortal()
{
    //window.open('http://www2.trt.com.au/CustomerPortal.htm','mywindow','width=820,height=600,toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes');
    //window.open('https://system.netsuite.com/pages/login.jsp','mywindow','width=820,height=600,toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes');
    window.open('https://system.netsuite.com/core/media/media.nl?id=12636&c=77631&h=9e21e687b53e95cd4d89&_xt=.htm', 'mywindow', 'width=800,height=600,toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes');
}

function openContact()
{
    window.open('ContactForm.aspx','mywindow','width=620,height=650,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}
