var Box1;
var Box2;
var cRed   = 100,
    cGreen = 130,
	cBlue  = 240;
var PulseState = 9;

function setAnchors()
{
if (!document.getElementsByTagName) return;

var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++)
	{
	var anchor = anchors[i]; 
	if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";

	anchor.onfocus = new Function("this.blur()"); 
	}
}

function BoxOpen(box)
	{
	if (box.direction == 1)
		{
		if (box.boxSize < 280)
			{
			box.boxSize += 8;
			box.boxLeft -= 8;
			box.boxTop  -= 8;
		
			box.smallBox.style.width  = box.boxSize + "px";
			box.smallBox.style.height = box.boxSize + "px";
			box.bigBox.style.width    = box.boxSize + "px";
			box.bigBox.style.height   = box.boxSize + "px";

			box.smallBox.style.left   = box.boxLeft + "px";
			box.smallBox.style.top    = box.boxTop  + "px";
			box.bigBox.style.left     = box.boxLeft + "px";
			box.bigBox.style.top      = box.boxTop  + "px";

			box.bigBox.style.opacity = (box.boxSize - 80) / 200;
			if (box.bigBox.filters)
				box.bigBox.filters.alpha.opacity = (box.boxSize - 80) / 2;
			}
		
		if (box.boxSize >= 280)
			{
			box.bigBox.style.opacity = 1;
			if (box.bigBox.filters) 
				box.bigBox.filters.alpha.opacity = 100;
			}
		else
			if (box == Box1)
				window.setTimeout("BoxOpen(Box1)", 15);
			else
				window.setTimeout("BoxOpen(Box2)", 15);
		}
	}

function BoxClose(box)
	{
	if (box.direction == 0)
		{
		box.boxSize -= 8;
		box.boxLeft += 8;
		box.boxTop  += 8;
		
		if (box.boxSize >= 80)
			{
			box.smallBox.style.width  = box.boxSize + "px";
			box.smallBox.style.height = box.boxSize + "px";
			box.bigBox.style.width    = box.boxSize + "px";
			box.bigBox.style.height   = box.boxSize + "px";

			box.smallBox.style.left   = box.boxLeft + "px";
			box.smallBox.style.top    = box.boxTop  + "px";
			box.bigBox.style.left     = box.boxLeft + "px";
			box.bigBox.style.top      = box.boxTop  + "px";

			box.bigBox.style.opacity = (box.boxSize - 80) / 200;
			if (box.bigBox.filters)
				box.bigBox.filters.alpha.opacity = (box.boxSize - 80) / 2;
			}

		if (box.boxSize <= 80)
			{
			box.bigBox.style.opacity = 0;
			if (box.bigBox.filters) 
				box.bigBox.filters.alpha.opacity = 0;
			}
		else
			if (box == Box1)
				window.setTimeout("BoxClose(Box1)", 15);
			else
				window.setTimeout("BoxClose(Box2)", 15);
		}
	}
	
function startBox1Open(e)
	{
	if (Box1.direction == 1)
		return;
	Box1.direction = 1;
	BoxOpen(Box1);
	}

function startBox1Close(e)
	{
	if (Box1.direction == 0)
		return;
	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;

	if (reltg.nodeName != 'DIV') return;
	while (reltg != tg && reltg.nodeName != 'BODY')
		reltg = reltg.parentNode;

	if (reltg == tg) return;

	Box1.direction = 0;
	window.setTimeout("BoxClose(Box1)", 300);
	}
	
function startBox2Open(e)
	{
	if (Box2.direction == 1)
		return;
	Box2.direction = 1;
	BoxOpen(Box2);
	}

function startBox2Close(e)
	{
	if (Box2.direction == 0)
		return;
	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;

	if (reltg.nodeName != 'DIV') return;
	while (reltg != tg && reltg.nodeName != 'BODY')
		reltg = reltg.parentNode;

	if (reltg == tg) return;

	Box2.direction = 0;
	window.setTimeout("BoxClose(Box2)", 300);
	}
	
function BoxObj(smallBox, bigBox)
	{
	this.smallBox  = document.getElementById(smallBox);
	this.bigBox    = document.getElementById(bigBox);
	this.direction = 0;
	this.bigBoxOp  = 0; // Opacity

	this.smallBox.style.width  = '80px';
	this.smallBox.style.height = '80px';
	this.bigBox.style.width    = '80px';
	this.bigBox.style.height   = '80px';

	this.boxSize = 80;
	this.boxLeft = parseInt(this.smallBox.offsetLeft);
	this.boxTop  = parseInt(this.smallBox.offsetTop);
	}

function setBox()
	{
	Box1 = new BoxObj('box1', 'bigbox1');
	Box2 = new BoxObj('box2', 'bigbox2');
	Box1.bigBox.onmouseover = startBox1Open; 
	Box1.bigBox.onmouseout  = startBox1Close; 
	
	Box2.bigBox.onmouseover = startBox2Open; 
	Box2.bigBox.onmouseout  = startBox2Close; 
	}
	
function Box2Pulse()
	{
	PulseState = ++PulseState % 20;
	  
	cRed   = 244 - Math.abs(10 - PulseState) * 3;
	cGreen = 144 - Math.abs(10 - PulseState) * 10;
	cBlue  =  33 + Math.abs(10 - PulseState) * 3;
	
	Box2.smallBox.style.borderColor = 'rgb(' + cRed + ', ' + cGreen + ', ' + cBlue + ')';
	setTimeout("Box2Pulse()", 75);
	}

