/* $Id: global.js 4167 2009-01-25 08:07:03Z ak $ */

function openWindow(filename, name, width, height, directories, menubar, resizable, scrollbars, status, toolbar, location) {

	var wf = "";
	wf = wf + "width=" + width;
	wf = wf + ",height=" + height;
	wf = wf + ",resizable=" + resizable;
	wf = wf + ",scrollbars=" + scrollbars;
	wf = wf + ",menubar=" + menubar;
	wf = wf + ",toolbar=" + toolbar;
	wf = wf + ",directories=" + directories;
	wf = wf + ",location=" + location;
	wf = wf + ",status=" + status;

	var w = window.open(filename,name,wf);

	if (w!=null) {
		if (w.location==null) w.location = filename;
		if (w.opener==null)  w.opener=self;
	}
	w.focus();
}

function ClickReturn () {
	var bAgent = window.navigator.userAgent;
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; // dont follow link
	else return false; // dont follow link
}

function autolink(formname) {
	link = document.forms[formname].target.value;
	self.location.href = link;
}

function hideAjaxSearchPanel() {
	document.getElementById('mw_ax_livesearch_placeholder').innerHTML = "";
	document.getElementById('q').value = 'search terms';
	hideElement('mw_ax_livesearch_placeholder');
}

function hideElement(elementId) {
	document.getElementById(elementId).style.display = "none";
	return false;
}

startList = function() {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("main-menu");

    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI" || node.nodeName=="UL") {
        node.onmouseover=function() {
          this.className+=" over";
        }

        node.onmouseout=function() {
          this.className=this.className.replace(" over", "");
        }
      }
    }
    /*
    navRoot = document.getElementById("db-flyout");

    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI" || node.nodeName=="UL") {
        node.onmouseover=function() {
          this.className+=" over";
        }

        node.onmouseout=function() {
          this.className=this.className.replace(" over", "");
        }
      }
    }
    */
  }
}

window.onload=startList;

function focus_login_pass() {
	document.getElementById('login_pass_placeholder').style.display = "none";
	document.getElementById('login_pass').style.display = "";
	document.getElementById('login_pass').focus();
}

function show_login_passplaceholder() {
	document.getElementById('login_pass').value = "";
	document.getElementById('login_pass').style.display = "none";
	document.getElementById('login_pass_placeholder').style.display = "";
	document.getElementById('login_pass_placeholder').value = "password";
}