var efeito = false;

window.onload = function()
{
	selectItem();
	
	if(!NiftyCheck())
		return;
	Rounded("div#clientes","all","#FFF","#F2F2F2","smooth");
	Rounded("div#servicos","all","#FFF","#F2F2F2","smooth");
	Rounded("div#contato","all","#FFF","#F2F2F2","smooth");
	Rounded("div#curvas","all","#FFF","#F2F2F2","smooth");
	Rounded("div#curva","all","#FFF","#F2F2F2","smooth");
	
/*	toScroll();

	// adicao do arquivo de reflexo das imagens
	addReflections();
*/
}

function showFiltros()
{
	if(!efeito)
	{
		efeito = true;

		if($('bla').style.display == 'none')
			new Effect.BlindDown($('bla'));
		else
			new Effect.BlindUp($('bla'));
			
		setTimeout('efeito=false', 1000);
	}		
}

// funcao para fazer o efeito de scroll quando clicar na tag a
function toScroll()
{
	var a = document.getElementsByTagName('a');
	
	for(i = 0; i < a.length; i++)
	{
		if(a[i].className == 'link_effect')
		{
			a[i].onclick = function()
			{
				new Effect.ScrollTo('topo');
			}
		}
		
		else if(a[i].className == 'to_produtos')
		{
			a[i].onclick = function()
			{
				new Effect.ScrollTo('produtos');
			}
		}
		
		else if(a[i].className == 'to_clientes')
		{
			a[i].onclick = function()
			{
				new Effect.ScrollTo('clientes');
			}
		}
		
		else if(a[i].className == 'to_servicos')
		{
			a[i].onclick = function()
			{
				new Effect.ScrollTo('servicos');
			}
		}
		
		else if(a[i].className == 'to_contatos')
		{
			a[i].onclick = function()
			{
				new Effect.ScrollTo('contatos');
			}
		}

		else if(a[i].className == 'to_rodape')
		{
			a[i].onclick = function()
			{
				new Effect.ScrollTo('rodape');
			}
		}


	}
}

var sel;

// funcao para selecionar umas das opcoes do menu
function selectItem()
{
	var 
		list 	= document.getElementsByTagName('li'),
		i 		= 0,
		m;
		
	for(i; i < list.length; i++)
	{
		if(list[i].parentNode.id == 'select_menu')
		{
			// se tiver a id selected, uma variavel vai captar o numero de seu indice
			if(list[i].id == 'selected')
			{
				sel = i;
			}
			
			if(list[i].id != 'selected')
			{
				list[i].onmouseover = function()
				{
					m = this;

					if(m.hasChildNodes && m.childNodes[0].tagName == 'A' && (m.className == 'first' || m.className == 'first a_off'))
						m.className = 'first a_on';
					else
						m.className = 'a_on';
				}
				
				list[i].onmouseout = function()
				{
					m = this;

					if(m.hasChildNodes && m.childNodes[0].tagName == 'A' && (m.className == 'first' || m.className == 'first a_on'))
						m.className = 'first a_off';
					else
						m.className = 'a_off';
				}
				
				list[i].onclick = function()
				{
					list[sel].id			= '';

					if(list[sel].className == 'first' || list[sel].className == 'first a_off')
					{
						list[sel].className = 'first';
					}
					else
					{
						list[sel].className 	= 'a_off';
					}

					this.id 				= 'selected';

					// funcao para chamar a si mesma
					// metodo recursivo para recomecar o evento
					selectItem();
				}
			}
		}
	}
}