var globIdx = null;
var lastEl = null;
var lastNode = null;

function frameCheck() {
	//if ((top.location.href != window.location.href) && (parent._editframe == null)) top.location.href = window.location.href;
}

function _flowGetField(frm, fieldName) {
	if (document.all) return eval("frm.elements('" + fieldName + "')")
	else if (document.getElementById) return document.getElementById(fieldName)
	else return eval("frm.elements['" + fieldName + "']");
}

function submitSearchSmall(frm) {
	count = '5';
	indexIds = '1;2';
	countEl = _flowGetField(frm, 'count');
	if (countEl != null) count = countEl.value;
	indexEl = _flowGetField(frm, 'indexids');
	if (indexEl != null) indexIds = indexEl.value;
	searchEl = _flowGetField(frm, 'searchSmall');
	searchStr = searchEl.value;
	setCookie('search', searchStr);
	url = '/default.aspx?page=268&indexids=' + indexIds + '&count=' + count + '&search=' + searchStr;
	window.location.href = url;
	return false;
}

function clickBM(url, id) {
	if (id != null) {
		lastNode = id;
		layer = 'layer' + id;
		if (lastEl != null) {
			if (typeof(lastEl) == "string") lastEl = document.getElementById(lastEl);
			lastEl.style.display = "none";
		}
		layerEl = document.getElementById(layer);
		if (layerEl != null) {
			layerEl.style.display = "block";
			lastEl = layerEl;
		}
	}
	if (url != '') {
		frameEl = document.getElementById('innerFrame');
		if (frameEl != null) innerFrame.MainWindow.location.href = url
		else {
			window.location.href = '/?page=' + lastNode + '&srcurl=' + url;
		}
	}
}

function writeBrowser() {
	if ((b.alias == "IE" && b.version >= 4)) {
		var s = "";
		s += "<style>";
		s += ".navItem {padding: 0px;}";
		s += ".navItem A {padding-top: 8px; padding-bottom: 8px; height: 30px; width: 100%;}";
	//	s += "TEXTAREA {border: 1px solid #0099CC;}";
	//	s += "INPUT.inputField {border: 1px solid #0099CC; height: 19px;}";
	//	s += "INPUT.inputButton {border: 1px solid #0099CC; background: white;}";
	//	s += "#search {padding-left: 2px; width: 100px; border: 1px solid #999999; color: white; background: #222222;}";
		s += "</style>";
		document.writeln(s);
	}
	else if ((b.alias == "NS") && (b.version >= 5)) {
		var s = "";
		s += "<style>";
	//	s += "#search {padding-left: 2px; width: 75px; border: 1px solid #999999; color: white; background: #222222;}";
		s += "</style>";
		document.writeln(s);
	}
	else if ((b.alias == "NS") && (b.version >= 4)) {
	}
	else if ((b.alias == "Opera") && (b.version >= 5)) {
	}
}

function checkForm() {
	return true;
}

function checkEmail(email) {
	if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1)) return false;
	return true;
}

function getRealNS(tempEl, typ, value, n) {
	i = 0;
	while ((tempEl != null) && (tempEl.tagName != "BODY") && (i < n)) {
		if (tempEl.className != null) {
			if ((tempEl.className.indexOf(value) != -1) || (tempEl.id == 'divMenu')) return tempEl;
		}
		tempEl = tempEl.parentNode;
		i++;
	}
	return null;
}

function getRealOffset(el, str) {
	temp = el;
	i = 0;
	while ((temp != null) && (temp.tagName != "BODY")) {
		i += eval("temp." + str);
		temp = temp.offsetParent;
	}
	return i;
}

function handleOver(e) {
}

function handleOut() {
}

function handleClick() {
}

function handleScroll() {
}

function handleResize() {
}

imgNavRight = new Image;
imgNavRight.src = "images/nav_right.gif";
imgNavRightOver = new Image;
imgNavRightOver.src = "images/nav_right_over.gif";

imgNavDown = new Image;
imgNavDown.src = "images/nav_down.gif";
imgNavDownOver = new Image;
imgNavDownOver.src = "images/nav_down_over.gif";

function hover(img, flag, layerEl) {
	imgEl = document.images[img];
	if (imgEl != null) {
		if (flag) {
			if ((imgEl.src).indexOf("right") != -1) imgEl.src = imgNavRight.src
			else imgEl.src = imgNavDown.src
		}
		else {
			if ((imgEl.src).indexOf("right") != -1) imgEl.src = imgNavRightOver.src
			else imgEl.src = imgNavDownOver.src
		}
	}
}

function toggleSelect() {
	var dropCol = document.body.getElementsByTagName("SELECT");
	for (j=0; j<dropCol.length; j++) {
		if (bMenuActive) dropCol[j].style.visibility = "hidden"
		else dropCol[j].style.visibility = "visible";
	}
}

function validateLogin() {
	isValid = ((document.getElementById('username').value != '') && (document.getElementById('username').value != 'Enter username') && (document.getElementById('password').value != ''));
	if (!isValid) alert('Please enter your username and password.');
	return isValid;
}

