// ===============================================
// START Window Opener -- used for Articles
// ===============================================
function openArticle(articleName, path)
{
	window.open( path + '/ui/jsp/articles/' + articleName + '.jsp','ArticlePage','width=670,height=575,scrollbars=yes,toolbar=yes,menubar=no,status=yes,resizable=yes,left=60,top=60,screenX=60,screenY=60');
}


// ===============================================
// START Window Opener -- used for Attoreny Search Results
// ===============================================
function openResults(resultSet)
{
	window.open( resultSet + '.jsp','Results','width=680,height=575,scrollbars=yes,toolbar=no,menubar=no,status=yes,resizable=no,left=60,top=60,screenX=60,screenY=60');
}

// ===============================================
// START Window Opener -- used for HELP PAGES
// ===============================================
function openHelp(helpQuestion)
{
	window.open( helpQuestion + '.jsp','help','width=300,height=300,scrollbars=yes,toolbar=no,menubar=no,status=yes,resizable=no,left=60,top=60,screenX=60,screenY=60');
}


// ===============================================
// START Function for writing date and time
// ===============================================

			var day="";
			var month="";
			var myweekday="";
			var year="";
			newdate = new Date();
			mydate = new Date();
			dston =  new Date('April 4, 1999 2:59:59');
			dstoff = new Date('october 31, 1999 2:59:59');
			var myzone = newdate.getTimezoneOffset();
			newtime=newdate.getTime();
			
			var zone = 5;  // references your time zone
			
			if (newdate > dston && newdate < dstoff ) {
			zonea = zone - 1 ;
			dst = "  ET";
			}
			else {
			zonea = zone ; dst = "  ET";
			}
			var newzone = (zonea*60*60*1000);
			newtimea = newtime+(myzone*60*1000)-newzone;
			mydate.setTime(newtimea);
			myday = mydate.getDay();
			mymonth = mydate.getMonth();
			myweekday= mydate.getDate();
			myyear= mydate.getYear();
			year = myyear;
			
			if (year < 2000)    // Y2K Fix, Isaac Powell
			year = year + 1900; // http://onyx.idbsu.edu/~ipowell
			myhours = mydate.getHours();
			if (myhours >= 12) {
			myhours = (myhours == 12) ? 12 : myhours - 12; mm = " PM";
			}
			else {
			myhours = (myhours == 0) ? 12 : myhours; mm = " AM";
			}
			myminutes = mydate.getMinutes();
			if (myminutes < 10){
			mytime = ":0" + myminutes;
			}
			else {
			mytime = ":" + myminutes;
			};
			armonth = new Array("January ","February ","March ","April ","May ","June ","July ","August ","September ", "October ","November ","December ")
			ardate = new Array("0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
			var time = (armonth[mymonth] +" "+ardate[myweekday] + ", " + year);

// ===============================================
// END Function for writing date and time
// ===============================================			



// ===============================================
// animation
// ===============================================			

function showAnimation() {
    var mainPage = document.getElementById("mainPage");
    var animationPage = document.getElementById("animationPage");
    mainPage.style.visibility = "hidden";
    animationPage.style.visibility = "visible";
}


// ===============================================
// trim function
// ===============================================	
function trim(inputString) {
    // Removes leading and trailing spaces from the passed string. Also removes
    // consecutive spaces and replaces it with one space. If something besides
    // a string is passed in (null, custom object, etc.) then return the input.
    if (typeof inputString != "string") { return inputString; }
    var retValue = inputString;
    var ch = retValue.substring(0, 1);
    while (ch == " ") { // Check for spaces at the beginning of the string
    retValue = retValue.substring(1, retValue.length);
    ch = retValue.substring(0, 1);
    }
    ch = retValue.substring(retValue.length-1, retValue.length);
    while (ch == " ") { // Check for spaces at the end of the string
    retValue = retValue.substring(0, retValue.length-1);
    ch = retValue.substring(retValue.length-1, retValue.length);
    }
    while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
    retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
    }
    return retValue;
}