function getBrowserWidth() {
	if (window.innerWidth) {
		return window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth != 0){
		return document.documentElement.clientWidth;
	}
	else if (document.body){
		return document.body.clientWidth;
	}
	return 0;
}

function checkSize() {

	var browserWidth = getBrowserWidth();

	// if less than 1024 width, return with no changes, defaults in index
	if (browserWidth < 1016) { return; };

	// 1024 870 is 85%  calculating gimpimage as 15% of this 85% minus ~10px for border
	if ((browserWidth >= 1016) && (browserWidth < 1272)){
		var tableheaderHTML = '<img src="images/FarcryDesignBanner_1024.jpg" width="870" height="137" align="center" border="0" alt="Farcry Design Banner">';
		var bannerimageHTML = '<table width="870" callpadding="0" cellspacing="0" align="center"><tr><td align="center">';
		var gimpimageHTML = '<a href="GIMP/index.html">GIMP Corner<BR><img src="images/GIMP_Corner_1024.png">';
	};

	// 1280 1088
	if ((browserWidth >= 1272) && (browserWidth < 1672)){
		var tableheaderHTML = '<img src="images/FarcryDesignBanner_1280.jpg" width="1088" height="171" align="center" border="0" alt="Farcry Design Banner">';
		var bannerimageHTML = '<table width="1088" callpadding="0" cellspacing="0" align="center"><tr><td align="center">';
		var gimpimageHTML = '<a href="GIMP/index.html">GIMP Corner<BR><img src="images/GIMP_Corner_1280.png">';
	};

	// 1680 1428
	if (browserWidth >= 1672){
		var tableheaderHTML = '<img src="images/FarcryDesignBanner_1680.jpg" width="1428" align="center" border="0" alt="Farcry Design Banner">';
		var bannerimageHTML = '<table width="1488" callpadding="0" cellspacing="0" align="center"><tr><td align="center">';
		var gimpimageHTML = '<a href="GIMP/index.html">GIMP Corner<BR><img src="images/GIMP_Corner_1680.png"></a>';
	};

	// 1367
	// most people in this range are going to be 1400x900 or 1400x1050

	// 1400
	// most will be 16xx x 10xx or 12xx

	// 1781 to infinity
	// most will be 1920x1080 or 1920x1200

	document.getElementById('bannerimage').innerHTML = bannerimageHTML;
	document.getElementById('tableheader').innerHTML = tableheaderHTML;
	document.getElementById('gimpimage').innerHTML = gimpimageHTML;
	return;
}

// This script opens a new browser window and writes
// HTML to display an image with a title and caption
function show_photo( pFileName, pTitle, pCaption, BG, TextC ) {
// specify window parameters
	photoWin = window.open( "", "photo", "width=900,height=712,status,scrollbars,resizable,screenX=20,screenY=40,left=20,top=40");
// wrote content to window
	photoWin.document.write('<html><head><title>' + pTitle + '</title><link rel="stylesheet" type="text/css" href="FarcryDesignGallery.css" ></head>');	
	photoWin.document.write('<body bgcolor="' + BG + '" text="' + TextC + '">');
	photoWin.document.write('<div ID=gal>');
//	photoWin.document.write('<center>');
	photoWin.document.write('<h1>Farcry Design Photo Gallery</h1>');
//	photoWin.document.write('<h1 class=gal>Farcry Design Photo Gallery</h1>');
//	photoWin.document.write('<br /><img src="' + pFileName + '" height=540 border=0>');
	photoWin.document.write('<br /><a href="' + pFileName + '"><img src="' + pFileName + '" height=540 border=0></a>');
	photoWin.document.write('<br /><strong>"' + pTitle + '"</strong>');
	photoWin.document.write('<br /><i>' + pCaption + '</i></div>');
	photoWin.document.write('<div ID="close"><a href="javascript:self.close()">Close</a>&nbsp;&nbsp;&nbsp;</div>');
	photoWin.document.write('<div align="center"><span class="copyright">&copy; Copyright 1999-2009 Farcry Design. All rights reserved.</span></div>');
	photoWin.document.write('<br /></body></html>');
	photoWin.document.close();	
// If we are on NetScape, we can bring the window to the front
	if (navigator.appName.substring(0,8) == "Netscape") photoWin.focus();
}

// This script for movies
function show_movie( pFileName, pTitle, pWidth, pHeight, oWidth, oHeight) {
// specify window paramaters
	movieWin = window.open( "", "photo", "width="+oWidth+",height="+oHeight+",status,scrollbars,resizable,screenX=20,screenY=40,left=20,top=40");
// wrote content to window
	movieWin.document.write('<html><head><title>' + pTitle + '</title><link rel="stylesheet" type="text/css" href="FarcryDesignGallery.css" ></head>');	
	movieWin.document.write('<body>');
	movieWin.document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr>');
	movieWin.document.write('  <td valign="middle" width="30"><a href="index.html" target="new"><img src="images/ChristianIslandBBLogoMini.png" alt="Christian Island B and B Logo" border="0" height="30" width="30"></a></td>');
	movieWin.document.write('  <td width="10">&nbsp;</td>');
	movieWin.document.write('  <td align="left" valign="middle" width="99%"><a href="index.html" target="new">Christian Island Bed &amp; Breakfast</a> <span class="small">[homepage]</span></td>');
	movieWin.document.write('</tr></tbody></table>');
	movieWin.document.write('<table align="center" cellpadding="10" cellspacing="0" width="100%">');
	movieWin.document.write('<tr><td bgcolor="#2a5943">');
	movieWin.document.write('<table align="center" cellpadding="20" cellspacing="0" width="100%">');
	movieWin.document.write('<tr><td bgcolor="white">');
	movieWin.document.write('<h1>Movie Clip:</h1>');
	movieWin.document.write('<p /><div align="center">');
	movieWin.document.write('<object id="MediaPlayer1" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ');
	movieWin.document.write('standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" width="' + pWidth + '" height="' + pHeight + '">');
	movieWin.document.write('<param name="fileName" value="' + pFileName + '">');
	movieWin.document.write('<param name="animationatStart" value="true">');
	movieWin.document.write('<param name="transparentatStart" value="false">');
	movieWin.document.write('<param name="autoStart" value="false">');
	movieWin.document.write('<param name="showControls" value="true">');
	movieWin.document.write('<param name="Volume" value="-450">');
	movieWin.document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="' + pFileName + '" name="MediaPlayer1" width="' + pWidth + '" height="' + pHeight + '" autostart="1" showcontrols="1" volume="-450"></embed>');
	movieWin.document.write('</object>');
	movieWin.document.write('<br /><div align="center"><strong>"' + pTitle + '"</strong></div>');
	movieWin.document.write('<p></p><div align="center"><a href="javascript:self.close()"><img src="images/buttons/close.jpg" alt="Close" border="0" height="24" width="55"></a></div>');
	movieWin.document.write('<p>WTH?</p><div align="center"><a href="javascript:self.close()">Close</a></div>');
	movieWin.document.write('</td></tr></table>');
	movieWin.document.write('</td></tr></table>');
	movieWin.document.write('<p></p><div align="center"><span class="copyright">&copy; Copyright 1999-2009 Farcry Design. All rights reserved.</span></div>');
	movieWin.document.write('</body></html>');
	movieWin.document.close();	
// If we are on NetScape, we can bring the window to the front
	if (navigator.appName.substring(0,8) == "Netscape") movieWin.focus();
}

