function open_image(url) {
var image= new Image()
	image.src=url;
var width=image.width;
var height=image.height;

var x=screen.width;
var y=screen.height;
var isScroll;
if(width>(x-10) || height>(y-50)) {
	if((width+10)>x) {
		width=x;if((height+50)>y) {width=width-20;height=y-50;}
	} else if((height+50)>y) {
		width=width-20;height=y-50;
	}
	isScroll=true;
} else isScroll=false;

var win=window.open('','img','width='+width+', height='+height+', scrollbars='+(isScroll ? 1 : 0)+', dependent=1, hotkeys=0, location=0, menubar=0, resizable=0, statusbar=0, toolbar=0, personalbar=0');
	win.document.open();
	win.document.write('<html style="margin:0px; padding:0px"><head><title>PixPack</title></head>');
	win.document.write('<body style="margin:0px; padding:0px" onblur="window.close()"><a href="#" onclick="window.close()" style="text-decoration: none">');
	win.document.write('<img border="0" src="'+url+'" alt="VoteMyShit"/>');
	win.document.write('</a></body>');
	win.document.close();
	win.focus();
	win.moveTo(0,0);
}

function bookmark(url, title) {
  if ((typeof window.sidebar=='object') && (typeof window.sidebar.addPanel=='function')) {
    if (window.location.protocol!='file:') window.sidebar.addPanel(title,url,'');
  } else {
	  if ((typeof window.external=='object') && (typeof window.external.AddFavorite!='undefined')) {
		window.external.AddFavorite(url,title);
	  } else {
    	alert('Your browser doesn\'t support this function');
	  }
  }
}
