old='';
function set(e,a)
{
	if(typeof(e)!='object')
		e=document.getElementById(e);
	E=e.tagName;
	if(E=='INPUT'||E=='TEXTAREA')
	{
		if(e.type=='checkbox')
		{
			a=a.toLowerCase();
			e.checked=(a=='1'||a=='on'||a=='sim'||a=='true'||a==1||a==true?true:false);
		}
		else
		{
			e.value=a;
		}
	}
	else if(E=='SELECT')
	{
		O=e.getElementsByTagName('option');
		for(i=0;i<O.length;i++)
			if(O[i].value==a)
				O[i].selected=true;	
	}
	else
	{
		e.innerHTML=a;
	}
}
//*****************************************************************************************************************
function c(e,a)
{
	document.getElementById(e).style.display=a?'block':'none';
}
//*****************************************************************************************************************
function P(o,e,a)
{
	try
	{
		x=new XMLHttpRequest();
	}
	catch(R)
	{
		x=new ActiveXObject('Msxml2.XMLHTTP');
	}
	if(o=='GET')
	{
		x.open(o,e);
		x.setRequestHeader('Cache-Control','no-store,no-cache,must-revalidate,post-check=0,pre-check=0');
		x.send(null);
	}
	else
	{
		X=e.split('?');
		x.open(o,X[0]);
		x.setRequestHeader('Content-type','application/x-www-form-urlencoded');
		x.setRequestHeader('Content-length',X[1].length);
		x.setRequestHeader('Connection','close');
		x.send(X[1]);
	}

	x.onreadystatechange=function()
		{
			if(x.readyState==4)
			{
				RETORNO=x.responseText;
				eval(a);
			}
		};
}
//*****************************************************************************************************************
function g(e,a)
{
	P('GET',e,a);
}
//*****************************************************************************************************************
function p(e,a)
{
	P('POST',e,a);
}
//*****************************************************************************************************************
function validar(e)
{
	var Tb=['input','textarea'];
	for(var k=0;k<2;k++)
	{
		var T=e.getElementsByTagName(Tb[k]);
		for(var i=0;i<T.length;i++)
		{
			v=[	'cpf','Foi informado um CPF inválido.',/\d{3}.?\d{3}.?\d{3}-?\d{2}/,
				'cnpj','Foi informado um CNPJ inválido.',/\d{2}.?\d{3}.?\d{3}\/?\d{4}-?\d{2}/,
				'mail','Foi informado um e-mail inválido.',/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/,
				'data','Foi informada uma data inválida.',/^((0?[1-9]|[12]\d)\/(0?[1-9]|1[0-2])|30\/(0?[13-9]|1[0-2])|31\/(0?[13578]|1[02]))\/(19|20)?\d{2}$/];
			if(T[i].name.indexOf('*')!=-1)
			{
				for(var j=0;j<v.length;j+=3)
				{
					var C=T[i].name.toLowerCase();
					if(C.indexOf(v[j])!=-1&&C.indexOf('datahora')==-1&&!T[i].value.match(new RegExp(v[j+2])))
					{
						alert(v[j+1]);
						return false;
					}
				}
				if(T[i].type!='file'&&T[i].value=='')
				{
					alert('São de preenchimento obrigatório: campos marcados com asterisco e campos de usuário e senha.');
					return false;
				}
			}
		}
	}
	return true;
}
//*****************************************************************************************************************
function is_array(s)
{
	return typeof(s)=='object'&&(s instanceof Array);
}
//*****************************************************************************************************************
function newW(url,w,h)
{
	window.open(url,'','top=15,left='+((window.screen.width/2)-(w/2))+',width='+w.toString()+',height='+h.toString()+',scrollbars=yes');
	return false;
}
//*****************************************************************************************************************
function $GET(s)
{
	var U=document.location.toString(),D=s.length+2;
	if((i=U.indexOf('?'+s+'='))!=-1||(i=U.indexOf('&'+s+'='))!=-1)
		return U.substring(i+D,U.indexOf('&',i+2)!=-1?U.indexOf('&',i+2):U.length);
	return;
}
//*****************************************************************************************************************
function replaceAll(s,A,B)
{
	var T=s;
	while(T.indexOf(A)!=-1)
		T=T.replace(A,B);
	return T;
}
//*****************************************************************************************************************
function setCookie(N,V,E)
{
	var D=new Date();
	D.setDate(D.getDate()+E);
	document.cookie=N+'='+escape(V)+(E==null?'':';expires='+D.toGMTString());
}
//*****************************************************************************************************************
function getCookie(N)
{
	var D=document.cookie,I,F;
	if((I=D.indexOf(N+'='))>=0)
	{
		I+=N.length+1;
		F=D.indexOf(';',I);
		return unescape(D.substring(I,(F>=0?F:D.length)));
	}
	return '';
}
//*****************************************************************************************************************
function getStyle(el, prop){
	if(document.defaultView && document.defaultView.getComputedStyle)
		str = document.defaultView.getComputedStyle(el,'').getPropertyValue(prop);
	else if(el.currentStyle)
	{
		prop = prop.replace
		(/\-(\w)/g,
			function(strMatch,p1)
			{
				return p1.toUpperCase();
			}
		);
		str = el.currentStyle[prop];
	}
	return str;
}
//*****************************************************************************************************************
function imagemW(src,descr)
{
	document.getElementById('img_ampliada').style.display='block';
	document.getElementById('img_ampliada_in').innerHTML='<img src="'+src+'" style="max-height:'+((screen.height/2)+70)+'px; max-width:'+((screen.width/2)+120)+'px; border:1px #bbb solid;"/><br/><br/><div class="descr_img">'+descr+'</div>';
}
//*****************************************************************************************************************
function openMid(src,descr)
{
	document.getElementById('dica_ampliada').style.display='block';
	document.getElementById('dica_ampliada_in').innerHTML='<h2 style="text-align:left; color:#fff; border-color:#fff;">'+src+'</h2><div class="descr_img" style="text-align:left; font-size:14px; background:#dfa040;">'+descr+'</div>';
	return false;
}
//*****************************************************************************************************************
function ready()
{
	var clock = setInterval(
	function()
	{
		if(document.body)
		{
			return clearInterval(clock);
		}
	},10
	);
}
//*****************************************************************************************************************
function IE_correct()
{
	if(document.getElementById('galeria_tot')!=null)
	{
		tds=document.getElementById('galeria_tot').getElementsByTagName('td');
		for(i=0;i<tds.length;i++)
		{
			tds[i].style.background='#fff';
			tds[i].style.background='#701414';
		}
	}
}
//*****************************************************************************************************************
if(typeof(load)=='undefined')
	load='';
load+='img8=new Image(); img8.src=\'i/bt2.gif\'; img9=new Image(); img9.src=\'i/bt4.gif\'; IE_correct();';
load+='if(document.getElementsByTagName(\'form\').length>0)document.getElementsByTagName(\'form\')[0].getElementsByTagName(\'input\')[0].focus();';
window.onload=function(){ready();eval(load);};
//*****************************************************************************************************************
function selMenu(n)
{
	arr=['','menu_empresa','menu_produto','menu_servico','menu_moto','menu_contato'];
	for(var i=1;i<arr.length;i++)
	{
		document.getElementById('op'+i).style.backgroundImage='none';
		document.getElementById(arr[i]).style.display='none';
	}
	document.getElementById(arr[n]).style.display='block';
	document.getElementById('op'+n).style.backgroundImage='url(i/canto.gif)';
	document.getElementById('op'+n).style.backgroundPosition='center top';
	document.getElementById('op'+n).style.backgroundRepeat='no-repeat';
	return false;
}
//*****************************************************************************************************************
function show_n(n)
{
	if(n==0){document.getElementById('n_list').innerHTML='<a class="noticia" href="noticia?OID=4369" onclick="return newW(\'noticia?OID=4369\',640,550);" style="border-bottom:1px #666 solid; padding-bottom:6px;"><b style="font-size:13px;">GP Brasil Motocross: Equipe Youthstream chega ao Bra...</b><div style="font:9px verdana; padding:3px 0;" class="right">24/07/2010 09:11</div>Greg Atkins e Justin Barclay são os responsáveis pela pista do GP Bras... <b>»</b></a><a class="noticia" href="noticia?OID=4368" onclick="return newW(\'noticia?OID=4368\',640,550);"><b style="font-size:13px;">Valentino Rossi na Ducati</b><div style="font:9px verdana; padding:3px 0;" class="right">24/07/2010 09:09</div>Valentino Rossi será anunciado como piloto da Ducati no Grande Prêmio ... <b>»</b></a>';}if(n==1){document.getElementById('n_list').innerHTML='<a class="noticia" href="noticia?OID=3246" onclick="return newW(\'noticia?OID=3246\',640,550);" style="border-bottom:1px #666 solid; padding-bottom:6px;"><b style="font-size:13px;"> 	  Harley Davidson reporta prejuízos na ordem de 21...</b><div style="font:9px verdana; padding:3px 0;" class="right">25/01/2010 11:15</div>  	Harley Davidson reporta prejuízos na ordem de 218 milhões de dólare... <b>»</b></a><a class="noticia" href="noticia?OID=3232" onclick="return newW(\'noticia?OID=3232\',640,550);"><b style="font-size:13px;">FIM poderá retornar com mo...</b><div style="font:9px verdana; padding:3px 0;" class="right">21/01/2010 17:23</div> FIM poderá retornar com motores de 1.000 cc para a MotoGP  Em 2007, a... <b>»</b></a>';}if(n==2){document.getElementById('n_list').innerHTML='<a class="noticia" href="noticia?OID=4333" onclick="return newW(\'noticia?OID=4333\',640,550);" style="border-bottom:1px #666 solid; padding-bottom:6px;"><b style="font-size:13px;">Swian Zanoni leva a melhor na 3ª etapa da Superliga ...</b><div style="font:9px verdana; padding:3px 0;" class="right">23/06/2010 12:01</div>este último final de semana, dias 19 e 20 de junho, a Superliga Brasil... <b>»</b></a><a class="noticia" href="noticia?OID=4297" onclick="return newW(\'noticia?OID=4297\',640,550);"><b style="font-size:13px;">Husaberg dois tempos e com...</b><div style="font:9px verdana; padding:3px 0;" class="right">04/06/2010 08:54</div>Pessoal, Estão rolando rumores fortes na net, nos principais fóruns li... <b>»</b></a>';}	return false;
}
//*****************************************************************************************************************
function carregar_promo(i)
{
	var item=[[''],['4335','TE 450 OKM ','Promoção ate durar o estoque ','R$ 26.900,00'],['4320','Web Evo ','- Partida eletrica, freio a disco , marcador de marcha no painel. 2010 0km ','R$ 5.290,00'],['4306','Fan ES ','-Fan com partida elétrica  baicha km ','R$ 5.590,00']];

	img1=new Image();
	img1.src='i/bt_dir2.gif';

	img2=new Image();
	img2.src='i/bt_esq2.gif';

	img3=new Image();
	img3.src='i/bt_dir.gif';

	img4=new Image();
	img4.src='i/bt_esq.gif';
    
	if(item.length!=1)
	{
		sstr='';
		if(item[i][3].length>1)
		{
			sstr='<div class="tit_inf_gomo">';
			if(i<(item.length-1))
				sstr+='<img src="i/bt_dir.gif" style="float:right; cursor:pointer; margin-left:-33px;" onclick="carregar_promo('+(i+1)+');" onmouseover="this.src=\'i/bt_dir2.gif\';" onmouseout="this.src=\'i/bt_dir.gif\';"/>';
			if(i>1)
				sstr+='<img src="i/bt_esq.gif" style="float:left; cursor:pointer; margin-right:-33px;" onclick="carregar_promo('+(i-1)+');" onmouseover="this.src=\'i/bt_esq2.gif\';" onmouseout="this.src=\'i/bt_esq.gif\';"/>';
			sstr+=item[i][1]+'</div>';
			sstr+='<div style="clear:both; padding:8px; padding-top:13px;">';
			sstr+='<img src="img.php?img=g/'+item[i][0]+'.jpg&amp;width=152" class="img_gomo" style="cursor:pointer;" onclick="return newW(\'/ampliado.php?img='+item[i][0]+'&label='+replaceAll(item[i][1], '<br/>',' / ')+' / '+replaceAll(item[i][2], '<br/>',' / ')+'\',725,535);"/>';
			sstr+=item[i][2]+'<br/><div class="preco" style="width:180px;">'+item[i][3]+'</div></div>';
			sstr+='<div class="right" style="padding:12px 8px 0 0; _margin-bottom:-4px; clear:both;"><a href="motos" class="veja_mais2">Ver mais motos</a> <a href="encomendar?t=Destaque&OID='+item[i][0]+'" class="veja_mais">Encomendar esta moto</a></div>';
		}
		else
		{
			sstr='';
			if(i<(item.length-1))
				sstr+='<img src="i/bt_dir.gif" style="position:absolute; right:1px; top:1px; z-index:2; cursor:pointer; margin-left:-33px; z-index:2;" onclick="carregar_promo('+(i+1)+');" onmouseover="this.src=\'i/bt_dir2.gif\';" onmouseout="this.src=\'i/bt_dir.gif\';"/>';
			if(i>1)
				sstr+='<img src="i/bt_esq.gif" style="position:absolute; left:1px; top:1px; z-index:2; cursor:pointer; margin-right:-33px;" onclick="carregar_promo('+(i-1)+');" onmouseover="this.src=\'i/bt_esq2.gif\';" onmouseout="this.src=\'i/bt_esq.gif\';"/>';
			sstr+='<div style="text-align:center;">';
			sstr+='<a style="background:url(img.php?img=g/'+item[i][0]+'.jpg&width=376&height=202) center no-repeat; display:block; height:202px; width:376px; padding:0;" href="#" onclick="return newW(\'/ampliado.php?img='+item[i][0]+'&label='+replaceAll(item[i][1], '<br/>',' / ')+' / '+replaceAll(item[i][2], '<br/>',' / ')+'\',725,525);"/></a>';
			sstr+='</div>';
		}
		sstr+='</div>';
	}
	else
	{
		sstr='<div class="tit_inf_gomo" style="font-family:verdana; padding-top:65px;">Sem promoções<br/>no momento.</div>';
	}

	document.getElementById('espaco_promo').innerHTML=sstr;
}