    var newwindow;
    function popdetails(url) {
        newwindow=window.open(url,'popdetails','height=500,width=500,resizable=yes,scrollbars=yes,status=yes');
        if (window.focus) newwindow.focus();
    }

    function poppeer(url) {
        newwindow=window.open(url,'poppeers','height=400,width=650,resizable=yes,scrollbars=yes');
        if (window.focus) newwindow.focus();
    }

	function addListener(obj,evt,func) {
		if (obj.attachEvent)
			obj.attachEvent('on' + evt, func);

		else {
			if (obj.addEventListener) {
				obj.addEventListener(evt,func,false);
			}
			else {
				if (obj.eval) {
					obj["on"+evt] = func;
				} else {
					alert("Error adding listener\nObject:"+obj+" ID:"+obj.id+" Name:"+obj.name+" TagName:"+obj.tagName+"\nEvent:"+evt);
				}
			}
		}
	}

	function resizeimg() {
		var win_width;
		var max_width;
		var width_str;
		if (window.innerWidth) {
			win_width = window.innerWidth - 15;
		} else if (document.documentElement.clientWidth) {
			win_width = document.documentElement.clientWidth;
		} else {
			win_width = 800;
		}
		if (win_width < 600) {
			win_width = 600;
		}
		max_width = win_width - 400;
		width_str = max_width + 'px';
		if (document.getElementsByTagName) {
			for (i=0; i<document.getElementsByTagName('img').length; i++) {
				im = document.getElementsByTagName('img')[i];
				if (im.width > max_width && im.src.indexOf("site_logo.gif") < 0) {
					im.style.width = width_str;
					eval("pop" + String(i) + " = new Function(\"pop = window.open('','fullscale','width=" + (screen.availWidth - 10).toString() + ", height=" + (screen.availHeight - 122).toString() + ", scrollbars=yes, resizable=yes, screenX=0, screenY=0, left=0, top=0'); pop.focus(); pop.document.writeln('<html><body><img src=" + im.src + "></body></html>');  pop.document.close(); pop.resizeTo(screen.availWidth, screen.availHeight);\")");
					eval("im.onclick = pop" + String(i) + ";");
					if (document.all) {
						im.style.cursor = 'hand';
					} else {
						im.style.cursor = 'pointer';
					}
					im.title = 'Click to full size. Clic para agrandar.'; 
				}
			}
		}
	}

	addListener(window, "load", resizeimg);


    function resize_avatar(img) {
        if(img.width>80) {
            img.height=parseInt(img.height*80/img.width);
            img.width=80;
        }
    }