// JavaScript Document

 function sendmail(sEmail,sDomain)  //Courtesy Bob Dubner
 	{
		url = "mailto:"+sEmail+"@"+sDomain;
 		window.open(url);
		event.returnValue=0;
	}

function	showDate()
	{
		var today = new Date();
		var thisDy = today.getDate();
		var thisMo = today.getMonth();
		var thisYr = today.getFullYear();
		var weekday = today.getDay();
		var month=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//	return month[monthNumber];
	    var day=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
//	return day[dayNumber];
		var ordinal = "th";
		if ((thisDy == 1) || (thisDy == 21) || (thisDy == 31))
			{
				ordinal = "st";
			}
		if ((thisDy == 2) || (thisDy == 22))
			{
				ordinal = "nd";
			}
		if ((thisDy == 3) || (thisDy == 23))
			{
				ordinal = "rd";
			}

//		document.write ("Today is "+day[weekday]+"," + "<br />");
		document.write ("Today is "+day[weekday]+", ");
		document.write (month[thisMo]+" "+thisDy+ordinal+", "+thisYr);

	}
	
function popup_win(officer)
		{
		var path = "../images/"+officer+"-lg.jpg";
		var newWin = window.open(path,"Flotilla_Officer","resizable=no,status=no,scrollbars=no,width=298,height=299");
		/* newWin.resizeTo(300,300); */
		newWin.focus();
		}

function uniform_win(uni)
		{
		var path = "../images/"+officer+"-lg.jpg";
		var newWin = window.open(path,"Flotilla_Officer","resizable=no,status=no,scrollbars=no,width=298,height=299");
		/* newWin.resizeTo(300,300); */
		newWin.focus();
		}
		
function photo_win(path,size)
		{
		var photoWin = window.open(path,"Air Station Caldwell","resizable=no,status=no,scrollbars=no,width=500,height=350");
		photoWin.focus();
		}

function halfMast()
	{
		var today = new Date();
		var thisDy = today.getDate();
		var thisMo = today.getMonth();
		var weekday = today.getDay();
		var thisYr = today.getFullYear();
		var localHour = today.getHours();
		if ((thisMo == 4) && (weekday == 1) && (thisDy > 24) && (localHour < 12))
			{	// Memorial Day Last Monday of May until Noon local time
				document.write ("<img src='../images/usoverunderhalfmast.gif' width='68' height='100' alt='The National Ensign and the USCG Auxiliary Blue Ensign fly at half staff in honor of Memorial Day until Noon local time' title='The National Ensign and the USCG Auxiliary Blue Ensign fly at half staff in honor of Memorial Day until Noon local time'/>");
			}
			else if ((thisMo == 8) && (thisDy == 11))
			{	// Veterans Day November 11
				document.write ("<img src='../images/usoverunderhalfmast.gif' width='68' height='100' alt='The National Ensign and the USCG Auxiliary Blue Ensign fly at half staff in honor of Veterans Day, November 11' title='The National Ensign and the USCG Auxiliary Blue Ensign fly at half staff in honor of Veterans Day, November 11' />");
			}
			else if ((thisYr = 2008) && (thisMo == 1))
			{	// Death of plankowner Vinvent Iannuzzelli - updated for Bob Jenny 2/24/08
				document.write ("<img src='../images/usoverunderhalfmast.gif' width='68' height='100' alt='The National Ensign and the USCG Auxiliary Blue Ensign fly at half staff in honor and tribute to the memory of Flotilla 10-20 member and past FC Bob Jenny' title='The National Ensign and the USCG Auxiliary Blue Ensign fly at half staff in honor and tribute to the memory of Flotilla 10-20 member and past FC Bob Jenny' />");
			}
			else
			{
					document.write ("<img src='../images/usoverunderflag.gif' width='68' height='100' alt='The National Ensign and the USCG Auxiliary Blue Ensign flying at full staff' title='The National Ensign and the USCG Auxiliary Blue Ensign flying at full staff' />");
			}
	}

function halfMastCG()
	{
		var today = new Date();
		var thisDy = today.getDate();
		var thisMo = today.getMonth();
		var thisYr = today.getFullYear();
		var localHour = today.getHours();
		if ((thisMo == 4) && (thisYr == 2004) && (thisDy == 7) && ((localHour >= 11) && (localHour < 13)))
			{
				document.write ("<img src='http://www.uscgaux.org/~airsimage/ushalfmast.gif' width='68' height='100' alt='US and CG Auxiliary flags on staff' />");
			}
			else
			{
					document.write ("<img src='http://www.uscgaux.org/~airsimage/usovercgflag.gif' width='68' height='100' alt='US and CG flags on staff' />");
			}
	}
	
function lastModDate()
	{
		if (Date.parse(document.lastModified) !=0)
		{
			var today = new Date(document.lastModified);
			var thisDy = today.getDate();
			var thisMo = today.getMonth();
			var thisYr = today.getFullYear();
			var weekday = today.getDay();
			var localHour = today.getHours();
			var localMin = today.getMinutes();
			var month=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec");
				//	return month[monthNumber];
		    var day=new Array("Sun","Mon","Tues","Weds","Thurs","Fri","Sat");
				//	return day[dayNumber];
			if (localHour < 10)
					{
						var leadHr = "0";
					}
					else
					{
						var leadHr = "";
					}
				
			if (localMin < 10)
					{
						var leadMin = "0";
					}
					else
					{
						var leadMin = "";
					}

			if (thisDy < 10)
					{
						var leadDy = "0";
					}
					else
					{
						var leadDy = "";
					}
				
						
			var printString =  leadDy + thisDy + "-" + month[thisMo] + "-" + thisYr;
			// printString = printString  + "<br />" + leadHr + localHour + leadMin + localMin + " Hours.";			
		
			document.write(printString);

			// document.write('This document last modified:<br />' + document.lastModified);
		}
		else
		{
			document.write("Cannot Read File Date");

		}
	}

function calendarEntry(year,month,day,eventText)
	{
		var today = new Date();
		var thisDy = today.getDate();
		var thisMo = today.getMonth();
		var thisYr = today.getFullYear();
		var monthName = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
		month--;

			if (((year == thisYear) && (month == thisMo) && (day >= thisDay)) || ((year == thisYear) && (month > thisMo)) || (year > thisYear))
				{
					document.write ("<tr> <td width='130' class='caldate'>");
					document.write (monthName[month]+" "+day+", "+year);
					document.write ("</td> <td class='calevent'>");
					document.write (eventText);
					document.write ("</td> </tr>");
				}
				else
				{
					document.write (year+"||"+thisYr)
					
				}
				
	}

				

// Macromedia Dreamweaver functions


function MM_reloadPage(init) 
	{  //reloads the window if Nav4 resized
		if (init==true) with (navigator)
			{
				if ((appName=="Netscape")&&(parseInt(appVersion)==4)) 
					{
						document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
					}
			}
		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

