var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);

var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_mac    = (agt.indexOf("mac")!=-1);
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1) );

var xmlhttp

function loadXMLDoc(url) {
	xmlhttp=null
// code for Mozilla, etc.
	if (window.XMLHttpRequest)xmlhttp=new XMLHttpRequest()

// code for IE
	else if (window.ActiveXObject) xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")

	if (xmlhttp!=null){
		xmlhttp.onreadystatechange=state_Change
		xmlhttp.open("GET",url,true)
  		xmlhttp.send(null)
	} else alert("Your browser does not support XMLHTTP.")
}



function state_Change() {

// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4){
// if "OK"
		if (xmlhttp.status==200) {
// ...some code here...
	 	} else {
	
// alert("Problem retrieving XML data "+xmlhttp.status)
		}
	}
}




function CJL_getCurrentStyle(elem, prop) {
	if( elem.currentStyle ) {  
		
		var ar = prop.match(/\w[^-]*/g);
		var s = ar[0];
      
		for(var i = 1; i < ar.length; ++i) s += ar[i].replace(/\w/, ar[i].charAt(0).toUpperCase());
      	return elem.currentStyle[s];
		
   } else if( document.defaultView.getComputedStyle ) return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop);

}




// Thid Adds .stick to <a> tags that match the current page

window.onload = function() {

	url = window.location + " ";
	parts = url.split("/", 10);
	page = parts[(parts.length - 1)];


	var links = document.getElementsByTagName("A");
	for (var i=0; i<links.length; i++) {
		
		if (links[i].href == window.location) links[i].className = links[i].className + " stick";
	 	else if ((links[i].href == window.location + 'index.htm') && page < 1) links[i].className = links[i].className + " stick";
	
	}
	

}


function money(mnt) {
    mnt -= 0;
    mnt = (Math.round(mnt*100))/100;
    return (mnt == Math.floor(mnt)) ? mnt + '.00' 
              : ( (mnt*10 == Math.floor(mnt*10)) ? 
                       mnt + '0' : mnt);
}


function toggle(what) {
	//alert(document.getElementById(what).style.display);
	if (document.getElementById(what).style.display=='block') document.getElementById(what).style.display = 'none';
	else document.getElementById(what).style.display = 'block';
	return true;
	
}

function makeEmail(name, domain) {
	 document.write (name + '@' + domain);
}

function makeEmailLink(name, domain, text) {
	document.write("<a href='mailto:" + name + '@' + domain + "'>" + text + "</a>");
}
