/* =============================================================================
$Id: phonePopup.js 6176 2007-04-30 10:37:29Z howardb $
$Date: 2007-04-30 11:37:29 +0100 (Mon, 30 Apr 2007) $
$Revision: 6176 $
$Author: howardb $
Copyright (c) 2005 Conchango Ltd. All rights reserved.
Web Application Version: [BUILD_16.07.32_2_071011]
Release Date: [12-October-2007]
============================================================================= */
var phoneImg =
{
	selectedId:'p1',
	selectedClass:'selected',
	zoomId:'zoomPhone',

	select: function(that)
	{
		//unset current highlight
		$(this.selectedId).className = '';

		//set highlight
		that.className = this.selectedClass;

		this.selectedId = that.id;

		//load zoom img
		$(this.zoomId).src = that.firstChild.src.replace(/small/,'zoom');

		//kill link
		return false;
	},

	preload: function(el)
	{
		if (el.id != this.selectId)
		{
			var img = new Image(1,1)
			img.src = el.firstChild.src.replace(/small/,'zoom');
		}
	}
}


// bind js events to html and preload any zoom images
var phoneRules =
{
	'li a' : function(el)
	{
		el.onclick = new Function('return phoneImg.select(this);');
		el.onmouseover = element.onclick;

		phoneImg.preload(element);
	},

	'#popupFooter a' : function(el)
	{
		el.onclick = new Function('window.close();');
	}
};
Behaviour.register(phoneRules);

