
/*
Submit Once form validation- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

/*
  forms need to look like the following: <form method="POST" onSubmit="submitonce(this)">
  OR we can accomplish the same thing with the line below
  Pages that want to use this script should look like the following (declared after the form):
  <script src='../lib/functions.js'></script>
*/

if(document.forms[0] !=null)
	document.forms[0].onsubmit=submitonce;

function submitonce(){
	var theform = document.forms[0];
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
		//screen thru every element in the form, and hunt down "submit" 
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit")
				//disable em
				tempobj.disabled=true
		}
	}
}


function openHelpWin(pageURL, anchorName){
	var popWin = null;
	pageURL = "" + pageURL
	if(pageURL == 'undefined')
		pageURL = "default.htm"
	
	if(!popWin || popWin.closed){
		popWin = window.open('http://www.gunaa.org/documents/help/' +
		pageURL + "#" + anchorName,'helpWin','scrollbars=yes,width=530,height=400');
	}
	popWin.focus();
}

function openInfoWin(pageURL, anchorName){
	var popWin = null;
	pageURL = "" + pageURL
	if(pageURL == 'undefined')
		pageURL = "default.htm"
	
	if(!popWin || popWin.closed){
		popWin = window.open('http://www.gunaa.org/documents/' +
		pageURL + "#" + anchorName,'infoWin','scrollbars=yes,width=530,height=400');
	}
	popWin.focus();
}

function changeECBX(form,ptype) {
	form.paytype.value = ptype;
	form.submit();
}

function printcard(){
	pgcard = window.open('pgunaacard.asp','pgcard','scrollbars=no,height=0,width=0');
   	pgcard.location.href = "pgunaacard.asp"
        if(navigator.appVersion.indexOf("4") != -1){
            pgcard.moveTo(0,0);
        }
	pgcard.focus();
}

function showcard(){
	
   	gcard = window.open('gunaacard.asp','gcard','scrollbars=yes,height=390,width=597');
   	gcard.location.href = "gunaacard.asp"
        if(navigator.appVersion.indexOf("4") != -1){
            gcard.moveTo(195,255);
        }
	gcard.focus();
}

function checkTextCount(fieldname, leftfieldname, count) {

		if (fieldname.value.length > count) {
		
			fieldname.value = fieldname.value.substring(0, count);
			
		} else {
		
			leftfieldname.value = count - fieldname.value.length;
			
		}
	}