var ldates = new Array();
var grps   = new Array();
var grpnames = new Array();
var cannedgrpnames = new Array();
var curflts = new Array();
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var timeUTC = '';
var srhr    = '';
var srmn    = '';
var sunrise = '';
var getspan3 = '';
//var trCnt;
var td1;
var cancelled_count = 0;
var grp = '';
//var trtag = new Array();
//var alltds = new Array();
var trtag = "";


/*
mybody      = document.getElementsByTagName("body")[0];
mytable     = mybody.getElementsByTagName("table")[0];
mytablebody = mytable.getElementsByTagName("tbody")[0];
myrow       = mytablebody.getElementsByTagName("tr")[1];
mycel       = myrow.getElementsByTagName("td")[1];
*/

var trCnt = document.getElementsByTagName("TR").length;   /* how many TRs */

function stats_by_group() {
	mybody  = document.getElementsByTagName("body")[0];
	mytable = mybody.getElementsByTagName("table")[0];
        
	for (i=1; 1<trCnt; i++){
		trtag  = mytable.getElementsByTagName("tr")[i];
		alltds = trtag.getElementsByTagName("TD");
		td1    = alltds[0];		
		str    = td1.innerHTML;	
	                                                  	//if (i<3) {alert(str);}
			var m = str.indexOf('cancelled');			  	
					
		allspan1 = td1.getElementsByTagName("span");	 						
		spanx    = (allspan1[4].innerHTML).split('<');	
		spany	 = (allspan1[0].innerHTML).split('<');
		spanz    = (allspan1[1].innerHTML).split('<');
		
			span4 	= spanx[0];    /* Group Name */
			dowspan = spany[0];    /* Day of Week */
			fltyr   = new Date(spanz[0]).getFullYear();    /* Year of launch */	
			
			if (m<0){grpnames[i] = span4;} else if(m>0) {cannedgrpnames[i] = span4;} 
			  if (fltyr == 2009) {}
	}	
}


/*http://bytes.com/topic/javascript/answers/151235-count-elements-array */
function countvalues(a) {
	var b = {}, i = a.length, j;
		while( i-- ) {
			j = b[a[i]];
			b[a[i]] = j ? j+1 : 1;
		}
	return b; // an object of element:count arrays
}

/* Build a report of scheduled, cancelled, and launched flights by group. */
function grppop() {
	var a = countvalues(grpnames.sort().reverse());
	var c = countvalues(cannedgrpnames.sort().reverse());

	var msg='';
	var mst='';
	var ce = 0;
	var ae = 0;
	var dt=new Date();

	// To see how many times each element appears
		for (elem in a){
	//	if (a=1) alert(elem);
			ce = c[elem];
				if (ce==undefined) {ce=0}
			ae = a[elem];
				if (ae==undefined) {ae=0}

			msg += '\n<tr><td>' + elem + '</td><td>'+ ae +'</td><td>'+ ce + '</td><td>'+ (ae - ce) + '</td></tr>';
		}  
		for (elem in c){
			mst += '\n<tr><td>' + elem + '</td><td>'+ a[elem] +'</td><td>'+ c[elem]+ '</td><td></td></tr>';
		}
		
  var generator=window.open('','name','resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
  
  generator.document.write('<html><head><title>Popup</title>');
  generator.document.write('<link rel="stylesheet" href="css/arhab.css">');
  generator.document.write('</head><body>');
  generator.document.write('<h2>Launch Report by Group</h2>');
  generator.document.write(dt);
  generator.document.write('<table id="background-image" summary="Groups Flight Report">');
  generator.document.write('<thead>');
  generator.document.write('<tr>');
  generator.document.write('<th scope="col">Group Name</th>');
  generator.document.write('<th scope="col">Scheduled </br />Flights</th>');
  generator.document.write('<th scope="col">Cancelled </br />Flights</th>');
  generator.document.write('<th scope="col">Total </br />Launches</th>');
  generator.document.write('</tr>');
  generator.document.write('</thead>');
  generator.document.write('<tbody>');
  generator.document.write(msg);
  generator.document.write('</tbody>');
  generator.document.write('</table>');
  generator.document.write('<p><a href="javascript:self.close()"> Close</a> the report.</p>');
  generator.document.write('</body></html>');
  generator.document.close();
  
  // To see how many times a particular element appears
  //alert( countvalues(arr)['Bear'] );
}


/* this function allows the user to see just the rows associated with one group */
function show_group(grp) {
	//alert(grp);
	for (i=1; i<trCnt; i++) {			
		trtag  = document.getElementsByTagName("TR")[i];
		alltds = trtag.getElementsByTagName("TD");
		td1      = alltds[0];							 
		
		allspan1 = td1.getElementsByTagName("span");	 						
		spanx    = (allspan1[4].innerHTML).split('<');	
		span4 = spanx[0];

		if (span4 == grp) {
			allspan1[4].innerHTML = grp+'<br /><br /><form><input type="button" onclick="refresh()" value="Show all Groups"></form>';
			trtag.style.display = '';
		}else trtag.style.display = 'none';
	}
}

/* Primary function to build announce page */
/* On the initial load the sumstate is empty, so the defaul is to show active flights only */
function countTR(trID,sumstate) {	
  if (sumstate == ' ') {sumstate = 'unchecked'; } /* checkbox on html page is unchecked, show active flights */
  
//scrnSize();

 // alert('scrnWidth= '+scrnWidth+'\n\nscrnHeight= '+scrnHeight);
 // alert('scrnWidth= '+Math.round(scrnWidth*.9)+'\n\nscrnHeight= '+Math.round(scrnHeight*.9));

/* Functions below here are for use with ARHABlaunchannouncements.html */
var ssid  = new Array();
var qrz   = new Array();
var qrx   = new Array();

var trtag = '';
var td = new Date(); /* todays date */
	tdyear 	  = td.getFullYear();
	tdmnth    = td.getMonth()+1;
	tdday     = td.getDate();
var kday      = new Date(tdmnth+'/'+tdday+'/'+tdyear);
var kdate     = new Date(tdmnth+'/'+tdday+'/'+tdyear);
    kdate.setDate(kdate.getDate()+5);

var tdplus5 = new Date();
    tdplus5.setDate(tdplus5.getDate()+5);  /* tdplus5 is today plus 5 days */
var tdplus1 = new Date();
	tdplus1.setDate(tdplus1.getDate()+1);  /* tdplus1 is today plus 1 day  */
	
var s;
var marked = 0;


/* the following is for debugging */
var myDate=new Date();
myDate.setFullYear(2009,9,2);  /* 10/3/2009, the 9 is for October */

/* Lets take a walk through the DOM */
  
	trCnt = document.getElementById(trID).getElementsByTagName("TR").length;   /* how many TRs */
			  
		for (var i=1; i<trCnt; i++) {			
			    trtag  = document.getElementsByTagName("TR")[i]; /* get the ith TR tag */			
			var alltds = trtag.getElementsByTagName("TD");		 /* gets all the TDs inside this TR */
			
			var td1       = alltds[0];							 /* first TD tag */
			    
			var allspan1  = td1.getElementsByTagName("span");	 /* gets the span tags from inside the 1st TD */
			var span1     = allspan1[0];						 /* this is the first span in this TD */							
			var span2     = allspan1[1];						 /* this is the second span in this TD tol */
			    dol       = allspan1[1].innerHTML;				 /* date of launch */
			var span3     = allspan1[2];						 /* tol */
			    tol       = allspan1[2].innerHTML;				 /* time of launch */
			var span4     = allspan1[3];
			var ld        = new Date(span2.innerHTML);			 /* launch date from the first span */
				ldates[i] = ld;
				ldyear 	  = ld.getFullYear();
				ldmnth    = ld.getMonth()+1;
				ldday     = ld.getDate();
			var span5     = allspan1[4];						 /* Groupname */
				grps[i]   = span5.innerHTML;
							
			var xd        = new Date(span2.innerHTML);
						
			var td2       = alltds[1];							 /* second TD tag */
			var allspan2  = td2.getElementsByTagName("span");
			var fltname   = allspan2[0].innerHTML;                /* flight name */
			var launchst  = allspan2[1].innerHTML;                /* launch site */
			var coords    = allspan2[2].innerHTML;                /* get the coords, 3rd span */
			var cord      = coords.split(',');                    /* split lat and long */
			
			var td3 = alltds[2];								 /* third TD tag */
			var allspan3 = td3.getElementsByTagName("span");	 /* gets the span tags from inside the 3rd TD */
			var bcall = allspan3[0].innerHTML; 				     /* get the balloon call sign(s) */
			var freq = allspan3[1].innerHTML;					 /* get the freq(s) */
			
			var td4 = alltds[3];								 /* fourth TD tag */
			var allspan4 = td4.getElementsByTagName("span");	 /* gets all the span tags from the fourth TD */
			var website = allspan4[0].innerHTML;				 /* websites span tag in the fourth TD */
			var contact = allspan4[1].innerHTML;			     /* contacts span tag in the fourth TD */
			
			var td5 = alltds[4];								 /* fifth TD tag */
			
						
			/* ========================================================================================== */

			
			/* if the flight was a success change the background to green */
			if (ld <= td) {
				trtag.style.backgroundColor = "#56d74d";  /* green */
			}
			
			/* if the flight was cancelled change the background to red   */
			if (td1.innerHTML.indexOf("cancelled") > 0) {
				trtag.style.backgroundColor = "#f79abd";  /* red */
				cancelled_count = cancelled_count + 1;
			} 
			
			if (sumstate == 'unchecked') {
				if (xd.setDate(xd.getDate()+9) <= td) {
					trtag.style.display = 'none';
										
				if (trtag.style.display == 'none') {
						curflts[i] = span5.innerHTML;	/* count the number hidden */
				}			
				}
			}

			/* ====================================== */
			/* Work for the launch location column #1 */	
			/* ====================================== */
			
			span1.innerHTML = dayNames[ld.getDay()] + '<br />'; 		 /* day of week */
			grp = allspan1[4].innerHTML;  /* just the group name */
			
			/* build a button to show the group history */  /* or use the link thing below */
			grpspan1 = '<form><input type="button" onclick="show_group('
			grpspan2 = "'"+grp+"'";
			grpspan3 = ')" value="Show Group History"></form>'
			grpspan = grpspan1+grpspan2+grpspan3;
			
			/* build a link to show the group history */   
			pt1 = '<a href="" OnClick="javascript:show_group('
			pt2 = "'"+grp+"'";
			pt3 = ');return false;">Show group history</a>';
		//	grpspan = pt1+pt2+pt3;
			
			/* the *-1 in cord[1] is to correct for an error in the calcSunriseUTC function */
			if (cord[0] !== '') {
				timeUTC  = calcSunriseUTC(calcJD(ldyear, ldmnth, ldday), cord[0], (cord[1]*-1)); 
				srhr     = Math.floor(timeUTC/60);
				srmn     = timeUTC%60;
				sunrise  = srhr+':'+Math.round(srmn)+' UTC';
				getspan3 = 'Sunrise: ' + sunrise + '<br /><br />Launch: ' + span3.innerHTML+'<br />';
			
				allspan1[2].innerHTML = getspan3;
				
			}else allspan1[2].innerHTML = '';
			
				/* this creates the show group history button */ 
				allspan1[4].innerHTML = allspan1[4].innerHTML+'<br /><br />'+grpspan;
				
						
			/* ====================================== */
			/* Work for the launch location column #2 */	
			/* ====================================== */
			
		/*	var nearest = http://ws.geonames.org/countrySubdivisionJSON?lat='+removeSpaces(cord[0])+'&lng='+removeSpace(cord[1]);
									
		alert(nearest); */
		
		ddol = dol.replace(/\//g, '-');
		
		/*strvar = '/';
		
		doll = dol.replace(strvar, "-"); doll = doll.replace(strvar, "-");*/
		
			
			var launchMap = '<br /><br /><a href="http://aprs.fi/?lat='+removeSpaces(cord[0])+'&lng='+removeSpaces(cord[1])+'&label=Launch site of: '+fltname+' by '+grp+', On: '+ddol+', At: '+tol+' '+' &z=17&mt=hybrid" target="_blank">Launch site map</a>';		
			
			/* add launch site map to the 2nd TD */	
			if (coords !== ''){ 
				td2.innerHTML = launchst+'<br /><br /><b>Lat/Lon:<br />'+coords+'</b><br /><br />'+launchMap;
			/*	td2.innerHTML = td2.innerHTML + launchMap; */
			} else {
				td2.innerHTML = launchst+'<br /><br />'+coords+'</b><br /><br />'+'Launch site unknown';
			}
					
			/* ================================================ */
			/* Work for the Callsigns and Frequencies column #3 */	
			/* ================================================ */			
			
			/* below we build a qrz lookup into each call sign, this also rebuild the entire 3rd TD */
			/* so that the call is followed by the frequency it will be on and two spaces */
			/* the 2nd span in the 3rd TD is then blanked out so as to not show in the column */
			/* be advised I have the css set to no decoration */
			var multiCall = bcall.split(',');					/* split the calls */
			var multiFreq = freq.split(',');                    /* split the modes & freqs */
			var callCnt   = multiCall.length;					/* how many calls are there */
			var s1 = "";
			
			var aprsfispan = '<a href="http://aprs.fi/?call=';
		
			/* This loop builds a QRZ lookup query for each call sign and it builds the multi-tracking aprs.fi link */
			for (j=0; j<callCnt; j++){		
				qrz[j]  = "";
				qrx[j]  = "";
				ssid[j] = "";	 
				
				calls   = multiCall[j].split('-');		/* split the call from the ssid */
				ssid[j] = calls[1];
				
				qrz[j]  = '<a href="http://www.qrz.com/db/'+ removeSpaces(calls[0])+
				  '" target="_blank"><b>'+removeSpaces(multiCall[j])+'</b></a><br />'+multiFreq[j]+'<br /><br />';			
												
		//		qrz[j] = '<a href="http://www.qrz.com/db/'+ removeSpaces(calls[0])+
		//				 '" rel="lyteframe" rev="width:'+ Math.round(scrnWidth*.7)+
		//				 'px; height:'+Math.round(scrnHeight*.7)+
		//				 'px; scrolling: auto;" title="QRZ Lookup"><b>'+
		//				 removeSpaces(multiCall[j])+'</b></a><br />'+multiFreq[j]+
		//				 '<br /><br />';
						
				aprsfispan = aprsfispan + removeSpaces(multiCall[j])+ ',';
							
				s1 = s1+'<br />'+qrz[j];	  	
				
			} /* end j loop */
			
			/* flight name and the new call sign display in the third td */										
			allspan3[0].innerHTML = '<b><i>'+fltname+'</i></b>'+'<br /><br />'+s1;	
			allspan3[1].innerHTML = '';     /* replace the freq in span 2 of TD 3 */
	
			for (m=0; m < callCnt; m++) {		/* clean up the mess left by the above */
				qrz[m]  = ""; 
				qrx[m]  = "";
				ssid[m] = ""; 
			} /* end m loop */
			
			/* =========================================== */
			/* Work for the web pages and emails column #4 */
			/* =========================================== */
			
			/* create a mailto works for 2 only...* see adjweb for ideas */
			var adjCon   = '<b>Contact:';
			var peeps    = '<br />';
			if (contact.length > 0){
				var conArray = contact.split(","); 				
				  if (conArray.length == 2) {
					var name     = conArray[0];
					var addr     = conArray[1];
					var adjCon   = '<b>Contact: <a href="mailto:'+removeSpaces(addr)+'">'+name+'</a></b>';
				  }else if (conArray.length == 4) {
				    var name     = conArray[0];
					var addr     = conArray[1];
				  	var name2    = conArray[2];
				  	var addr2    = conArray[3];
				  	var adjCon   = '<b>Contact: <a href="mailto:'+removeSpaces(addr)+'">'+name+'</a></b>'+
				  	  ' <b>or: <a href="mailto:'+removeSpaces(addr2)+'">'+name2+'</a></b>';
				  } 
			}
					
			/* Clean up the website address */
			var adjWeb = '<b>Websites: </b><br />';
			if (website.length > 5){
			  	var multiWeb = website.split(',');
			  	var webCnt   = multiWeb.length;
			  		for (w=0; w < webCnt; w++) {
			    		adjWeb = adjWeb + '<b><a href="'+removeSpaces(multiWeb[w])+'" target="_blank">'+multiWeb[w]+'</a></b>';
			    	}
			} else {var adjWeb = '<b>Website: None</b>';}
														
			/* This is a link to both aprs.fi and findu.com, The aprsfispan var is created above */
			var fispan = '<br /><br /><b>Flight tracking Sites:</b>'+
			  '<br />'+aprsfispan+'" target="_blank">Click for flight map on aprs.fi</a><br /><br />'+
			  '<a href="http://www.findu.com/cgi-bin/find.cgi?'+removeSpaces(multiCall[0])+
			  '" target="_blank">Click for FindU.com</a>'+
			  '<br /><br /><a href="http://db.aprsworld.net/datamart/switch.php?call='+
			  removeSpaces(multiCall[0])+'&maps=yes" target="_blank">Aprsworld.net</a>';
								
			/* use the lat/long of launch to create a wx forecast and clear skys chart, launchsite wont work */
			var wx     = '<br /><br /><b>Weather Sites:</b>'+
			  '<br /><a href="http://forecast.weather.gov/MapClick.php?site=LOT&textField1='+cord[0]+
			  '&textField2='+cord[1]+'&e=0">Click for Weather Forecast</a><br /><br />'+
			  '<a href="http://cleardarksky.com/cgi-bin/find_chart.py?type=llmap&olat='+cord[0]+
			  '&olong='+cord[1]+'&unit=1&radius=50" target="_blank">Clear Sky Chart</a>' +
			  '<br /><br /><a href="http://forecast.weather.gov/MapClick.php?' +
			  'b0=t&b0mn=&b0mx=&b1=rh&b1mn=&b1mx=&b2=td&b2mn=&b2mx=&b3=wsmph&b3'+
			  'mn=0&b3mx=10&b4=sc&b4mn=0&b4mx=50&b5=pp&b5mn=0&b5mx=25&textField1='+cord[0]+
			  '&textField2='+cord[1]+'&Submit=Submit&FcstType=wxplan&site=EAX">Activity Planner</a>';
			
			var newInnertd4 = adjWeb+'<br /><br />'+adjCon;	
	
			// launch date is yesterday or earlier and it wasnt cancelled, just show tracking sites 
			if (ld < kday & (td1.innerHTML.indexOf("cancelled") <= 0)) {
				newInnertd4 = newInnertd4 + fispan;
			}

			// launch date is between today and 5 days from now add the weather sites
		/*	if (ld <= kdate & ld >= kday & (td1.innerHTML.indexOf("cancelled") <= 0)) {			
				newInnertd4 = newInnertd4 + wx + fispan;
			} else if (ld <= kdate & ld >= kday) { 
				newInnertd4 = newInnertd4 + wx;
			} */
			
			if (ld <= kdate & ld >= kdate){  /* was kday */
				newInnertd4 = newInnertd4 + wx;
			} else if (ld <= kdate & ld >= kday & (td1.innerHTML.indexOf("cancelled") <= 0)) {			
				newInnertd4 = newInnertd4 + wx + fispan;
			}
			
				allspan4[0].innerHTML = newInnertd4;
				allspan4[1].innerHTML = ''; 
				
			var completed_flights = trCnt - cancelled_count;	
			var percent_completed = (completed_flights/trCnt)*100;
				
			/* these go in the banner on the right side of the window */
			stats = '<span style="color: red; float: left;">Launch Statistics (8/09 to date):</span><br />' +		
					'Scheduled Launchs: ' + trCnt + '<br />' +
	        		'Cancelled Launches: ' + cancelled_count + '<br />' +
	        		'Completed Flights: ' + completed_flights + '<br />' +
	        		'<span style="float: right;">======================= </span><br />' +
	        		'<span style="color:green;">Completed: ' + 
	        		Math.round(percent_completed*10)/10 + '%</span>';
	        
			  document.getElementById('fltstats').innerHTML = stats;			
			  
			 /* this combo of creating the last updated date and using innerHTML breaks IE6 */
			//  lastupdatedate = lastupdate();
			  
			//  document.getElementById('lastupdate').innerHTML = lastupdatedate;
				
		}	/* end of i loop */    

			addCounts();
} /* end of function */


function addCounts(val) {
	ckval = document.ftr.somerecords.checked;
	parts = grps.length - curflts.length;

	if (val == 'all' & ckval === false) 
		document.getElementById('flts').innerHTML = 'All '+grps.length+' Flights shown';
	else 
		document.getElementById('flts').innerHTML = parts+' of '+grps.length+' Flights shown';	
}


/* This function is for use with links.html */ 
function groupTR(trID) {		  
	//var trCnt = document.getElementById(trID).getElementsByTagName("TR").length; /* how many TRs */
		document.getElementById("memCounts").innerHTML = 'TOTAL: '+trCnt+
		' Ham Radio Groups &amp; Educational Institutions';
	  
		for (var i=1; i < trCnt; i++) {								
			var trtag = document.getElementsByTagName("TR")[i];	 /* get the ith TR tag */			
			var alltds = trtag.getElementsByTagName("TD");		 /* gets all the TDs inside this TR */
			
			var td1      = alltds[0];							 /* first TD tag */
			var allspan1 = td1.getElementsByTagName("span");	 /* the span tags from inside the 1st TD */
			var span1    = allspan1[0];							 /* this is the first span in this TD */							var span2    = allspan1[1];						 /* this is the second span in this TD */
			
			var td2 = alltds[1];								 /* second TD tag */
			var shortx = td2.innerHTML;
			var newinner = '<span style="font-size:18pt; color:red;">'+shortx+'</span>';
				td2.innerHTML = newinner;
			var allspan2 = td2.getElementsByTagName("span");
			
			var td3 = alltds[2];								 /* third TD tag */
			var allspan3 = td3.getElementsByTagName("span");
			var td3string = td3.innerHTML;                       /* String in td #3 */
			
			var td3Array = td3string.split('http://');           /* split the string at http:// */
			
			if (td3Array.length > 1) {
			
				if (td3Array[1] === ''){1 + 1;}                         /* no http do nothing */
				else{
				var td3split = td3Array[0]+'<br /><a href="http://'+removeSpaces(td3Array[1])+
				'">http://'+removeSpaces(td3Array[1])+'</a>';
			
					td3.innerHTML = td3split;		
				} /* end of else loop */
			}  /* end of if loop */
		}	/* end for loop */		
} /* end of function */


/* this function is for the annomail page */
var balcnt;

function ballcnt(){
	showDiv(bal1, ' ');
	showDiv(bal2, ' ');
	showDiv(bal3, ' ');
		balcnt = document.getElementById("balcnt").value;
		  if (balcnt == 1) {
		  	showDiv(bal1,'show');
		  }else if (balcnt == 2) {
		  	showDiv(bal2,'show');
		  }else if (balcnt == 3) {
		  	showDiv(bal3,'show');
		  }else if (balcnt >= 4) {
		  	alert('I can only handle up to three balloons at the momement.\nPlease submit any additonals on a\nseperate form.\n\nThanks... the management hi hi');
		  }
}

function showDiv(DivID, state) {
	if (state == " ") {
 		DivID.style.display='none';
	} else {
		DivID.style.display='block';
	}	
}

function removeSpaces(string) {
	var tstring = "";
	  string = '' + string;
	  splitstring = string.split(" ");
			try {
		  		for(i = 0; i < splitstring.length; i++)
			  		tstring += splitstring[i];
						return tstring;
			}catch(e) {
				alert('Error 1289:\n\nThere is a problem with the call sign, please check the value.');
				//	return;
			}
}

function displayRow(trID, state){
	saying = document.getElementById('showAll').innerHTML;
		if (saying == 'Show all records') {document.getElementById('showAll').innerHTML = 'Show current records';
		}else {document.getElementById('showAll').innerHTML = 'Show all records';}
	
	var trCntt = document.getElementById(trID).getElementsByTagName("TR").length; 
	    td = new Date();
		for (var i=1; i<trCntt; i++) {			
			trtag  = document.getElementsByTagName("TR")[i];
			alltds = trtag.getElementsByTagName("TD");
			td1      = alltds[0];							 
			allspan1 = td1.getElementsByTagName("span");	 						
			span2    = allspan1[1];	
			xd     = new Date(span2.innerHTML);
		
			if (xd.setDate(xd.getDate()+9) <= td) {
				if (trtag.style.display === '')  trtag.style.display = 'none';
				else trtag.style.display = '';
			}
		}
}

function lastupdate() {
			datUpdated = new Date(document.lastModified) ;
			datMonth = datUpdated.getMonth() + 1 ;
			datDate = datUpdated.getDate() ;
			datYear = datUpdated.getFullYear() ;
			inside = ("<p style='font-style: italic; color:red; font-weight: bold;'>Last Updated: " + 
			  datMonth + "/" + datDate + "/" + datYear + "</p>") ;
			
			return inside;
}

/* this javascript from; http://www.howtocreate.co.uk/tutorials/javascript/browserwindow */
var scrnWidth = 0, scrnHeight = 0;
function scrnSize() {
  //var scrnWidth = 0, scrnHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    scrnWidth = window.innerWidth;
    scrnHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    scrnWidth = document.documentElement.clientWidth;
    scrnHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    scrnWidth = document.body.clientWidth;
    scrnHeight = document.body.clientHeight;
  }

  return [ scrnWidth, scrnHeight ];
 
}

