function next_focus(formName, elementName, elementLength, nextElement) {
        if(document.forms[formName].elements[elementName].value.length >= elementLength)
                document.forms[formName].elements[nextElement].focus()
        return true
}

function setFocusOnFirstBlankInput() {

  var field = document.forms[0];

  for (i = 0; i < field.length; i++) {

    if (((field.elements[i].type == "text") || (field.elements[i].type == "password")) && (field.elements[i].value.length == 0)) {
      document.forms[0].elements[i].focus();
      break;
    }
  }
}

function textAreaCharacterLimiter(field, maxlimit) {

  if (field.value.length > maxlimit)
    field.value = field.value.substring(0, maxlimit);
}

function popup(url,width,height){
	winWidth = 800;
	winHeight = 600;

	if (screen) {
		winWidth = screen.width;
		winHeight = screen.height;
	}

	leftLocation = ((winWidth/2)-(width/2));
	topLocation = ((winHeight/2)-(height/2));

	windowObj =	window.open(url,"newWin","toolbar=no,width=" + width + ",height=" + height + ",menubar=no,status=yes,scrollbars=no,resizable=no,top=" + topLocation + ",left=" + leftLocation);
	windowObj.focus();
}

/*
function showDetailView(URL, orientation){

	if (orientation=='P') {
		width = 602;
		height = 830;
	} else {
		width = 803;
		height = 635;
	}
	
	alert(URL);

	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + ",top=0,left=0');");
}*/

function bookmarksite(title, url){
	if (navigator.appVersion.indexOf("AOL")>0){
	alert ("Please add us to your AOL Favorites Folder by clicking on the red heart Favorites icon at the top of your browser window.");
	}
	else {
		if (document.all)
			window.external.AddFavorite(url, title);
		else if (window.sidebar)
			window.sidebar.addPanel(title, url, "");
	}
}

function right(e) { 
	var d = new Date();
	d = d.getFullYear();
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))return false;
		else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { 
			alert("(c)2004-" + d + " Tomgirl Baking Company");
			return false;
		}
		return true;
	}

document.onmousedown=right;document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;


