﻿//this function requires jQuery to be present
//toggles the visibility of an element, if a speed argument exists, it will be used


aamadServer = 'http://iacas.adbureau.net';
var aamadServer, aamPageId, aamRndNum;
aamRndNum = Math.round(Math.random() * 1000000000) * 9;
aamPageId = Math.round(Math.random() * 1000000000) * 8;

function toggleVisibility(element, showSpeed)
{
	var speed = showSpeed == undefined ? "normal" : showSpeed;
		
	if(element.style.display == "none")
		$("#" + element.id).show(speed);
	else
		$("#" + element.id).hide(speed);
}

/*
10/31/2005 Brenton Unger 

Similar to document.all() but allows for partial name matching due to the heirarchial nature of asp.net controls.

Arguments:

	tagName: the type of tag you're after; input, textarea, select, etc
	controlID: the ID of the control you're wishing to return. 

Returns: 
	First control that contains the passed controlID, or null if not found.

*/
function findControl(tagName, controlID)
{
	var col = document.getElementsByTagName(tagName);
	
	if(col)
	{
		for(var x=0;x<col.length;x++)
		{
			if(col[x].id)
			{				
				if(col[x].id.toLowerCase().indexOf(controlID.toLowerCase()) != -1)
					return col[x];
			}
		}
	}
	
	return null;
}



