
// remember to add a backslash(\) before quotes around text

document.write('<map name="boxmap" id="boxmap"><area shape="rect" coords="5,5,58,31" href="http://news.bbc.co.uk" alt="" title="To BBC news" /><area shape="rect" coords="62,5,114,31" href="http://www.theregister.co.uk" alt="" title="To TheRegister" /><area shape="rect" coords="116,34,170,60" href="http://www.opera.com" alt="" title="To Opera Software" /><area shape="rect" coords="60,62,114,89" href="http://www.seattlemariners.com" alt="" title="To Seattle Mariners" /><area shape="rect" coords="116,91,170,118" href="http://community.pmail.com" alt="" title="To Pegasus Mail community" /></map>');

// CALL OUT IE USERS
document.write('<!--[if IE]><p style="position:fixed; top:10px; left:20px; padding:6px; font-family:Arial,sans-serif; font-weight:bold; font-size:small; background-color:#fffafa; color:#ff0000; border: thin black solid; z-index:1020;">You\'re using the <a style="color:#ff0000;" href="http://www.howtocreate.co.uk/wrongWithIE/?chapter=Summary" title="Get enlightened">awful</a> Internet Explorer, which is unable to display this site correctly. Try <a style="color:#ff0000;" href="http://www.opera.com" title="www.opera.com">Opera</a> or <a style="color:#ff0000;" href="http://www.mozilla.com" title="www.mozilla.com">Firefox</a>.</p><![endif]-->');

function message(where) {
	// ONLY FIRST LINE USED AT PRESENT
	if(where=="main") {document.write('Currently a Celebdaq beta tester...')}
	if(where=="foot") {
		randnum=Math.floor(Math.random()*5);
		switch(randnum) {
			case 0 :
				document.write('<br />&nbsp;&raquo; The capital of Benin is Porto-Novo');break;
			case 1 :
				document.write('<br />&nbsp;&raquo; Cumin, coriander and turmeric can reduce flatulence');break;
			case 2 :
				document.write('<br />&nbsp;&raquo; In the US, "Carry On" star Jim Dale reads the Harry Potter audiobooks');break;
			case 3 :
				document.write('<br />&nbsp;&raquo; The Blue Shark can swim at 25mph');break;
			case 4 :
				document.write('<br />&nbsp;&raquo; Rubik\'s Cube possible patterns: 43,252,003,274,489,856,000');break;
			default :
				document.write('');
		}
	}
}

function logoplacer() {
	document.write('<img style="z-index:10;position:fixed;top:0%;" src="core_img/topedge.png" width="100%" height="31" alt="" border="0"><img id="filler" src="core_img/filler.gif" alt="" border="0"><a href="http://www.japero.co.uk"><img id="logo" src="core_img/logo.png" width="227" height="50" alt="Japero logo" title="Return to Japero homepage" /></a>');
}

function boxplacer() {
	document.write('<img id="topboxes" src="core_img/topboxes.png" usemap="#boxmap" width="231" height="122" alt="" /><!-- <p><img id="ribbon" style="z-index:11;" src="core_img/site_age.gif" width="125" height="125" alt="" border="0" /></p> -->');
}

function sidemenu(loaded) {
	// FIRST AND LAST <LI></LI> ELEMENTS ARE IN THE PAGE
	document.write('<a title="Japero homepage" href="index.htm"><span id="home">Home</span></a></li><li><a title="Computer and technology-related stuff" href="tech.htm"><span id="it">Tech articles</span></a></li><li><a title="Downloads" href="downloads.htm"><span id="dloads">Downloads</span></a></li><li><a title="My mind is racing" href="brain.htm"><span id="brain">My brain hurts</span></a></li><li><a title="Nick Abbot audio files" href="nickabbot.htm"><span id="nick">Nick Abbot</span></a></li><li><a title="A whole bunch of home-made quizzes" href="quiz/index.htm" style="color:#cc6600;">Quizzes - NEW</a></li><li><a title="My brother\'s F1 prediction game" href="f1/index.htm">F1 Prediction</a><!-- <li><a title="Local pred copy" href="../../f1predictor/index.htm">Local Pred page</a></li> -->');
	document.getElementById(loaded).style.color='#ff0000';
// OLD MOOTOOLS HOOKS
//	$('main').addEvent('mouseover',function(){japfader('menu',0.1,1000)});
//	$('menu').addEvent('mouseover',function(){japfader('menu',1,50)});
}

var opac=10;
function japfade() {
	// MY OWN ELEMENT-FADING CODE BECAUSE MOOTOOLS IS UGLY
	// IT WON'T WORK IN IE BECAUSE MICROSOFT DON'T WANT TO SUPPORT OPACITY - TOUGH CHEDDAR
	document.getElementById('menu').style.opacity=opac/10;
	if(opac>1 && opac<11) {
		opac--;
		timer=setTimeout('japfade()',75);
	}
}

function mailer(name,addr,subj) {
	document.write('<a href="mailto:'+addr+'@japero.co.uk?subject='+subj+'" title="Click to start an e-mail message">E-mail '+name+'</a>');
}

function footlink() {
	document.write('<a href="read.htm?opera10"><img src="core_img/opera.gif" style="position:relative; top:2px;" alt="Use Opera" title="Use Opera" /></a>');
}

function modif() {
	altered=new Date(document.lastModified);
	//moment=altered.getHours()+":"+altered.getMinutes();
	month=altered.getMonth();
	date=altered.getDate();
	ordinal="th";
	if(date==1 || date==21 || date==31)	{ordinal="st"}
	if(date==2 || date==22)	{ordinal="nd"}
	if(date==3 || date==23)	{ordinal="rd"}
	year=altered.getFullYear();
	monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	document.write(date,ordinal+' '+monthname[month]+' '+year);
}

function reverse_lists() {
// THIS FUNCTION COURTESY OF ROSS SHANNON
// http://rossshannon.com/2009/02/
    var olists = document.getElementsByTagName('ol');
    for (var i = 0; i < olists.length; i++) {
        if (!olists[i].className.match(/\breversed\b/))
            continue;
        var items = olists[i].getElementsByTagName('li');
        for(var j = 0; j < items.length; j++) {
            items[j].setAttribute("value", items.length - j);
        }
    }
}

// ---------------------------------------------------------------------------------

function japfader(el,fi,ti) {
	// OLD BYTEFX STUFF - NOT USED
	if(ti>=700) {
		$(el).set('tween',{duration:700,transition:'expo:out'});
	}
	else {
		$(el).set('tween',{duration:50,transition:'linear'});
	}
	$(el).tween('opacity',fi);
}
