// JavaScript Document
var cp = new Array()
var mt = new String()

function initCp() {
	mt = 'a' + 'i' + 'l'
	mt = 'm' + mt 
	mt = mt + 't' + 'o' + ':'

	cp['Sales'] = new Array('%47%D4%D3%96%FC%E9', '%34%B5%BF%F3%8F%A9%29%A6%B4%E6%8E%86%23%A1%B0%E2%8F%85%2B%B7%FD%F5%93%84')
	cp['Accounting'] = new Array('%B1%FA%3E%88%1B%FF', '%D0%99%5D%E7%6E%91%C5%93%50%EF%5B%91%C3%9D%4E%FA%74%9B%C4%99%4A%FB%77%93%D2%D4%5D%E7%76')
	cp['Service'] = new Array('%04%93%19%1A%CC%48%0B%4B', '%77%F6%6B%6C%A5%2B%6E%0B%6A%E1%7E%6A%BE%27%6F%3E%67%E7%6A%76%A0%2B%25%28%6B%FE')

}

function getCp(tag) {
	var kSetU
	var enValU
	var vi
	var ki
	var ret = new String()
	var itm = cp[tag]
	if (typeof(itm) != 'undefined') {
		kSetU = unescape(itm[0])
		enValU = unescape(itm[1])
		ki = 0;
		for (vi = 0; vi < enValU.length; vi++) {
			ret += String.fromCharCode(kSetU.charCodeAt(ki) ^ enValU.charCodeAt(vi));
			if ((++ki) >= kSetU.length) ki = 0
		}
	} else {
		ret = ''
	}
	return ret
}

function isAnchor(a) {
	var ret = false
	if (typeof(a) == 'object') {
		if (a.nodeName == 'A') {
			ret = true
		}
	}
	return ret
}

function openMtUrl(a, tag) {
	if (isAnchor(a)) {
		if (a.isRevealed) {
			window.location = mt + getCp(tag)
		}
	}
	return true
}

function reveal(a, tag) {
	if (isAnchor(a)) {
		if (a.childNodes.length == 0) {
			a.appendNode(document.createTextNode(getCp(tag)))
		} else {
			a.childNodes[0].nodeValue = getCp(tag)
		}
		a.prevWindowStatus = window.status
		window.status = buildGotoInstruction(tag)
		a.isRevealed = true
	}
	return true
}

function restore(a, tag) {
	if (isAnchor(a)) {
		window.status = a.prevWindowStatus
		a.isRevealed = false
		if (a.childNodes.length != 0) {
			a.childNodes[0].nodeValue = buildGotoInstruction(tag)
		}
	}
	return true	
}

function buildHoverInstruction(tag) {
	return "Hover to reveal"
}

function buildGotoInstruction(tag) {
	return "Click to send email"
}

function insertContactPoint(tag) {
	var ret = new String()
	ret = '<' 
			+ 'a href="javascript:void(0);"'
			+ ' onMouseOver="return reveal(this,\''+ tag + '\');"'
			+ ' onMouseOut="return restore(this,\'' + tag + '\');"'
			+ ' onClick="return openMtUrl(this,\'' + tag + '\');"'
			+ '>'
			+ buildGotoInstruction(tag)
			+ '<' + '/a' + '>'
			
	document.write(ret)
}

initCp()
