function flash(url, largura, altura){
 var aux = '';
 aux += '<object classid="clsid:clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' +largura+ '" height="' +altura+ '" align="middle">';
 aux += '<param name="allowScriptAccess" value="sameDomain" />';
 aux += '<param name="movie" value="' +url+ '">';
 aux += '<param name="loop" value="false" />';
 aux += '<param name="menu" value="false" />';
 aux += '<param name="quality" value="high">';
 aux += '<param name="wmode" value="transparent" />'; // se preciso, habilitar WMODE
 aux += '<embed src="' +url+ '" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' +largura+ '" height="' +altura+ '"></embed>';
 //aux += '<embed src="' +url+ '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' +largura+ '" height="' +altura+ '"></embed>';
 aux += '</object>';
 document.write (aux);
}


function flash_topo(url, largura, altura){
 var aux = '';
 aux += '<object classid="clsid:clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' +largura+ '" height="' +altura+ '" align="middle">';
 aux += '<param name="allowScriptAccess" value="sameDomain" />';
 aux += '<param name="movie" value="' +url+ '">';
 aux += '<param name="loop" value="false" />';
 aux += '<param name="menu" value="false" />';
 aux += '<param name="quality" value="high">';
 aux += '<param name="wmode" value="transparent" />'; // se preciso, habilitar WMODE
 aux += '<embed src="' +url+ '" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' +largura+ '" height="' +altura+ '"></embed>';
 //aux += '<embed src="' +url+ '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' +largura+ '" height="' +altura+ '"></embed>';
 aux += '</object>';
 document.write (aux);
}
// ----------------------------------------------------------------------//

var min=10;
var max=16;
function increaseFontSize(ft) {
   //var p = document.getElementById('aA1');
   var p = ft=='ft' ? document.getElementsByTagName('td') : document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}
function decreaseFontSize(ft) {
   //var p = document.getElementsByTagName('aA1');
   var p = ft=='ft' ? document.getElementsByTagName('td') : document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

// ----------------------------------------------------------------------//

function CNWin(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no,toolbar=no,status=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


// POPUP TV GRADUAL
function setPosition(who) {
	var item = document.getElementById(who).style;
	item.top = "20%";
	item.left = "20%";
	item.width = "640px";
	item.height = "500px";
	//item.margin = "90px auto auto 330px";
	//setTimeout("hideWho('popup_window')",30000);
}
function hideWho(who) {
	var item = document.getElementById(who).style;
	item.display = "none";
}

function initPopup(id, tipo){
  setPosition('popup_window');
  document.getElementById('popup_window').innerHTML = popupHtml(id, tipo);
  document.getElementById('popup_window').style.display = 'block';
}


function popupHtml(id, tipo){
	html = '';
	if(tipo == 'tvgradual'){
		html += '<table border="0" cellpadding="0" cellspacing="0" style="border:4px solid #666">';
		html += '<tr>';
		html += '<td style="padding-left:3px; background-color:#666; color:#FFF"><strong>TV Gradual</strong></td>';
		html += '<td style="text-align:right;padding-bottom:3px; background-color:#666"><a><img src="../../imagens/popup_fechar.gif" width="58" height="15" border="0" id="pfbtfec" onClick="hideWho(\'popup_window\');" onMouseOver="document.getElementById(\'pfbtfec\').src=\'../../imagens/popup_fechar_over.gif\';" onMouseOut="document.getElementById(\'pfbtfec\').src=\'../../imagens/popup_fechar_over.gif\';" /></a></td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td colspan="2"><embed src="http://www.truetech.com.br/webtvconsole/usuario/embed.swf" quality="high" bgcolor="#ffffff" width="640" height="480" name="AdobeTVPlayer" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" flashVars="console=135&video=' +id+ '"></embed></td>';
		html += '</tr>';
		html += '</table>';
	}
	else if(tipo == 'tvcanaldoprodutorrural'){
		html += '<table border="0" cellpadding="0" cellspacing="0" style="border:4px solid #666">';
		html += '<tr>';
		html += '<td style="padding-left:3px; background-color:#666; color:#FFF"><strong>TV Canal do Produtor Rural</strong></td>';
		html += '<td style="text-align:right;padding-bottom:3px; background-color:#666"><a><img src="../../imagens/popup_fechar.gif" width="58" height="15" border="0" id="pfbtfec" onClick="hideWho(\'popup_window\');" onMouseOver="document.getElementById(\'pfbtfec\').src=\'../../imagens/popup_fechar_over.gif\';" onMouseOut="document.getElementById(\'pfbtfec\').src=\'../../imagens/popup_fechar_over.gif\';" /></a></td>';
		html += '</tr>';
		html += '<tr>';
		html += '<td colspan="2"><iframe width="640" height="500" src="http://www.youtube.com/embed/' + tipo + '" frameborder="0" allowfullscreen></iframe></td>';
		html += '</tr>';
		html += '</table>';
	}
	else{
		alert('rr');
	}
	return html;
}


function refreshImg(img){
   total_imagens = 9;
   imagem = document.getElementById(img);
   endereco = imagem.src;
   novo = endereco.replace("http://", "");
   parte = novo.split('/');
   quant = parte.length;
   img = parte[quant-1];
   nome = parseInt(img.replace(".jpg", ""));
   if(nome == total_imagens) nome = 1;
   nome ++;
   window.document.getElementById('imagem_captcha').value = nome;
   nome += '.jpg';
   imagem.src = 'http://www.diadecampo.com.br/imagens/captcha/' + nome;
}



function confirmDel(delUrl,msg) {
  if(confirm(msg))
    window.location=delUrl;
}
