// EMAIL ADDRESS PRINTING FUNCTIONS

// Writes out an email address to the page.
function writeEmail(name, domain) {
	document.write(name + '@' + domain);
}

// Writes out an email link that displays the email address as its text.
function writeEmailLink0(name, domain) {
	document.write('<a href="mailto:' + name + '@' + domain + '">'
	  + name + '@' + domain + '</a>');
}

function writeEmailLink(name, domain, subject) {
	if (subject) {
		document.write('<a href="javascript:sendEmail(\''
		  + name + '\', \'' + domain + '?subject=' + subject + '\')">');
	} else {
		document.write('<a href="javascript:sendEmail(\''
		  + name + '\', \'' + domain + '\')">');
	}
	writeEmail(name, domain);
	document.write('</a>');
}

function writeEmailLink2(realName, name, domain) {
	document.write('<a href="javascript:sendEmail(\''
	  + name + '\', \'' + domain + '\')">');
	document.write(realName);
	document.write('</a>');
}

function feedbackLink() {
	document.write('<a href="mailto:');
	//writeEmail('info', 'lrca.org.uk');
	writeEmail('smjg', 'iname.com');
	document.write('">Contact us<\/a> with questions or comments about this web site.<br />');
}

/*
This function is to be used inside the HREF tag to simulate having the mailto:
code inside of it, but without being easily harvested by spammers. Example:
<a href="javascript:sendEmail('pshikli', 'bizware.com');">
*/
function sendEmail(name, domain) {
	location.href = 'mailto:' + name + '@' + domain;
}


// *** deprecated: converting to text links with CSS
// MOUSEOVER IMAGES WITH NAVIGATION
// For simplicity, this is the simply prepended to the image name
var imagePath = '';
var imageExt = 'gif';

function MouseOver(nm, up) {
	this.name = nm;
	
	this.inImage = new Image;
	this.inImage.src = imagePath + nm + '_a.' + imageExt;
	
	this.outImage = new Image;
	this.outImage.src = imagePath + nm + (up ? '_p.' : '_l.') + imageExt;

	this.mouseIn = function() {
		document[nm].src = this.inImage.src;
	}
	this.mouseOut = function() {
		document[nm].src = this.outImage.src;
	}
}


// MAIN NAVIGATION BAR
// (to bypass redirect pages)

function currentLinks() {
	if (!document.getElementById) return false;

	currentLink('league', '2009_10');
	currentLink('lc', 'lc2009_10');
	currentLink('ct', 'ct2008_9');
	currentLink('cc', 'cc2009');
	currentLink('cups', 'cups2009');
}


function currentLink(linkId, target) {
	var link = document.getElementById('l_' + linkId);
	if (link) link.href = link.href.replace('/' + linkId + '/', '/' + target + '/');
}
