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 startTagSearch(searchfor)
95 HTML_AJAX.grab(encodeURI('rpc.php?action=tag_search&for=' + searchfor));
96 refreshAvailableTags();
97 refreshSelectedTags();
101 function startDateSearch()
103 from_year = document.getElementById('fromyear').value;
104 from_month = document.getElementById('frommonth').value;
105 from_day = document.getElementById('fromday').value;
106 from = from_year +"-"+ from_month +"-"+ from_day;
107 to_year = document.getElementById('toyear').value;
108 to_month = document.getElementById('tomonth').value;
109 to_day = document.getElementById('today').value;
110 to = to_year +"-"+ to_month +"-"+ to_day;
112 HTML_AJAX.grab(encodeURI('rpc.php?action=date_search&from='+ from +'&to='+ to));
118 function setViewMode(mode)
120 var exprt = document.getElementById('output');
121 exprt.innerHTML = "Loading...";
122 exprt.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_export&mode=' + mode));
125 function clearSearch()
127 document.getElementsByName('searchfor')[0].value = '';
130 function AskServerWhatToDo()
132 return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
135 function init_phpfspot()
137 refreshAvailableTags();
139 whattodo = AskServerWhatToDo();
141 if(whattodo == 'showpi' || whattodo == 'showpi_date') {
144 if(whattodo == 'showpi_tags') {
145 refreshSelectedTags();
148 if(whattodo == 'show_photo') {
149 if(photo = getPhotoToShow()) {
151 refreshSelectedTags();
156 function setBackGrdColor(item, color)
158 if(color == 'mouseover')
159 item.style.backgroundColor='#c6e9ff';
160 if(color == 'mouseout')
161 item.style.backgroundColor='#eeeeee';
162 if(color == 'mouseclick')
163 item.style.backgroundColor='#93A8CA';
166 function getPhotoToShow()
168 // update selected tags
169 var photo_to_show = HTML_AJAX.grab(encodeURI('rpc.php?action=get_photo_to_show'));
171 // if no image needs to be shown, return false from here
172 if(photo_to_show == "")
175 return photo_to_show;
178 function showCalendar(date_box, click_obj)
180 var calendar = document.getElementById('calendar');
181 if(date_box == 'from') {
182 var xpos = document.getElementById('frompic').offsetLeft;
183 var ypos = document.getElementById('frompic').offsetTop;
184 calendar_mode = 'from';
186 if(date_box == 'to') {
187 var xpos = document.getElementById('topic').offsetLeft;
188 var ypos = document.getElementById('topic').offsetTop;
189 calendar_mode = 'to';
191 calendar.style.left = xpos + 60 + 'px';
192 calendar.style.top = ypos + 80 + 'px';
194 if(calendar.style.visibility == "" || calendar.style.visibility == 'hidden') {
195 calendar.style.visibility = 'visible';
196 calendar.innerHTML = "Loading...";
197 calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix'));
201 calendar.style.visibility = 'hidden';
206 function setMonth(year, month, day)
208 var calendar = document.getElementById('calendar');
209 calendar.innerHTML = "Loading...";
210 calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day));
213 function setCalendarDate(year, month, day)
215 document.getElementById(calendar_mode+'year').value = year;
216 document.getElementById(calendar_mode+'month').value = month;
217 document.getElementById(calendar_mode+'day').value = day;
222 HTML_AJAX.grab(encodeURI('rpc.php?action=reset'));
224 refreshAvailableTags();
225 refreshSelectedTags();
229 function WSR_getElementsByClassName(oElm, strTagName, oClassNames){
230 var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
231 var arrReturnElements = new Array();
232 var arrRegExpClassNames = new Array();
233 if(typeof oClassNames == "object"){
234 for(var i=0; i<oClassNames.length; i++){
235 arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames[i].replace(/-/g, "\-") + "(\s|$)"));
239 arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames.replace(/-/g, "\-") + "(\s|$)"));
243 for(var j=0; j<arrElements.length; j++){
244 oElement = arrElements[j];
246 for(var k=0; k<arrRegExpClassNames.length; k++){
247 if(!arrRegExpClassNames[k].test(oElement.className)){
253 arrReturnElements.push(oElement);
256 return (arrReturnElements)
260 function preloadPhotos(lbImg) {
265 d.photos=new Array();
267 var i, j=d.photos.length;
269 lbImg=WSR_getElementsByClassName(document,"img","thumb");
270 for(i=0;i<lbImg.length;i++){
271 d.photos[j]=new Image;
272 d.photos[j].src=lbImg[i].src;
278 var calendar_shown = 0;
279 var calendar_mode = '';