﻿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)
{
    if (url != null && url != '')
    {
        window.location = url;
    }
    else
    {
        window.location = window.location;
    }
}

function confirmDelete(item) 
{
    return confirm('Are you sure you want to delete this ' + item + '?');
}

function Print(path) 
{
	openWindow(path + 'resources/utilities/print.aspx', 680, 620, 'yes');
}

function openWindow(loc,wdt,hgt,scroll,resizable) 
{
	window.open(loc.replace(/\&amp;/g,'&'), 'win', 'height=' + hgt + ',width=' + wdt + ',top=120,left=100' + ',toolbar=yes,scrollbars=' + scroll + ',resizable=' + resizable);
}

function CaptureEnter(field, event, path) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		Go(path + '?' + field.name + '=' + field.value);
		return false;
	} 
	else
	return true;
}

function DoSubmit(cmd) {
    getObj(cmd).click();
}

function CheckBoxChange(cb) 
{

	var frm = cb.form, i = 0;
	
	while (i < frm.length) {
	
		if (frm[i].type == 'checkbox') {
		
			frm[i].checked = cb.checked;
		
		}
		
		i++;

	}

}
function Back(steps) {
    window.history.go(steps);
}