
//TOGGLES THE VISIBILITY OF ELEMENTS*****************************************
function TA_showItem(ID){
	var e = document.getElementById(ID);
	
	if(e.style.display!="block" && e.style.display!="none"){
		e.style.display = "block";
		}
	
	if(e.style.display=="none"){
		e.style.display = "block";
		}else{
		e.style.display = "none";
		}
	}
	
	
//FORMS FUNCTIONALITY*********************************************************
function TA_readForm(theForm) {
	var activeForm = document.getElementById(theForm);
	var elems = activeForm.elements;
	var str = "";
	for (var ix=0; ix < activeForm.length; ix++) {
		var elem = activeForm.elements[ix];
		switch(elem.type){
			case "submit":
				break;
			case "checkbox":
				if(elem.checked==true){
					str += elem.name+"="+escape(elem.value)+"&";
				}
				break;
			case "radio":
				if(elem.checked==true){
					str += elem.name+"="+escape(elem.value)+"&";
				}
				break;				
			default:
				str += elem.name+"="+escape(elem.value)+"&";
				break;
			}
		}
	return(str);
	}
	

function TA_submitForm(theForm, action, file, returnDiv, returnFunction){
	if(document.getElementById('response')){
		document.getElementById('response').style.display = "none";	
		document.getElementById('response').innerHTML = "";		
	}
	var variables = TA_readForm(theForm);
	variables = "action="+action+"&"+variables;
	updateContentArea(returnDiv, variables, file, returnFunction);
	}
	
function TA_submitBoxForm(theForm, action, file){
	var returnDiv = 'innerFloatDiv';
	var variables = TA_readForm(theForm);
	variables = "action="+action+"&"+variables;
	updateContentArea(returnDiv, variables, file);
	}
//END FORMS FUNCTIONALITY**********************************************************


//TRANSITION FUNCTIONALITY**********************************************************
function TA_change(objName, steps, ease, nextFunction, objectProperty_1, objectProperty_2, objectProperty_3, objectProperty_4){
	var j = 1;	
	
	if(!killChange){
		var killChange=0;
	}
	
	function nextProp(j){	
		var propName = "objectProperty_"+j;
		if(eval(propName)){
			var objProperty = eval(propName);
			}else{
			if(nextFunction){
				setTimeout(nextFunction, 1);
				}
			}

		if(objProperty){
			j++;
			var newObj = document.getElementById(objName);	
			var styleDeets = new Array();
			styleDeets = objProperty.split(":");
			var curStyle = styleDeets[0];
			var curVal = parseInt(newObj.style[curStyle]);
			if(!curVal){
				var curVal = 0;
				}
			var endVal = parseInt(styleDeets[1]);
			if(ease==1){
				steps = parseInt(steps);
				var step = (endVal-curVal)/(((steps+1)*(steps/2))*4);
				}else{
				var step = (endVal-curVal)/parseInt(steps);	
				}
			var i = 0;
			
			function TA_goTrans(){
				if(i<steps){
					if(ease==1){
						curVal = parseInt(curVal) + (((steps-i)*4)*step);
						}else{
						curVal = parseInt(curVal) + parseInt(step);							
						}
					curVal = Math.round(curVal);
					switch(curStyle){
						case "height":
							newObj.style.height = curVal+"px";
							break;
						case "width":
							newObj.style.width = curVal+"px";
							break;
						case "top":
							newObj.style.top = curVal+"px";
							break;
						case "opacity":
							newObj.style.filter = "alpha(opacity="+curVal+")";
							newObj.style.opacity = (curVal/100);
							break;
						case "marginLeft":
							var newVal = curVal + "px";
							newObj.style.marginLeft = newVal;
							break;
						default:
							newObj.style[curStyle] = curVal;
							break;	
						}
					i++;
					if(killChange!=1){
						setTimeout(TA_goTrans, 1);			
						}
					}else{
					if(j<5){
						nextProp(j);
						}										
					}
				}
						
			TA_goTrans();
			}
		}

	if(document.getElementById(objName)){	
		nextProp(1);
		}
	}

//SCROLLING FUNCTIONALITY********************************************************

//Initial, global variables
var scrollCurrent = 0;
var scrollObject = "";
var scrollMask = "";
var scrollIncrement = 0;
var floatDiv = '';

function TA_initScroll(a, b, c){
	scrollObject = a;
	scrollMask = b;
	scrollIncrement = c;		
	}
			
function TA_scrollRight() {
	var objWidth = parseFloat(document.getElementById(scrollObject).offsetWidth);
	var maskWidth = parseFloat(document.getElementById(scrollMask).offsetWidth);	
	
	if(scrollCurrent>=(maskWidth-objWidth)){
		scrollCurrent = parseInt(scrollCurrent) - parseInt(scrollIncrement);
		TA_change(scrollObject, 50, 1, '', 'marginLeft:'+scrollCurrent);
		}
	}
  
function TA_scrollLeft() {
	var objWidth = parseFloat(document.getElementById(scrollObject).offsetWidth);
	var maskWidth = parseFloat(document.getElementById(scrollMask).offsetWidth);	
	
	if(scrollCurrent<0){
		scrollCurrent = parseInt(scrollCurrent) + parseInt(scrollIncrement);
		TA_change(scrollObject, 50, 1, '', 'marginLeft:'+scrollCurrent);
		}
	} 
//END SCROLLING FUNCTIONALITY*******************************************************


//FLOATING, ROLL_OVER DIV FUNCTIONS*************************************************
function TA_startFloatDiv(){
	floatDiv = document.createElement("DIV");
	floatDiv.id = "floatDiv";
	floatDiv.style.position = 'absolute';
	floatDiv.style.display = 'none';
	
	var fullBody = document.getElementsByTagName("BODY")[0];
	fullBody.appendChild(floatDiv);
	}

function TA_showDiv(insideText, classStyle, offsetX, offsetY, timeOffset, keep){
	mouseOver = 1;
	function runDiv(){
		if(mouseOver==1){
			var floatDiv = document.getElementById('floatDiv');
			if(classStyle){
				floatDiv.className = classStyle;
				}
				floatDiv.style.display = "block";
			if(!keep && keep!=1){
				floatDiv.innerHTML = insideText;
				}
			floatDiv.style.zIndex = "1000";
			
			floatDiv.style.top = curMouseY + parseInt(offsetY) + "px";
			floatDiv.style.left = curMouseX + parseInt(offsetX) + "px";
			}
		}

	window.setTimeout(runDiv, timeOffset);

	}

function TA_showBox(classStyle, contentWidth, varsPassed, url, fade, offsetY, callBack){
	function runDiv(){
		var floatDiv = document.getElementById('floatDiv');

		var closeX = "<div id='sbCloseX' onMouseDown='TA_hideDiv();'>x</div><div id='innerFloatDiv'>";
		floatDiv.innerHTML = closeX;
		
		if(classStyle){
			floatDiv.className = classStyle;
			}else{
			floatDiv.className = "shadowBox";
			}
			
		if(!url){
			floatDiv.innerHTML += varsPassed;
		}
		
		floatDiv.style.zIndex = "1000";
		floatDiv.style.top = (parseInt(document.documentElement.scrollTop) + (250 - parseInt(offsetY))) + "px";
		floatDiv.style.left = document.body.offsetWidth/2 - contentWidth/2 + "px";
		floatDiv.style.display = "block";
		floatDiv.innerHTML += "<div style='clear:both;'></div></div>";	
	}

	runDiv();
	if(url){
		updateContentArea("innerFloatDiv", varsPassed, url, callBack, 'yes');
	}else{
		if(callBack){
			eval(callBack);
		}
	}		
	if(fade){
		TA_change('floatDiv', '40', 0, '', 'opacity:130');
		}
	}

function TA_attachBox(elementName, classStyle, varsPassed, url){
	function runDiv(){
		var floatDiv = document.getElementById('floatDiv');
		if(!url){
			floatDiv.innerHTML += varsPassed;
		}

		floatDiv.style.zIndex = "1000";
		floatDiv.style.top = eTop + "px";
		floatDiv.style.left = eLeft + "px";
		floatDiv.style.display = "block";
		floatDiv.className = classStyle;
	}

	if(document.getElementById(elementName)){
		var element = document.getElementById(elementName);
		
		var position = findPos(element);
		var eTop = position[1] + element.offsetHeight;
		var eLeft = position[0];
		
		window.setTimeout(runDiv, 0);
		if(url){
			updateContentArea("floatDiv", varsPassed, url);
			}
		}
	}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		
	return [curleft,curtop];
	}
}

function TA_hideDiv(timeOut){
	if(timeOut){
		function closeTADiv(){
			var floatDiv = document.getElementById('floatDiv');
			floatDiv.style.display = "none";
			floatDiv.innerHTML = '';
			mouseOver = 0;
			}
			
		window.setTimeout(closeTADiv, timeOut);
		
		}else{
		var floatDiv = document.getElementById('floatDiv');
		floatDiv.style.display = "none";
		floatDiv.innerHTML = '';
		mouseOver = 0;
		}
	
	//CHECK IF THERE IS A NEXT STEP INVOLVED
	if(nextStep){
		eval(nextStep);

		//REMOVE THE NEXT STEP VALUE SO IT DOESN'T GET PROCESSED AGAIN
		nextStep=false;
		}
	}

function mouseMove(ev){
	ev = ev || window.event;
	var mousePos = mouseCoords(ev);		
	curMouseX = mousePos.x;
	curMouseY = mousePos.y;
}

function mouseCoords(ev){
	if(ev.pageX>0 || ev.pageY>0){
		return {x:ev.pageX, y:ev.pageY};
	}else{
		var xPos = ev.clientX;
		var yPos = ev.clientY;
		
		return {x:xPos,y:yPos};
	}
}

if(window.addEventListener) window.addEventListener("load",TA_startFloatDiv,false);
else if (window.attachEvent) window.attachEvent("onload",TA_startFloatDiv);

var mouseOver = 0;
var curMouseX = 0;
var curMouseY = 0;
var nextStep = "";
document.onmousemove = mouseMove;

//END FLOATING, ROLL_OVER DIV FUNCTIONS*********************************************

<!--Switches text within a div tag -->
function switchText(objName,x,newText) { //v4.01
  if ((obj=getObject(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
<!-- Adds compatibility for other browsers when Trying to Identify Objects -->
function getObject(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

