function setActiveStyleSheet(title)
{
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++)
	{
		if(a.getAttribute("rel").indexOf("style") != -1
			&& a.getAttribute("title"))
		{
			a.disabled = true;
			if(a.getAttribute("title") == title)
				a.disabled = false;
		}
	}
}

function throw_error(text)
{
	errorboxa = document.getElementById('errorbox');
	errorboxa.style.display = 'block';
	new Effect.Highlight(errorboxa, { startcolor: '#ff9999', endcolor: '#dddddd', queue: 'end' });
}

function set_error(text)
{
	errorboxa = document.getElementById('errorbox');
	errorbox_texta = document.getElementById('errorbox_text');
	errorbox_texta.innerHTML = text;
	throw_error();
}

function search_click(button)
{
	var stp = document.getElementById('property_price');
	var str = document.getElementById('rent_price');

	if (button.value == 1)
	{
		stp.style.display = 'none';
		str.style.display = 'block';
	} else {
		stp.style.display = 'block';
		str.style.display = 'none';
	}
}


var animate_pos = new Array();
animate_pos[0] = 0;
animate_pos[1] = 0;

function animate(parentid, anim, delay)
{
	var container = document.getElementById(parentid);
	var ulnode = container.childNodes[0].nodeName == 'UL' ? 0 : 1;
	var num = container.childNodes[ulnode].childNodes.length;
	var blocks = new Array();
	var actualnum = 0;
	var nextid = 0;
	for (i = 0; i < num; i++)
	{
		if (container.childNodes[ulnode].childNodes[i].nodeName == 'LI')
		{
			blocks[actualnum] = container.childNodes[ulnode].childNodes[i];
			actualnum++;
		}
	}

	if (delay > 0)
	{
		setTimeout("animate('" + parentid + "', " + anim + ")",delay);
		new Effect.Fade(blocks[0], { duration: 1, from: 0.01, to: 0.99 });
		return;
	}

	if (animate_pos[anim] + 1 == actualnum)
		nextid = 0;
	else
		nextid = animate_pos[anim] + 1;

	blocks[animate_pos[anim]].style.display = 'block';
	blocks[animate_pos[anim]].style.zIndex = 50;
	blocks[nextid].style.display = 'block';
	blocks[nextid].style.zIndex = 55;

	var from = new Effect.Fade(blocks[animate_pos[anim]], { duration: 3, from: 0.99, to: 0.01 });
	var to = new Effect.Fade(blocks[nextid], { duration: 3, from: 0.01, to: 0.99 });

	animate_pos[anim] = nextid;

	setTimeout("animate('" + parentid + "', " + anim + ")",6000);
}