
try {
	document.execCommand('BackgroundImageCache', false, true);
} 
catch (e) {
}

function storeCaret(textArea) {
	if (textArea.createTextRange) 
		textArea.caretPos = document.selection.createRange().duplicate();
}

function insertHTML(textArea, html) {
	if (textArea.createTextRange && textArea.caretPos) {
		var caretPos = textArea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? html + ' ' : html;
	} 
	else {
		textArea.value += html;
	}
	textArea.focus();
}



function ImagePreLoad() {
	if (document.images) {
		preLoad1 = new Image();
		preLoad1.src = "\images/h_who_on.gif";
		
		preLoad2 = new Image();
		preLoad2.src = "\images/h_what_on.gif";
		
		preLoad3 = new Image();
		preLoad3.src = "\images/h_links_on.gif";
		
		preLoad4 = new Image();
		preLoad4.src = "\images/h_contact_on.gif";
		
		preLoad5 = new Image();
		preLoad5.src = "\images/h_login_on.gif";
	}
}

function goToURL(form)
  {

    var myindex=form.dropdownmenu.selectedIndex
    if(!myindex=="")
      {
        window.location.href=form.dropdownmenu.options[myindex].value;

      
      }
}


// Define all the images and states for rollovers.
// Only define the 4 main sections here, as well as the text-block rollover.
if (document.images) {
// _On_ states
  whoOn = new Image();
  whoOn.src = "/images/h_who_on.gif";
  whatOn = new Image();
  whatOn.src = "/images/h_what_on.gif";
  linksOn = new Image();
  linksOn.src = "/images/h_links_on.gif";
  contactOn = new Image();
  contactOn.src = "/images/h_contact_on.gif";
  loginOn = new Image();
  loginOn.src = "/images/h_login_on.gif";
// _Off_ states
  whoOff = new Image();
  whoOff.src = "/images/h_who_off.gif";
  whatOff = new Image();
  whatOff.src = "/images/h_what_off.gif";
  linksOff = new Image();
  linksOff.src = "/images/h_links_off.gif";
  contactOff = new Image();
  contactOff.src = "/images/h_contact_off.gif";
  loginOff = new Image();
  loginOff.src = "/images/h_login_off.gif";
}
// This function performs all rollovers on the page.  Pass desired image state and image name.
function rotate(state,imageName) {
        if (document.images) {
               document.images[imageName].src = eval(state + ".src");
        }
}
// Use this to preload the 4 text-block rollovers on the right of the page.
// Make sure it is called with an _onload_ in the body tag.
function ImagePreLoad() {
  if (document.images) {
    preLoad1 = new Image();
    preLoad1.src = "/images/h_who_on.gif";
preLoad2 = new Image();
    preLoad2.src = "/images/h_what_on.gif";
	preLoad3 = new Image();
    preLoad3.src = "/images/h_links_on.gif";
	preLoad4 = new Image();
    preLoad4.src = "/images/h_contact_on.gif";
	preLoad5 = new Image();
    preLoad5.src = "/images/h_login_on.gif";
  }
}






// This breaks the page out of frames from another site.
if (top.location != self.location) {top.location = self.location}


// Define all the images and states for rollovers.
// Only define the 4 main sections here, as well as the text-block rollover.
if (document.images) {
// _On_ states
  whoOn = new Image();
  whoOn.src = "/images/h_who_on.gif";
  whatOn = new Image();
  whatOn.src = "/images/h_what_on.gif";
  linksOn = new Image();
  linksOn.src = "/images/h_links_on.gif";
  contactOn = new Image();
  contactOn.src = "/images/h_contact_on.gif";
  loginOn = new Image();
  loginOn.src = "/images/h_login_on.gif";
// _Off_ states
  whoOff = new Image();
  whoOff.src = "/images/h_who_off.gif";
  whatOff = new Image();
  whatOff.src = "/images/h_what_off.gif";
  linksOff = new Image();
  linksOff.src = "/images/h_links_off.gif";
  contactOff = new Image();
  contactOff.src = "/images/h_contact_off.gif";
  loginOff = new Image();
  loginOff.src = "/images/h_login_off.gif";
}
// This function performs all rollovers on the page.  Pass desired image state and image name.
function rotate(state,imageName) {
        if (document.images) {
               document.images[imageName].src = eval(state + ".src");
        }
}
// Use this to preload the 4 text-block rollovers on the right of the page.
// Make sure it is called with an _onload_ in the body tag.
function ImagePreLoad() {
  if (document.images) {
    preLoad1 = new Image();
    preLoad1.src = "/images/h_who_on.gif";
	preLoad2 = new Image();
    preLoad2.src = "/images/h_what_on.gif";
	preLoad3 = new Image();
    preLoad3.src = "/images/h_links_on.gif";
	preLoad4 = new Image();
    preLoad4.src = "/images/h_contact_on.gif";
	preLoad5 = new Image();
    preLoad5.src = "/images/h_login_on.gif";
  }
}




//------------- Cookie Functions-------------------//
function readCookie(name) 
{
	var nameEQ=name+"=";
	var ca=document.cookie.split(';');
	for(var i=0;i<ca.length;i++) {
		var c=ca[i];
		while (c.charAt(0)==' ') c=c.substring(1,c.length);
		if (c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setCookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}
//------------- Cookie Functions-------------------//

//------------- Global Nav Functions-------------------//
function isLoggedIn()
{
	var type = readCookie("LCTSessionCookie");
	return (type!=null);
}





function contact() {
	contactUs(Contact_XML);
}



function openExternalWindow(url) {
	if (url) {
		openExtWindow('/redirect.html?URL='+escape(url),'','height=540 width=675');
	}
}



//------------- Global Nav Functions-------------------//

//------------- Image Functions-------------------//
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_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_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];}
}
//------------- Image Functions-------------------//

//------------- Layer Functions-------------------//
var prevL1Lyr, prevL1OverLyr, prevL2OverLyr = null;
function layerOverHandler(n, lyrL1, lyrL1Over, lyrL2Over)
{
	if (is.ns4)
	{
		x = lyrL1.getRelativeX() - lyrParentDiv.getRelativeX();
	}
	else
	{
		x = 0;
		if (n > 1)
		{
			for(i=1; i<n; i++)
			{
				if (is.ie)
					isLyr = (document.all["lyr" + i] != null);
				else 
					isLyr = (document.getElementById("lyr" + i) != null);
					
				if(isLyr){ 
					tempLyr = eval("lyr" + i + "Div" )
					x = x + tempLyr.w;
				}
			}
		}
	}
	if (lyrL1Over != null) lyrL1Over.moveTo(x, 0);
	if (lyrL2Over != null) lyrL2Over.moveTo(171, 65);
		
	hideLyr();
	showLyr(lyrL1, lyrL1Over, lyrL2Over);
}

function layerOutHandler()
{
	hideLyr();
}

function showLyr(lyrL1, lyrL1Over, lyrL2Over)
{

	if (prevL2OverLyr != null) prevL2OverLyr.hide();
	if (prevL1OverLyr != null) prevL1OverLyr.hide();
	if (prevL1Lyr != null) prevL1Lyr.show();

	prevL1Lyr	= lyrL1;
	prevL1OverLyr	= lyrL1Over;
	prevL2OverLyr	= lyrL2Over;
	
	if (prevL1Lyr != null) prevL1Lyr.hide();
	if (prevL1OverLyr != null) prevL1OverLyr.show();
	if (prevL2OverLyr != null) prevL2OverLyr.show();
}

function hideLyr()
{
	
	if (prevL1Lyr != null) prevL1Lyr.show();
	if (prevL1OverLyr != null) prevL1OverLyr.hide();
	if (prevL2OverLyr != null) prevL2OverLyr.hide();

	prevL1Lyr	= null;
	prevL1OverLyr	= null;
	prevL2OverLyr	= null;
}



function checkLyr(bln, timeout, func)
{
	eval(timeout + " = window.setTimeout('if(" + bln + "==false){" + func + ";window.clearTimeout(" + bln + ");}', 800)");
	eval(timeout + " = 0;")
}

function showMouseOverText(e, text, size, bordercolor, bgcolor, styleClass, position) {
	var txtBoxLayer = new DynLayer("MouseOverTxtBox");
    if(is.ns4) {
    	x  = e.pageX;
        y  = e.pageY;
    } else {
    	x  = document.body.scrollLeft + e.clientX;
        y  = document.body.scrollTop + e.clientY;
    }
    
    if(size == null || size == "") size = "300";
    if(bordercolor == null || bordercolor == "") bordercolor = "#000000";
    if(bgcolor == null || bgcolor == "") bgcolor = "#FFFFDD";
    if(styleClass == null || styleClass == "") styleClass = "tableText";
	
    text = '<table width="'+size+'" border="0" bgcolor="'+bordercolor+'" cellpadding="1" cellspacing="0"><tr><td><table width="100%" border="0" bgcolor="'+bgcolor+'" cellpadding="3" cellspacing="0"><tr><td class="'+styleClass+'">' + text + '</td></tr></table></td></tr></table>';
    txtBoxLayer.write(text);
    
    x = x + 5;
    if(position != null){
    	if(position == "bottom"){
    		txtBoxLayer = new DynLayer("MouseOverTxtBox");
    		y = y - txtBoxLayer.h - 2;
    	} else {    		
    		y = y + 2;    		
    	}    	   	
    }
    
    txtBoxLayer.moveTo(x, y);
    txtBoxLayer.show();
    
}
function hideMouseOverText() {
	var txtBoxLayer = new DynLayer("MouseOverTxtBox");
    txtBoxLayer.hide();
}

//------------- Layer Functions-------------------//

//------------- Other Functions-------------------//
function openTimeZoneWindow()
{
	openExtWindow('/LincolnPageServer?KURL=/lfg/uni/tim/content.xml&amp;ARG_ARRAY=/lfg/uni/tim/content.xml&amp;LFGPage=NONE','','height=560 width=350 scrollbars=yes');
}


var messageMaxCount = 10;
function messageAlert(msg,id)
{
	var client = "/";
	if(viewAs!=null && (viewAs=="leg"||viewAs=="adv"))
		client += "leg/";
	var val = readCookie(id);
	var count = readCookie(id+"Count");
	if(count == null) 
		count = 0;
	else
		count = parseInt(count);
		
	msg = escape(msg);
	if((val == null || val == "yes")&&(count<=messageMaxCount))
		openExtWindow('/lfg/admin/msg'+client+'messagealert.html?msg='+msg+'&id='+id,id,'width=350,height=400,resizable=yes');
}

function openExtWindow(url,name,features){
	var extWin = window.open(url,name,features);
	extWin.focus();
}

function printerFriendly()
{
	var url = location.href;
	var printerURL = url;
	actInd = url.indexOf("KPage_Action");
	alreadyPrinterFriendly = url.indexOf("PRINTER_FRIENDLY");
	
	if (alreadyPrinterFriendly == -1)
	{
		fragment = url.lastIndexOf("#"); 
		if (fragment != -1) 
		{ 
			url = url.substring(0,fragment);
		}
		 
		if (actInd != -1)
		{
		  endInd = url.indexOf("&", actInd);
		  if (endInd == -1)
		      endInd = url.length();
		  printerURL = url.substring(0,actInd) + "KPage_Action=PRINTER_FRIENDLY"
		          + url.substring(endInd);
		}
		else
		{
			qInd = url.indexOf("?");
			if (qInd < 0 )
				printerURL = url + "?KPage_Action=PRINTER_FRIENDLY";
			else
				printerURL = url + "&KPage_Action=PRINTER_FRIENDLY";
		}
	  
		openExtWindow(printerURL,  'printer', 'height=600 width=740, screenX=10,screenY=5, top=10,left=5, menubar=yes, toolbar=yes, scrollbars=yes, resizable=yes');
	}
}

function go()
{

	level1 = document.audienceForm.views.options[document.audienceForm.views.selectedIndex].value;
	window.parent.location.href = "/LincolnPageServer?LFGPage=/lfg/" + level1 + "/index.html";
}

var errorTitles = new Array(1);
errorTitles[0] = "An error was encountered processing your request";

var errorMsgs = new Array(1);
errorMsgs[0] = "Please click <a href=\"javascript:history.back()\">here</a> to return to the previous page.";
	
function getErrorTitle(index){
	if(index < errorTitles.length)
		return errorTitles[index];
	else
		return 0		
}

function getErrorMsg(index){
	if(index < errorMsgs.length)
		return errorMsgs[index];
	else
		return 0		
}

//------------- Other Functions-------------------//
