//Funcao Adiciona a Favoritos
function fnAdicionaFavoritos(){
	str_titulo = " :: Dahruj Honda :: ";
	str_url = "http://www.dahrujhonda.com.br";
	if(window.sidebar){ window.sidebar.addPanel(str_titulo,str_url,""); }
	else if(window.external){ window.external.AddFavorite(str_url,str_titulo); }
	else if(window.opera && window.print){ return true; }
}
// PESQUISA DADOS
function pesquisar_dados(valor,pagina,campo,selecionado){
	extensao = 1;
	for(cont_string=0; cont_string<pagina.length; cont_string++){
		if(pagina.charAt(cont_string) == '.'){ extensao = 0; }
	}
	if(extensao != 0){ pagina = pagina+'.php?'; }
	else{ pagina = pagina+'&'; }
	http.open("GET",pagina+"id="+valor,true); 
	http.onreadystatechange = function(){ handleHttpResponse(campo,selecionado); };
	http.send(null);
}
function handleHttpResponse(campo,selecionado){
	campo_select = document.getElementById(campo);
	if(http.readyState == 4){
		campo_select.options.length = 0;
		results = http.responseText.split(",");
		for(i=0; i<(parseInt(results.length)-1); i++){
			string = results[i].split("|");
			if(string[0] != ''){
				campo_select.options[i] = new Option(string[0],string[1]);
				if(selecionado == string[1]){ campo_select.options[i].selected = true; }
			}
			if(selecionado == ''){ campo_select.options[0].selected = true; }
		}
	}
}
function getHTTPObject(){
	if(typeof ActiveXObject == "undefined" && typeof XMLHttpRequest == "undefined") return null;
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5){
		try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e){
			try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (E){ xmlhttp = false; }
		}
	}
	@else xmlhttp = null;
	@end @*/
	if(xmlhttp == null && typeof XMLHttpRequest != 'undefined'){
		try{ xmlhttp = new XMLHttpRequest(); }
		catch(e){ xmlhttp = null; }
	}
	return xmlhttp; 		
}
var http = getHTTPObject();
//Funcao de popup
function MM_openBrWindow(theURL,winName,features){
	var myWin = window.open(theURL,winName,features);
	myWin.focus();
}
//Funcao para videos home
function fnAbreVideo(video,id){ abreAjax('video_'+video+'.php?id='+id,'video_1','GET'); }
/*Funcao para target*/
function fnTarget(str_target){
	//declaracao de variaveis
	var ch_tag_A, vet_A, int_i;
	var str_titulo;	
	//pega todos os <a> da pagina e percorre um por um para achar o rel="external"
    ch_tag_A = document.getElementsByTagName('a');
    for(int_i=0; int_i<ch_tag_A.length; int_i++){
		vet_A = ch_tag_A[int_i];
		if(vet_A.getAttribute("href")&& vet_A.getAttribute('rel') != null){
			if(vet_A.getAttribute('rel').substring(0,8) == 'external'){
				vet_A.target = str_target;
				str_titulo = ch_tag_A.title;
				ch_tag_A.title = str_titulo;
			}
		}
	}
}
//Validacao da Newsletter
function ValidaNews(form,evento){
	if(form.news.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nDigite corretamente o seu e-mail.");
		form.news.focus();
		return false;
	}
}
//Validacao da busca
function ValidaForm_SeuCarro(form){
if((form.placa.value.length <= 7)||(form.placa.value == ":: Digite sua placa ::")){
		alert("Preencha a placa do seu veículo corretamente para obter suas informações.");
		form.placa.focus();
		return false;
	}
}
function fnFlash(str_url,int_largura,int_altura){
	document.writeln('<object type="application/x-shockwave-flash" data="'+str_url+'" width="'+int_largura+'" height="'+int_altura+'">');
	document.writeln('<param name="movie" value="'+str_url+'">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('</object>');
}