// JavaScript Document
function contarClicks(idBusca){

	window.open('contaclick.php?id='+document.getElementById(idBusca).value, '_blank');
	
}



function openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);
  
}


//////////////////// JUMP MENU ////////////////////

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//////////////////// INSERIR CARACTERES NO FORMULÁRIO ////////////////////

function formatar(src, mask) {
	var i = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(i)
	if (texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}

//////////////////// EXIBE / ESCONDE DIV ////////////////////

function displayDiv(name) {
	if (document.getElementById(name).style.display=='') {
		document.getElementById(name).style.display='none';
		document.getElementById(name+'-img').src="imgs/layout/seta_down.gif";
	} else {
		document.getElementById(name).style.display='';
		document.getElementById(name+'-img').src="imgs/layout/seta_up.gif";
	}
}

//////////////////// POP UP ////////////////////

function popupWindow(url, nome, largura, altura) {
  window.open(url,nome,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+largura+',height='+altura+',screenX=20,screenY=20,top=20,left=20')
}

//////////////////// PNG TRANSPARENTE ////////////////////

function correctPNG()
   {
   for(var i=0; i<document.images.length; i++)
      {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
         img.outerHTML = strNewHTML
         i = i-1
         }
      }
   }
window.attachEvent("onload", correctPNG);


//////////////////// MURAL ////////////////////


function emoticon(text) {
	var txtarea = document.mural.comentario;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		txtarea.focus();
	}
	else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

// Continuação
function over(src,clrover) {
    if (!src.contains(event.fromElement)) {	src.style.cursor = 'default'; src.bgColor = clrover; }
}
function out(src,clrIn) {
	if (!src.contains(event.toElement)) { src.style.cursor = 'default';	src.bgColor = clrIn; }
}
