// JavaScript Document
function pressEnterKey(e,frmName)
{
    var tKeycode;

	if (window.event) 
		tKeycode = window.event.tKeycode;
	else if (e) 
		tKeycode = e.which;
	else 
		return true;

	if (tKeycode == 13)
	{
		//call function	
		return false;
   	}
	else
		return true;
} 



function DirectPage(Url)
{
	document.location.href = Url;
}


function ShowDiv(Id)
{
	//alert(Id);
	try{
	document.getElementById(Id).style.display = "block";
	}
	catch(e){}
}

function HideDiv(Id)
{
	try{
	document.getElementById(Id).style.display = "none";
	}
	catch(e){}
}

function ShowHideDiv(Id)
{
	if (document.getElementById(Id).style.display == "none")
		document.getElementById(Id).style.display = "block";
	else
		document.getElementById(Id).style.display = "none";
}

function ChangeStyle(Obj,className)
{
	
	try
	{
		Obj.setAttribute("class",className);
	}
	catch(e){};
	
	try
	{
		Obj.setAttribute("className",className);
	}
	catch(e){}
}


function ChangeStyleById(objId,className)
{
	ChangeStyle(document.getElementById(objId),className);
}

function ChangeLanguage(pLang)
{
	document.forms['Language'].lang.value = pLang;
	document.forms['Language'].submit();
}

function PreSubmit(frmName, act)
{	
	//alert(frmName);
	document.forms[frmName].task.value = act;
	//alert(document.forms[frmName].task.value);
	document.forms[frmName].submit();
}

function PreDelete(Str,frmName, act)
{
	input_box=confirm(Str);
	if(input_box==true)
	{
		document.forms[frmName].task.value = act;
		document.forms[frmName].submit();
	}
	//alert(act);
	//alert(document.forms[frmName].task.value);
}


var arrOnLoadFunctions = new Array();
function OnLoad()
{
	//alert(arrOnLoadFunctions.length);
	for (i=0; i < arrOnLoadFunctions.length; i++)
	{
		eval(arrOnLoadFunctions[i]);
	}
}

function ShowPopup(pPage, pId)
{
	var objPopup = document.getElementById("Popup");
	objPopup.style.display = "block";
	objPopup.style.top = document.body.scrollTop;
	window.open("./?page=" + pPage + "&id=" + pId,"PopupFrame");
}

function HidePopup()
{
	window.open("./loading.html","PopupFrame");
	HideDiv("Popup");
}

var TaskBar_TimeOut;

function MoveTaskBar_Start()
{
	var obj = document.getElementById("TaskBar");
	obj.style.display = "block";
	obj.style.bottom = 0;
	TaskBar_TimeOut = setTimeout("MoveTaskBar()",0);
}

function MoveTaskBar()
{
	clearTimeout(TaskBar_TimeOut);
	//Move Task Bar
	var obj = document.getElementById("TaskBar");
	//obj.style.bottom = - document.body.scrollTop;
	obj.style.bottom = parseInt(obj.style.bottom) - Math.round((document.body.scrollTop + parseInt(obj.style.bottom))/2);
	TaskBar_TimeOut = setTimeout("MoveTaskBar()",50);
}

function WindowResize()
{
	//MoveTaskBar();
	
}


function  Pagination(frmName, pStep, pTotalPage, pAction)
{
	var tCurrPage	=	document.forms[frmName].pageindex.value;
	if ( ((pStep > 0) && (tCurrPage < pTotalPage)) || ((pStep < 0) && (tCurrPage > 1)))
	{
		document.forms[frmName].pageindex.value	=	parseFloat(tCurrPage) + parseFloat(pStep);
		//alert(document.forms[frmName].pageindex.value);
		PreSubmit(frmName, pAction);
	}
	
}


function OnfocusObject(pMess, pObject)
{
	if (pObject.value == pMess)
		pObject.value	=	"";
}


function OnblurObject(pMess, pObject)
{
	if (pObject.value == "")
		pObject.value	=	pMess;
}




//arrOnLoadFunctions.push("MoveTaskBar_Start();");
