var htmlContainer;
var selectedMenu;

var limit;
var j = 1;
var p = 1;

/* imagem */
function switchEstreias(estreiasNr){
	limit = estreiasNr;
	runSlideShow();
}
	
function runSlideShow(){
	var htmlContainerToHide = new Object();
		htmlContainerToHide = document.getElementById(p);
		htmlContainerToHide.style.display = "none";
	htmlContainer = document.getElementById(j);
	htmlContainer.style.display = "block";
	p = j;
	j++;
	if (j > (limit)) j=1;
	t = setTimeout('runSlideShow()', 5000)
}


function overMenu(htmlId){
	if(selectedMenu == document.getElementById(htmlId)){return;}
	document.getElementById(htmlId).src = "/images/menu/menu"+htmlId+"On.png";
}

function outMenu(htmlId){
	if(selectedMenu == document.getElementById(htmlId)){return;}
	document.getElementById(htmlId).src = "/images/menu/menu"+htmlId+".png";
}

function selectMenu(htmlId){
	selectedMenu = document.getElementById(htmlId);
	document.getElementById(htmlId).src = "/images/menu/menu"+htmlId+"On.png";
}

function openCinemaFicha(idFilme){
	document['cinemaFichaFlash'].setPreloader();
	document['cinemaFichaFlash'].openBoxJavascriptHandler('/xml/fichacinema.aspx?id='+idFilme);
}

function closeCinemaFicha(){
	document.getElementById('cinemaFicha').style.display = "none";
}

function cinemaFichaPhraser(){
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '1',
			'height', '1',
			'src', '/flash/cinemaFicha',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'cinemaFichaFlash',
			'bgcolor', '#ffffff',
			'name', 'cinemaFichaFlash',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/flash/cinemaFicha',
			'salign', ''
			); //end AC code
	}
}

function switchFichaLoja(dir){
	var plantaLink = document.getElementById('plantaLojaLink');
	var fichaLoja = document.getElementById('fichaLojaContainer');
	var plantaLoja = document.getElementById('plantaLojaContainer');
	if(dir == "show"){
		plantaLoja.style.display = "block";
		fichaLoja.style.display = "none";
		plantaLink.style.display = "none";
	}else{
		plantaLoja.style.display = "none";
		fichaLoja.style.display = "block";
		plantaLink.style.display = "block";
	}
}

function menuMain(){
	var queryString = "";
	
	
	if(typeof menuId != "undefined"){queryString += "&menuId="+menuId}
	if(typeof fvSector != "undefined"){queryString += "&fvSector="+fvSector}
	if(typeof fvSubSector != "undefined"){queryString += "&fvSubSector="+fvSubSector}
	
	
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '999',
			'height', '100%',
			'src', '/flash/menuMain',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'menuMain',
			'bgcolor', '#ffffff',
			'name', 'menuMain',
			'menu', 'false',
			'FlashVars', ''+queryString,
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/flash/menuMain',
			'salign', ''
			); //end AC code
	}
}

function flashHome(){
	
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '630',
			'height', '333',
			'src', '/flash/banner_home_04032010',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'animHome',
			'bgcolor', '#ffffff',
			'name', 'animHome',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/flash/banner_home_04032010',
			'salign', ''
			); //end AC code
	}
}

function cinemaDestaquesDataReader(dataPath,idPrefixo){	
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '1',
			'height', '1',
			'src', '/flash/cinemaDestaquesDataReader',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'cinemaDestaquesDataReader'+idPrefixo,
			'bgcolor', '#ffffff',
			'name', 'cinemaDestaquesDataReader'+idPrefixo,
			'menu', 'false',
			'FlashVars', 'dataPath='+dataPath+'&prefixo='+idPrefixo,
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/flash/cinemaDestaquesDataReader',
			'salign', ''
			); //end AC code
	}
}

function noticiasDestaquesDataReader(dataPath,idPrefixo){	
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '1',
			'height', '1',
			'src', '/flash/noticiasDestaquesDataReader',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'noticiasDestaquesDataReader'+idPrefixo,
			'bgcolor', '#ffffff',
			'name', 'noticiasDestaquesDataReader'+idPrefixo,
			'menu', 'false',
			'FlashVars', 'dataPath='+dataPath+'&prefixo='+idPrefixo,
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/flash/noticiasDestaquesDataReader',
			'salign', ''
			); //end AC code
	}
}

function dataPhraserNextData(flashId){
	document[flashId].next();
}

function dataPhraserPreviousData(flashId){
	document[flashId].previous();
}

function windowOpener(windowHeight, windowWidth, windowName, windowUri)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    //newWindow.focus();
    //return newWindow.name;
}


function Lojistas() {
	window.open('http://portal.mundicenter.com/braga/main.aspx','lojistas','toolbar=no,width=700,height=512,location=no,status=yes,directories=no,menubar=no,scrollbars=yes,resizable=no');
}
function LojistasMapa() {
	window.open('http://portal.mundicenter.com/braga/main.aspx','lojistas','toolbar=no,width=700,height=512,location=no,status=yes,directories=no,menubar=no,scrollbars=yes,resizable=no');
        window.close();
}
function Imprensa(IDCentro) {
	theURL="http://www.mundicenter.com/";
	window.open(theURL+'imprensa/default.aspx?iIDCentro='+IDCentro.toString(),'imprensa','toolbar=no,width=700,height=500,location=no,status=no,directories=no,menubar=no,scrollbars=yes,resizable=no');
}
function ImprensaMapa(IDCentro) {
	theURL="http://www.mundicenter.com/";
	window.open(theURL+'imprensa/login.aspx?iIDCentro='+IDCentro.toString(),'imprensa','toolbar=no,width=700,height=500,location=no,status=no,directories=no,menubar=no,scrollbars=yes,resizable=no');
        window.close();
}