var blnIsFormLocked;

function o(id)
{
	return document.getElementById(id);
}

function doc(id)
{
	return o(id).contentDocument || o(id).contentWindow.document;
}

function p(frame)
{
	frame.contentWindow.focus();
	frame.contentWindow.print();
}

function public_alavi_print(id, title, comment)
{
	doc('ifrmPrint').getElementById('divContent').innerHTML = o(id).innerHTML;
	doc('ifrmPrint').getElementById('divTitle').innerHTML = title;
	doc('ifrmPrint').getElementById('divComment').innerHTML = comment;

	p(o('ifrmPrint'));
}

function SetOpacity(obj, opacity)
{
	obj = obj.style;
	obj.opacity = opacity / 100;
	obj.MozOpacity = opacity / 100;
	obj.KhtmlOpacity = opacity / 100;
	obj.filter = "alpha(opacity = " + opacity + ")";
}

function IsDigit(e)
{
	var key;
	if (window.event)
	{
		e = window.event;
		key = e.keyCode;
	}
	else
	{
		key = e.charCode;
	}
	return key == 0 || key == 8 || (key >= 48 && key <= 57);
}

function IsStudentID(str)
{
	return /^$|^\d{7}$/.test(str);
}

function IsDocID(str)
{
	return /^$|^\d{6,7}$/.test(str);
}

function IsDocValue(str)
{
	return /^$|^\d{5,10}$/.test(str);
}

function IsCheckNumber(str)
{
	return /^$|^\d{1,9}$/.test(str);
}

function DisableGrid(obj1, obj2)
{
	var i, tr = obj1.getElementsByTagName("tr");
	for (i = 1; i < tr.length - 1; i++)
		tr[i].className = "DisabledRow";
	obj2.className = "HighlightedRow";
}

function EnableGrid(obj)
{
	var i, tr = obj.getElementsByTagName("tr");
	for (i = 1; i < tr.length - 1; i++)
		tr[i].className = (i % 2? "ItemStyle": "AlternatingItemStyle");
}
