3 var image_div = document.getElementById("content");
4 image_div.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=showphoto&id=' + id));
9 var credits = document.getElementById("content");
10 credits.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=showcredits'));
13 function Tags(mode, id)
16 // add the tag to users session
17 HTML_AJAX.grab(encodeURI('rpc.php?action=addtag&id=' + id));
19 else if(mode == "del") {
20 // del the tag from users session
21 HTML_AJAX.grab(encodeURI('rpc.php?action=deltag&id=' + id));
23 else if(mode == "condition") {
24 setCheckedValue(id, id.value);
25 HTML_AJAX.grab(encodeURI('rpc.php?action=tagcondition&mode=' + id.value));
28 refreshAvailableTags();
29 refreshSelectedTags();
34 function refreshAvailableTags()
36 // update available tags
37 var avail_tags = document.getElementById('available_tags');
38 avail_tags.innerHTML = "Loading...";
39 avail_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_available_tags'));
42 function refreshSelectedTags()
44 // update selected tags
45 var selected_tags = document.getElementById("selected_tags");
46 selected_tags.innerHTML = "Loading...";
47 selected_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_selected_tags'));
50 function showPhotoIndex(begin_with)
52 if(begin_with == undefined)
53 HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=show_photo_index'));
55 HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=show_photo_index&begin_with=' + begin_with));
58 // if photo index is currently shown, refresh it
59 function refreshPhotoIndex()
61 if(document.getElementById("matrix") != undefined || startup == 1) {
67 function click(object)
74 // set the radio button with the given value as being checked
75 // do nothing if there are no radio buttons
76 // if the given value does not exist, all the radio buttons
77 // are reset to unchecked
78 function setCheckedValue(condition, value) {
80 var count = condition.length;
81 if(count == undefined) {
82 condition.checked = (condition.value == value.toString());
85 for(var i = 0; i < count; i++) {
86 condition[i].checked = false;
87 if(condition[i].value == value.toString()) {
88 condition[i].checked = true;
93 function startSearch()
95 var searchfor = document.getElementsByName('searchfor')[0].value
97 from_year = document.getElementById('fromyear').value;
98 from_month = document.getElementById('frommonth').value;
99 from_day = document.getElementById('fromday').value;
100 from = from_year +"-"+ from_month +"-"+ from_day;
101 to_year = document.getElementById('toyear').value;
102 to_month = document.getElementById('tomonth').value;
103 to_day = document.getElementById('today').value;
104 to = to_year +"-"+ to_month +"-"+ to_day;
106 var request = 'rpc.php?action=search';
108 if(searchfor != "") {
109 request = request + '&for=' + searchfor;
112 if(document.getElementsByName('consider_date')[0].checked == true) {
113 request = request + '&from='+ from +'&to='+ to;
116 var sort_order = document.getElementsByName('sort_order')[0];
117 request = request + '&sort_order='+ sort_order.options[sort_order.selectedIndex].value;
119 HTML_AJAX.grab(encodeURI(request));
121 refreshAvailableTags();
122 refreshSelectedTags();
127 function datesearch()
131 if(document.getElementsByName('consider_date')[0].checked == true) {
135 document.getElementById('fromyear').disabled = mode;
136 document.getElementById('frommonth').disabled = mode;
137 document.getElementById('fromday').disabled = mode;
138 document.getElementById('toyear').disabled = mode;
139 document.getElementById('tomonth').disabled = mode;
140 document.getElementById('today').disabled = mode;
144 function setViewMode(mode)
146 var exprt = document.getElementById('output');
147 exprt.innerHTML = "Loading...";
148 exprt.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_export&mode=' + mode));
151 function clearSearch()
153 document.getElementsByName('searchfor')[0].value = '';
155 if(document.getElementsByName('consider_date')[0].checked == true) {
156 document.getElementsByName('consider_date')[0].checked = false;
161 function AskServerWhatToDo()
163 return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
166 function init_phpfspot()
168 refreshAvailableTags();
170 whattodo = AskServerWhatToDo();
172 if(whattodo == 'showpi' || whattodo == 'showpi_date') {
175 if(whattodo == 'showpi_tags') {
176 refreshSelectedTags();
179 if(whattodo == 'show_photo') {
180 if(photo = getPhotoToShow()) {
182 refreshSelectedTags();
187 function setBackGrdColor(item, color)
189 if(color == 'mouseover')
190 item.style.backgroundColor='#c6e9ff';
191 if(color == 'mouseout')
192 item.style.backgroundColor='#eeeeee';
193 if(color == 'mouseclick')
194 item.style.backgroundColor='#93A8CA';
197 function getPhotoToShow()
199 // update selected tags
200 var photo_to_show = HTML_AJAX.grab(encodeURI('rpc.php?action=get_photo_to_show'));
202 // if no image needs to be shown, return false from here
203 if(photo_to_show == "")
206 return photo_to_show;
209 function showCalendar(date_box, click_obj)
211 var calendar = document.getElementById('calendar');
212 var year = document.getElementById(date_box+'year').value;
213 var month = document.getElementById(date_box+'month').value;
214 if(date_box == 'from') {
215 var xpos = document.getElementById('frompic').offsetLeft;
216 var ypos = document.getElementById('frompic').offsetTop;
217 calendar_mode = 'from';
219 if(date_box == 'to') {
220 var xpos = document.getElementById('topic').offsetLeft;
221 var ypos = document.getElementById('topic').offsetTop;
222 calendar_mode = 'to';
224 calendar.style.left = xpos + 100 + 'px';
225 calendar.style.top = ypos + 80 + 'px';
227 if(calendar.style.visibility == "" || calendar.style.visibility == 'hidden') {
228 calendar.style.visibility = 'visible';
229 calendar.innerHTML = "Loading...";
230 calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year=' + year + '&month=' + month));
238 function hideCalendar()
240 var calendar = document.getElementById('calendar');
241 if(calendar.style.visibility != 'hidden') {
242 calendar.style.visibility = 'hidden';
247 function setMonth(year, month, day)
249 var calendar = document.getElementById('calendar');
250 calendar.innerHTML = "Loading...";
251 calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day));
254 function setCalendarDate(year, month, day)
256 document.getElementById(calendar_mode+'year').value = year;
257 document.getElementById(calendar_mode+'month').value = month;
258 document.getElementById(calendar_mode+'day').value = day;
264 HTML_AJAX.grab(encodeURI('rpc.php?action=reset'));
266 refreshAvailableTags();
267 refreshSelectedTags();
271 function WSR_getElementsByClassName(oElm, strTagName, oClassNames){
272 var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
273 var arrReturnElements = new Array();
274 var arrRegExpClassNames = new Array();
275 if(typeof oClassNames == "object"){
276 for(var i=0; i<oClassNames.length; i++){
277 arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames[i].replace(/-/g, "\-") + "(\s|$)"));
281 arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames.replace(/-/g, "\-") + "(\s|$)"));
285 for(var j=0; j<arrElements.length; j++){
286 oElement = arrElements[j];
288 for(var k=0; k<arrRegExpClassNames.length; k++){
289 if(!arrRegExpClassNames[k].test(oElement.className)){
295 arrReturnElements.push(oElement);
298 return (arrReturnElements)
302 function preloadPhotos(lbImg) {
307 d.photos=new Array();
309 var i, j=d.photos.length;
311 lbImg=WSR_getElementsByClassName(document,"img","thumb");
312 for(i=0;i<lbImg.length;i++){
313 d.photos[j]=new Image;
314 d.photos[j].src=lbImg[i].src;
319 function startSlideShow()
322 HTML_AJAX.grab(encodeURI('rpc.php?action=reset_slideshow'));
324 sliding = setInterval("nextSlide()", sliding_time*1000);
325 document.getElementById('stop_ico').src = "resources/32_stop.png";
328 clearInterval(sliding);
330 document.getElementById('stop_ico').src = "resources/32_play.png";
336 next_img = HTML_AJAX.grab(encodeURI('rpc.php?action=get_next_slideshow_img'));
337 document.getElementById('slide_img').src = next_img;
342 prev_img = HTML_AJAX.grab(encodeURI('rpc.php?action=get_prev_slideshow_img'));
343 document.getElementById('slide_img').src = prev_img;
346 function pauseSlideShow()
348 if(!sliding_paused) {
350 clearInterval(sliding);
351 document.getElementById('pause_ico').src = "resources/32_play.png";
355 sliding = setInterval("nextSlide()", sliding_time*1000);
356 document.getElementById('pause_ico').src = "resources/32_pause.png";
360 function startAutoBrowse()
364 autobrowse = setInterval("autoBrowse()", 5000);
367 clearInterval(autobrowse);
369 document.getElementById('autobrowse_ico').src = "resources/32_play.png";
373 function autoBrowse()
375 if(document.getElementById('next_link')) {
376 var next_link = document.getElementById('next_link').href;
377 window.location.href = next_link;
378 document.getElementById('autobrowse_ico').src = "resources/32_pause.png";
382 function initSlider()
384 var sliderEl = document.getElementById ? document.getElementById("slider-1") : null;
385 var inputEl = document.forms[0]["slider-input-1"];
386 var s = new Slider(sliderEl, inputEl);
389 s.setValue(sliding_time);
390 document.getElementById("current_slide_time").innerHTML = sliding_time + "s Interval";
391 s.onchange = function () {
392 sliding_time = s.getValue();
393 document.getElementById("current_slide_time").innerHTML = sliding_time + "s Interval";
394 if(!sliding_paused && sliding) {
395 clearInterval(sliding);
396 sliding = setInterval("nextSlide()", sliding_time*1000);
399 window.onresize = function () {
406 var calendar_shown = 0;
407 var calendar_mode = '';
410 var sliding_paused = 0;
411 var sliding_time = 3;