// Clock
function clock() {
var digital = new Date();
dispDate = digital.toLocaleDateString();
dispTime = digital.toLocaleTimeString();
pendule1.innerHTML = dispDate;
pendule2.innerHTML = dispTime;
setTimeout("clock()", 1000);
}
function lastMod()
{
	var updt = new Date (document.lastModified);
        updtdate= updt.toLocaleDateString();
	var towrite = 'Last Updated: ' + updtdate;
	return towrite;
}
// Add Favorite
function addfav() {
local_domain="192.168.0.1";
if (document.domain==local_domain) {
window.external.AddFavorite('http://192.168.0.1:8888', 'Miracle Computing (Internal)')
} else {
window.external.AddFavorite('http://www.miraclecomputing.com.au', 'Miracle Computing')
}
}
// Disable right mouse click
function rtclickcheck(){
if (document.all && event.button != 1) { 
alert("Add to your Favorites" +'\n' + "by clicking on the logo of" + '\n' +
      "Miracle Computing." + '\n' + '\n' + "Thank you!");
return false;
}
}
document.onmousedown = rtclickcheck
// Window status scroll
function scrollit_r2l(seed)
{
        var m1  = "Our mission is to identify market needs and achieve customer satisfaction ";
        var m2  = "through continual innovative use of technology and excellent service.";

        var msg=m1+m2;
        var out = " ";
        var c   = 1;

        if (seed > 100) {
                seed--;
                var cmd="scrollit_r2l(" + seed + ")";
                timerTwo=window.setTimeout(cmd,100);
        }
        else if (seed <= 100 && seed > 0) {
                for (c=0 ; c < seed ; c++) {
                        out+=" ";
                }
                out+=msg;
                seed--;
                var cmd="scrollit_r2l(" + seed + ")";
                    window.status=out;
                timerTwo=window.setTimeout(cmd,100);
        }
        else if (seed <= 0) {
                if (-seed < msg.length) {
                        out+=msg.substring(-seed,msg.length);
                        seed--;
                        var cmd="scrollit_r2l(" + seed + ")";
                        window.status=out;
                        timerTwo=window.setTimeout(cmd,100);
                }
                else {
                        window.status=" ";
                        timerTwo=window.setTimeout("scrollit_r2l(100)",75);
                }
        }
}
// Fading Text
var texts = new Array(
"<font color='{COLOR}'><b><i><center>IDENTIFY MARKET NEEDS<br>&nbsp;</center></b></i></font>",
"<font color='{COLOR}'><b><i><center>ACHIEVE CUSTOMER SATISFACTION</center></b></i></font>",
"<font color='{COLOR}'><b><i><center>INNOVATIVE USE OF TECHNOLOGY</center></b></i></font>",
"<font color='{COLOR}'><b><i><center>EXCELLENT SERVICE<br>&nbsp;</center></b></i></font>");
var bgcolor = "#FFFFFF"; 
var fcolor = "#FF0000";  
var steps = 30; 
var show = 700; 
var sleep = 40;
var loop = true;
var colors = new Array(steps);
getFadeColors(bgcolor,fcolor,colors);
var color = 0;
var text = 0;
var step = 1;
function fade() {
var text_out = texts[text].replace("{COLOR}", colors[color]);
if (document.all) fader.innerHTML = text_out;
color += step; 
if (color >= colors.length-1) {
step = -1;
if (!loop && text >= texts.length-1) return;
}
if (color == 0) {
step = 1;
text += 1;
if (text == texts.length) text = 0;
}
setTimeout("fade()", (color == colors.length-2 && step == -1) ? show : ((color == 1 && step == 1) ? sleep : 50));
}
function getFadeColors(ColorA, ColorB, Colors) {
len = Colors.length; 
if (ColorA.charAt(0)=='#') ColorA = ColorA.substring(1);
if (ColorB.charAt(0)=='#') ColorB = ColorB.substring(1);
var r = HexToInt(ColorA.substring(0,2));
var g = HexToInt(ColorA.substring(2,4));
var b = HexToInt(ColorA.substring(4,6));
var r2 = HexToInt(ColorB.substring(0,2));
var g2 = HexToInt(ColorB.substring(2,4));
var b2 = HexToInt(ColorB.substring(4,6));
var rStep = Math.round((r2 - r) / len);
var gStep = Math.round((g2 - g) / len);
var bStep = Math.round((b2 - b) / len);
for (i = 0; i < len-1; i++) {
Colors[i] = "#" + IntToHex(r) + IntToHex(g) + IntToHex(b);
r += rStep;
g += gStep;
b += bStep;
}
Colors[len-1] = ColorB;
}
function IntToHex(n) {
var result = n.toString(16);
if (result.length==1) result = "0"+result;
return result;
}
function HexToInt(hex) {
return parseInt(hex, 16);
}