function imgSwap(pic)
{
	var path = pic.src;
	var overState = "_hot";
	var imgStr, hover, type;
	
	if(path.indexOf(".gif") != -1) {
		type = ".gif";
		imgStr = path.substring(0, path.indexOf(type))
		hover = imgStr + overState + type;
	} else if(path.indexOf(".jpg") != -1) {
		type = ".jpg";
		imgStr = path.substring(0, path.indexOf(type))
		hover = imgStr + overState + type;
	} else {
		alert("Unsupported Image Format.");
		type = hover = null;
		return;
	}

	pic.src = hover;

	pic.onmouseout = function() {
		path = this.src;
		imgStr = path.substring(0, path.indexOf(overState + type))
		hover = imgStr + type;
		this.src = hover;
		this.onmouseout = null;
	}

}



function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function ToolTip(obj, sText)
{
	var str = '';
	var ypos = parseInt(obj.offsetTop);
	var xpos = parseInt(obj.offsetLeft);
	var DivID = 'TTip' + Math.round(Math.random() * 100);
	
	str = '<div class="ToolTip" id="' + DivID + '">' + sText + '</div>';
	
	obj.insertAdjacentHTML('afterEnd', str);
	obj.lang = DivID;
		
	GetTag(DivID).style.positon = 'absolute';
	GetTag(DivID).style.left = (xpos - (parseInt(obj.offsetWidth) / 2)) + 'px';
	GetTag(DivID).style.top = (ypos - parseInt(obj.offsetHeight)) + 'px';
	GetTag(DivID).style.zIndex = 100;
	GetTag(DivID).style.display = 'inline';
}

function HideTip(DivID)
{
	var div = GetTag(DivID);
	var par = div.parentNode;
	
	div.style.display = 'none';
	par.removeChild(div);
}

function FormatNumber(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function CheckIt(BoxID)
{	
	GetTag(BoxID).checked = !GetTag(BoxID).checked;
}