// **************************************************
// This is the Temple of Dins common javascript file.
// **************************************************

// **************************************************
// Global variables
// **************************************************

var g_domain = 'watk';
var g_doman_suffix = 'co.uk';
var g_timerID = 0;
var g_timerCount = 0;

// **************************************************
// Breaks out of enclosing frames
// **************************************************

function breakFrames() {
	if (window != top) {
		top.location.href = location.href
	} ;
};


// **************************************************
// Breaks out of enclosing frames
// **************************************************

function newBreakFrames() {
	var idx = "0";

	if (top.location.href == "http://www.templeofdin.co.uk/index.php") {
		// Do nothing
		idx = "1";

	} else if (top.location.href == "http://www.jollyboyscc.org.uk/index.php") {
		// Do nothing
		idx = "1";

	} else {
		idx = "0";
	} ;

	// If we've been elcosed in someone elses frame break out.
	if (idx == "0") {
		window.status = "Not from Temple of Din";
		// alert(top.location.href);
		// if (window != top) top.location.href = location.href;
	} else {
		window.status = "From Temple of Din";
	} ;

};

// **************************************************
// Display a random message on a WATK page load.
// **************************************************

function showWATKMessage() {
	var ss1 = new Array(20)
	ss1[0] = "We are the nutters, we come from the sea..."
	ss1[1] = "Walter and the Knobheads, Punk Never Ends"
	ss1[2] = "Walter and the Knobheads, Poulton-Le-Fyldes Premier Punk Band"
	ss1[3] = "Walter and the Knobheads use Dolphin Friendly Tuners"
	ss1[4] = "This page is guaranteed to be free of worthwhile or educational content"
	ss1[5] = "Please stop picking your nose, this is a religious site."
	ss1[6] = "Walter and the Knobheads, Poulton-Le-Fyldes Premier Punk Band"
	ss1[7] = "12 electrons were lost whilst loading this page"
	ss1[8] = "Walter and the Knobheads, Poulton-Le-Fyldes Premier Punk Band"
	ss1[9] = "Don't blame the Knobheads.... the Devil made us do it"
	ss1[10] = "Love is the Law, Love under Will"
	ss1[11] = 'Hail Eris !  All hail Discordia ! Praise "Bob" !'
	ss1[12] = "Todays favourite animal is the Cat"
	ss1[13] = "Todays favourite insect is the Walrus"
	ss1[14] = "Help... I'm being held prisoner in your browser's status bar..."
	ss1[15] = "Todays lucky number is 2,145.023"
	ss1[16] = "Todays lucky colour is nine gazelles"
	ss1[17] = "Todays favourite animal is the Carleton antelope"
	ss1[18] = "This page is made from hand picked electrons."
	ss1[19] = "This page has been constructed for idiots, by idiots"

	var now = new Date()
	var sec = now.getSeconds()
	var msg = ss1[sec % 20]

	//Show a random message

	window.status=msg

};


// **************************************************
// Email function
// **************************************************

function mailMe(object,recipient) {
    var em_add = 'mailto:' + recipient + '@' + g_domain + "." + g_domain_suffix;

    object.encoding = 'text/plain';
    object.action = em_add
    object.method = 'POST';

};



// **************************************************
// Test function
// **************************************************

function testAlert() {
   alert("At least the javascript got called...");
};
