var IE = (document.all) ? true : false;
var DOM = (document.getElementById) ? true : false;
var NS4 = (document.layers) ? true : false;

if (document.all) {n=0;ie=1;ns6=0;}
if (document.getElementById&&!document.all){n=0;ie=0;ns6=1;}
if (document.layers) {n=1;ie=0;ns6=0;}

if (document.layers) {var browserType="nn4";}
if (document.all) {var browserType="ie";}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {var browserType="gecko";}

function divVis(visib,elId) {
	if (browserType == "gecko") {
		dpo = eval('document.getElementById(\'' + elId + '\')');
	} else if (browserType == "ie") {
		dpo = eval('document.all[\'' + elId + '\']');
	} else {
		dpo = eval('document.layers[\'`' + elId + '\']');
	}
	dpo.style.visibility = visib;
	dpo.style.display = (visib=='visible')? "block":"none";
}

function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }

function getElm(elmID) { return (IE) ? document.all[elmID] : (DOM) ? document.getElementById(elmID) : false; }

//-------------------Menu-----------------------\\
var shouldClose = false;
var currentMenu = null;
var menuTimer = null;
function openMenu(which) {
	shouldClose = false;
	if (currentMenu != null) { currentMenu.style.display='none'; }
	currentMenu = ie?eval(which):document.getElementById(which);
	currentMenu.style.display='block';
}
function closeMenu() {
	shouldClose?currentMenu.style.display='none':false;
}
function forceCloseMenu() {
	currentMenu!=null?currentMenu.style.display='none':false;
}
function menuOut() {
	shouldClose = true;
	menuTimer = setTimeout("closeMenu()",500)
}
function menuOver() {
	shouldClose = false;
	if (menuTimer) clearTimeout(menuTimer);
}
//-------------------END Menu-----------------------\\
/*------------------Quote-------------------------\\
var currentQuote;
var quote = new Array(
	"Providing Integration Solutions in our On-Demand World",
	"Connecting you and everyone you know together",
	"Simply the best Integration Solution",
	"Checkout our <a href=\"/Coverage/\">Press Coverage</a>"
)

function changeQuote() {
	var newQuote = Math.floor(Math.random() * quote.length);
	if (currentQuote == newQuote) {
		changeQuote();
		return null;
	}
	currentQuote = newQuote;
	var q = ie?eval("quoteDIV"):document.getElementById("quoteDIV");
	q.innerHTML = "<strong>" + quote[currentQuote] + "</strong>";
	setTimeout("changeQuote()",10000);
}
//-------------------END Quote----------------------*/

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function openStayInformed(bool) {
	var w;
	if (getCookie("stayInformedPopup") == null || bool) {
		setCookie("stayInformedPopup",1)
		w = window.open("/MediaReleases.aspx",'StayInformed','status,width=550,height=400,scrollbars=yes,resizable=yes,screenX=200,screenY=200,top=200,left=200');
		w.focus();
	}
}
function colorRow(which,Bcolr,Fcolr){
	var whichRow = (IE) ? document.all[which] : (DOM) ? document.getElementById(which) : false;
	if (whichRow) {
	  if (IE){
	        for (var i=0;i<whichRow.children.length;i++){
	           whichRow.children[i].style.backgroundColor=Bcolr;
	           //whichRow.children[i].style.color = Fcolr;
	        }
	  } else if (DOM){
	        for (var i=0;i<whichRow.cells.length;i++){
	           whichRow.cells[i].style.backgroundColor=Bcolr;
	           //whichRow.cells[i].style.color = Fcolr;
	        }
	  }
	}
}
function trim(inputString) {
   if (typeof inputString != "string") { return inputString; }
   return inputString.replace(/^\s*|\s*$/g,"");
}
function isBlank(value) {
	if (value == null || value == "" || trim(value) == "") { return true; }
	else { return false; }
}
function dispEmail(User,Domain,Subject,dispAs) {
	if (!Subject) Subject = "";
	if (!dispAs) dispAs = User + "@" + Domain;
	document.write("<a href='ma" + "il" + "to:" + User + "@" + Domain + "?subject=" + Subject + "'>" + dispAs + "</a>");
}
