function add_bookmark(domain,title) {
	var browsName = navigator.appName;
	if (browsName == "Microsoft Internet Explorer") {
		window.external.AddFavorite('http://www.' + domain,title);
	} else if (browsName == "Netscape") {
		alert ("Para adicionar ao bookmark utilize: Ctrl + D");
	}
}

function janela(name, link, W, H) {
  leftpos = (screen.width)?(screen.width-W)/2:100;
  toppos = (screen.height)?(screen.height-H)/2:100;
  win = window.open(link, name,'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=0,menubar=no,width='+W+',height='+H+',fullscreen=no');
  win.focus();
  win.moveTo(leftpos, toppos);
}

if(!Array.indexOf){
	Array.prototype.indexOf = function(obj){
		for(var i=0; i<this.length; i++){
			if(this[i]==obj){
				return i;
			}
		}
	return -1;
	}
}

function getStyleBySelector(s) {
	var sheetList = document.styleSheets;
	var ruleList;
	var i, j;
	for (i=sheetList.length-1; i >= 0; i--) {
		if (sheetList[i].cssRules) ruleList = sheetList[i].cssRules;
		else ruleList = sheetList[i].rules;
		for (j=0; j<ruleList.length; j++) {
			if (ruleList[j].selectorText == s) {
				return ruleList[j].style;
			}   
		}
	}
	return null;
}

/*
 * Botões
 */
function botaoLetra(d) {
	var fonte13 = new Array('13pt','15pt','17pt','19pt');
	var fonte10 = new Array('10pt','12pt','14pt','16pt');
	var fonte9 = new Array('9pt','11pt','13pt','15pt');
	var i;
	i=fonte13.indexOf(getStyleBySelector('.cpTitulo').fontSize);
	if (d=='+') i++; else i--;
	if (i<0) i=0; else if (i>=fonte13.length) i=(fonte13.length-1);
	getStyleBySelector('BODY').fontSize=fonte10[i];
	getStyleBySelector('TD').fontSize=fonte10[i];
	getStyleBySelector('TD A').fontSize=fonte10[i];
	getStyleBySelector('.blTitulo').fontSize=fonte13[i];
	getStyleBySelector('.cpTitulo').fontSize=fonte13[i];
	getStyleBySelector('.blSubtitulo').fontSize=fonte10[i];
	getStyleBySelector('A.blSubtitulo').fontSize=fonte10[i];
	getStyleBySelector('.cpFonte').fontSize=fonte10[i];
	getStyleBySelector('.cpCapa').fontSize=fonte10[i];
	getStyleBySelector('A.cpCapa').fontSize=fonte10[i];
	getStyleBySelector('.cpData').fontSize=fonte9[i];
/* Firefox
	getStyleBySelector('body').fontSize=fonte10[i];
	getStyleBySelector('td, a.td').fontSize=fonte10[i];
	getStyleBySelector('.blTitulo').fontSize=fonte13[i];
	getStyleBySelector('.cpTitulo').fontSize=fonte13[i];
	getStyleBySelector('.blSubtitulo, a.blSubtitulo').fontSize=fonte10[i];
	getStyleBySelector('.cpFonte').fontSize=fonte10[i];
	getStyleBySelector('.cpCapa, a.cpCapa').fontSize=fonte10[i];
	getStyleBySelector('.cpData').fontSize=fonte9[i];
*/
	return;
}

function botaoAlbum() {
	if (document.getElementById('album')) {
		var item = document.getElementById('album');
		if (document.getElementById('album').style.display=='block')
			document.getElementById('album').style.display='none';
		else document.getElementById('album').style.display='block';
	}
}

function botaoContraste() {
	getStyleBySelector('BODY').color='black';
	getStyleBySelector('TD').color='black';
	getStyleBySelector('TD A').color='black';
	getStyleBySelector('.blTitulo').color='black';
	getStyleBySelector('.cpTitulo').color='black';
	getStyleBySelector('.blSubtitulo').color='black';
	getStyleBySelector('A.blSubtitulo').color='black';
	getStyleBySelector('.cpFonte').color='black';
	getStyleBySelector('.cpCapa').color='black';
	getStyleBySelector('A.cpCapa').color='black';
	getStyleBySelector('.cpData').color='black';
	// negrito
	getStyleBySelector('BODY').fontWeight='bold';
	getStyleBySelector('TD').fontWeight='bold';
	getStyleBySelector('TD A').fontWeight='bold';
	getStyleBySelector('.blTitulo').fontWeight='bold';
	getStyleBySelector('.cpTitulo').fontWeight='bold';
	getStyleBySelector('.blSubtitulo').fontWeight='bold';
	getStyleBySelector('A.blSubtitulo').fontWeight='bold';
	getStyleBySelector('.cpFonte').fontWeight='bold';
	getStyleBySelector('.cpCapa').fontWeight='bold';
	getStyleBySelector('A.cpCapa').fontWeight='bold';
	getStyleBySelector('.cpData').fontWeight='bold';

	return;
}

/*
 * Menu Horizontal
 */
function expand(s) {
	var td = s;
	var d = td.getElementsByTagName("div").item(0);
	td.className = "menuHover";
	d.className = "menuHover";
}
function collapse(s) {
	var td = s;
	var d = td.getElementsByTagName("div").item(0);
	td.className = "menuNormal";
	d.className = "menuNormal";
}

