
//////////////////////////////////////////////////////////////////
//////////////////////	Text Counter	//////////////////////////
//////////////////////////////////////////////////////////////////

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) { // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
	}
	// otherwise, update counter
	else { 
		countfield.value = field.value.length;
	}
}

function textCounterById(fieldId, countfield, maxlimit) {
	//alert(document.getElementById(fieldId).value.length);
	//alert(countfield);
	if (document.getElementById(fieldId).value.length > maxlimit) { // if too long...trim it!
		document.getElementById(fieldId).value = document.getElementById(fieldId).value.substring(0, maxlimit);
	}
	// otherwise, update counter
	else { 
		countfield.value = document.getElementById(fieldId).value.length;
	}
}

//////////////////////////////////////////////////////////////////
//////////////////////	Submit Once	//////////////////////////////
//////////////////////////////////////////////////////////////////

var submitcount = 0;
function submitOnce() {
   if (submitcount == 0) {
      submitcount++;
      return true;
   }
   else  {
      //alert("This form has already been submitted.");
      return false;
   }
}


//////////////////////////////////////////////////////////////////
//////////////////////	"zpop" Function	//////////////////////////
//////////////////////////////////////////////////////////////////
var p; 
function zpop(url,id,h,w,mb,tb) { 

p = window.open(url,id,"height="+h+",width="+w+",menubar="+mb+",resizable=yes,toolbar="+tb+",scrollbars=yes"); 

p.window.focus();

} 