﻿var PhoenixCurrencyMaxtrix = new Object();
PhoenixCurrencyMaxtrix.timer = null;
PhoenixCurrencyMaxtrix.msRefresh = 5000;
PhoenixCurrencyMaxtrix.ctrMatrix = 'Phoenix_Module_CtrIDMatrix';
PhoenixCurrencyMaxtrix.ctrLoader = 'Phoenix_Module_CtrIDMatrix_Loader';
PhoenixCurrencyMaxtrix.result = '';
PhoenixCurrencyMaxtrix.sc0 = null;
PhoenixCurrencyMaxtrix.url = 'http://www.exactrate.net/Server.aspx?cmd=200';



PhoenixCurrencyMaxtrix.bgColor = 'fff';
PhoenixCurrencyMaxtrix.borderColor = 'f8c300';
PhoenixCurrencyMaxtrix.bgColorAlter = 'eee';

PhoenixCurrencyMaxtrix.call = function(){
    // On Loader
    var ld = document.getElementById(this.ctrLoader);
    if(ld) ld.style.display = '';
    
    // Set url service
    var ws = this.url + '&bgColor='+ this.bgColor + '&borderColor='+ this.borderColor + '&bgColorAlter='+ this.bgColorAlter + '&rand=' + Math.random();
        
    // Remove tag script scriptData
    if(this.sc0) this.sc0.parentNode.removeChild(this.sc0);
    
    // Script tag auto call
    this.sc0 = document.createElement('SCRIPT');
    this.sc0.id = 'sc0';
    this.sc0.type = 'text/javascript';
    this.sc0.src = ws;
    
    // Append script tag
    try{document.getElementsByTagName('head')[0].appendChild(this.sc0);}
    catch(ex){document.body.appendChild(this.sc0);}
}
PhoenixCurrencyMaxtrix.callBack = function(){
    var ld = document.getElementById(this.ctrLoader);
    if(ld) ld.style.display = 'none';
    var mx = document.getElementById(this.ctrMatrix);
    if(mx) mx.innerHTML = this.result + "<a style='color:#555; text-decoration:none; font-size:8pt;' target='_blank' href='http://www.exactrate.net'>powered by ExactRate.net »</a>";
}
PhoenixCurrencyMaxtrix.firstStart = function(){
    // Get style
    if(typeof PhoenixCurrencyMaxtrixConfig != 'undefined'){
        for(prop in PhoenixCurrencyMaxtrixConfig){
            this[prop] = PhoenixCurrencyMaxtrixConfig[prop];
        }
    }
    this.call();
    this.timer = window.setInterval("PhoenixCurrencyMaxtrix.call()",this.msRefresh);
}
window.setTimeout("PhoenixCurrencyMaxtrix.firstStart()",1000);
