// JavaScript Document


function AddValues(jDestn,jSource)
{
	var oDestn = jDestn;
	var oSource = jSource.innerHTML;
	if (document.getElementById(oDestn).innerHTML == '')	
	{
		document.getElementById(oDestn).innerHTML = "'"+oSource+"'";
	}
	else
	{
		document.getElementById(oDestn).innerHTML = document.getElementById(oDestn).innerHTML +",'"+oSource+"'";
	}
}

function CheckandApplyValues(jDestn,jValue1,jFlag, jValue2)
{
	var oFlag = document.getElementById(jFlag).value;
	if (oFlag != 0)
	{
		document.getElementById(jDestn).value = jValue1;
		document.getElementById(jFlag).value = '0';
	}
	else
	{
		document.getElementById(jDestn).value = jValue2;
		document.getElementById(jFlag).value = '1';
	}
}


function CalculateAndApply(jValue1,jValue2,jDestn,jMathFn)
{
	if (jMathFn == 'x')
	{
		var oResult = (jValue1*jValue2);
	}
	if (jMathFn == '/')
	{
		var oResult = (jValue1/jValue2);
	}
	if (jMathFn == '+')
	{
		var oResult = (jValue1+jValue2);
	}
	if (jMathFn == '-')
	{
		var oResult = (jValue1-jValue2);
	}
	
	document.getElementById(jDestn).value = (Math.round(oResult*Math.pow(10,2)))/Math.pow(10,2);
}

function Add6Values(jSource1,jSource2,jSource3,jSource4,jSource5,jSource6,jDestn)
{
	var val1 = document.getElementById(jSource1).value;
	var val2 = document.getElementById(jSource2).value;
	var val3 = document.getElementById(jSource3).value;
	var val4 = document.getElementById(jSource4).value;
	var val5 = document.getElementById(jSource5).value;
	var val6 = document.getElementById(jSource6).value;
	var oTotal = eval(val1)+eval(val2)+eval(val3)+eval(val4)+eval(val5)+eval(val6);
	document.getElementById(jDestn).value = oTotal;
	var oForm = 'FeeForm';
	document.getElementById(oForm).submit();
}


function applyValues(jDestn,jSource)
{
	var oDestn = jDestn;
	var oSource = jSource.value;
	document.getElementById(oDestn).innerHTML = oSource;
}

function SetEmpty(oItem)
{
	var jItem = oItem;
	document.getElementById(jItem).value = "";
}

function divdisplay(oDisplay)
{
	document.getElementById(oDisplay).style.display ="block";
}

function divhide(oHide)
{
	document.getElementById(oHide).style.display ="none";
}


function CheckBoxCheckAll(oTagID,oTagMin,oTagMax)
{
	for(var i=0; i < oTagMax; i++)
	{
		var jID = oTagID + oTagMin;
		if (document.getElementById(jID).checked == true)
		{
			document.getElementById(jID).checked = false;
		}
		else
		{
			document.getElementById(jID).checked = true;
		}
		oTagMin = oTagMin + 1;
	}
}


function MultipleDisplay(oConstVal,oStartCtr,oEndCtr)
{
	for (var i=0; i<oEndCtr; i++ )
		{
			var jVal = oConstVal+oStartCtr;
			document.getElementById(jVal).style.display ="block";
			oStartCtr = oStartCtr + 1;
		}
}

function MultipleHide(oConstVal,oStartCtr,oEndCtr)
{
	for (var i=0; i<oEndCtr; i++ )
		{
			var jVal = oConstVal+oStartCtr;
			document.getElementById(jVal).style.display ="none";
			oStartCtr = oStartCtr + 1;
		}
}

function FormSubmit(oform)
{
	document.getElementById(oform).submit();
}


function PopWindow(oLink, oName, oWidth, oHeight, oScroll) 
{
	var winl = (screen.width - oWidth) / 2;
	var wint = (screen.height - oHeight) / 2;
	popWin = 'height='+oHeight+',width='+oWidth+',top='+wint+',left='+winl+',scrollbars='+oScroll+',resizable';
	win = window.open(oLink, oName, popWin);
	if (parseInt(navigator.appVersion) >= 4) 
		{
			 win.window.focus(); 
		}
}

function PopStdSizeWindow(jLink,jHeight,jWidth)
{
	var oHref = jLink;
	var oHeight = jHeight;
	var oWidth = jWidth;
	PopWindow(oHref,'OREA','750','500','yes');
	return false;
}


function PopWithToolbar(oLink, oName, oWidth, oHeight, oScroll, oTool) 
{
	var winl = (screen.width - oWidth) / 2;
	var wint = (screen.height - oHeight) / 2;
	popWin = 'height='+oHeight+',width='+oWidth+',top='+wint+',left='+winl+',toolbar='+oTool+',scrollbars='+oScroll+',resizable';
	win = window.open(oLink, oName, popWin);
	if (parseInt(navigator.appVersion) >= 4) 
		{
			 win.window.focus(); 
		}
}

function PopWithToolbarFullScreen(oLink) 
{
	var winl = 1;
	var wint = 1;
	var oWidth = (screen.width - 10);
	var oHeight = (screen.height - 10);
	var oTool = 'no';
	var oScroll = 'auto';
	popWin = 'height='+oHeight+',width='+oWidth+',top='+wint+',left='+winl+',toolbar='+oTool+',scrollbars='+oScroll+',resizable';
	win = window.open(oLink, '', popWin);
	if (parseInt(navigator.appVersion) >= 4) 
		{
			 win.window.focus(); 
		}
}

function fullScreen(theURL) 
{
window.open(theURL, '', 'toolbar=yes,scrollbars=auto,fullscreen=yes,resizable');
}

function transferHTML(oFrom, oTo)
{
	var jTo = oTo;
	var jFrom = document.getElementById(oFrom).innerHTML;
	document.getElementById(jTo).value = jFrom;
}

function GetNameAndAssignTo(oPromptMessage, oApplyValueTo)
{
	var jNameToAssign = window.prompt(oPromptMessage);
	document.getElementById(oApplyValueTo).value = jNameToAssign;
}

function transferHTMLandFormSubmit(oFrom,oTo,oform)
{
	transferHTML(oFrom, oTo);
	FormSubmit(oform);
}

