var submitCount = 0;

function nopopup() {
	submitCount++;
}

function submitOnce() {
	submitCount++;
	/*
	if (submitCount == 0) {
		submitCount++;
		return true;
	} else {
		alert("Processing ...");
		return false;
	}
	*/
}

var exitPopVar = 1;

function exitPop() {

	if(location.search.indexOf("nopop") != -1) {
		return(0);
	}
	if (submitCount > 0) exitPopVar = 0;
	if (exitPopVar) {
		var url    = "winback.aspx?pd=" + pd + "&od=" + od + "&source=" + source + "&pop=" + pop;
		var top    = 0;
		var left   = 0;
		var width  = 250;
		var height = 250;
		
		if (!top)  {top  = (window.screen.availHeight - height)/2;}
		if (!left) {left = (window.screen.availWidth  - width )/2;}

		var PoPv = 'location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0';
		var PoPw = window.open(url,'_blank','width='+width+',height='+height+',top='+top+',left='+left+','+PoPv+'');
	}
}

function autotab(original,destination) {
	if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
		destination.focus()
}
