//Javascript document

function loadValueFromQuerystring() {
	var hasQueryString = document.URL.indexOf('?');
	var queryString = "";
	if (hasQueryString != -1) {
		// Create variable from ? in the url to the end of the string
		queryString = document.URL.substring(hasQueryString+6, document.URL.length);
		//alert(queryString);
		document.archiveSearch.AuthorLastName.value = queryString;
	}
}


function clearField(thefield) {
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}

function winopen(page,name,w,h) {
	window.open(page, "coupon", "width="+w+",height="+h+",scrollbars=yes,menubar=yes,resizable=yes");
}

function popWindow(pURL,name,features){
	new_window = window.open(pURL,name,features);
	new_window.focus();
}

function switchElementVisibility(elementID, state) {
	if (document.getElementById(elementID))	{
		objDiv = document.getElementById(elementID);
		if (state == 'on') {
			objDiv.style.display = 'block';
		} else if (state == 'off') {
			objDiv.style.display = 'none';
		}
	}
}