
var WGdc=".";  
	var WGgc=",";
	var WGnc="-";
	var WGcs="";
function WGformatMoney(A,W) 
{  
// Author   : Jonathan Weesner (http://cyberstation.net/~jweesner/)
// Copyright: Use freely. Keep Author and Copyright lines intact.
	var N=Math.abs(Math.round(A*100));
   var S=((N<10)?"00":((N<100)?"0":""))+N;

   S=WGcs+((A<0)?WGnc:"")+WGgroup(S.substring(0,(S.length-2)))+WGdc+
      S.substring((S.length-2),S.length)+((A<0&&WGnc=="(")?")":"");
   return (S.length>W)?"Over":S;
}

// WGgroup inspired by Bill Dortch's usenet post (www.hidaho.com)
function WGgroup(S) 
{
   return (S.length<4)?S:(WGgroup(S.substring(0,S.length-3))+
      WGgc+S.substring(S.length-3,S.length));
}

function roundOff(value, precision) {	// Precision = 2 decimal places
		if(parseInt(value) <= 0) {
			// Incorrect Value
			return 0;
			}
		
        value = "" + value //convert value to string
        precision = parseInt(precision);
        var whole = "" + Math.round(value * Math.pow(10, precision));
        var decPoint = whole.length - precision;        if(decPoint != 0)
        {                result = whole.substring(0, decPoint);
                result += ".";
                result += whole.substring(decPoint, whole.length);        }
        else        {                result = whole;        }
        return result;
}



function amtround(num)
{
	numrnd = 0;
	numrnd = num * 100;
	numrnd = Math.round(numrnd);
	temp1 = numrnd.toString(10);
	temp1n = temp1.length;
	numrnd = temp1.substring(0,temp1n-2) + "." + temp1.substring(temp1n-2,temp1n);	
	numrnd = parseFloat(numrnd);
}

function amtround2(num)
{
	numrnd2 = 0;
	numrnd2 = num * 100;
	numrnd2 = Math.round(numrnd2);
	temp1 = numrnd2.toString(10);
	temp1n = temp1.length;
	numrnd2 = temp1.substring(0,temp1n-2) + "." + temp1.substring(temp1n-2,temp1n);	
	numrnd2 = parseFloat(numrnd2);
}

function calc3(form) {
	a = form.a.value*1;
	a = a-form.b.value*1;
	a = a-form.c.value*1;
	a = a-form.d.value*1;
	a = a-form.e.value*1;
	a = a-form.f.value*1;
	amtround(a);
	a = numrnd;
	
	form.Answer.value = WGformatMoney(numrnd);
	}

function calc2(form) {
	a = form.a.value*1;
	a = a+form.b.value*1;
	a = a+form.c.value*1;
	a = a+form.d.value*1;
	e = form.e.value*1;
	e = e+form.f.value*1;
	e = e+form.g.value*1;
	e = e+form.h.value*1;
	e = e+form.i.value*1;
	amtround(a);
	amtround2(e);
	a = numrnd;
	e = numrnd2;
		
	form.Attend.value = WGformatMoney(numrnd);
	form.Other.value = WGformatMoney(numrnd2);
	
	form.Answer.value = WGformatMoney(a+e);
	}


function change1(url){
location.href=url;	
}

function OpenWin(sLocation) 
{
window.open(sLocation, 'New_Window','width=600,height=525, history=no,resizable=yes,status=no,scrollbars=no,toolbar=no,scrolling,menubar=no,left=0,top=0"')
}

function OpenWin1(sLocation) 
{
window.open(sLocation, 'New_Window', 'width=750,height=550, history=yes,resizable=yes,status=yes,scrollbars=yes,toolbar=yes,scrolling,menubar=yes,left=0,top=0"')
}

function OpenWin9(sLocation)
{ 
window.open(sLocation, 'New_Window','width=750,height=570,history=no,resizable=yes,status=no,scrollbars=yes,scrolling=yes,menubar=no, toolbar=no,left=0, top=0"'); 
}

var str = "left=0,screenX=0,top=0,screenY=0,fullscreen, " +
"menubar=0,scrollbars=1,scrolling=1,resizable=1'";

if (window.screen) {
var ah = screen.availHeight - 30;
  var aw = screen.availWidth - 10;
  str += ",height=" + ah;
  str += ",innerHeight=" + ah;
  str += ",width=" + aw;
  str += ",innerWidth=" + aw;
} else {
str += ",resizable"; // so the user can resize the window manually
}

function showRemote(sLocation) {
self.name = "main";

OpenWindow = window.open(sLocation, "remote", str); 
}

function showRemote2(sLocation) {
self.name = "main";

var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=1,scrolling=1,resizable=1,width=500,height=500,left=0,top=0'"; 

OpenWindow = window.open(sLocation, "remote", windowprops);
}

function showRemote3(sLocation) {
self.name = "main";

var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=1,scrolling=1,resizable=1,width=700,height=525,left=0,top=0'"; 

OpenWindow = window.open(sLocation, "remote", windowprops);
}

function closeRemote() {
timer = setTimeout('window.close();', 10);
}


