//Clear on focus function
function clearText(id) {
    document.getElementById(id).value = "";
}

function checkAllRows(frm,objName,status)
{
	for(i=0;i<frm.elements.length;i++)
	if(frm.elements[i].name==objName &&  frm.elements[i].type=='checkbox')
	{
	   frm.elements[i].checked=status;
	}
}

function isCheckAllRows(frm,objName,objSel) 
{
   var checkedAll=true;
   for(i=0;i<frm.elements.length;i++)
	if(frm.elements[i].name==objName &&  frm.elements[i].type=='checkbox')
	{
	   if(frm.elements[i].checked==false && checkedAll==true)
	   {
	     checkedAll=false;
	   }
	}
	objSel.checked=checkedAll;
}

function toggleMe(a){
  var e=document.getElementById(a);
  if(!e)return true;
  if(e.style.display=="none"){
    e.style.display="block"
  } else {
    e.style.display="none"
  }
  return false;
}
function hideLayer(layerId){ 
  if(document.getElementById(layerId))
  {
 	if (document.all) { document.all[layerId].style.visibility = "hidden"; } 
	if(document.layers){ document.layers[layerId].visibility = "hide";} 
	if(document.getElementById) {document.getElementById(layerId).style.visibility='hidden';} 
  }	
}
function showLayer(layerId) {  
  if(document.getElementById(layerId))
  { 
	if (document.all) { document.all[layerId].style.visibility = "visible";} 
	if(document.layers) { document.layers[layerId].visibility = "show" ;} 
	if(document.getElementById) {document.getElementById(layerId).style.visibility='visible';} 
  }	
}
function delAlert(msg)
{
	return confirm("Are you sure, you want to delete this " + msg + "?");
}
function delAlert(msg)
{
	return confirm("Are you sure, you want to delete this " + msg + ".");
}
function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}
// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if (IEmac && IE4)  // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}

