
/* ====================================================

	GENERAL SITE COMMANDS AND VARIABLES

  Created by John Mounsey, Peaknet Limited.
  john@peaknet.ltd.uk
  © 2OO6 - please do not steal!

==================================================== */

/* ____________________________________________________

Set Overall Variables..
____________________________________________________ */

var siteName		= '_Generic inc.'
var pagelink		= document.location
var localOrLive		= location.protocol
var pagePath		= location.href
var siteDomain		= location.hostname
var pagename		= document.title
var developer		= 'John Mounsey'
var developerurl	= 'http://www.peaknet.co.uk/'
var defaultStatus	= developerurl



/* ____________________________________________________

Date and Time Functions..
____________________________________________________ */

var months=new Array(13);

months[1]	= "January";
months[2]	= "February";
months[3]	= "March";
months[4]	= "April";
months[5]	= "May";
months[6]	= "June";
months[7]	= "July";
months[8]	= "August";
months[9]	= "September";
months[10]	= "October";
months[11]	= "November";
months[12]	= "December";

var time	= new Date();
var lmonth	= months[time.getMonth() + 1];
var date	= time.getDate();
var dateEnd	= "th"
var year	= time.getYear();

if 	(date == 1 || date == 21 || date == 31)	{ dateEnd = 'st'; }
else if (date == 2 || date == 22) 		{ dateEnd = 'nd'; }
else if (date == 3 || date == 23)		{ dateEnd = 'rd'; }

if (year < 2000) year = year + 1900

function today() { document.write(date + dateEnd + " " + lmonth + ", " + year); }



/* ====================================================
Page Greeting
==================================================== */

function greeting()

{
if (hour >= 22)		{ period = 'night'; }
else if (hour >= 17)	{ period = 'evening'; }
else if (hour >= 12) 	{ period = 'afternoon'; }
else if (hour >= 6) 	{ period = 'morning'; }
document.write('Good afternoon');
}


/* ====================================================
Hide "Loading" message
==================================================== */

function hideLoad()

{
// alert('Loading complete!')
document.getElementById('loading')
loading.style.display='none';
}

/* ====================================================
Things to do when page 100% loaded or resized
==================================================== */

function loaded()

{
window.status		= 'Page 100% Loaded.';
hideLoad();
}

/* ====================================================
Show Destination of a url
==================================================== */

function preUrl(destUrl)

{
var destTarg	= destUrl.target;

if (destTarg != '' || destTarg != '_top')
	{
	destUrl.title	= 'Opens: ' + destUrl.href + ' (in a new window)';
	}
}

/* ====================================================
Bookmark / Add to Favorites script
==================================================== */

function bookmark()

{ 
if (window.external)
	{
	external.AddFavorite(pagelink,pagename)
	}
}



/* ====================================================
Recommend a Friend
==================================================== */

function sendPage()
	{
	alert('This opens a blank Email for you to send to friends ..');
	window.location='mailto:?subject=I recommend this site: ' + siteUrl + ' (' + siteName + ')';
	}


/* ====================================================
Previous Pages
==================================================== */

function goBack(dest) { history.go(-1); }
function doubleBack() { history.go(-2); }



/* ====================================================
Change text within an ID'd <P> or <TD> tag
==================================================== */

function change(part,msg)
{
document.getElementById(part).innerText = msg;
}


/* ____________________________________________________

Footer Tools
____________________________________________________ */

function credit()
{
document.write('<P TITLE="copyright message" CLASS="tools">© ' + siteName + ' ' + thisYear + '</P>');
}



/* ____________________________________________________

Generic Change-Class Function
____________________________________________________ */

function rollTo(piece,prefClass)
{
piece.className=prefClass;
}



/* ____________________________________________________

No Class Function
____________________________________________________ */

function deClass(targCell)
{
targCell.className='';
}



/* ____________________________________________________

MM Jump Menu
____________________________________________________ */

function jumpTo(targ,selObj,restore)
{
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}



/* ____________________________________________________

GO to a page
____________________________________________________ */

function go(destPage)
{
top.location=destPage
}



/* ____________________________________________________

Hide all menus
____________________________________________________ */

function m1()
{
document.getElementById('m3').style.display='none';
document.getElementById('m2').style.display='none';
document.getElementById('m1').style.display='inline';
}

function m2()
{
document.getElementById('m1').style.display='none';
document.getElementById('m3').style.display='none';
document.getElementById('m2').style.display='inline';
}

function m3()
{
document.getElementById('m1').style.display='none';
document.getElementById('m2').style.display='none';
document.getElementById('m3').style.display='inline';
}

function hideRecent()
{
document.getElementById('recentGridLo').className='visible';
document.getElementById('recentGrid').className='hidden';
}

function showRecent()
{
document.getElementById('recentGrid').className='visible';
document.getElementById('recentGridLo').className='hidden';
}

function showContents()
{
document.getElementById('contentsLo').className='hidden';
document.getElementById('contents').className='visible';
}

function hideContents()
{
document.getElementById('contents').className='hidden';
document.getElementById('contentsLo').className='visible';
}



/* ____________________________________________________

Previous Page(s)
____________________________________________________ */

function windowOpener(page,w,h)
{
window.open(page,'ImageZoom','resizable=yes,location=yes,directories=yes,toolbar=yes,status=yes,scrollbars=yes,width='+ 800 + ',height='+ 600);
}

