// swaps the visibility of two adjacent layers... good for help text, etc.

function swap() 
{
    for (var i=0; i<swap.arguments.length; i++) {
        var element = document.getElementById(swap.arguments[i]);
        element.style.display = (element.style.display == "none") ? "block" : "none";
    }
}

// disable button on submit to prevent multiple submits of the same form

function disable(btn) 
{
    btn.disabled = true;
}


// Clear form fields on entry... handy for putting in example data to clear onFocus.
// Also clears any temporary styles to change default vs. example text styles

function clearDefault(el) 
{
  if (el.defaultValue==el.value) el.value = "";
  if (el.style) el.style.cssStyles = "";
}


// Timed layer that disappears. Used for hiding an element after ÔxÕ of seconds. Great for hiding status messages after a person has submitted a form.
/* Usage:
 <script type="text/javascript">	//<!-- <![CDATA[
   document.write('<iframe src="/assets/messages/message.html" width="300" height="65" scrolling="no" frameborder="0"></iframe>');
	//]]> -->
 </script>

----------------------------------------
message.html
----------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>messge.html</title>
	<link href="/c/basic.css" rel="stylesheet" type="text/css"/>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="c/basic.css" rel="stylesheet" type="text/css"/>

</head>

<body>

<p><a href="example01.html">View Example</a></p>

</body>
</html>
----------------------------------------

----------------------------------------
example01.html
----------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Example Hide</title>
	<link href="/c/basic.css" rel="stylesheet" type="text/css"/>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script src="/assets/site/site.js" type="text/javascript"></script>

<style type="text/css">
#hidaway {background: #ffc;color: #333;
	border: 1px solid #90ee90;
	padding: 3px;
margin: 0 0 20px;}
</style>
</head>

<body>
<script type="text/javascript">
timedLayer('hidaway')
</script>
<div id="hidaway">Looking at this for five seconds will make it disappear.</div>
<p><a href="javascript:location.reload()">View Example Again</a></p>
</body>
</html>

----------------------------------------

*/

var timerID;

function ShowLayer(id)
{
  document.getElementById().style.display = "block"; 
}

function HideTimedLayer(id)
{  
    clearTimeout(timerID);
    document.getElementById(id).style.display = "none";
}

function timedLayer(id)
{
  setTimeout("HideTimedLayer(\"" + id + "\")",5000); //5000= 5 seconds
}


/**********************************************************
Sleight
(c) 2001, Aaron Boodman
http://www.youngpup.net
**********************************************************/

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent)
{
	document.writeln('<style type="text/css">img { visibility:hidden; } </style>');
	window.attachEvent("onload", fnLoadPngs);
}

function fnLoadPngs()
{
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--)
	{
		if (itsAllGood && img.src.match(/\.png$/i) != null)
		{
			var src = img.src;
			var div = document.createElement("DIV");
			div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizing='scale')"
			div.style.width = img.width + "px";
			div.style.height = img.height + "px";
			img.replaceNode(div);
		}
		img.style.visibility = "visible";
	}
}

/**********************************************************
Sleight for Backgrounds
Original code (c) 2001 Aaron Boodman, http://www.youngpup.net
This version (c) 2003 Drew McLellan, http://www.allinthehead.com
*********************************************************
if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", alphaBackgrounds);
}

function alphaBackgrounds(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	for (i=0; i<document.all.length; i++){
		var bg = document.all[i].currentStyle.backgroundImage;
		if (itsAllGood && bg){
			if (bg.match(/\.png/i) != null){
				var mypng = bg.substring(5,bg.length-2);
				document.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='scale')";
				document.all[i].style.backgroundImage = "url('/assets/images/x.gif')";
			}
		}
	}
}

*/

