﻿function openWindow(cSite, cSiteName, iWidth, iHeight, iLeft, iTop) {
 cVars = "width="+iWidth+", ";
 cVars+= "height="+iHeight+", ";
 cVars+= "left="+iLeft+", ";
 cVars+= "top="+iTop+", ";
 cVars+= "location=no, ";
 cVars+= "menubar=no, ";
 cVars+= "scrollbars=yes, ";
 cVars+= "resizable=no ,";
 cVars+= "status=no, ";
 cVars+= "dependent=yes, ";
 cVars+= "toolbar=no ";
 wWindow = window.open(cSite, cSiteName, cVars);
}

function openWindowFixed(cSite, cSiteName, iWidth, iHeight, iLeft, iTop) {
 cVars = "width="+iWidth+", ";
 cVars+= "height="+iHeight+", ";
 cVars+= "left="+iLeft+", ";
 cVars+= "top="+iTop+", ";
 cVars+= "location=no, ";
 cVars+= "menubar=no, ";
 cVars+= "scrollbars=no, ";
 cVars+= "resizable=no ,";
 cVars+= "status=no, ";
 cVars+= "dependent=yes, ";
 cVars+= "toolbar=no ";
 wWindow = window.open(cSite, cSiteName, cVars);
}

/*******************************
IMAGEPOP
(c) 2003, Peter Bailey, http://www.peterbailey.net
Modified by Skyzyx Genesis, http://www.skyzyx.com

- Works in IE5+, Gecko 0.94+ (maybe earlier?)
- Downlevel for Opera.
- Probably works in KHTML browsers
*******************************/

function imgPop(imageURL) {
 if (document.getElementById && navigator.userAgent.toLowerCase().indexOf('opera') == -1) {
 var imgWin = window.open('','imgWin','width=200, height=200, left=100, top=100');

 with (imgWin.document) {
 open();
 writeln('<html><head><title>Loading...</title>');
 writeln('<style type="text/css"><!-- body { margin: 0px; } --></style></head>');
 writeln('<body onload="self.focus();"><a href="" onclick="window.close()"><img id="pic" style="display:none" border="0" /></a></body></html>');
 close();
 }

 var img = new Image();
 img.onload = function() { sizeImgWin(imgWin, img); };
 img.src = imageURL;
 }
 else
 window.open(imageURL);
}

function sizeImgWin(win, img) {
 var new_w = img.width;
 var new_h = img.height;
 var old_w = win.innerWidth || win.document.body.offsetWidth;
 var old_h = win.innerHeight || win.document.body.offsetHeight;

 if (!new_w)
 new_w = old_w;
 if (!new_h)
 new_h = old_h;

 new_w -= old_w;
 new_h -= old_h;
 win.resizeBy(new_w,new_h);
 win.document.title = img.src.substring(img.src.lastIndexOf("/")+1);
 var pic = win.document.getElementById('pic');
 pic.src = img.src;
 pic.style.display = 'block';

 sw=screen.width;
 sh=screen.height;

 var leftPos=((sw-new_w)/2)-100; // Exactly centered.
 var topPos=((sh-new_h)/2)-(100+(((sh-new_h)/2)*0.2)); // Centered, then moved up 20%
 win.moveTo(leftPos, topPos);
} 