+ if(document.getElementsByName('searchfor_tag')[0] != undefined)
+ document.getElementsByName('searchfor_tag')[0].value = '';
+ if(document.getElementsByName('searchfor_name')[0] != undefined)
+ document.getElementsByName('searchfor_name')[0].value = '';
+
+ if(document.getElementsByName('consider_date')[0] != undefined &&
+ document.getElementsByName('consider_date')[0].checked == true) {
+ document.getElementsByName('consider_date')[0].checked = false;
+ datesearch();
+ }
+ if(document.getElementsByName('consider_rate')[0] != undefined &&
+ document.getElementsByName('consider_rate')[0].checked == true) {
+ document.getElementsByName('consider_rate')[0].checked = false;
+ }
+
+} // clearSearch()
+
+/**
+ * if the client is planless, ask the server what to do
+ * next.
+ */
+function AskServerWhatToDo()
+{
+ return HTML_AJAX.grab(encodeURI(web_path + '/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...).
+ *
+ * as parameter the server can set the correct webpath.
+ * espacialley when using user-friendly url's, the browser
+ * does not know the correct URLs to address images, stylesheets,
+ * ... then.
+ */
+function init_phpfspot(srv_webpath)
+{
+ if(srv_webpath != undefined)
+ web_path = srv_webpath;
+ else
+ web_path = '';
+
+ /* always load list of available tags */
+ //this should not be more necessary since 4.5.08
+ //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()) {
+ showPhoto(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(web_path + '/rpc.php?action=get_photo_to_show'));
+
+ // if no image needs to be shown, return false from here
+ if(photo_to_show == "")
+ return false;
+
+ return photo_to_show;
+
+} // getPhotoToShow()
+
+/**
+ * a fake-zoom for photo
+ *
+ * a quick to let the browser do some zooming on
+ * photos.
+ */
+function zoom(mod)
+{
+ var photo;
+
+ if(mod == undefined)
+ return;
+
+ /* internet explorer */
+ if(document.images['photo'].width)
+ photo = document.images['photo'];
+
+ /* all others */
+ if(photo == undefined && document.getElementById('photo').width)
+ photo = document.getElementById('photo');
+
+ if(photo != undefined) {
+
+ if(origWidth == undefined)
+ origWidth = photo.width;
+ if(origHeight == undefined)
+ origHeight = photo.height;
+
+ if(mod != 0) {
+ new_w = photo.width * (1 + mod/100);
+ new_h = photo.height * (1 + mod/100);
+ photo.width = new_w;
+ photo.height = new_h;
+
+ if(photo_details_pos == undefined) {
+ photo_details_pos = findPos(document.getElementById('photo_details'),'left');
+ }
+
+ if((photo.offsetLeft + new_w) >= photo_details_pos-20) {
+ hidePhotoDetails('true');
+ }
+ else {
+ hidePhotoDetails('false');
+ }
+ }
+ else {
+ photo.width = origWidth;
+ photo.height = origHeight;
+ hidePhotoDetails('false');
+ }
+ }
+
+} // zoom()
+
+/**
+ * hides the photo details layin
+ *
+ * if the photo is getting zoomed quiet large, this will
+ * auto-hide (and also restore) the photo-details-box.
+ */
+function hidePhotoDetails(mode)
+{
+ var photo_details;
+
+ if(photo_details = document.getElementById('photo_details')) {
+ if(mode == 'true') {
+ photo_details.style.visibility = 'hidden';
+ photo_details.style.display = 'none';
+ }
+ else {
+ photo_details.style.visibility = 'visible';
+ photo_details.style.display = '';
+ }
+ }
+} // hidePhotoDetails()
+
+/**
+ * show calendar
+ */
+function showCalendar(date_box, click_obj)
+{
+ var calendar = document.getElementById('calendar');
+ var year = document.getElementById(date_box+'year').value;
+ var month = document.getElementById(date_box+'month').value;
+ if(date_box == 'from') {
+ var xpos = document.getElementById('frompic').offsetLeft;
+ var ypos = document.getElementById('frompic').offsetTop;
+ calendar_mode = 'from';
+ }
+ if(date_box == 'to') {
+ var xpos = document.getElementById('topic').offsetLeft;
+ var ypos = document.getElementById('topic').offsetTop;
+ calendar_mode = 'to';
+ }
+ calendar.style.left = xpos + 100 + 'px';
+ calendar.style.top = ypos + 80 + 'px';
+
+ if(calendar.style.visibility == "" || calendar.style.visibility == 'hidden') {
+ calendar.style.visibility = 'visible';
+ calendar.innerHTML = "Loading...";
+ calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path +'/rpc.php?action=get_calendar_matrix&year=' + year + '&month=' + month));
+ calendar_shown = 1;
+ }
+ else {
+ hideCalendar();
+ }
+
+} // showCalendar()
+
+/**
+ * hide calendar
+ */
+function hideCalendar()
+{
+ var calendar = document.getElementById('calendar');
+ if(calendar.style.visibility != 'hidden') {
+ calendar.style.visibility = 'hidden';
+ calendar_shown = 0;
+ }
+} // hideCalendar()
+
+/**
+ * switch month in calendar
+ */
+function setMonth(year, month, day)
+{
+ var calendar = document.getElementById('calendar');
+ calendar.innerHTML = "Loading...";
+ calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day));