// JavaScript Document

// Utility scripts - www.lawgcap.org
// Written by Kevin Humbles for Louisiana Wing Civil Air Patrol

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

// hide/show div tag contents
function chgprop(iobj){
	var obj = findObj(iobj);
	
	if(obj.style.display == "block"){
		obj.style.display = "none";
	}else if(obj.style.display == "none"){
		obj.style.display = "block";
	}
}

//icon change from + to - and it rocks
function icontoggle(icon){ 

	var curicon = findObj(icon);

	var icontxt = curicon.innerHTML; 
	
	if (icontxt == '+') { 
		curicon.innerHTML = '-'; 
	} else { 
		curicon.innerHTML = '+'; 
	} 
}



// date formatter and writer
function displaydate(x){
			var now = new Date();
			var m = now.getMonth();
			
			switch(now.getDay()){
				case 0:
					wd = "Sunday";
					break;
				case 1:
					wd = "Monday";
					break;
				case 2:
					wd = "Tuesday";
					break;
				case 3:
					wd = "Wednesday";
					break;
				case 4:
					wd = "Thursday";
					break;
				case 5:
					wd = "Friday";
					break;
				case 6:
					wd = "Saturday";
			}

			switch(now.getMonth()){
				case 0:
					m = "January";
					break;
				case 1:
					m = "February";
					break;
				case 2:
					m = "March";
					break;
				case 3:
					m = "April";
					break;
				case 4:
					m = "May";
					break;
				case 5:
					m = "June";
					break;
				case 6:
					m = "July";
					break;
				case 7:
					m = "August";
					break;
				case 8:
					m = "September";
					break;
				case 9:
					m = "October";
					break;
				case 10:
					m = "November";
					break;
				case 11:
					m = "December";
			}

			var d = now.getDate();
			var y = now.getYear();

			
			
			switch(x){
				case 1:
					document.write(wd + ", " + m + " " + d + ", " + y);
					break;
				case 2:
					document.write(m + " " + d + ", " + y);
			}

}

// Function that is called by the onclick command within the anchor tag
function LinkAlert () 
{
//The alert window and the text that will appear is quoted \n makes a new line
alert ("You have clicked a link that opens a new browser window and connects\n to a server NOT under the control of The Louisiana Wing.");
}

//Random Picture Generator
var imagenumber = 4 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;

message = new Array


message[1] = ""
message[2] = ""
message[3] = ""
message[4] = "" 
message[5] = "" 
message[6] = "" 
message[7] = "" 
message[8] = "" 


var msg = message[rand1]

if (String(rand1).length == 1) {
  rand1 = "0" + rand1;
}


//Protected Email Address Tool
//"><!--

// -->




