﻿// JScript File

function NewWin(url) {
  var newWindow = window.open(url, "", "location=yes, directories=yes, fullscreen=no, menubar=yes, status=yes, toolbar=yes, width=800, height=600, scrollbars=yes");
  
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	return [curleft,curtop];
}

function ReqShow(typ) {
    if (typ == "P") {
        if (document.getElementById('Pending').className == 'show') {
            document.getElementById('Pending').className = 'hide';
            document.getElementById('ShowP').value = 'Show Pending Requests';
        }
        else {
            document.getElementById('Pending').className = 'show';
            document.getElementById('ShowP').value = 'Hide Pending Requests';
        }
    }
    if (typ == "C") {
        if (document.getElementById('Complete').className == 'show') {
            document.getElementById('Complete').className = 'hide';
            document.getElementById('NoStatus').className = 'hide';
            document.getElementById('ShowC').value = 'Show Completed Requests';
        }
        else {
            document.getElementById('Complete').className = 'show';
            document.getElementById('NoStatus').className = 'show';
            document.getElementById('ShowC').value = 'Hide Completed Requests';
        }
    }
}

function ShowHide(elem,img) {
    if (document.getElementById(elem).className == 'show') {
        document.getElementById(elem).className = 'hide';
        document.getElementById(img).src = 'images/expand_blue.jpg';
    }
    else {
        document.getElementById(elem).className = 'show';
        document.getElementById(img).src = 'images/collapse_blue.jpg';
    }
}

function ShowLinks(elem) {
        var arrElements = document.getElementsByTagName('div');
        for(var i=0; i<arrElements.length; i++) {
            if (arrElements[i].className == 'show' || arrElements[i].className =='showabsolute') {
                arrElements[i].className = 'hide';
            }
        }
        if (elem != '') {
            if (document.getElementById(elem).className == 'show') {
                document.getElementById(elem).className = 'hide';
            }
            else {
                document.getElementById(elem).className = 'show';
            }
        }
}

function MM_controlSound(x, _sndObj, sndFile) { //v3.0
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = "play";
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else NewWin(sndFile); //window.location = sndFile;
}

function move_box(an, box) {
  var cleft = 0;
  var ctop = 0;
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    ctop += parseInt(
      document.body.currentStyle['marginTop']);
  }
  box.style.top = ctop + 'px';
}

function show_hide_box(an, borderStyle, popup) {
  var arrElements = document.getElementsByTagName('div');
  for(var i=0; i<arrElements.length; i++) {
    if (arrElements[i].className == 'show') {
        arrElements[i].className = 'hide';
    }
  }
  
  var href = an.href;
  var boxdiv = document.getElementById(href);

  if (boxdiv != null) {
    if (boxdiv.style.display=='none') {
      move_box(an, boxdiv);
      boxdiv.style.display='block';
    } else
      boxdiv.style.display='none';
    return false;
  }

  boxdiv = document.getElementById(popup);
  if (boxdiv.className == 'show') {
    boxdiv.className = 'hide';
  }
  else {
    boxdiv.className = 'show';
  }
  boxdiv.style.position = 'absolute';
  boxdiv.style.border = borderStyle;
  boxdiv.style.backgroundColor = '#fff';

  move_box(an, boxdiv);

  return false;
}

function centerdiv(brdstyle,divid) {
    var arrElements = document.getElementsByTagName('div');
    for(var i=0; i<arrElements.length; i++) {
        if (arrElements[i].className == 'showabsolute') {
            arrElements[i].className = 'hide';
        }
    }
    if (document.getElementById(divid).className == 'hide') {
        document.getElementById(divid).className = 'showabsolute';
    }
    else {
        document.getElementById(divid).className = 'hide';
    }
    document.getElementById(divid).style.border = brdstyle;
    document.getElementById(divid).style.backgroundColor = '#fff';
    
    var IpopTop = ((document.body.clientHeight - document.getElementById(divid).offsetHeight) / 2) + document.body.scrollLeft;
    var IpopLeft = ((document.body.clientWidth - document.getElementById(divid).offsetWidth) / 2) + document.body.scrollTop;
           
    document.getElementById(divid).style.left = IpopLeft + 'px';
    document.getElementById(divid).style.top = IpopTop + 'px';
    
}
