function changeMenuCategoriaPecaPiloto( strform )
{
	var maxLength = 0; 
	catopc = new Array; //Moto
	
	if( strform == 'undefined' )
		strform = 0; 

	// Para o novo menu
	var str = document.forms[strform].arrcategoria_piloto.value;	
	var famname = new Array();
	famname = str.split(',');	
	catopc = famname;			
	catopc = catopc.sort();
	// Para o novo menu
	
	// verifica de onde vem e coloca Selecione...
	if (document.title.indexOf('anúncio') == '-1' ) 	
	{
		catopc.unshift("Todos");
	}
	else
	{
		catopc.unshift("Selecione...");
	}
	
	maxLength = catopc.length;	

	if (document.forms[strform].opcao_anuncio)  	
	{	
		if (document.forms[strform].opcao_anuncio.value=='PIL')  
		{
			for (i = lst; i > 0; i--)
			{ 
				document.forms[strform].marca_anuncio.options[i] = null;
			}
	
	
		  tot = catopc.length;	  
			for (i = 0; i < tot; i++)
			{ 
				if(document.forms[strform].marca_anuncio)
				{
					document.forms[strform].marca_anuncio.options[i] = new Option(catopc[i]);
				}
					
			}

			lst = catopc.length;
		}
	}	
	return catopc;
}

//##################################
function changeMenuMarcaPecaPiloto( strform )
{
	var maxLength = 0; 
	catopc = new Array; //Moto

	if( strform == 'undefined' )
		strform = 0; 

	// Para o novo menu
	var str = document.forms[strform].arrmarca_piloto.value;	
	var famname = new Array();
	famname = str.split(',');	
	catopc = famname;			
	catopc = catopc.sort();
	// Para o novo menu
	
	// verifica de onde vem e coloca Selecione...
	if (document.title.indexOf('anúncio') == '-1' ) 	
	{
		catopc.unshift("Todos");
	}
	else
	{
		catopc.unshift("Selecione...");
	}

	maxLength = catopc.length;			
	if (document.forms[strform].opcao_anuncio)  	
	{
		if (document.forms[strform].opcao_anuncio.value=='PIL')  
		{
			for (i = lst; i > 0; i--)
			{ 
				document.forms[strform].marca_anuncio.options[i] = null;
			}
	
	
		  tot = catopc.length;	  
			for (i = 0; i < tot; i++)
			{ 
				if(document.forms[strform].marca_anuncio)
				{
					document.forms[strform].marca_anuncio.options[i] = new Option(catopc[i]);
				}					
			}

			lst = catopc.length;
		}
	}			
	return catopc;
}


//##################################
function changeMenuMarcaPecaMaquina( strform )
{
	var maxLength = 0; 
	catopc = new Array; //Moto

	if( strform == 'undefined' )
		strform = 0; 

	// Para o novo menu
	var str = document.forms[strform].arrmarca_maquina.value;	
	var famname = new Array();
	famname = str.split(',');	
	catopc = famname;			
	catopc = catopc.sort();
	// Para o novo menu
	
	// verifica de onde vem e coloca Selecione...
	if (document.title.indexOf('anúncio') == '-1' ) 	
	{
		catopc.unshift("Todos");
	}
	else
	{
		catopc.unshift("Selecione...");
	}

	maxLength = catopc.length;			

	
	if (document.forms[strform].opcao_anuncio)
	{
		if (document.forms[strform].opcao_anuncio.value=='PIL')  
		{
			for (i = lst; i > 0; i--)
			{ 
				document.forms[strform].marca_anuncio.options[i] = null;
			}
	
	
		  tot = catopc.length;	  
			for (i = 0; i < tot; i++)
			{ 
				if(document.forms[strform].marca_anuncio)
				{
					document.forms[strform].marca_anuncio.options[i] = new Option(catopc[i]);
				}
					
			}

			lst = catopc.length;
		}
	}		
	
	return catopc;

}

//##############################################
function changeMenuCategoriaPecaMaquina( strform )
{
	var maxLength = 0; 
	catopc = new Array; //Moto
	
	if( strform == 'undefined' )
		strform = 0;					

	// Para o novo menu
	var str = document.forms[strform].arrcategoria_maquina.value;			
	
	var famname = new Array();
	famname = str.split(',');	
	catopc = famname;			
	catopc = catopc.sort();
	// Para o novo menu	
	
	// verifica de onde vem e coloca Selecione...
	if (document.title.indexOf('anúncio') == '-1' ) 	
	{
		catopc.unshift("Todos");
	}
	else
	{
		catopc.unshift("Selecione...");
	}
			
	maxLength = catopc.length;	
	
	if (document.forms[strform].opcao_anuncio)  	
	{
		if (document.forms[strform].opcao_anuncio.value=='MAQ')  	
		{
			for (i = lst; i > 0; i--)
			{ 
				document.forms[strform].marca_anuncio.options[i] = null;
			}
	
		  tot = catopc.length;	  
			for (i = 0; i < tot; i++)
			{ 
				if(document.forms[strform].marca_anuncio)
				{
					document.forms[strform].marca_anuncio.options[i] = new Option(catopc[i]);
				}
					
			}
			lst = catopc.length;
		}
	}
	return catopc;	
}

// Usado em anuncie_peca_maquina
function changeMenuMarcaMoto()
{
	var maxLength = 0; 
	catopc = new Array; //Moto

	// verifica de onde vem e coloca Selecione...
	if (document.title.indexOf('anúncio') == '-1' ) 	
	{
		catopc[0] = 'Todos';
	}
	else
	{
		catopc[0] = 'Selecione...';
	}

	catopc[1] = 'Agrale';		
	catopc[2] = 'ATK';
	catopc[3] = 'Aprilia';
	catopc[4] = 'Bimota';
	catopc[5] = 'Buell';
	catopc[6] = 'BMW';
	catopc[7] = 'BSA';
	catopc[8] = 'By Cristo';
	catopc[9] = 'Cagiva';
	catopc[10] = 'Daelim';
	catopc[11] = 'Derbi';
	catopc[12] = 'Ducati';
	catopc[13] = 'Gas Gas';
	catopc[14] = 'Harley Davidson';
	catopc[15] = 'Honda';
	catopc[16] = 'Husaberg';
	catopc[17] = 'Husky';
	catopc[18] = 'Husqvarna';
	catopc[19] = 'Kahena';
	catopc[20] = 'Kasinski';
	catopc[21] = 'KTM';
	catopc[22] = 'Kawasaki';
	catopc[23] = 'Kynco';
	catopc[24] = 'Moto Guzzi';
	catopc[25] = 'MV Agusta';
	catopc[26] = 'MVK';
	catopc[27] = 'Peugeot';
	catopc[28] = 'Piaggio';
	catopc[29] = 'Sundown';
	catopc[30] = 'Suzuki';
	catopc[31] = 'Triumph';
	catopc[32] = 'Triway';
	catopc[33] = 'Vento';
	catopc[34] = 'Vespa';
	catopc[35] = 'Yamaha';
	catopc[36] = 'Zhongyu';
	catopc[37] = 'Outras';

	return catopc;

}



// Muda opções
function changeMenu()
{
	var maxLength = 0;

	for (qtde_form = 0; qtde_form < document.forms.length; qtde_form++)
	{
		if (document.forms[qtde_form].opcao_anuncio)  
		{
		
			if (document.forms[qtde_form].opcao_anuncio.value=='M')  
			{
				menuNum = 0; 
			}else{
				menuNum = 1; 
			}

			if (menuNum == 0)
			{
				var maxLength = 0; 
				catopc = new Array; //Moto

				// verifica de onde vem e coloca Selecione...
				if (document.title.indexOf('anúncio') == '-1' ) 	
				{
					catopc[0] = new Option('Todos');
				}
				else
				{
					catopc[0] = new Option('Selecione...');
				}

				catopc[1] = new Option('Agrale');		
				catopc[2] = new Option('ATK');
				catopc[3] = new Option('Aprilia');
				catopc[4] = new Option('Bimota');
	 			catopc[5] = new Option('Buell');
				catopc[6] = new Option('BMW');
				catopc[7] = new Option('BSA');
				catopc[8] = new Option('By Cristo');
				catopc[9] = new Option('Cagiva');
				catopc[10] = new Option('Daelim');
				catopc[11] = new Option('Derbi');
				catopc[12] = new Option('Ducati');
				catopc[13] = new Option('Gas Gas');
				catopc[14] = new Option('Harley Davidson');
				catopc[15] = new Option('Honda');
				catopc[16] = new Option('Husaberg');
				catopc[17] = new Option('Husky');
				catopc[18] = new Option('Husqvarna');
				catopc[19] = new Option('Kahena');
				catopc[20] = new Option('Kasinski');
				catopc[21] = new Option('KTM');
				catopc[22] = new Option('Kawasaki');
				catopc[23] = new Option('Kynco');
				catopc[24] = new Option('Moto Guzzi');
				catopc[25] = new Option('MV Agusta');
				catopc[26] = new Option('MVK');
				catopc[27] = new Option('Peugeot');
				catopc[28] = new Option('Piaggio');
				catopc[29] = new Option('Sundown');
				catopc[30] = new Option('Suzuki');
				catopc[31] = new Option('Triumph');
				catopc[32] = new Option('Triway');
				catopc[33] = new Option('Vento');
				catopc[34] = new Option('Vespa');
				catopc[35] = new Option('Yamaha');
				catopc[36] = new Option('Zhongyu');
				catopc[37] = new Option('Outras');
				maxLength = catopc.length;	
			}

			if (menuNum == 1)
			{
				catopc = new Array; //Jet
				catopc[0] = new Option('Todos');
				catopc[1] = new Option('Colluna');
				catopc[2] = new Option('Polaris');
				catopc[3] = new Option('Sea Doo');
				catopc[4] = new Option('Yamaha');
				catopc[5] = new Option('Kawasaki');
				maxLength = catopc.length;
			}

			tot = catopc.length;
			for (i = lst; i > 0; i--)
			{ 
				document.forms[qtde_form].marca_anuncio.options[i] = null;
			}

			for (i = 0; i < tot; i++)
			{ 
				if(document.forms[qtde_form].marca_anuncio)
				{
					document.forms[qtde_form].marca_anuncio.options[i] = catopc[i];	
				}
					
			}

			lst = catopc.length;
		}
	}		
}

// monta selects com os Estilos na Busca Avancada e no Anuncio
//******************************
function opcoesEstilos(){
//******************************
for (qtde_form = 0; qtde_form < document.forms.length; qtde_form++){
var maxLength2 = 0;
estilo = new Array; // Estilos

if (document.title.indexOf('anúncio') == '-1' ) 	{ 
	estilo[0] = new Option('Todos','');
}else{
	estilo[0] = new Option('Selecione um estilo');
}

estilo[1] = new Option('Sport');
estilo[2] = new Option('Custom');
estilo[3] = new Option('Turismo');
estilo[4] = new Option('Triciclo');
estilo[5] = new Option('Dual Purpose');
estilo[6] = new Option('Off-road');
estilo[7] = new Option('Scooter');
estilo[8] = new Option('Quadriciclo');
estilo[9] = new Option('Naked');
estilo[10] = new Option('Trial');
estilo[11] = new Option('SuperMotard');
maxLength2 = estilo.length;

tot2 = estilo.length;
if(document.forms[qtde_form].estilo_anuncio){
	for (i = lst2; i > 0; i--){ document.forms[qtde_form].estilo_anuncio.options[i] = null;      }
	for (i = 0; i < tot2; i++){ document.forms[qtde_form].estilo_anuncio.options[i] = estilo[i]; }
}
}
lst2 = estilo.length;
}


function redireciona(param){
	if (param == 'catalogo_motos.asp' || param == 'produtos_catalogo_digital.asp'){
		location.href=param;
	} else {
		abre_no_scrol('catalogo_usuario.asp?cod_usuario='+param,'poa','543','608');
		location.href='catalogo_motos.asp';
	}
}

function redireciona_peca(param){
	if (param == 'catalogo_pecas.asp' || param == 'produtos_catalogo_digital.asp')
	{
		location.href=param;
	} 
	else 
	{
		abre_no_scrol('catalogo_usuario_peca.asp?cod_usuario='+param,'poa','543','640');
		location.href='catalogo_pecas.asp';
	}
}

function abre_no_scrol(pUrl,pTit,pLX,pAY) {
  var xx=50;
  var yy=50;
  if (navigator.appVersion.substring(0,1)>3) {
    xx=((screen.width-pLX-8)/1);
    yy=((screen.height-pAY-15)/2);
  }
window.open(pUrl,pTit,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resize=no,copyhistory=no,width='+pLX+',height='+pAY+',top='+yy+',left='+xx+',screenX='+xx+',screenY='+yy);
}
function movein(which){
	which.style.background='#707A99';
}

function moveout(which){
	which.style.background='#8792B1';
}


function adiciona_favorito(parametro){
	window.open('insere_favorito.asp?cod_anuncio='+parametro,'favorito','width=350,height=350');
}


function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


// abre janela
function abre(url,janela,larg,alt,scroll,pos1,pos2){
 window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable=no,copyhistory=no,top="+pos1+",left="+pos2+",screenY="+pos1+",screenX="+pos2+",width="+larg+",height="+alt);
}


// monta selects com os Categorias
//******************************
function opcoesCategoria()
//******************************
{
for (qtde_form = 0; qtde_form < document.forms.length; qtde_form++)
{
	var maxLength2 = 0;
	categoria = new Array; // categorias

	if (document.title.indexOf('anúncio') == '-1' ) 	{
		categoria[0] = new Option('Todos');
	}
	else
	{
		categoria[0] = new Option('Selecione...');
	}

	categoria[1] = new Option('Calca'); //calça
	categoria[2] = new Option('Bota');
	categoria[3] = new Option('Jaqueta');
	categoria[4] = new Option('Blusa');
	categoria[5] = new Option('Joelheira');
	categoria[6] = new Option('Capacete');
	categoria[7] = new Option('Camiseta');
	categoria[8] = new Option('Óculos');
	maxLength2 = categoria.length;

	tot2 = categoria.length;		
	lst2 = tot2;

	for (i = lst2; i > 0; i--)
	{ 
		document.forms[qtde_form].fld_categoria_anuncio.options[i] = null;
	}
	
	for (i = 0; i < tot2; i++)
	{ 
		document.forms[qtde_form].fld_categoria_anuncio.options[i] = categoria[i];		
	}
	}
	lst2 = categoria.length;
}


// monta selects com os Marcas Pilotos
//******************************
function opcoesMarcas_Pilotos()
//******************************
{
for (qtde_form = 0; qtde_form < document.forms.length; qtde_form++)
{
	var maxLength2 = 0;
	marc_piloto = new Array; // Marcas_Pilotos

	if (document.title.indexOf('anúncio') == '-1' ) 	
	{
		marc_piloto[0] = new Option('Todos');
	}
	else
	{
		marc_piloto[0] = new Option('Selecione...');
	}

	marc_piloto[1] = new Option('Circuit');
	marc_piloto[2] = new Option('ASW');
	marc_piloto[3] = new Option('GIVI');
	marc_piloto[4] = new Option('SHARK');
	marc_piloto[5] = new Option('SHOEI');
	marc_piloto[6] = new Option('Outros');
	maxLength2 = marc_piloto.length;		

	tot2 = marc_piloto.length;		
	lst2 = tot2;

	for (i = lst2; i > 0; i--)
	{ 
		document.forms[qtde_form].fld_marca_anuncio.options[i] = null;
	}
	
	for (i = 0; i < tot2; i++)
	{ 
		document.forms[qtde_form].fld_marca_anuncio.options[i] = marc_piloto[i];		
	}
	}
	lst2 = marc_piloto.length;
}

//************************************************
//************ script do scroll do menu esquerdo 


function setVariables() {
if (navigator.appName == "Netscape") {
v=".top=";
dS="document.";
sD="";
y="window.pageYOffset";
}
else {
v=".pixelTop=";
dS="";
sD=".style";
y="document.body.scrollTop";
   }
}
function checkLocation() {
object="object1";
yy=eval(y)+70;
eval(dS+object+sD+v+yy);
setTimeout("checkLocation()",10);
}
