// JavaScript Document

// Utility scripts

// 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";
	}
}

// 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.getFullYear();

			
			
			switch(x){
				case 1:
					document.write(wd + ", " + m + " " + d + ", " + y);
					break;
				case 2:
					document.write(m + " " + d + ", " + y);
			}

}