// HLPS base JS definitions - 01/15/2010
function ief(x,y) // x = top <div> id, y = top <div> width, IE fix
	{
	
	if (x == undefined)
		{x = "T1";}
	if (y == undefined)
		{y = 800;}
	bw = document.body.clientWidth; // Body width
	tw = bw - 20;
	dw = document.getElementById(x).clientWidth; // <div> width
	if (bw>y)
		{
		tw = y - 10; // IE
		ml = Math.round((bw-y)/2);} // margin left
		else
			{ml = 0;}
	if (dw>y)
		{
		document.getElementById(x).style.width=y;
		document.getElementById(x).style.margin="0 auto 0 auto";
			}
	if (dw==0)
		{
		if (bw>y)
			{document.getElementById(x).style.width=y;}
		if (ml>0)
			{document.getElementById(x).style.marginLeft=ml;}
			}
		}

	function w(x) // For HLPS top title bar only, sets jpg width
		{		
		if (dw>0)
			{tw = dw - 30;} // Firefox
		document.getElementById("s1").width = tw;
		}
			
a = "hillsborolighthouse.org";
function em1(x,y,z) // Email, x=anchor ID, y=email title, z=mailbox 
	{
	if (x == undefined)
		{x = "E1";}
	if (y == undefined)
		{y = Undefined;}
	if (z == undefined)
		{z = "info";}	
	document.getElementById(x).href = "mailto:"+z+"@"+a+"?Subject=HLPS%20"+y+"%20page%20query";
	document.write(z+'@'+a);
		}
		
function idx()
	{
	cw = document.body.clientWidth;
	if (cw<800)
		{
		document.write('<div style="border:3px solid #E00000;background:#FFFFFE;color:#E00000;padding:3px;">');
		document.write('<b>Warning:</b> Browser display is '+cw+'px wide s/b 800px wide or more to render properly.</div>');
		}
	z = 0;
	if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
		{
		var ffv=new Number(RegExp.$1); // capture x.x portion and store as a number
		if (ffv > 4.9)
			{
			document.write('<div style="background:#FFFFFE;border:1px solid green;color:green;padding:3px;text-align:center;">');
			document.write('This browser is: Firefox V'+ffv+'</div>');
			}
		else
			{
			document.write('<div style="border:3px solid #E00000;background:#FFFFFE;color:#E00000;padding:3px;">');
			document.write('This browser is: Firefox V'+ffv);
			document.write(', it s/b upgraded to FF V5 or higher for pages to render properly. </div>');
			}
		}	
		else
	 		z++;
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) //test for MSIE x.x;
		{
		var iev=new Number(RegExp.$1); // capture x.x portion and store as a number
		if (iev > 6)
			{
			document.write('<div style="background:#FFFFFE;border:1px solid green;color:green;padding:3px;text-align:center;">');
			document.write('This browser is: IE-V'+iev+'</div>');
			}
		else
			{
			document.write('<div style="border:3px solid #E00000;background:#FFFFFE;color:#E00000;padding:3px;">');
			document.write('This browser is: IE-V'+iev);
			document.write(', it s/b upgraded to IE-V8 or IE-V9 or higher for pages to render properly.</div>');
			}
		}
		else
			z++;
	if (z > 1)
		{
		document.write('<div style="border:3px solid #E00000;background:#FFFFFE;color:#E00000;padding:3px;">');
		document.write('This browser is not a recommended browser such as Firefox V4 or IE-8 or IE-9.</div>');
		}
	}
//
	m1 = " Tour details, 18 Point Walking Tour of the Lighthouse/Grounds (See TOURS in box on right). ";
	var i = 0;
	function marquee()
	{
	m2 = ".                                                                                          .";
	var i0 = m1.length;
	var i1 = i0 * 2;
	var i2 = i0 - i - 1;
	var i3 = i0 - i2;
	if (i < i0)
		{m2 = /* m2.substr(0,i2) + */ m1.substr(0,i3);}
		else
			if (m3.length > 1)
				{m2 = m3.substr(1,m3.length-1);}
	document.mqf.mq.value = m2;
	if (i < i1)
		{i++;}
		else
			{i = 0;}
	m3 = m2;
	setTimeout(marquee,120)
	}
