/* apprflag.js */

if(document.images) {		// Preload images
}

function getCompEnv(){
	var screenRes = '';
	var cmptrEnv = 'U.A.=' + navigator.userAgent + ', OS=' + window.navigator.platform + ', CPU=' + window.navigator.cpuClass;
	if ( window.screen ){
		screenRes += window.screen.width; 
		screenRes += 'x'; 
		screenRes += window.screen.height;
	}else{
		screenRes = 'Unknown';
	}
	cmptrEnv += ', Resolution=';
	cmptrEnv += screenRes;
	return cmptrEnv;
} // End getCompEnv

function findCurPageName(){
	var url=location.href;
	var lastSlash = url.lastIndexOf("/");
	var curPageName = url.substring(lastSlash+1,url.length);
	var dot = curPageName.indexOf(".");
	curPagePrefix = curPageName.substring(0,dot);
	return curPageName;
} // End findCurPageName

function doSponsors() {
	var sponsors='';
	sponsors+='<div align="center"><img src="./sponsors/betterhomesnj.jpg" alt="Better Homes" width="235" height="281" /></div>';
	sponsors+='<div align="center"><br /><img src="sponsors/ecsales.jpg" alt="Enterprise Car Sales" width="161" height="69" /><br /></div>';
	sponsors+='<div align="center"><br /><img src="./sponsors/AF.jpg" alt="" width="243" height="161" /></div>'; 
	sponsors+='<div align="center"><br /><img src="./sponsors/MB.jpg" alt="" width="243" height="101" /></div>';
	document.write(sponsors);
}
function doTopButton() {
	var pLine = '';
		pLine +='<a href="#"><img src="./images/navtop.gif" style="text-align:center;" width="49" height="24" border="0" alt=""  /></a>';
		pLine +='<br />';
		document.write(pLine);
}
function doLinkLine() {
	var pLine = '';
		pLine +='<br /><span style="text-align:center;font-size:90%"><a href="index.html">Home</a> | <a href="usarmy.html">Army</a> | <a href="usnavy.html">Navy</a> | <a href="usmc.html">Marines</a> | <a href="usaf.html">Air Force</a> | <a href="uscg.html">Coast Guard</a> | <a href="cemeteries.html">Those Who Gave All</a> |<a href="orderform.html">Order Form</a> |<a href="contact.html">Contact Us</a></p>';
		document.write(pLine);
		pLine = '';
		pLine +='<br /><br /><b>APPRECIATION FLAG COMPANY, INC., PO Box 127, Hamburg, NJ 07419</b><br />Telephone:&nbsp; 862-222-3968&nbsp;&nbsp; E-mail:&nbsp; dec@appreciationflag.com<br />';
		pLine +='<br />';
		document.write(pLine);
}
function doFooter(){
	var pLine = '';
	pLine +='<table width="100%"  valign="top" cellpadding="0" cellspacing="0" border="0" summary="page footing">';
	pLine +='<tr><td colspan="2"><img class="botline" src="./images/spacer.gif" width="100%" height="2" border="0" alt=""/></td></tr>';
	pLine +='<tr><td align="left" valign="top"><img src="./images/spacer.gif" border="0" style="margin-right:5px;" alt="" /></td>';
	pLine +='<td class="footer" align="left" valign="top">&copy;&nbsp;' + g_COPYRIGHT + '.&nbsp;&nbsp;All rights reserved.';
	pLine +='<br/>Please report problems viewing this site as ';
	pLine +='<a class="footnote" href="mailto:'+g_WEBMASTERMAILTO + '?subject=Re: Website ' + g_CLIENTURL + ', Page=' + findCurPageName() + ', ';
	pLine +=getCompEnv();
	pLine +='">Comments to Webmaster</a><br/>';
	var sLine= 'Site last modified ' + g_sLASTUPDATE + ', Reviewed ' + g_sLASTREVIEW + '&nbsp;by ' +
		'<a class="footer" href="' + g_WEBMASTERURL + '" target="_blank">' + g_WEBMASTERNM + '</a>&nbsp; ' + 
		'<br/></td></tr></table>';
	pLine += sLine;
	document.write(pLine);
}	//End doFooter
function openPopupWindow(url, winWidth, winHeight, winName) {
//function openPopupWindow(url, winWdth, winHght, winName) {
//var imgObj = new Image();
//imgObj.src = url;
//var winWidth = imgObj.width;
//var winHeight = imgObj.height;
	var W=winWidth;
	var H=winHeight;
	var X_unrounded=(screen.availWidth/2)-(winWidth/2);
	var Y_unrounded=(screen.availHeight/2) - (winHeight/2);

	var X=Math.round(X_unrounded); 
	var Y=Math.round(Y_unrounded);
	
	var popUpName = ''; 
	if(winName) popUpName = winName;	// If winName is available, use it
	else if(typeof g_PopUpName != 'undefined') popUpName = g_PopUpName;	// if popup name is still null and a global name is available, use it
	else popUpName = 'DEFLT';					// Default Window Name
	
	winWidth += 30;		// allow for scroll bar width
	winHeight += 30;	// allow for scroll bar height
	var winParms = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + winWidth + ',height=' + winHeight + ',Left=' + X + ',Top=' + Y + ',left=' + X + ',top=' + Y;

	var htmlcode='';
	htmlcode='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"';
  htmlcode+='"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
  htmlcode+='<html xmlns="http://www.w3.org/1999/xhtml">';
	htmlcode+='<head><title>&nbsp;</title>';
	htmlcode+='<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
	htmlcode+='<meta http-equiv="Content-language" content="en-US" />';
	htmlcode+='<body style="font-family:Arial,Verdana,Helvetica,Geneva,sans-serif;font-size:12px;font-weight:bold;background-color:#003387;color:#ffffff;margin:0px 4px 4px 4px;text-align:center;">';
	htmlcode+='Click Image to Close Window<br />';
	htmlcode+='<a href="javascript:window.close();"><img src="' + url + '" border="0" alt="" /></a>';
	htmlcode+='</body></html>';

	var ran_unrounded=Math.random()*100;									// Generate a random number from 1 - 100
	var ran_number=Math.round(ran_unrounded); 
	var randomname = popUpName+ran_number;								// Append the random number to the window name
	
	var winObj = window.open(url, randomname, winParms);	// Create window object
	winObj.document.writeln(htmlcode);										// Send the html code generated above to the window
	return;
}	// End openPopupWindow
