






















DWRUtil.isHTMLElement = function(ele, nodeName)
{
if (nodeName == null)
{


return ele != null &&
typeof ele == "object" &&
ele.nodeName != null;
}
else
{
return ele != null &&
typeof ele == "object" &&
ele.nodeName != null &&
ele.nodeName.toLowerCase() == nodeName.toLowerCase();
}
};






DWRUtil.detailedTypeOf = function(x)
{
var reply = typeof x;

if (reply == "object")
{
reply = Object.prototype.toString.apply(x);
reply = reply.substring(8, reply.length-1);
}

return reply;
};










DWRUtil.isArray = function(data)
{
return (data && data.join) ? true : false;
};










DWRUtil.isDate = function(data)
{
return (data && data.toUTCString) ? true : false;
};







DWRUtil.isHTMLInputElement = function(ele)
{
return DWRUtil.isHTMLElement(ele, "input");
};







DWRUtil.isHTMLTextAreaElement = function(ele)
{
return DWRUtil.isHTMLElement(ele, "textarea");
};







DWRUtil.isHTMLSelectElement = function(ele)
{
return DWRUtil.isHTMLElement(ele, "select");
};






DWRUtil.getElementById = function(id)
{
if (document.getElementById)
{
return document.getElementById(id);
}
else if (document.all)
{
return document.all[id];
}

return null;
};








DWRUtil.setEnabled = function(ele, state)
{
var orig = ele;
ele = $(ele);
if (ele == null)
{
alert("setEnabled() can't find an element with id: " + orig + ".");
return;
}






ele.disabled = !state;
ele.readonly = !state;
if (DWRUtil._isIE)
{
if (state)
{
ele.style.backgroundColor = "White";
}
else
{

ele.style.backgroundColor = "Scrollbar";
}
}
};






DWRUtil.showById = function(ele)
{
var orig = ele;
ele = $(ele);
if (ele == null)
{
alert("showById() can't find an element with id: " + orig + ".");
return;
}


ele.style.display = '';
};






DWRUtil.hideById = function(ele)
{
var orig = ele;
ele = $(ele);
if (ele == null)
{
alert("hideById() can't find an element with id: " + orig + ".");
return;
}

ele.style.display = 'none';
};






DWRUtil.toggleDisplay = function(ele)
{
var orig = ele;
ele = $(ele);
if (ele == null)
{
alert("toggleDisplay() can't find an element with id: " + orig + ".");
return;
}

if (ele.style.display == 'none')
{

ele.style.display = '';
}
else
{
ele.style.display = 'none';
}
};








DWRUtil.alternateRowColors = function()
{
var tables = document.getElementsByTagName("table");
var rowCount = 0;

for (var i = 0; i < tables.length; i++)
{
var table = tables.item(i);
var rows = table.getElementsByTagName("tr");

for (var j = 0; j < rows.length; j++)
{
var row = rows.item(j);
if (row.className == "zebra")
{
if (rowCount % 2)
{
row.className = 'oddrow';
}
else
{
row.className = 'evenrow';
}

rowCount++;
}
}

rowCount = 0;
}
};






DWRUtil.setCSSClass = function(ele, cssclass)
{
var orig = ele;
ele = $(ele);
if (ele == null)
{
alert("setCSSClass() can't find an element with id: " + orig + ".");
return;
}

ele.className = cssclass;
};






DWRUtil.callOnLoad = function(load)
{
if (window.addEventListener)
{
window.addEventListener("load", load, false);
}
else if (window.attachEvent)
{
window.attachEvent("onload", load);
}
else
{
window.onload = load;
}
};






DWRUtil.fillList = function(ele, data, valueprop, textprop)
{
DWRUtil.removeAllOptions(ele);
DWRUtil.addOptions(ele, data, valueprop, textprop);
};





DWRUtil.drawTable = function(ele, data, cellFuncs)
{
DWRUtil.addRows(ele, data, cellFuncs);
};








DWRUtil.clearChildNodes = function(id)
{
var ele = DWRUtil.getElementById(id);
if (ele == null)
{
alert("clearChildNodes() can't find an element with id: " + id + ".");
throw id;
}

while (ele.childNodes.length > 0)
{
ele.removeChild(ele.firstChild);
}
};


