function popup(urlstring, width, height, scrollbar) {
	wWidth = window.screen.availWidth;
	wHeight = window.screen.availHeight;
	xpos = ypos = 0;
	if(!width) w = 800;
	else w = width;
	if(!height) h = 600;
	else h = height;
	var scrollbars = 'no';
	if(scrollbar) scrollbars = 'yes';
	
	if(wWidth > w) {
		xpos = (wWidth - w)/2;
	}
	if(wHeight > h) {
		ypos = (wHeight - h)/2;
	}

	window.open(urlstring, "fotka", "scrollbars=" + scrollbars + ", toolbar=no, directories=no, top=" + ypos + ", left=" + xpos + ", menubar=no, width=" + w + ",height=" + h + ", resizable=yes");
	return false;
}

function imgpopup(urlstring, width, height, scrollbar) {
	wWidth = window.screen.availWidth;
	wHeight = window.screen.availHeight;
	xpos = ypos = 0;
	if(!width) w = 800;
	else w = width;
	if(!height) h = 600;
	else h = height;
	var scrollbars = 'no';
	if(scrollbar) scrollbars = 'yes';
	
	if(wWidth > w) {
		xpos = (wWidth - w)/2;
	}
	if(wHeight > h) {
		ypos = (wHeight - h)/2;
	}

	window.open("fotka-detail.php?img=" + urlstring, "fotka", "scrollbars=" + scrollbars + ", toolbar=no, directories=no, top=" + ypos + ", left=" + xpos + ", menubar=no, width=" + w + ",height=" + h + ", resizable=yes");
	return false;
}

function imgpopup_puvodni(urlstring) {
	wWidth = window.screen.availWidth;
	wHeight = window.screen.availHeight;
	xpos = ypos = 0;
	if(!arguments[1]) w = 800;
	else w = arguments[1];
	if(!arguments[2]) h = 600;
	else h = arguments[2];
	var scrollbars = 'no';
	if(arguments[3]) scrollbars = 'yes';

	if(wWidth > w) {
		xpos = (wWidth - w)/2;
	}
	if(wHeight > h) {
		ypos = (wHeight - h)/2;
	}

	window.open("fotka-detail.php?img=" + urlstring, "fotka", "scrollbars=" + scrollbars + ", toolbar=no, directories=no, top=" + ypos + ", left=" + xpos + ", menubar=no, width=" + w + ",height=" + h + ", resizable=yes");
	return false;
}

function externalLinks() {
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
}

window.onload = function() {
	externalLinks();
}

