// var topnav = new elcNavigation('topnav');
// topnav.hasTimeout = false;
// topnav.offLayer = null;

// var pnav = new elcNavigation('pnav');
// pnav.hasTimeout = false;
// pnav.offLayer = "pNavOff";

// var pgnav = new elcNavigation('pgnav');
// pgnav.hasTimeout = false;
// pgnav.offLayer = null;

// var bottomnav = new elcNavigation('bottomnav');
// bottomnav.hasTimeout = false;
// bottomnav.offLayer = null;

/* precache */
function cacheImg(path){
    var img = new Image();
    img.src = path;
    bcImageCache.store(path,img);
}

// Global Nav search and email field clear and replace functions

var condText;
function clearTextBoxOnCondition(textBox,conditionText){
        if(textBox.value == conditionText) {
          textBox.value="";
	  condText=conditionText;
	}
}    


function fillTextBoxOnCondition(textBox){
        if(textBox.value == "") {
          textBox.value=condText;
        }
}

function checkMaxLength (textarea, evt, maxLength) {
	if (textarea.selected && evt.shiftKey)
	// ignore shift click for select
		return true;
	var allowKey = false;
	if (textarea.selected && textarea.selectedLength > 0)
		allowKey = true;
	else {
		var keyCode = document.layers ? evt.which : evt.keyCode;
		if (keyCode < 32 && keyCode != 13)
			allowKey = true;
		else
			allowKey = textarea.value.length < maxLength;
		}
	textarea.selected = false;
	return allowKey;
}

// Pop a window
var popupWindow;
function popup(url,scrollbars,width,height){
    popupWindow = open(url, 'lmPopupWindow', 'toolbar=0,location=0,directories=0,status=0,menubars=0,resizable=0,scrollbars='+scrollbars+',width='+width+',height='+height+',top=20,left=20');
    if (popupWindow != null) {
        popupWindow.focus();
    }
}

// Close window
function closewindow() {
	this.window.close();
}

/* Copied from elcNavigation and head_common.tmpl */
if ((typeof wsmlMakeWebServiceHref) == "undefined")
{
  wsmlMakeWebServiceHref =
  wsmlMakeResourceHref =
  wsmlMakeResourceUrl =
  wsmlMakeLeakHref =
  wsmlMakeComponentHref =
  wsmlMakeCssHref = new Function ("u", "return u;");
}

// wsml functions are defined above
function elcSendURL( url ) {
//	printurl = wsmlMakeWebServiceHref(url);
//	alert(printurl);
	location.replace(wsmlMakeWebServiceHref(url));
}


/* Routines for new navigation - May 2008 - rhiggins */

function signup_hover() {
        document.signup_image.src = "/images/signup_overlay.gif";
}

function signup_leave() {
        document.signup_image.src = "/images/signup.gif";
}

function signup_togglebox() {
	if (document.getElementById) {
		var theDialogBox = document.getElementById("signupbox");
		theDialogBox.style.display = theDialogBox.style.display == "none" ? "block" : "none";
	}
}
