<!--
/*************************************************************************************************************************\
RDWONLINE v7.0: THE SEOQUOULOXOLOCADIUM
Javascript/AJAX functions - general (15 functions) December 17, 2005

FUNCTIONS: getElement(), toggle(), rollover(), pushdown(), externalLinks(), showSplashExtra(), usableCheckbox(), createSecondaryNavigation(),
subnavMain(), subnavPortfolio(), subnavPastimes(), subnavLinks(), subnavGuestbook(), subnavAllOthers(), createRequestObject()

Javascript conceptualized and written by Ronald D. Willis
2004-6002 Arducane Development.  All rights reserved.
\**************************************************************************************************************************/

function getElement (obj)
{
	if (document.all)
		return document.all[obj];

	if (document.getElementById)
		return document.getElementById(obj);
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function addToOnLoad (func)
{
    var oldonload = window.onload;

	if (typeof(oldonload) != 'function')
	{
		window.onload = func;
	}
	else
	{
	    window.onload = function()
    	{
        	oldonload();
	        func();
    	}
	}
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function nostatus()
{
	window.status = null;
	return true;
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function popup (mypage, myname, w, h, scroll, pos)
{
	var win = null;
	var settings = null;

	if (pos == "random")
	{
		LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
		TopPosition= (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
	}
	else if (pos == "center")
	{
		LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
		TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
	}
	else
	{
		LeftPosition = 0;
		TopPosition = 20;
	}

	myname = myname.replace(' ', '');
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win = window.open(mypage,myname,settings);
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function usingCrappyBrowser() //check to see if the end-user is using a crappy browser
{
	return (navigator.appName.indexOf('Internet Explorer') > 0) ? true : false;	
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function toggle (layerID)
{
    var x = getElement(layerID);
    x.style.display = (x.style.display == 'block') ? '' : 'block';    
    return;
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function rollover (name, status)
{
	var swap = (status == 1) ? 'ON' : 'OFF';
	var last = (status == 1) ? 3 : 2;

	if (document.all)	//image swap for Internet Explorer
	{
		var img = document.images[name].src;
		var ext = img.substr(img.length-4);
		var adj = img.length - last - 4;
		var raw = img.substr(0, adj);
		document.images[name].src = raw + swap + ext;
	}
	 else if (document.getElementById)	//image swap for Mozilla, Firefox, Netscape, Opera
	{
		var img = document.getElementById(name);
		var fulltext = img.src;
		var ext = img.src.substr(-4);
		var adj = fulltext.length - last - 4;
		var raw = fulltext.substr(0, adj);
		img.src = raw + swap + ext;
	}

	return true;
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function pushdown (id, addtl)
{
	var l = getElement(id);
	var height = (screen.height) ? screen.height : self.innerHeight;
	var offset = Math.abs(addtl) + (height - 2 * l.offsetHeight) / 2;
	l.style.marginTop = Math.round(offset) + 'px';
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function externalLinks()
{
	if (!document.getElementsByTagName)
		return;

	var a = document.getElementsByTagName('a');

	for (var i = 0; i < a.length; i++)
	{
		if (a[i].getAttribute('rel') == 'external')
			a[i].target = '_blank';
	}
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function usableCheckbox(name)
{
	var checkset = getElement(name);
	checkset.checked = !(checkset.checked);	
}

/*----------------------------------------------------------------------------------------------------------------------------*/

function usableRadio(name, valued)
{
	var radioset = getElement(name);

	for (var i = 0; i < radioset.length; i++)
	{
		if (valued == radioset[i].value)
			radioset[i].checked = true;		
	}
}

/*----------------------------------------------------------------------------------------------------------------------------*/

// the createRequestObject() function is used to create a request object that will be
// used in making a remote call to the server to fetch plain text/JSON/XML content

function createRequestObject()
{
	var reqob;

	if (window.ActiveXObject)
	{
		try
		{
			reqob = new ActiveXObject('Msxml2.XMLHTTP');
		}
		catch (e)
		{
			try
			{
				reqob = new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch (e)
			{
				reqob = false;
			}
		}
	}
	else if (window.XMLHttpRequest)
	{
		try
		{
			reqob = new XMLHttpRequest();
		}
		catch (e)
		{
			reqob = false;
		}
	}

	return reqob;
}


//object must be created outside of functions for AJAX to work in Internet Explorer
var http = createRequestObject();
-->