function newImage(strSrc){
	i = new Image();
	i.src = strSrc;
	return i;
}

function getObj(id) {
	if(document.all){
		return document.all(id);
	}else if(document.getElementById){
		return document.getElementById(id);
	}
}

function setInnerHTML(id, str){
	if(document.getElementById(id)) {
		document.getElementById(id).innerHTML = str;
	} else if(document.all[id]) {
		document.all[id].innerHTML = str;
	}
}

function loadImage(nome, status){

	if (document.images) {
		document.images[nome].src = eval(nome + status + '.src');
	}

}

function viewSubMenu(ind) {
	getObj('ghost').style.zIndex = '1';
	getObj('submenu1').style.display = 'none';
	getObj('submenu2').style.display = 'none';
	getObj('submenu3').style.display = 'none';
	getObj('submenu6').style.display = 'none';
	getObj('submenu8').style.display = 'none';
	getObj('submenu9').style.display = 'none';
	zeraClassMenu();
	if (ind != '') {
		getObj('submenu1').style.zIndex = '10';
		getObj('submenu2').style.zIndex = '10';
		getObj('submenu3').style.zIndex = '10';
		getObj('submenu6').style.zIndex = '10';
		getObj('submenu8').style.zIndex = '10';
		getObj('submenu9').style.zIndex = '10';
		getObj('submenu' + ind).style.display = 'block';
	} else {
		getObj('submenu1').style.zIndex = '-1';
		getObj('submenu2').style.zIndex = '-1';
		getObj('submenu3').style.zIndex = '-1';
		getObj('submenu6').style.zIndex = '-1';
		getObj('submenu8').style.zIndex = '-1';
		getObj('submenu9').style.zIndex = '-1';
	}
}

function fechaSubmenu() {
	getObj('submenu1').style.display = 'none';
	getObj('submenu2').style.display = 'none';
	getObj('submenu3').style.display = 'none';
	getObj('submenu6').style.display = 'none';
	getObj('submenu8').style.display = 'none';
	getObj('submenu9').style.display = 'none';
	zeraClassMenu();
}

function selItem(obj) {
	obj.className = 'itemexsel';
}

function zeraClassMenu() {
	getObj('menu1').className = 'itemex';
	getObj('menu2').className = 'itemex';
	getObj('menu3').className = 'itemex';
	getObj('menu4').className = 'item';
	getObj('menu5').className = 'item';
	getObj('menu6').className = 'itemex';
	getObj('menu7').className = 'item';
	getObj('menu8').className = 'itemex';
	getObj('menu9').className = 'itemex';
	getObj('menu10').className = 'itemb';
}

function gotoPage(strUrl){ 
    location.href = strUrl; 
}

function popup(url, w, h) {

	t = (window.screen.height-h)/2;
	l = (window.screen.width-w)/2;
	config = "menubar=0, toolbar=0, resizable=no, scrollbars=yes,status=0, location=0, width=" + w + ", height=" + h + ", top=" + t + ", left=" + l;
	win = window.open(url, 'Enquete', config);

}

function openPopup(url, w, h, s) {
	t = (window.screen.height-h)/2;
	l = (window.screen.width-w)/2;
	config = "menubar=0, toolbar=0, resizable=no, scrollbars=" + s + ",status=0, location=0, width=" + w + ", height=" + h + ", top=" + t + ", left=" + l;
	win = window.open(url, 'Enquete', config);
}

function validateenquete() {
	var ok = (document.getElementById('resp1').checked || document.getElementById('resp2').checked || document.getElementById('resp3').checked);

	if (ok) {
		return true;
	} else {
		alert('Selecione uma opção!');
		return false;
	}
}
	

function votarEnquete() {

	var form = document.frmEnquete;
	var valor = 0;

	for (i = 0; i < form.resposta.length; i++) {
		if (form.resposta[i].checked) {
			valor = form.resposta[i].value;
			break;
		}
	}
	if (validateenquete())
	{
		popup('Enquete.asp?resposta=' + valor, 450, 300);
	}

}

function viewnoticiaimg(codImg) {
	var wnd;
	var winwidth = 100;
	var winheight = 100;
	var winleft = (screen.width / 2) - (winwidth / 2 );
	var wintop  = (screen.height / 2) - (winheight / 2 );
	
	wnd = window.open('viewnoticiaimg.asp?codImagem='+codImg, 'gal', 'scrollbars=no, width='+winwidth+', height='+winheight+',left='+winleft+',top='+wintop );

	if (wnd)
		wnd.focus();
	
}