// JavaScript Document
<!-- Inicio
/*
function popUp(URL) {
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=321,height=428,left = 479.5,top = 298');");
}
*/
function getbrowserwidth() {
	if (navigator.userAgent.indexOf("MSIE") > 0) { 
		return(document.body.clientWidth);
	} else {
		return window.outerWidth;
	}
}
function getbrowserheight() {
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		return(document.body.clientHeight);
	} else {
		return(window.outerHeight);
	}
}

function popUp(foto) {
// get center of browser window
	var X = getbrowserwidth() / 2;
	var Y = getbrowserheight() / 2;
	var width = 260;
	var height = 348;
	//alert(foto);
	//popup = window.open('foto.htm', 'popup', 'scrollbars=no ' + 'width=' + width + ' ' + 'height=' + height + ' ' + 'top=' + (window.screenTop + (Y - (height/2))) + ' ' + 'left=' + (window.screenLeft + (X - (width/2))) );
	janelaFocus = window.open("destino.php?foto="+foto, "janela", 'scrollbars=no,width=260,height=348,top=100,left=30');
	janelaFocus.focus();
}

/*
abaxio script para agilizar o processo das popups, apenas coloque o nome da imagem desejada que ele abrirá sempre na mesma janela.
<a href="#" onClick="popUp('foto.htm'); setCookie('imagem', '2.jpg')"> link </a>
*/

// .... CRIA COOKIE ............................................
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
  alert(value);
}
// ... PEGA COOKIE ..............................................
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// ... DELETA COOKIE ............................................
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}