/*	TITLE		: cbc.js
	
	DECRIPTION	: Javascript library
	
	REQUIREMENTS: jQuery.js

	HISTORY		:	2008-06-08	SJW	Added email
----------------------------------------------------------------------
*/

/*
----------------------------------------------------------------------
	TITLE:		: email.js
	
	DESCRIPTION	: Convert <span class="email"> into <a href="mailto:"> links
	
	HISTORY		: 2008-06-08 SJW Initial version
----------------------------------------------------------------------
*/
$(document).ready(function(){
// Default domain name
	var domain = "countybridgeclub.co.uk";

// Regular expression to match all spaces
	var from = / /g;

// Loop through all <span class="email"> tags
	
	$('span.email').each(function(){
// Read the 'rel' attribute
		var title = $(this).attr('title');

// Read the name of the person between the <span> and </apsn> tags
		var person = $(this).html();

		if(title == null){
// No 'title' attribute specified.
// Check to see if we recognise the person. 
// If known, then use their known email address.
			switch(person){
			case "Robert Northage":
				email = "rhnorthage" + "@super.net";
				break;
			default:
// If person is unknown then replace all spaces with a dot and append the default domain name
				email = person.replace(from, ".") + "@" + domain;
			}
		} else {
// 'rel' attribute specific. Check for '#' in the email address.
			if(title.indexOf("#") == -1){
// No '#' in the email address, so append the default domain
				email = title + "@" + domain;
			} else {
// '#' in the email address, so replace it with a '@'
				email = title.replace("#","@");
			}
		};

// Create an <a> tag
		var anchor = document.createElement("a");
// Set the 'href' attrribute to the email address (prefix with mailto:)
		anchor.setAttribute("href", "mailto:" + email);
// Create a text node with the name of the person (taken from the <span> tag)
		var text = document.createTextNode(person);
// Append the text node to the <a> tag
		anchor.appendChild(text);
// Append the <a> tag to the document, immediately after the <span>...</span>. Then remove the <span> tag. 
		$(this).after(anchor).remove();
	});
});


/* ================================================================ 
This copyright notice must be untouched at all times.
Copyright (c) 2009 Stu Nicholls - stunicholls.com - all rights reserved.
=================================================================== */
$(document).ready(function(){
	$(".hidden").hide();
	$(".more").html("more &hellip;");
 
	$(".more").click(function() {
	if (this.className.indexOf('clicked') != -1 ) {
		$(this).prev().slideUp(500);
		$(this).removeClass('clicked')
		$(this).html("more&hellip;");
	}
	else {
		$(this).addClass('clicked')
		$(this).prev().slideDown(500);
		$(this).html("&hellip;less");
	}
});
 
});

