
var searchBoxHeight = 52;
var timeoutId = null;
var searchBoxTop = 52;

function slide() {
	var searchBox = document.getElementById("search_box");
	if (searchBox) {
		if (searchBoxTop > 1) {
			searchBoxTop -= 3;
			searchBox.style.top = searchBoxTop + "px";
			searchBox.style.clip = "rect(0px,116px," + (searchBoxHeight - searchBoxTop) + "px,0px)";
			timeoutId = window.setTimeout("slide()", 30);
		} else {
			if (timeoutId != null) {
				window.clearTimeout(timeoutId);
				timeoutId = null;
			}
		}
	}
}

function setFieldValue(obj, str) {
	// clears field when user clicks in. resets to default str when user clicks out 
	// with no value in the field.
	if (obj.value == str) {
		obj.value = "";
	}
	else if (obj.value == "") {
		obj.value = str;
	}
}

function doTourPopup() {
	popUpModal('../../optima_tour.html', 646, 416);
	
}

// popup window (full) - all window elements are enabled
function popUpFull(url, width, height) {
	wndHndl = window.open(url, 'popup' + Math.floor(Math.random()*1000), 'toolbar=yes,scrollbars=yes,location=yes,statusbar=yes,menubar=yes,resizable=yes,width=' + width + ',height=' + height + ',left=100,top=100');
	if (wndHndl) {
		wndHndl.focus();
	} else {
	  alert(popupBlockWarningMessage);
	}
}

// popup window (limited) - only scrollbars and window resizing are enabled
function popUpLimited(url, width, height) {
	wndHndl = window.open(url, 'popup' + Math.floor(Math.random()*1000), 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=yes,width=' + width + ',height=' + height + ',left=100,top=100');
	if (wndHndl) {
		wndHndl.focus();
	} else {
	  alert(popupBlockWarningMessage);
	}
}

// popup window (modal) - all window elements are disabled
function popUpModal(url, width, height) {
	wndHndl = window.open(url, 'popup' + Math.floor(Math.random()*1000), 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=no,width=' + width + ',height=' + height + ',left=100,top=100');
	if (wndHndl) {
		wndHndl.focus();
	} else {
	  alert(popupBlockWarningMessage);
	}
}

// get a request parameter - returns empty string if not found
function getParameter(parameterName) {
	var queryString = window.location.search;
	var parameterName = parameterName + "=";
	
	if (queryString.length > 0) {
		begin = queryString.indexOf ( parameterName );
		if (begin != -1) {
			begin += parameterName.length;
			end = queryString.indexOf ("&" , begin);
			if (end == -1) {
				end = queryString.length
			}
			return unescape (queryString.substring(begin, end));
		}
	}
	return "";
}

