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;
			}
		}
	}
}

function fnAdicionaFavoritos(){
	str_titulo = "Medilabor";
	str_url = "http://www.medilabor.com.br";
	try{
		if(window.external){window.external.AddFavorite(str_url,str_titulo); }
	}
	catch(e)
	{
		try{
			if(window.sidebar){ window.sidebar.addPanel(str_titulo,str_url,""); }
		}
		catch(ee)
		{
			if(window.opera && window.print){ return true; }
		}
	}	
}


function verificaNews(form){
	var email = form.email.value;
    if((email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(email == 'E-mail:')){
    	alert("O campo Email deve ser preenchido corretamente");
    	form.email.focus();
    	return false;
	}
}

//Funcao de popup indique amigo
function MM_openBrWindow(theURL,winName,features){
	var myWin =  window.open(theURL,winName,features);
	myWin.focus();
}



function verificaBusca(form){
	if((form.produto.value.length<=1) && (form.fabricante.value.length<=1)){
		alert("Preencha a Busca corretamente para obter suas informações.");		
		return false;
	}
	
}

//funcao para o (mostrar e ocultar)
function onOff(id){
	esconder = (document.getElementById(id).style.display == 'block');
	/*if ( visivel == "" || visivel == "none" ) { document.getElementById(id).style.display = "block" }
	else{ document.getElementById(id).style.display = "none"; }*/
	divs = document.getElementsByTagName('DIV');
	for(d=0; d<divs.length; d++){
		_div = divs[d];
		if (_div.className == 'dicas'){
			id_link = 'dicas_'+(_div.id);
			_link = document.getElementById(id_link);
			if(_div.id != id){ _div.style.display = 'none'; }
			else{ _div.style.display = esconder ? 'none' : 'block'; }
		}
	}
}

function ValidaForm_senha(form){	
	var str_email = form.emailsenha.value ;
    if (( str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email == 'Email:' )){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.emailsenha.focus();
    	return false;
	}
	
}
function verificaLogin(form){
	var str_email = form.loginemail.value ;
    if (( str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email == 'Email:' )){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.loginemail.focus();
    	return false;
	}
	if((form.senha.value.length <= 5)||(form.senha.value == "Senha:")){
		alert("Preencha a Senha corretamente para obter suas informações.");
		form.senha.focus();
		return false;
	}
}
//mostra e oculta (menu)
function mostra(campo){
    document.getElementById(campo).style.display='' ;
}

function oculta(campo){
    document.getElementById(campo).style.display='none' ;
}




