function Is() {
    var agent   = navigator.userAgent.toLowerCase();
    this.major  = parseInt(navigator.appVersion);
    this.minor  = parseFloat(navigator.appVersion);
    this.ns     = ((agent.indexOf('mozilla')   != -1) &&
                  (agent.indexOf('spoofer')    == -1) &&
                  (agent.indexOf('compatible') == -1) &&
                  (agent.indexOf('opera')      == -1) &&
                  (agent.indexOf('webtv')      == -1));
    this.ns2    = (this.ns && (this.major      ==  2));
    this.ns3    = (this.ns && (this.major      ==  3));
    this.ns4    = (this.ns && (this.major      ==  4));
    this.ns6    = (this.ns && (this.major      >=  5));
    this.ie     = (agent.indexOf("msie")       != -1);
    this.ie3    = (this.ie && (this.major      <   4));
    this.ie4    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   == -1));
    this.ie5    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   != -1));
    this.ieX    = (this.ie && !this.ie3 && !this.ie4);
}

var is = new Is();
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

var available_width;
var available_height;
function winSize(whichway){
	    if(ns6) {
	        available_width=window.innerWidth;
	        available_height=window.innerHeight;
	    } else if(ie4) {
	        available_width=document.body.clientWidth;
	        available_height=document.body.clientHeight;
	    }
	if(whichway=="h") return available_height;
	else if(whichway=="w") return available_width;
}

da_image = new Image();
da_image.src="http://www.mi-xology.com/favicon.ico";

var Open = "circle"
var Close = "disc"

function getRandomNum(lbound, ubound) {	return (Math.floor(Math.random() * (ubound - lbound)) + lbound); }
function mod(a, b) { return a-Math.floor(a/b)*b } 
function div(a, b) { return a-Math.floor(a/b) } 

function chooseSplash() {
var splash = new Array(); r=-1;
r++; splash[r] = new Array("splash02.jpg",0.95)
r++; splash[r] = new Array("splash03.jpg",0.5)
r++; splash[r] = new Array("splash05.jpg",0.2)
r++; splash[r] = new Array("splash06.jpg",0.7)
r++; splash[r] = new Array("splash07.jpg",0.85)
r++; splash[r] = new Array("splash08.jpg",0.6)
r++; splash[r] = new Array("splash09.jpg",0.5)
r++; splash[r] = new Array("splash11.jpg",0.6)
r++; splash[r] = new Array("splash12.jpg",0.45)
r++; splash[r] = new Array("splash13.jpg",0.4)
r++; splash[r] = new Array("splash14.jpg",0.45)
r++; splash[r] = new Array("splash15.jpg",0.45)
r++; splash[r] = new Array("splash16.jpg",0.45)
r++; splash[r] = new Array("splash17.jpg",0.6)
r++; splash[r] = new Array("splash18.jpg",0.8)
r++; splash[r] = new Array("splash19.jpg",0.45)
r++; splash[r] = new Array("splash20.jpg",0.35)
r++; splash[r] = new Array("splash21.jpg",0.4)
r++; splash[r] = new Array("splash23.jpg",0.6)
var rnum = getRandomNum(0, r+1);
var varurl=mixImg("img/splash/"+splash[rnum][0],splash[rnum][1],"mi-xology.com");
document.write(varurl);
}	

function mixImg(imgSrc,imgWidthPcnt,imgAlt) {
if(imgSrc=="mix"){imgSrc="http://www.mi-xology.com/img/mi-xology.jpg";imgAlt="mi-xology.com";}
if(is.ie4||is.ie5||is.ns6||is.ns4) {
var image01 = new Image();
var count = 0;
while (!((image01.height>=10)&&(image01.width>=10))) {
image01.src = imgSrc;
count++;
if (count == 100) break;
}
if (count == 100) { var image1 ='<img src="'+imgSrc+'" alt="'+imgAlt+'" border="0">'; }
else { image1_width = (winSize("w")*imgWidthPcnt);
image1_height = (image1_width*image01.height/image01.width);
var image1 = '<img src="'+imgSrc+'" width="' + image1_width + '" height="' + image1_height + '" alt="'+imgAlt+'" border="0">';
}
}
else { var image1 ='<img src="'+imgSrc+'" alt="'+imgAlt+'" border="0">'; }
return image1;
}

function searchBar() {
var srchtag = "";
srchtag += '<div id="searchBar"><FORM name=formSear action="http://www.mi-xology.com/pages/search.html" method="GET" onSubmit="return OnSearchSubmit()"><p align="center"><INPUT name=searWords >&nbsp;<INPUT name=Send type=submit value=Search></FORM></div>';
document.write(srchtag);
}

function bottomBar() {
var shopspan = '<span class="shop" onMouseOver="this.className=\'shopover\'" onMouseOut="this.className=\'shop\';"><SPAN style="color:#FFA8A8">s</SPAN><SPAN style="color:#FFE2A8">h</SPAN><SPAN style="color:#E2FFC5">o</SPAN><SPAN style="color:#A8FFFF">p</span></span>';
var bLink = new Array(); b=-1;
b++; bLink[b] = new Array("http://www.mi-xology.com/pages/free.htm", "free");
b++; bLink[b] = new Array("http://www.mi-xology.com/pages/aboutmi.htm", "about");
b++; bLink[b] = new Array("http://www.mi-xology.com/pages/whatmi.htm", "what");
b++; bLink[b] = new Array("http://mi-xology.blogspot.com", "news");
b++; bLink[b] = new Array("http://www.mi-xology.com/archives/archives.htm", "archives");
b++; bLink[b] = new Array("http://www.mi-xology.com/shop/",shopspan);
var bottag = "";
bottag += '<div class="bottomBar" align="center"><div align="center">';
for (i=0; i<=b; i++) {
if (document.location.href==bLink[i][0]) { bottag += '<span class="here">'+bLink[i][1]+'</span>'; }
else { bottag += '<a href="'+bLink[i][0]+'">'+bLink[i][1]+'</a>'; }
if (i<b) { bottag += ' | '; }
else { bottag += '</div>'; }
}
bottag += '<div align="center"><a href="http://www.mi-xology.com/pages/contact.htm">contact@mi-xology.com</a></div></div>';
document.write(bottag);
}


function showhide(what){
if(ie4) {
if (document.all[what].style.display=="none"){document.all[what].style.display="inline";}
else{document.all[what].style.display="none";}
} else
if (document.getElementById([what]).style.display=="none"){document.getElementById([what]).style.display="inline";}
else{document.getElementById([what]).style.display="none";}
}


function setContent(name, value) {
var d;  
if (ie4) { d = document.all[name]; } 
else { d = document.getElementById(name); }       
d.innerHTML = value;    
}       

function getContent(name) {
var d;
if (ie4) { d = document.all[name]; } 
else { d = document.getElementById(name); }
return d.innerHTML;
}

function setColor(name, value) {
var d;  
if (ie4) { d = document.all[name]; } 
else { d = document.getElementById(name); }
d.style.color = value;  
}

function getColor(name) {
var d;
if (ie4) { d = document.all[name]; } 
else { d = document.getElementById(name); }
return d.style.color;
}

function animate(name, col) {
var value = getContent(name);
if (value.indexOf('<span') >= 0) { return; }
var length = 0;
var str = '';
var ch;
var token = '';
var htmltag = false;	
for (i = 0; i < value.length; i++) {
ch = value.substring(i, i+1);
if (i < value.length - 1) { nextch = value.substring(i+1, i+2); } else { nextch = ' '; }
token += ch;
if (ch == '<' && '/aAbBpPhHiIoOuUlLtT'.indexOf(nextch) >= 0) { htmltag = true; }
if (ch == '>' && htmltag) { htmltag = false; }
if (!htmltag && ch.charCodeAt(0) > 30 && ch != ' ' && ch != '\n') {		
str += '<span id="' + name + '_' + length + '">' + token + '</span>';
token = '';
length++;
}
}
setContent(name, str);
command = 'animateloop(\'' + name + '\', ' + length + ', 0, 1, \'' + col + '\')';
setTimeout(command , 100);
}

function animateloop(name, length, ind, delta, col) {
var next = ind + delta;
if (next >= length) { delta = delta * -1; next = ind + delta; }
if (next < 0) { delta = delta * -1; next = ind + delta; }
setColor(name + '_' + ind, getColor(name + '_' + next));
setColor(name + '_' + next, col);
command = 'animateloop(\'' + name + '\', ' + length + ', ' + next + ', ' + delta + ', \'' + col + '\')';
setTimeout(command , 100);
}



//1)Enter domains to be EXCLUDED from opening in new window:
var excludedomains=["mi-xology.com", "mi-xology.blogspot.com"]

//2)Automatically open offsite links in new window? (1=yes, 0 will render a checkbox for manual selection)
var auto=1

var excludedomains=excludedomains.join("|")
rexcludedomains=new RegExp(excludedomains, "i")

if (!auto)
document.write('<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="dynamiclink()">Open off-site links in new window</form>')

function dynamiclink(){

if (auto||(!auto&&document.targetmain.targetnew.checked)){
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)
document.links[i].target="_blank"
}
}
else
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.indexOf(mydomain)==-1)
document.links[i].target=""
}
}

if (auto)
window.onload=dynamiclink

