// var bcImageCache = new elcHashMap();
// var bcOffsetMap  = new elcRMap();

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

function protectHREF() {
	if (pnav.off) {
		pnav.off.hide();
	}
}

/* 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));
}

