<!--

//create function, it expects 2 values.
function insertAfter(newElement,targetElement)	{
	//target is what you want it to go after. Look for this elements parent.
	var parent = targetElement.parentNode;
	
	//if the parents lastchild is the targetElement...
	if(parent.lastchild == targetElement)	{
		//add the newElement after the target element.
		parent.appendChild(newElement);
	}
	else	{
		// else the target has siblings, insert the new element between the target and it's next sibling.
		parent.insertBefore(newElement, targetElement.nextSibling);
	}
}

var items = new Array() ;
function additem(object)	{
	
	if ( typeof (items[object] ) === 'undefined' )	{
		items[object] = 0 ;
	}
	
	idname = object + '[' + items[object] + ']' ;
	
	items[object] ++ ;
	
	div = document.getElementById ( "add_quest" ) ;
	
	place = document.getElementById ( idname ) ;
	
	newitem = '<span id="' + object + '[' + items[object] + ']"><br /><input type="text" width="20" maxlength="50" name="' + object + '[' + items[object] + ']" /></span>' ;
	
	newnode = document.createElement ( "span" ) ;
	
	newnode.innerHTML = newitem ;
	
	insertAfter ( newnode , place ) ;

}
function remitem(object)	{
	
	if ( typeof (items[object] ) === 'undefined' )	{
		items[object] = 0 ;
	}
	else if (items[object] > 0 )		{
		idname = object + '[' + items[object] + ']' ;
		
		place = document.getElementById ( idname ) ;
		
		place.parentNode.removeChild(place)
		
		items[object] -- ;
	}
}

var width = document . documentElement . clientWidth ;
var startX = width / 100 - 5 ; //set x offset of bar in pixels
var startY = 200 ; //set y offset of bar in pixels

function iecompattest ( )	{
return ( document.compatMode && document.compatMode != "BackCompat" ) ? document.documentElement : document.body
}

function staticbar ( )	{
	barheight = document . getElementById ( "topbar" ) . offsetHeight ;
	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	window . stayTopLeft = function ( )	{
		var pY = ns ? pageYOffset : iecompattest().scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 2);
	}
	ftlObj = ml ( "topbar" ) ;
	stayTopLeft();
}
function ml ( id )	{
		var el = document . getElementById ( id ) ;	// Set the element by id link to the variable el.
		el . style . visibility = "visible" ;	// Set the element visible.
		if ( document . layers )	{
			el . style = el ;
		}
		el . sP =	function ( x , y )	{
			this . style . left = x + "px" ;
			this . style . top = y + "px" ;
		}	;
		el . x = startX ;
		el . y = startY ;
		return el;
	}
function showBar ( )	{	// Shows the bar. Only use if you actually have an id with topbar.
	if (window.addEventListener)	{
		window.addEventListener("load", staticbar, false)
	}
	else if (window.attachEvent)	{
		window.attachEvent("onload", staticbar)
	}
	else if (document.getElementById)	{
		window.onload=staticbar
	}
	setTimeout("closebar()", 7000);
}
function closebar ( )	{
	document . getElementById("topbar") . style . visibility = "hidden" ;
}

function pop_up(url)	{
	//window.opener.location.href = window.opener.location.href;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=200,left = 545,top = 350');");
}

function img_change ( img_path , id , visi )		{
	
	if ( !visi )	{	// If the optional argument isn't there, set it to visible.
		var visi = "visible" ;
	}
	
	img = document . getElementById ( id ) ;	// This gets the image by it's id.
	
	img . src = img_path ;	// Change the image to whatever they wanted.
	img . style . visibility = visi ;	// Change the visibilty to whatever they wanted.
}

function img_change_new ( img_path , id , visi )		{
	
	if ( !visi )	{	// If the optional argument isn't there, set it to visible.
		var visi = "visible" ;
	}
	
	img = document . getElementById ( id ) ;	// This gets the image by it's id.
	
	img . src = img_path ;	// Change the image to whatever they wanted.
	img . style . visibility = visi ;	// Change the visibilty to whatever they wanted.
}

function highlight(field) {
        field.focus();
        field.select();
}

function settext(id)	{
	document.getElementById(id).innerHTML = 'Please wait...';
	setTimeout("cleartext('jscontent')",3000);
}

function cleartext(id)	{
	document.getElementById(id).innerHTML = '';
}

-->