function addFav(title,url){

 if (window.sidebar) window.sidebar.addPanel(title, url,"");
 else if(window.opera && window.print){
 var mbm = document.createElement('a');
 mbm.setAttribute('rel','sidebar');
 mbm.setAttribute('href',url);
 mbm.setAttribute('title',title);
 mbm.click();
 }
 else if(document.all){window.external.AddFavorite(url, title);}
}
/*////// limpa caixa de pesquisa - inicio */

 function checkform_busca(form) {
  if (form.q.value == "" || form.q.value == " Pesquisa") {
    // alert("Por favor, informe a(s) palavra(s) que deseja pesquisar ...");
	form.q.value=""
    	form.q.focus();
    return false ;
 }

 return true;
 }

 

 	function limpa_q()
	{
		if (document.search.q.value==" Pesquisa")
		{
		document.search.q.value=""
		document.search.q.focus();
		}
	}
 	function limpa2_q()
	{
		if (document.search.q.value=="")
		{
		document.search.q.value=" Pesquisa"
		document.search.q.focus();
		}
	}	
	
	
/*////// limpa caixa de pesquisa - final */	


function mais(url){
if (document.getElementById('div_envie').style.display==''){
	document.getElementById('div_envie').style.display='none';
	alert('url');
}else{
	document.getElementById('div_envie').style.display='';
	}
}


/*-------------------------------------*/


var agt			= navigator.userAgent.toLowerCase();
var is_major	= parseInt(navigator.appVersion);
var is_minor	= parseFloat(navigator.appVersion);
var is_ie		= ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie4up	= (is_ie && (is_major >= 4) && (is_major <= 6));
var ns4			= (document.layers)? true:false;
var ie4			= (document.all)? true:false;
var url			= document.location.href;
var winSize		= 200;
var openMsg		= "[Espiar Website]";
var closeMsg	= "[Fechar]";

//#################################################

//Espiar
function getElt(id) {
  return document.getElementById ? document.getElementById(id) :
           (document.all ? document.all[id] : 0);
}

function toggle(id, show) {
  var elt = getElt(id);
  if (! elt) return;
  if (show > 0 || (! show && elt.style.display == 'none')) {
    elt.style.display = '';
    toggled = displayed = id;
  } else {
    elt.style.display = 'none';
    toggled = displayed = 0;
  }
}

function espiar(id, show, post) {
  var lk = getElt('po-' + id);
  var fr = getElt('pf-' + id);
  if (! lk || ! fr) return false;
  toggle('pf-' + id, show);
  toggle('po-' + id, - show);
  toggle('pc-' + id, show);
  if (! show) return;
  if (fr.src) ;
  else if (post) postlink(lk, 'pf-'+id);
  else fr.src = lk.href;
  return false;
}


var wForm = "";
function popWform(value){
	wForm = value;
}


//#################################################


var copytoclip=1

function selectCopiar(theField) {
var tempval=eval("document."+theField);
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy");
window.status="O código foi copiado para a área de transferência";
alert('O código foi copiado para a área de transferência');
setTimeout("window.status=''",1800);
}
}

function select(theField) {
var tempval=eval("document."+theField);
tempval.focus();
tempval.select();
}


//#################################################


//pega a resolução do visitante
w = screen.width;
h = screen.height;

//divide a resolução por 2, obtendo o centro do monitor
meio_w = 170;
meio_h = 200;


	
function imprimir(id){
window.open('imprimir.php?id='+id+'&img=yes', '', "status=no, width=600, height=500, top="+meio_h+", left="+meio_w+", scrollbars=yes");
}
