+ HTML_AJAX.replace(document.getElementById("content"), encodeURI(url));
+
+} // showPhotoIndex()
+
+/**
+ * update photo index
+ *
+ * this function will be called, to request a refresh of the
+ * photo index. this, for example, can be caused, when changing
+ * the tag-selection.
+ */
+function refreshPhotoIndex()
+{
+ /* only invoke showPhotoIndex(), if photo-index is really shown */
+ if(document.getElementById("index") != undefined || startup == 1) {
+ showPhotoIndex();
+ startup = 0;
+ }
+
+} // refreshPhotoIndex()
+
+/**
+ * blur cursor focus
+ *
+ * this function removes the focus-rectangle which may appear
+ * when click on a link. Not always beautiful.
+ */
+function click(object)
+{
+ if(object.blur)
+ object.blur();
+
+} // click()
+
+/**
+ * change current radio-button setting
+ *
+ * This function will check the radio-button with the given value.
+ * If no radio-button is currently displayed, this function will do
+ * nothing.
+ * If the given value does not exist, the existing radio buttons will
+ * be reseted.
+ */
+function setCheckedValue(condition, value) {
+
+ var count = condition.length;
+ if(count == undefined) {
+ condition.checked = (condition.value == value.toString());
+ return;
+ }
+ for(var i = 0; i < count; i++) {
+ condition[i].checked = false;
+ if(condition[i].value == value.toString()) {
+ condition[i].checked = true;
+ }
+ }
+
+} // setCheckedValue()
+
+/**
+ * Invoke a search
+ *
+ * This function will be invoked by starting
+ * any kind of search (tag-name, photo-name, date, ...).
+ */
+function startSearch()
+{
+ from_year = document.getElementById('fromyear').value;
+ from_month = document.getElementById('frommonth').value;
+ from_day = document.getElementById('fromday').value;
+ from = from_year +"-"+ from_month +"-"+ from_day;
+ to_year = document.getElementById('toyear').value;
+ to_month = document.getElementById('tomonth').value;
+ to_day = document.getElementById('today').value;
+ to = to_year +"-"+ to_month +"-"+ to_day;
+
+ var objTemp = new Object();
+ objTemp['action'] = 'search';
+
+ if(document.getElementsByName('searchfor_tag')[0].value != "") {
+ objTemp['for_tag'] = document.getElementsByName('searchfor_tag')[0].value;
+ }
+ if(document.getElementsByName('searchfor_name')[0].value != "") {
+ objTemp['for_name'] = document.getElementsByName('searchfor_name')[0].value;
+ }
+ if(document.getElementsByName('consider_date')[0].checked == true) {
+ objTemp['from'] = from;
+ objTemp['to'] = to;
+ }
+
+ var retr = HTML_AJAX.post('rpc.php', objTemp);
+ if(retr == "ok") {
+ refreshAvailableTags();
+ refreshSelectedTags();
+ showPhotoIndex();
+ }
+ else {
+ window.alert("Server message: "+ retr);
+ }
+
+} // startSearch()
+
+/**
+ * enable/disable date search
+ *
+ * this function will either enable or disable the
+ * input fields for the date-search
+ */
+function datesearch()
+{
+ var mode = true;
+
+ if(document.getElementsByName('consider_date')[0].checked == true) {
+ mode = false;
+ }
+
+ document.getElementById('fromyear').disabled = mode;
+ document.getElementById('frommonth').disabled = mode;
+ document.getElementById('fromday').disabled = mode;
+ document.getElementById('toyear').disabled = mode;
+ document.getElementById('tomonth').disabled = mode;
+ document.getElementById('today').disabled = mode;
+
+} // datesearch()
+
+/**
+ * set view mode
+ *
+ * called for photo-index export. will return the
+ * selected mode via AJAX from the server.
+ */
+function setViewMode(mode)
+{
+ var exprt = document.getElementById('output');
+ exprt.innerHTML = "Loading...";
+ exprt.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_export&mode=' + mode));
+
+} // setViewMode()
+
+/**
+ * reset all search-fields
+ */
+function clearSearch()
+{
+ document.getElementsByName('searchfor_tag')[0].value = '';
+ document.getElementsByName('searchfor_name')[0].value = '';
+
+ if(document.getElementsByName('consider_date')[0].checked == true) {
+ document.getElementsByName('consider_date')[0].checked = false;
+ datesearch();
+ }
+
+} // clearSearch()
+
+/**
+ * if the client is planless, ask the server what to do
+ * next.
+ */
+function AskServerWhatToDo()
+{
+ return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
+} // AskServerWhatToDo()
+
+/**
+ * init phpfspot
+ *
+ * this function will be called when the browser opens phpfspot
+ * the first time. It will fetch the tag-lists and will then
+ * switch to the right view, which the browser got told from
+ * the server (maybe someone hit the refresh button...).
+ */
+function init_phpfspot(mode)
+{
+ /* always load list of available tags */
+ refreshAvailableTags();
+
+ /* ask the server what we are currently displaying */
+ whattodo = AskServerWhatToDo();
+
+ if(whattodo == 'showpi' || whattodo == 'showpi_date') {
+ showPhotoIndex();
+ }
+ if(whattodo == 'showpi_tags') {
+ refreshSelectedTags();
+ showPhotoIndex();
+ }
+ if(whattodo == 'show_photo') {
+ if(photo = getPhotoToShow()) {
+ showImage(photo);
+ refreshSelectedTags();
+ }
+ }
+
+} // init_phpfspot()
+
+/**
+ * change background-color on mouse-over
+ */
+function setBackGrdColor(item, color)
+{
+ if(color == 'mouseover')
+ item.style.backgroundColor='#c6e9ff';
+ if(color == 'mouseout')
+ item.style.backgroundColor='#eeeeee';
+ if(color == 'mouseclick')
+ item.style.backgroundColor='#93A8CA';
+
+} // setBackGrdColor()
+
+/**
+ * ask server, which photo needs to be shown
+ *
+ * when user press the refresh-button in a single-photo
+ * view or maybe enters the link via an external URL, the
+ * client does not know, what photo will be shown (dimensions...).
+ * But the server can tell this the browser.
+ */
+function getPhotoToShow()
+{
+ var photo_to_show = HTML_AJAX.grab(encodeURI('rpc.php?action=get_photo_to_show'));