
var id_contact_message = 'contact_message';
var default_contact_message = '';

var contact = [
	[ new Image(), new Image(), '(901)767-2354' ],
	[ new Image(), new Image(), '(901)761-9244' ],
	[ new Image(), new Image(), 'info@alliedbusinessbrokers.com' ]
];

contact[0][0].src = '/Media/Images/contact-phone-off.gif'; 
contact[0][1].src = '/Media/Images/contact-phone-on.gif';
contact[1][0].src = '/Media/Images/contact-fax-off.gif';
contact[1][1].src = '/Media/Images/contact-fax-on.gif';
contact[2][0].src = '/Media/Images/contact-address-off.gif';
contact[2][1].src = '/Media/Images/contact-address-on.gif';

function Point(x, y) {
	this.x = x;
	this.y = y;
}

function getObj(id) {
	if(document.layers) {
		return document.layers[id];
	} else if(document.all) {
		return document.all[id];
	} else if(document.getElementById) {
		return document.getElementById(id);
	}
}

function getPosition(el) {
	if(document.all) {
		return getPositionIE(el);
	} else if(document.getElementById) {
		return getPositionNS(el);
	}
}

function getPositionNS(el) {
	return new Point(el.x, el.y);
}

function getPositionIE(el) {
	var r = new Point(el.offsetLeft, el.offsetTop);
	
	if(el.offsetParent) {
		var tmp = getPositionIE(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}

	return r;
}

function putObj(parent, target, offsetX, offsetY) {
	var pt = getPosition(parent);
	target.style.top = new String(pt.y + offsetY) + 'px';
	target.style.left = new String(pt.x + offsetX) + 'px';
	return pt;
}

function registerDropDown(obj, parent) {
	putObj(parent, obj, -5, 15);
	obj.style.display = 'block';
}

function contactOn(obj, index) {
	var contact_message = getObj(id_contact_message);
	obj.src = contact[index][1].src;
	contact_message.innerHTML = contact[index][2];
}

function contactOff(obj, index) {
	var contact_message = getObj(id_contact_message);
	obj.src = contact[index][0].src;
	contact_message.innerHTML = default_contact_message;
}
