/*---------------------------------------------------------------------------------------------------------------------
	Basic DHTML Methods
	-----------------------------------------------------
	ShowContent(source,target) - write the content of one DOM element into another DOM element
---------------------------------------------------------------------------------------------------------------------*/

function ShowContent(source, target){
	var src = document.getElementById(source)
	if (src)
	{
		var trg = document.getElementById(target)
		if (trg)
		{
			trg.innerHTML = src.innerHTML
			trg.style.visibility='visible'
		}
	}	
}

function Hide(id,ext){
	var targ = document.getElementById(id)
	if (targ)
	{
		var newId = id+ext
		targ.src="/_Library/graphics/"+newId
		//targ.style.visibility = 'hidden'
	}
}
function Show(id,ext){
	var im = document.getElementById(id)
	if (im)
	{
		var newId = id+ext
		im.src="/_Library/graphics/"+newId
		//im.style.visibility='visible'
	}
}

/*---------------------------------------------------------------------------------------------------------------------
	Form Methods
	------------------------------------------------------
	ChangeButtonAndSubmit() - makes the target image invisible so the background shows up, submits the form	
	
---------------------------------------------------------------------------------------------------------------------*/
function ChangeButtonAndSubmit( id){

	var trg = document.getElementById(id)
	trg.style.visibility="hidden"
	document.forms[0].submit()
}

/*---------------------------------------------------------------------------------------------------------------------
	Debugging Methods
	------------------------------------------------------
	Debug(message) - write to a debug div in the 
	
	
---------------------------------------------------------------------------------------------------------------------*/
var DEBUGCOUNTS = new Array()
var DEBUGFLAG = true

function Debug(message,newLine){
	if (!DEBUGFLAG){ return }
	var x = document.getElementById('debug')
	if (x)
	{
		x.innerHTML += message
		if (newLine == 1){ x.innerHTML += "<BR>\n"; }
	}
}
function Line(message){ Debug(message,1) }
function Runaway( indice ){ 
	if (!indice){ indice = 0; }
	if (!DEBUGCOUNTS[indice]){DEBUGCOUNTS[indice]=1}
	DEBUGCOUNTS[indice]++; 
	if (DEBUGCOUNTS[indice] > 100){ Line("Runaway Limit Reached!"); return true; DEBUGCOUNTS[indice] = 0 } 
	return false; 
}
		