﻿function getObj(o)
{
  if (document.getElementById)
  {
    return document.getElementById(o);
  }
  else if (document.all)
  {
    return document.all(o);
  }
  else if (document.layers)
  {
    return document.layers(o);
  }
}
function hide(o)
{
    getObj(o).style.display='none';
    getObj(o).style.visibility='hidden';
}
function show(o)
{
    getObj(o).style.display='';
    getObj(o).style.visibility='visible';
}

function Go(url) 
{
    window.location.href = url;
}

function confirmDelete(item) 
{
    return confirm('Are you sure you want to delete this ' + item + '?');
}

function Print() 
{
	openWindow('../utilities/print.aspx', 680, 620, 'yes');
}

function openWindow(loc,wdt,hgt,scroll, resizable) 
{	
	window.open(loc, 'win', 'height=' + hgt + ',width=' + wdt + ',top=120,left=100' + ',toolbar=yes,scrollbars=' + scroll + ',resizable=' + resizable);
}

function pageWidth() 
{
    return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
}

function pageHeight() 
{
    return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
}

function posLeft()
{
    return typeof window.pageXOffset != "undefined" ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft:document.body.scrollLeft ? document.body.scrollLeft : 0;
}

function posTop()
{
    return typeof window.pageYOffset != "undefined" ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

function posRight()
{
    return posLeft()+pageWidth();
}

function posBottom()
{
    return posTop()+pageHeight();
}

function DisableEnter(field, event, cmd) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		DoSubmit(cmd);
		return false;
	} 
	else
	return true;
}

function DoSubmit(cmd) {
    getObj(cmd).click();
}