﻿// JScript File
// new window centered on screen function
function NewWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

// quick new window centered on screen function
function NewWindowQuick(theURL, myWidth, myHeight) { 
	var winName = "newWindowQuick";
	var isCenter = 'true';
	var features = 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes';
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/4;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function disableMe(theItem) {
  theItem.disabled = true
  GetPostBackEventReference(theItem);
}

function confirmIt(theMessage) {
    var doIt = confirm(theMessage);
    if (doIt) { 
        return true;
    } else {
        return false;
    }
}

function ToggleElementDisplay(theElementID) {
	//alert(theElementID);

	var theElement = document.getElementById(theElementID);
	//theElement.setAttribute("style", "display:block;");
	//alert(theElement.getAttribute("style"));
	
	var displayStyle = theElement.style.display

	if (displayStyle == '') {
		theElement.style.display = "none";
	}
	else {
		theElement.style.display = "";
	}
}

function EnableElementDisplay(theElementID) {
	//alert(theElementID);

	var theElement = document.getElementById(theElementID);
	//theElement.setAttribute("style", "display:block;");
	//alert(theElement.getAttribute("style"));
	
	theElement.style.display = "";
}

function logOut(sleepInterval) {
	bodyTags = document.getElementsByTagName("body");
	bodyTags[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	var agree = confirm("Are you sure you wish to logout?");
	if (agree) {
		return true;
	} else {
		bodyTags[0].style.filter = "";
		return false;
	}
}

