<!--
var textCleared = false;
var pass = "";
function toggleBlock(block) {
	if(block) {
		if(block.style.display != "none") collapseBlock(block);
		else expandBlock(block);
	}
}

function expandBlock(block) {
	if(block) {
		block.style.display = "block";
	}
}

function collapseBlock(block) {
	if(block) {
		block.style.display = "none";
	}
}

function clearDefaultText(t, type) {
	if(type == "ID") {
		if(t.value == "ASN ID") t.value = "";
	} else if(type == "PASSWORD") {
		if(t.value == "PASSWORD") t.value = "";
		textCleared = true;
		//if(t.type == "text") t.type = "password";
	}
}

function verifyNoEmailDesired(t) {
	if(t && t.checked == true) {
		if(confirm("If you do not provide an email address, you cannot receive email confirmations or communications from us.  Are you sure you wish to proceed?")) {
			t.form.param_email_e_r_80.value = "nomail@notaries.org";
			return true;
		}
		return false;
	}
	return true;
}

function putPassInForm(t) {
	if(t) {
		updateHiddenPassword(t.tpassword);
		t.password.value = pass;
	}
}

function updateHiddenPassword(t) {
	if(textCleared) {
		var val = t.value.split('');
		var tempPass = pass.split('');
		for(i = 0; i < val.length; i++) {
			if(val[i] != '*') {
				tempPass[i] = val[i];
				val[i] = '*';
			}
		}
		t.value = val.join('');
		pass = tempPass.join('');
		if(t.value.length < pass.length) pass = pass.substr(0, t.value.length);
	}
}

function confirmDeleteCourse() {
	if(confirm("This action will permanently and irreversibly delete the selected course and all of its content.  Are you sure you want to do this?")) {
		return true;
	}
	return false;
}

function verifyDeleteOrder() {
	if(confirm("This action will permanently and irreversibly delete the selected order and all of its items and payments.  Are you sure you want to do this?")) {
		return true;
	}
	return false;
}

function getStateInfo(state) {
	
}

function checkContentLength(t, len) {
	if(t.value.length > len) {
		alert("This field has a maximum allowable length of " + len + " characters");
		t.value = t.value.substring(0, len);
	}
	return true;
}

function verifyCatDelete() {
	if(confirm("This action will permanently and irreversibly delete the selected product category and ANY PRODUCTS IT CURRENTLY CONTAINS.  Are you sure you want to do this?")) {
		return true;
	}
	return false;
}

function verifyDeleteSection() {
	if(confirm("This action will permanently and irreversibly delete the selected course section and its contents.  Are you sure you want to do this?")) {
		return true;
	}
	return false;
}

function getStateInfoFromMap(t) {
	if(t && t.length == 2) {
		document.location.href="?form=stateinfo&statecode="+t;
		return true;
	}
	return false;
}

function chooseLocatorCity(t, oth) {
	t2 = document.getElementById(oth);
	if(t.selectedIndex > 0 && t2.selectedIndex > 0) {
		document.location.href="?form=locator&state="+t2.options[t2.selectedIndex].value+"&city="+t.options[t.selectedIndex].value;
		return true;
	}
	return false;
}

function sortBy(t, url) {
	document.location.href = url + "&sortby=" + t.options[t.selectedIndex].value;
}

var isOpen = true;

function openSpecialNav() {
	//if(isOpen) return;
	var t = document.getElementById('loginNavDiv');
	new Effect.Appear(t);
	//isOpen = true;
}

function closeSpecialNav(e) {
	var t = document.getElementById('loginNavDiv');
	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	//alert(tg.tagName);
	if (tg.nodeType != 1 || tg.nodeName != 'DIV') return;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	while (reltg && reltg != tg && reltg.nodeName != 'BODY') {
		if(reltg.id == "siteNav") return;
		reltg= reltg.parentNode;
	}
	if (! reltg || reltg == tg || reltg.id == "siteNav") return;
	new Effect.Fade(t);
}

function toggleExampleImage(t2, t) {
	if(t) {
		if(isOpen) {
			new Effect.Fade(t);
			isOpen = false;
			t2.innerHTML = "Click to Show Example Images";
		} else {
			new Effect.Appear(t);
			isOpen = true;
			t2.innerHTML = "Click to Hide Example Images";
		}
	}
}

function openwin(url, w, h) {
	if(url) {
		var twin = window.open(url,'thisWin','location=no,toolbars=no,width='+w+',height='+h+',scrollbars=yes');
		if(twin) {
			twin.focus();
		}
	}
}

function applyFilter(t) {
	document.location.href = "?form=editjoinproducts&filter="+t.options[t.selectedIndex].value;
}

function applyProductFilter(t) {
	document.location.href = "?form=productlist&filter="+t.options[t.selectedIndex].value;
}

function applyAddOnFilter(t) {
	document.location.href = "?form=editaddonproducts&filter="+t.options[t.selectedIndex].value;
}

var handlerFunc = function(t) {
    document.getElementById("pagearea").innerHTML = t.responseText;
}

var errFunc = function(t) {
    alert('Error ' + t.status + ' -- ' + t.statusText);
}


function doQtyUpdate(f) {
	qstr = formData2QueryString(f);
	//qstr += "&form=viewcart&updateqty=true&altdoc=true";
	new Ajax.Request('index.php?form=viewcart&altdoc=true&updateqty=true', {asynchronous:true, method:'post', postBody:qstr, onSuccess:handlerFunc, onFailure:errFunc});
}

function formData2QueryString(f) {

	var docForm = f;
	var strSubmitContent = '';
	var formElem;
	var strLastElemName = '';
	
	for (i = 0; i < docForm.elements.length; i++) {
		
		formElem = docForm.elements[i];
		switch (formElem.type) {
			// Text fields, hidden form elements
			case 'text':
			case 'hidden':
			case 'password':
			case 'textarea':
			case 'select-one':
				strSubmitContent += formElem.name + '=' + escape(formElem.value) + '&'
				break;
				
			// Radio buttons
			case 'radio':
				if (formElem.checked) {
					strSubmitContent += formElem.name + '=' + escape(formElem.value) + '&'
				}
				break;
				
			// Checkboxes
			case 'checkbox':
				if (formElem.checked) {
					// Continuing multiple, same-name checkboxes
					if (formElem.name == strLastElemName) {
						// Strip of end ampersand if there is one
						if (strSubmitContent.lastIndexOf('&') == strSubmitContent.length-1) {
							strSubmitContent = strSubmitContent.substr(0, strSubmitContent.length - 1);
						}
						// Append value as comma-delimited string
						strSubmitContent += ',' + escape(formElem.value);
					}
					else {
						strSubmitContent += formElem.name + '=' + escape(formElem.value);
					}
					strSubmitContent += '&';
				}
				break;
				
		}
		strLastElemName = formElem.name
	}
	
	// Remove trailing separator
	strSubmitContent = strSubmitContent.substr(0, strSubmitContent.length - 1);
	return strSubmitContent;
}

//-->

