function openFotoHigh(theURL, w, h) { // url
	
	if ((is.ie)) {
			var urlFrame = 'flip/blank.php';
			janela = window.open(urlFrame,'fotohigh','status=no,width=10,height=10,scrollbars=no, resizable=no');
			janela.document.open();
			janela.document.writeln('<title>Imprimir...</title>');
			janela.document.writeln('<frameset rows="200,*" frameborder="NO" border="0" framespacing="0">');
			janela.document.writeln('  <frame src="flip/loading.php" name="loading" scrolling="NO" noresize >');
			janela.document.writeln('  <frame src="' + theURL +'" name="printLoad" scrolling="NO" noresize >');
			janela.document.writeln('</frameset>');
			janela.document.close();
	} else {
		 janela = window.open(theURL,'fotohigh','status=no,width=10,height=10,scrollbars=no, resizable=no');
	}
	
	//	janela = window.open(theURL,'fotohigh','status=no,width=10,height=10,scrollbars=no, resizable=no');
	w = parseFloat(w) + parseFloat(12 +20);
 h = parseFloat(h) + parseFloat(35 +20);

 maxW = screen.width ;
 maxH = screen.height ; 

 if (maxW < w)w = maxW ;
 if (maxH < h) h = maxH ;
 
 //janela.resizeTo(w,h);
 //janela.moveTo((screen.width-w)/2, (screen.height -h)/2);
	//janela.moveTo(30, 30);
	
 janela.resizeTo(300,100);
 janela.moveTo((screen.width-300)/2, (screen.height - 100)/2);
	janela.focus();
}

function openComposite(theURL, w, h) { // url
	janela = window.open(theURL,'fotohigh','status=no,width=10,height=10');
	w = parseFloat(w) + parseFloat(15);
 h = parseFloat(h) + parseFloat(35);
 janela.resizeTo(w,h);
	janela.moveTo((screen.width-w)/2, (screen.height -h)/2);
	janela.focus();
}

function openBook(theURL, w, h, winID) { // url

	//w = 300;
 //h = 55;
 //w = 810;
	if (screen.width > 800){
	 w = 1024;
	 h = 768;
 }
	var is = new Is();
 if (is.win) {
 	 janela = window.open(theURL,winID,'status=no,width=10,height=10,scrollbars=auto,resizable=1');
		 checkPopupBlocker();
		 if (checkPopup(janela)) {
			 try {
			 janela.resizeTo(w,h);
				janela.moveTo((screen.width-w)/2, (screen.height -h)/2);
				janela.focus();
			 }catch(error){
			 	alert("Para acessar o conteúdo das edições é necessário DESATIVAR QUAISQUER MECANISMOS DE ANTI-POPUP");
			 }
		 } else {
		 	alert("Para acessar o conteúdo das edições é necessário DESATIVAR QUAISQUER MECANISMOS DE ANTI-POPUP");
		 }
 }else {
 		if (screen.width > 800){
 			janela = window.open(theURL,winID,'status=no,width=1024,height=768,scrollbars=no,resizable=1');
 		} else {
 			janela = window.open(theURL,winID,'status=no,width=800,height=600,scrollbars=no,resizable=1');
 		}
 }
}

function openSearch(theURL) { // url
	search = window.open(theURL,'fotohigh','status=no,width=10,height=10,scrollbars=no');
	w = 471//parseFloat(w) + parseFloat(15);
 h = 289//parseFloat(h) + parseFloat(35);
 search.resizeTo(w,h);
	search.moveTo((screen.width-w)/2, (screen.height -h)/2);
	search.focus();
}

function openLoading(theURL) { // url
	//loading = window.open(theURL,'fotohigh','status=no,width=10,height=10,scrollbars=yes,');
	///w = 500//parseFloat(w) + parseFloat(15);
 //h = 300//parseFloat(h) + parseFloat(35);
 //loading.resizeTo(w,h);
	//loading.moveTo((screen.width-w)/2, (screen.height -h)/2);
	//loading.focus();
	//window.opener.onload = function () {alert()};
	
	
	showModelessDialog(theURL,window,"status:false;dialogWidth:300px;dialogHeight:300px");
	
}

function IsPopupBlocker() {
		var oWin = window.open("","testpopupblocker","width=100,height=50,top=5000,left=5000");
		if (oWin==null || typeof(oWin)=="undefined") {
			return true;
		} else {
			oWin.close();
			return false;
		}
}

function checkPopup(pop){	
	if (pop==null || typeof(pop)=="undefined") {
			return false;
		} else {
			return true;
		}
}

function checkPopupBlocker(){	
	if (IsPopupBlocker()) {
		alert("Você possui bloqueador de Popups. Para acessar o conteúdo das edições é necessário DESATIVAR QUAISQUER MECANISMOS DE ANTI-POPUP");
	} else {
		//alert("Popup blocker NOT detected.");
	}
}


//function window.onfocus(){
//	document.ondragstart = new Function("return false;");
//	document.oncontextmenu = new Function("return false;");
//	document.onselectstart = new Function("return false;");
//}
function disableInterfaceThings() {
	document.ondragstart = new Function("return false;");
	document.oncontextmenu = new Function("return false;");
	document.onselectstart = new Function("return false;");
}

function adaptWindowOnScreen(){

}

window.onfocus = new Function("disableInterfaceThings();");

	function gotoEdicao(ID_Edicao) {
		arquivoFlip = (demo)? 'preview.php' : 'flip.php';
		if ((ID_Edicao == idEdicao) && (idEdicao != undefined)) {
			gotoPage(1);
		} else {
			url = arquivoFlip+"?idEdicao="+ ID_Edicao;
			document.location.href = url;
		}
	}

	function gotoEditoria(ID_Edicao, ID_Caderno, numPagEditoria, origem) {
		arquivoFlip = (demo)? 'preview.php' : 'flip.php';
		if(window.name == "flip"){
			if ((ID_Caderno == idCaderno) && (idCaderno != undefined)) {
				gotoPage(numPagEditoria);
			} else {
				origemView = (origem == undefined) ? '' : '&origem='+origem;
				url = arquivoFlip+"?idEdicao="+ID_Edicao+"&idCaderno="+ ID_Caderno + "&page2go=" + numPagEditoria + origemView;
				document.location.href = url;
				//alert(url);
			}
		}else{
			origemView = (origem == undefined) ? '' : '&origem='+origem;
			url = arquivoFlip+"?idEdicao="+ID_Edicao+"&idCaderno="+ ID_Caderno + "&page2go=" + numPagEditoria + origemView;			
			window.open(url,'flip','status=no,width=1015,height=712,scrollbars=yes, resizable=yes');
		}
	}
	
	