// JavaScript Document

function checkLogin() {
	if ($('name').value=='') {
		alert('Please fill in your username');
		$('name').focus();
		return false;
	}
	if ($('pwd').value=='') { 
		alert('Please fill in your password');
		$('pwd').focus();
		return false;
	}
}

function xMenu1(triggerId, menuId, mouseMargin, openEvent)
{
  var isOpen = false;
  var trg = xGetElementById(triggerId);
  var mnu = xGetElementById(menuId);
  if (trg && mnu) {
    xAddEventListener(trg, openEvent, onOpen, false);
  }
  function onOpen()
  {
    if (!isOpen) {
      xMoveTo(mnu, xPageX(trg), xPageY(trg) + xHeight(trg));
      xShow(mnu);
      xAddEventListener(document, 'mousemove', onMousemove, false);
      isOpen = true;
    }
  }
  function onMousemove(ev)
  {
    var e = new xEvent(ev);
    if (!xHasPoint(mnu, e.pageX, e.pageY, -mouseMargin) &&
        !xHasPoint(trg, e.pageX, e.pageY, -mouseMargin))
    {
      xHide(mnu);
      xRemoveEventListener(document, 'mousemove', onMousemove, false);
      isOpen = false;
    }
  }
}

function changeLocation(menuObj)
{
   var i = menuObj.selectedIndex;
   if(i >= 0)
   {  
      window.location = menuObj.options[i].value;
   }
}
function showLayer(id) {
var lyr = getElemRefs(id);
if (lyr && lyr.css) lyr.css.display = "block";
}

function hideLayer(id) {
var lyr = getElemRefs(id);
if (lyr && lyr.css) lyr.css.display = "none";
}

function getElemRefs(id) {
var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
if (el) el.css = (el.style)? el.style: el;
return el;
}

function leftpositioning(id)
{
	var	newposition = document.body.clientWidth/2 - document.getElementById(id).scrollWidth/2;
	document.getElementById(id).style.left = newposition +"px";
}

function backinframe (id1,id2) {

var frame = document.getElementById(id1);
var win = frame.contentWindow;


document.getElementById(id2).onclick = function() {
win.parent.history.back();
}
}
