// © Copyright 2006 PK Multimedia Australia.
// Developer/Author : PK Multimedia Australia.

if ( window.top.location.href != window.self.location.href ) window.top.location.href = window.self.location.href;

window.onerror = function() { return false; }
window.document.body.onselectstart = function() { return false; }
window.document.body.onbeforeprint = function() { window.document.getElementById("ADTEXDIVMenu").style.fontSize = "x-small"; window.document.getElementById("divADTEX").style.display = "NONE"; }
window.document.body.onafterprint = function() { window.document.getElementById("ADTEXDIVMenu").style.fontSize = "8pt"; window.document.getElementById("divADTEX").style.display = ""; }
window.defaultStatus = "AD-TEX Pty Ltd.";

var divADTEX = window.document.createElement( "DIV" );
divADTEX.id = "divADTEX";
divADTEX.style.position = "ABSOLUTE";
divADTEX.style.visibility = "HIDDEN";
divADTEX.style.height = "33px";
divADTEX.style.backgroundColor = "TRANSPARENT";
divADTEX.style.color = "#FFF";

divADTEX = window.document.body.appendChild( divADTEX );
window.document.getElementById("divADTEX").style.left = (window.document.body.offsetWidth / 2 - 305).toString() + "px";
window.document.getElementById("divADTEX").style.top = "15px";

window.onresize = function() { window.document.getElementById("divADTEX").style.left = (window.document.body.offsetWidth / 2 - 305).toString() + "px"; }

var spanADTEXLogo = window.document.createElement( "SPAN" );
spanADTEXLogo.style.height = "10px";
spanADTEXLogo.style.font = "BOLD 13pt 'TIMES NEW ROMAN'";
spanADTEXLogo.innerHTML = "AD-TEX&nbsp;";
spanADTEXLogo = divADTEX.appendChild( spanADTEXLogo );

var spanPTYLTD = window.document.createElement( "SPAN" );
spanPTYLTD.style.fontSize = "13px";
spanPTYLTD.innerHTML = "<nobr>Pty Ltd&nbsp;</nobr>";
spanADTEXLogo.appendChild( spanPTYLTD );

var spanADTEXCtrl = window.document.createElement( "SPAN" );
spanADTEXCtrl.style.marginLeft = "8px";
spanADTEXCtrl.style.font = "BOLD 8pt ARIAL";
spanADTEXCtrl = divADTEX.appendChild( spanADTEXCtrl );

var spanADTEXMsg = window.document.createElement( "SPAN" );
spanADTEXMsg.id = "ADTEXMsg";
spanADTEXMsg.innerHTML = "<nobr>Welcome to the AD-TEX website and ad-life to your concrete</nobr>"
spanADTEXMsg = spanADTEXCtrl.appendChild( spanADTEXMsg );

function ADTEXMessages() { // © 2006 - Copyright 2006 PK Multimedia Australia
    this.m_MSGIdx = -1;
    this.m_vADTEXMSGs = [];
    this.m_RNDADTEXMSG = true;

    this.m_PopulateMSGs = function() {
        var MSGsNode = this.m_ADTEXMessageXMLDoc.childNodes[1];
        if ( MSGsNode != null && MSGsNode.hasChildNodes() )
            for( var Idx = 0; Idx < MSGsNode.childNodes.length; Idx++ )
                if( MSGsNode.childNodes[Idx].nodeType != 3 )
                    this.m_vADTEXMSGs[ this.m_vADTEXMSGs.length ] = MSGsNode.childNodes[Idx].firstChild.nodeValue;
    }
    this.GetMSG = function() {
        var Idx = 0;
        if ( this.m_RNDADTEXMSG ) {
            Idx = Math.round(Math.random() * 100);
            Idx %= this.m_vADTEXMSGs.length;
        } else 
            Idx = (++this.m_MSGIdx) % this.m_vADTEXMSGs.length;
        return this.m_vADTEXMSGs[ Idx ];
    }
    this.GetMSGLen = function() { return this.m_vADTEXMSGs.length; }

    this.m_ADTEXMessageXMLDoc = window.document.createElement( "XML" );
    this.m_ADTEXMessageXMLDoc.id = "ADTEXMessageXMLDI";
    this.m_ADTEXMessageXMLDoc.ADTEXMSG = this;
    this.m_ADTEXMessageXMLDoc.ondataavailable = function() { window.document.getElementById( "ADTEXMessageXMLDI" ).ADTEXMSG.m_PopulateMSGs(); }
    this.m_ADTEXMessageXMLDoc.src = "./App_Assets/ADTEXMSGs.xml";
    this.m_ADTEXMessageXMLDoc = window.document.body.appendChild( this.m_ADTEXMessageXMLDoc );
}

try {
    function ADTEXMSGEffect() {
        divADTEX.style.visibility = "HIDDEN";
        divADTEX.filters.item("DXImageTransform.Microsoft.RandomBars").apply();
        if ( ADTEXMessage.GetMSGLen() ) ADTEXMsg.innerText = ADTEXMessage.GetMSG();
        divADTEX.style.visibility = "VISIBLE";
        divADTEX.filters.item("DXImageTransform.Microsoft.RandomBars").play();
        
    }

    var ADTEXMessage = new ADTEXMessages();

    if ( (window.navigator.userAgent.indexOf("MSIE ") > 0) && (window.navigator.appName == "Microsoft Internet Explorer") && (window.navigator.platform == "Win32" || window.navigator.platform == "Win64") && (parseInt(window.navigator.userAgent.substring(window.navigator.userAgent.indexOf("MSIE ")+5,window.navigator.userAgent.indexOf(";",window.navigator.userAgent.indexOf("MSIE ")))) >= 5) ) {
        ADTEXWebSite.addBehavior( "#default#clientCaps" ); // Check for DirectAnimation
        if ( ADTEXWebSite.isComponentInstalled( "{283807B5-2C60-11D0-A31D-00AA00B92C03}", "componentid" ) ) {
            spanADTEXLogo.onclick = function() { window.location.href = "AD-TEX Splash Page.html"; }
            spanADTEXLogo.title = "Click Here";
        }

        divADTEX.style.filter = "progid:DXImageTransform.Microsoft.Blinds(direction='down',bands=1) progid:DXImageTransform.Microsoft.Shadow(direction=135, color=#8898C8, strength=2) progid:DXImageTransform.Microsoft.RandomBars(orientation='vertical');"; 
        divADTEX.filters.item("DXImageTransform.Microsoft.Blinds").apply();
        divADTEX.style.visibility = "VISIBLE";
        divADTEX.filters.item("DXImageTransform.Microsoft.Blinds").play();
        divADTEX.onfilterchange = function() {
            if ( divADTEX.filters.item("DXImageTransform.Microsoft.Blinds").status == 0 ) {
                divADTEX.onfilterchange = null;
                window.setInterval( ADTEXMSGEffect, 15000 );
                ADTEXMessage.m_RNDADTEXMSG = parseInt( Math.random() * 10 ) > 4 ? true : false; 
            }
        }
    }
    else {
        if ( ADTEXMessage.GetMSGLen() == 0 ) {
            ADTEXMessage.m_ADTEXMessageXMLDoc = null;
            ADTEXMessage.m_PopulateMSGs = null;
            ADTEXMessage.m_PopulateMSGs = function() {
                this.m_vADTEXMSGs = null;
                this.m_vADTEXMSGs = [];
                this.m_vADTEXMSGs[ 0 ] = "AD-TEX Concrete Coatings transforms your new or existing concrete";
                this.m_vADTEXMSGs[ 1 ] = "AD-TEX Coloured Bagging Render comes in 28 exciting Designer Colours";
                this.m_vADTEXMSGs[ 2 ] = "AD-TEX products can be used on the surfaces such as Concrete areas";
                this.m_vADTEXMSGs[ 3 ] = "Masonry Makeovers Franchise is a complete Spray-on-paving business";
                this.m_vADTEXMSGs[ 4 ] = "Contact your nearest AD-TEX Distributor for any technical advice";
                this.m_vADTEXMSGs[ 5 ] = "AD-TEX Website developed by PK Multimedia Australia";
            }
            ADTEXMessage.m_PopulateMSGs();
        }
        window.setInterval( "window.document.getElementById('ADTEXMsg').innerHTML = ADTEXMessage.GetMSG();", 15000);
    }
} catch( FiltersIEDOM_NotSupported ) { ; }

divADTEX.style.visibility = "VISIBLE";