function bagueteOverlib(str) {

	return overlib(Base64.decode(str));

}

function openGaleria(type, id, pic) {

	window.open('openGaleria.php?type='+type+'&id='+id+'&pic='+pic, 'openGaleria', 'width=732,height=600,resizable=0,status=0,menubar=0');

}

function changePic(type, id, pic, slide) {

	parent.leftFrame.location = 'openGaleria1.php?type='+type+'&id='+id+'&pic='+pic;
	if(slide != "undefined")
		parent.rightFrame.location = 'openGaleria2.php?type='+type+'&id='+id+'&pic='+pic+'#'+pic;

}

function openComunicarErros(title, url) {

	window.open('comunicarErros.php?title='+title+'&url='+url, 'comunicarErros', 'width=310,height=475,resizable=0,status=0,menubar=0');

}

function openEnvieAmigo(title, url) {

	window.open('envieAmigo.php?title='+title+'&url='+url, 'envieAmigo', 'width=310,height=720,resizable=0,status=0,menubar=0');

}

function imprimeNoticia(id) {

	window.open('noticiasDetalhes.imprime.php?id='+id, 'imprimeNoticia', 'width=640,height=480,resizable=1,scrollbars=1,status=0,menubar=0');

}

function imprimeColuna(id) {

	window.open('colunasDetalhes.imprime.php?id='+id, 'imprimeColuna', 'width=640,height=480,resizable=1,scrollbars=1,status=0,menubar=0');

}

function imprimeArtigo(id) {

	window.open('artigosDetalhes.imprime.php?id='+id, 'imprimeArtigo', 'width=640,height=480,resizable=1,scrollbars=1,status=0,menubar=0');

}

function imprimeVitrine(id) {

	window.open('vitrine.imprime.php?id='+id, 'imprimeVitrine', 'width=640,height=480,resizable=1,scrollbars=1,status=0,menubar=0');

}

function imprimeEntrevista(id) {

	window.open('entrevista.imprime.php?id='+id, 'imprimeEntrevista', 'width=640,height=480,resizable=1,scrollbars=1,status=0,menubar=0');

}

function imprimeAgenda(id) {

	window.open('agendaDetalhes.imprime.php?id='+id, 'imprimeAgenda', 'width=640,height=480,resizable=1,scrollbars=1,status=0,menubar=0');

}

function openEnvieComentario(id, type, title, url) {

	window.open('envieComentario.php?id='+id+'&type='+type+'&title='+title+'&url='+url, 'envieComentario', 'width=310,height=505,resizable=0,status=0,menubar=0');

}

function clearField(field) {

	field.value = '';
	return;

}

function showEnqueteResults() {

	document.getElementById('enqueteReady').style.display = 'none';
	document.getElementById('enqueteReadyShow').style.display = 'block';
	document.getElementById('enqueteShow').style.display = 'none';

}

function showEnquete() {

	document.getElementById('enqueteReady').style.display = 'block';
	document.getElementById('enqueteReadyShow').style.display = 'none';
	document.getElementById('enqueteShow').style.display = 'none';

}

function increaseFontSize() {
	
	var max = 18;

	var titulo = document.getElementById("bagueteTitulo");
	if(titulo.style.fontSize) {
		var s = parseInt(titulo.style.fontSize.replace("px", ""));
	}
	else {
		var s = 14;
	}
	if(s < max) {
		s += 1;
	}
	titulo.style.fontSize = s + "px";
	
	var texto = document.getElementById("bagueteTexto");
	if(texto.style.fontSize) {
		var s = parseInt(texto.style.fontSize.replace("px", ""));
	}
	else {
		var s = 11;
	}
	if(s < max) {
		s += 1;
	}
	texto.style.fontSize = s + "px";

	// a
	var a = texto.getElementsByTagName("a");
	for(var i = 0; i < a.length; i++) {
		if(a[i].style.fontSize) {
			var s = parseInt(a[i].style.fontSize.replace("px", ""));
		}
		else {
			var s = 11;
		}
		if(s < max) {
			s += 1;
		}
		a[i].style.fontSize = s + "px";

	}

}

function decreaseFontSize() {

	var min = 8;
	
	var titulo = document.getElementById("bagueteTitulo");
	if(titulo.style.fontSize) {
		var s = parseInt(titulo.style.fontSize.replace("px", ""));
	}
	else {
		var s = 14;
	}
	if(s > min) {
		s -= 1;
	}
	titulo.style.fontSize = s + "px";

	var texto = document.getElementById("bagueteTexto");
	if(texto.style.fontSize) {
		var s = parseInt(texto.style.fontSize.replace("px", ""));
	}
	else {
		var s = 11;
	}
	if(s > min) {
		s -= 1;
	}
	texto.style.fontSize = s + "px";

	// a
	var a = texto.getElementsByTagName("a");
	for(var i = 0; i < a.length; i++) {
		if(a[i].style.fontSize) {
			var s = parseInt(a[i].style.fontSize.replace("px", ""));
		}
		else {
			var s = 11;
		}
		if(s > min) {
			s -= 1;
		}
		a[i].style.fontSize = s + "px";

	}

}

/**
 * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
 */

function writeFlash(p) {
	writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeShockWave(p) {
	writeEmbed(
	'166B1BCA-3F9C-11CF-8075-444553540000',
	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
	'application/x-director',
		p
	);
}

function writeQuickTime(p) {
	writeEmbed(
		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
		'video/quicktime',
		p
	);
}

function writeRealMedia(p) {
	writeEmbed(
		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'audio/x-pn-realaudio-plugin',
		p
	);
}

function writeWindowsMedia(p) {
	p.url = p.src;
	writeEmbed(
		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
		'application/x-mplayer2',
		p
	);
}

function writeEmbed(cls, cb, mt, p) {
	var h = '', n;

	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
	h += '>';

	for (n in p)
		h += '<param name="' + n + '" value="' + p[n] + '">';

	h += '<embed type="' + mt + '"';

	for (n in p)
		h += n + '="' + p[n] + '" ';

	h += '></embed></object>';

	document.write(h);
}

//imprime a barra do uol conforme a resolução
function bagueteUOLbarra(){
	var barrauol = document.getElementById('barrauol');
	barrauol.style.width = screen.width;
	
	
	document.write("<script src='http://barra.uol.com.br/b/bpv1_m2.js'></script>");

}


// Centered Pop-Up Window (v1.0)
// (C) 2002 www.smileycat.com
// Free for all users, but leave in this header


function newWindow(mypage,myname,w,h,features) {
  var win = null;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
