
function wm(file){
	window.open(file,'any','top=5 left=5 scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=740,height=520');
}

///////////////////////////////////////////
// PAGE FUNCTIONS
///////////////////////////////////////////
// checa se a págian esta no frame
// <body onLoad="chkFrame();">
function chkFrame(){
	var loc = document.location.href;
	if (!top.frameOk){
		top.location.href = 'http://www.mathema.com.br/default.asp?url='+loc
	} else {
		if (document.getElementById('breadcrumb')){
			var title = document.title;			
			if (title != ''){
				vLinks = document.getElementById('breadcrumb').innerHTML;
				if (vLinks != ''){
					vBrdArr = title.split(' - ');
					vLinksArr = vLinks.split(';');
					if (vLinksArr.length){
						for (n=0;n<vLinksArr.length;n++){
							vstr = vLinksArr[n].split(':');
							vpos = vstr[0];
							vurl = vstr[1];						
							vBrdArr[vpos] = '<a href="'+vurl+'">'+vBrdArr[vpos]+'</a>';
						}
					} else {
						vstr = vLinksArr.split(':');
						vpos = vstr[0];
						vurl = vstr[1];						
						vBrdArr[vpos] = '<a href="'+vurl+'">'+vBrdArr[vpos]+'</a>';
					}
					title = vBrdArr.join(' - ');					
				}
				title = title.replace(/ - /gmi, ' >> ');
				title = title.replace(/>> Jogos >>/, '>> <a href="_display.html">Jogos</a> >>');
				title = title.replace(/>> Alunos >>/, '>> <a href="_alunos.html">Alunos</a> >>');				
				title = title.replace(/>> Brincadeiras >>/, '>> <a href="_display.html">Brincadeiras</a> >>');
				title = title.replace(/>> Sala de Aula >>/, '>> <a href="_display.html">Sala de Aula</a> >>');				
				title = title.replace(/>> Matemática e Leitura >>/gmi, '>> <a href="_display.html">Matemática e Leitura</a> >>');
				document.getElementById('breadcrumb').innerHTML = title;	
				document.getElementById('breadcrumb').style.visibility = 'visible';
			}
		}
	}
}

// indique a um amigo
// <a href="#" onClick="javascript:indique();return false;">indique para um amigo</a>
function indique(path){
	var loc = document.location.href;	
	if (path){
		popup(path+'sistemas/amigo/enviar.asp?tit='+document.title+'&url='+loc,400,480,'no','no');
	} else {
		popup('../../sistemas/amigo/enviar.asp?tit='+document.title+'&url='+loc,400,480,'no','no');
	}
}

function printPage(){
	window.print();
}

function voltar(bck){
	if (bck){
		if (bck == 'back'){
			history.back();					
		} else if (bck == 'home') {
			document.location.href = '/_display.html';
		} else {
			document.location.href = bck;		
		}
	} else {
		var loc = document.location.href;
		var bckLoc = getParameter(loc,'bck');
		if (bckLoc != ''){
			//document.location.href = '/'+bckLoc;
			document.location.href = '/'+bckLoc;		
		} else {
			document.location.href = '/_display.html';
			//document.location.href = '/_display.html';
		}
	}
}

///////////////////////////////////////////
// POPUP
///////////////////////////////////////////
var popWin=0;
function popup(URLStr, width, height, scrolls, menu, janela){
	if(popWin){
		if(!popWin.closed) popWin.close();
	}
	if (!janela){janela = 'popWin'}
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	if (menu == 'yes') {top = top - 40};
	if (janela == 'yes') {top = top - 40};	
	popWin = open(URLStr, janela, 'toolbar=no,location=no,directories=no,status=no,menubar='+menu+',scrollbars='+scrolls+',resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

////////////////////////////////////////////
// GERAIS
////////////////////////////////////////////
function getParameter (queryString, parameterName) {
	var parameterName = parameterName + "=";
	if ( queryString.length > 0 ) {
		begin = queryString.indexOf ( parameterName );
		if ( begin != -1 ) {
			begin += parameterName.length;
			end = queryString.indexOf ( "&" , begin );
			if ( end == -1 ) {
				end = queryString.length;
			}
			return unescape ( queryString.substring ( begin, end ) );
		}
		return "";
	}
}

// autopopup

PositionX = 100;
PositionY = 100;
defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}

var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
	if (isNN){
		imgWin=window.open('Zoom','',optNN);
	}
	if (isIE){
		imgWin=window.open('Zoom','',optIE);
	}
	with (imgWin.document){
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');writeln('window.resizeTo(300,300);');
		writeln('width=300-(document.body.clientWidth-document.images[0].width);');
		writeln('height=300-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNN){');       
		writeln('window.innerWidth=document.images["George"].width;');
		writeln('window.innerHeight=document.images["George"].height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
		close();		
	}
}
