// ===============================================
// ******* OPEN INDEPENDENT DISPLAY WINDOW *******
// ===============================================

function OpenWindow(SiteName, URL, pagetop, pageleft, pagewidth, pageheight){

if(winID && !winID.close()) {winID.close()}

var windowprops = "toolbar=0,menubar=yes,scrollbars=yes,resizable=0,location=0,directories=0,status=0,top=" + pagetop + ",left=" + pageleft + ",width=" + pagewidth + ",height=" + pageheight;
var PageTitle = "<title> " + SiteName + " - Armyrats Website</title>";
winID = window.open('', SiteName, windowprops);

winID.document.write('<html>');
winID.document.write('<head>');
winID.document.write('<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">');
winID.document.write(PageTitle);
winID.document.write('<meta name="GENERATOR" content="Microsoft FrontPage 4.0">');
winID.document.write('<meta name="ProgId" content="FrontPage.Editor.Document">');
winID.document.write('<meta name="Microsoft Border" content="t, default">');
winID.document.write('</head>');

winID.document.write('<frameset framespacing="0" border="0" rows="120,*,40" frameborder="0">');
winID.document.write('<frame name="header" src="" scrolling="no" noresize marginwidth="0" marginheight="0">');
winID.document.write('<frame name="display" src="" scrolling="auto" noresize marginwidth="0" marginheight="0">');
winID.document.write('<frame name="footer" src="" scrolling="no" noresize marginwidth="0" marginheight="0">');
winID.document.write('<noframes>');
winID.document.write('<body>');
winID.document.write('<p>This page uses frames, but your browser doesnt support them.');
winID.document.write('</body>');
winID.document.write('</noframes>');
winID.document.write('</frameset>');
winID.document.write('</html>');
winID.document.close();
winID.frames[0].location="_borders/header.htm";
winID.frames[1].location=URL;
winID.frames[2].location="_borders/footer.htm";
winID.focus();
}

// ========================================================================
// ******* FUNCTION DISPLAY LARGE EXPANDED IMAGE IN EXTERNAL WINDOW *******
// ========================================================================

function expandImage(imageRef, winWidth, winHeight){

var aspectRatio;

if(winWidth >= (screen.width - 30) || winHeight >= (screen.height - 100)){

	if (winWidth >= winHeight){
	aspectRatio = (screen.width - 30) / winWidth;
	}else{
	aspectRatio = (screen.height - 100) / winHeight;
	}
	
	winWidth = Math.round(Math.abs(winWidth * aspectRatio));
	winHeight = Math.round(Math.abs(winHeight * aspectRatio));
}

if(winID && !winID.closed){
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;

	if (NS) {
		sWidth = winID.innerWidth;
		sHeight = winID.innerHeight;
	}else{
		sWidth = winID.document.body.clientWidth;
		sHeight = winID.document.body.clientHeight;
	}

	if((sWidth!=winWidth) || sHeight!=(winHeight)) {
		winID.close();
	}
	
}

sleep(500);

if(!winID || winID.closed){
	winID = window.open("","ImageViewer","width=" + winWidth + ",height=" + winHeight + ",top=10,left=" + ((screen.width-winWidth)-20) + ",menubar=no,toolbar=no");
}

winID.document.open();
winID.document.write('<head>\n');
winID.document.write('<title>Armyslags - Snapshots</title>\n');
winID.document.write('<sc' + 'ript language="JavaScript">\n');

winID.document.write('document.title = "Snapshots"\n');

winID.document.write('function right(e) {\n');
winID.document.write('if (navigator.appName == "Netscape" && (e.which == 3 || e.which == 2))\n');
winID.document.write('return false;\n');
winID.document.write('else if (navigator.appName == "Microsoft Internet Explorer" && (event.button == 2 || event.button == 3)) {\n');
winID.document.write('alert("Sorry, you do not have permission to right click.");\n');
winID.document.write('return false;\n');
winID.document.write('}\n');
winID.document.write('return true;\n');
winID.document.write('}\n');

winID.document.write('document.onmousedown=right;\n');
winID.document.write('document.onmouseup=right;\n');
winID.document.write('if (document.layers) window.captureEvents(Event.MOUSEDOWN);\n');
winID.document.write('if (document.layers) window.captureEvents(Event.MOUSEUP);\n');
winID.document.write('window.onmousedown=right;\n');
winID.document.write('window.onmouseup=right;\n');

winID.document.write('</' + 'script>\n');

winID.document.write('</head>\n');
winID.document.write('</div></body></html>\n');
winID.document.write('<div style="position:absolute;width:' + winWidth + 'px;height:' + winHeight + 'px;left:0px;top:0px">\n');
winID.document.write('<a href="javascript:self.close()" target="_self">\n');
winID.document.write('<img border="0" name="LargeImage" src=' + imageRef + ' width="' + winWidth + '" height="' + winHeight + '" >\n');
winID.document.write('</div></body></html>\n');
winID.document.close();
winID.focus();

}

// =========================================================================
// ******* FUNCTION PAUSES CODE EXECUTION FOR GIVE NUMBER OF SECONDS *******
// =========================================================================

function sleep(numberMillis){

var now = new Date();
var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime)
		return;
	}
}

// =======================================================
// ******* OPEN INDEPENDENT WEBSITE DISPLAY WINDOW *******
// =======================================================

function viewWebsite(URL, siteTitle, screenWidth, screenHeight) {

var windowprops = "toolbar=0, menubar=0, scrollbars=1, resizable=1, location=0, directories=0, status=0, top=10, left=" + (screen.width - (screenWidth + 20)) + ", width=" + screenWidth + ", height=" + screenHeight;
weblinksID = window.open('', 'Weblinks', windowprops);

weblinksID .document.write('<html>\n');
weblinksID.document.write('<head>\n');
weblinksID.document.write('<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">\n');
weblinksID.document.write('<title>' + siteTitle +'</title>\n');
weblinksID.document.write('<meta name="GENERATOR" content="Microsoft FrontPage 4.0">\n');
weblinksID.document.write('<meta name="ProgId" content="FrontPage.Editor.Document">\n');
weblinksID.document.write('<meta name="Microsoft Border" content="t, default">\n');
weblinksID.document.write('</head>\n');

weblinksID.document.write('<frameset framespacing="0" border="0" rows="100,*,50" frameborder="0">\n');
weblinksID.document.write('<frame name="header" src="" scrolling="no" noresize marginwidth="0" marginheight="0">\n');
weblinksID.document.write('<frame name="main" src="" scrolling="auto" noresize marginwidth="0" marginheight="0">\n');
weblinksID.document.write('<frame name="footer" src="" scrolling="no" noresize marginwidth="0" marginheight="0">\n');
weblinksID.document.write('<noframes>\n');
weblinksID.document.write('<body>\n');
weblinksID.document.write('<p>This page uses frames, but your browser doesnt support them.\n');
weblinksID.document.write('</body>\n');
weblinksID.document.write('</noframes>\n');
weblinksID.document.write('</frameset>\n');
weblinksID.document.write('</html>\n');
weblinksID.document.close();
weblinksID.frames[0].location="_borders/header.htm";
weblinksID.frames[1].location=URL;
weblinksID.frames[2].location="_borders/footer.htm";
weblinksID.focus();
}


