// All Scripts
// contains all javascripts used by pages


////////////////////////////////////////////////////////////
// IS BLANK
// checks if search our site form is blank
//
// called with
//    <form method="get" action="http://search.atomz.com/search/" name="ss" onsubmit="return isBlank();">

function isBlank()
{	value=document.ss.elements['sp-q'].value;
	if ( value == "" )
	{	alert("Please enter a search query.");
		return false;
	}
	else {return true;}
}

////////////////////////////////////////////////////////////
// LAST MODIFIED
//
// called with
//    <script language="JavaScript" type="text/javascript">LastMod()</script>

function LastMod ()
{	var daynames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var monthnames = new Array("January","February","March","April","May","June","July",
								"August","September","October","November","December");
	var lastModDate = new Date(document.lastModified)
	var day = daynames[lastModDate.getDay()]
	var month = monthnames[lastModDate.getMonth()]
	var date = lastModDate.getDate()
	var year = lastModDate.getYear()
	year += (year < 2000) ? 1900 : 0;
	document.write("<p align='center'><small>Last Modified: " + month + " " + date + ", " + year+"</small></p>")
//	document.write("<p align='center'><small>Last Modified: " + day + ", " + month + " " + date + ", " + year+"</small></p>")
}


////////////////////////////////////////////////////////////
// SHOW and HIDE image
//
// called with
//     onMouseOver="show(obj);" onMouseOut="hide(obj);"

function show (obj)
{	obj.style.visibility = 'visible';
}

function hide (obj)
{	obj.style.visibility = 'hidden';
}


////////////////////////////////////////////////////////////
// STOP HIDING a div
//
// called with
//     <a href="javascript:unhide(obj)" class="lib">click here</a>

function unhide (id)
{	if(document.getElementById(id).style.display=="none")
		{document.getElementById(id).style.display="block";}
	else
		{document.getElementById(id).style.display="none";}
}


////////////////////////////////////////////////////////////
// Days until ....
// called with:
//
//   <script language="JavaScript" type="text/javascript">DaysUntil('year','month','day','not yet message','final message')</script>

function DaysUntil(targYear,targMonth,targDay,incompleteMessage,finalMessage)
{	targMonth--; 
	var finalDate=new Date();
	finalDate.setFullYear(targYear,targMonth,targDay);
	
	var today = new Date();
	
	if (finalDate<=today)
	{	document.write(finalMessage);
	}
	else
	{	daysToGo = finalDate.getTime( ) - today.getTime( );
		daysToGo = Math.floor(daysToGo / (1000 * 60 * 60 * 24));
		document.write(incompleteMessage + ' ' + daysToGo + ' days.');
	}
}

////////////////////////////////////////////////////////////
// change iframe src
// called with:
//
//    <a href="load1.html" onclick="return changeIframeSrc('ifrm', this.href)">Page 1</a>

function changeIframeSrc(id, url)
{
    if (!document.getElementById) return;
    var el = document.getElementById(id);
    if (el && el.src)
	{	el.src = url;
        return false;
    }
    return true;
}

////////////////////////////////////////////////////////////
// make % complete graph
// called with:
//
//    <script language="JavaScript" type="text/javascript">perComp(10)</script>

function perComp(perc)
{	var startImg = '<img src="http://www.yarranet.net.au/phill/images/spacer.gif" alt="" width="';
	var endCompImg = '" height="10" border="0" style="background:#f00">';
	var endIncompImg = '" height="10" border="0" style="background:#ddd">';
	var incomp = 100-perc;
	document.write( '<em>' +perc + '%</em> ' );
	document.write( startImg + perc + endCompImg );
	document.write( startImg + incomp + endIncompImg + ' complete.');
	return true;
}

// END