//Gallery function load_gallery(api_key, photoset){ if(!api_key || !photoset || api_key == '' || photoset == ''){ return false; } var e31gallery_params = { method: 'flickr.photosets.getPhotos', api_key: api_key, per_page: '200', page: '1', photoset_id: photoset }; var gallery = new e31gallery({ layout: 'default', source: { type: 'xml', service: 'flickr', data: 'Butray/lib/remote_proxy.php?url=http://api.flickr.com/services/rest/', params: e31gallery_params, method: 'post' }, gallery: $('photo_gallery'), main: $('photo_gallery_main_photo'), prev_button_img: 'images/e31gallery_arrow_left.png', next_button_img: 'images/e31gallery_arrow_right.png', prev_thumb: $('photo_gallery_thumb_prev'), next_thumb: $('photo_gallery_thumb_next'), prev_button: $('photo_gallery_prev'), next_button: $('photo_gallery_next'), all_thumbs: $('photo_gallery_all_thumbs'), all_thumbs_toggle: $('photo_gallery_all_thumbs_toggle'), all_thumbs_shade: $('photo_gallery_all_thumbs_shade') }); } window.addEvent('domready', function(e){ if($('photo_file_input')){ update_photo_upload_form(); var pfi = $('photo_file_input'); pfi.setStyle('opacity', 0); pfi.setStyle('visibility', 'visible'); pfi.addEvent('change', function(e){ update_photo_upload_form(); }); } function update_photo_upload_form(){ var pfi = $('photo_file_input'); $('photo_file_input_faux').value = pfi.value; //Set the value of the 'fake' input to the real file input value if(pfi.value != '' && !$('photo_file_submit')){ //The value of the file input isn't empty and there isn't a submit button... $('photo_upload_inputs').adopt(new Element('input',{ //Create a new submit button 'type': 'submit', 'id': 'photo_file_submit', 'class': 'photo_file_button', 'value': 'Upload', 'styles':{ 'margin-left': '4px' } })); if(!$('photo_upload_iframe')){ // If no upload iFrame, create it and append to doc var iframe = new IFrame({ //Create the iframe 'styles':{ 'display': 'none' }, 'src': 'about:blank', 'id': 'photo_upload_iframe', 'name': 'photo_upload_iframe' //needed for target reference }); $(document.body).adopt(iframe); //append the iframe iframe.addEvent('load', function(e){ //when the iframe loads any page... var resp = get_iframe_data(this.id); //get the iframe data if(resp == ''){ return false; //no data yet }else{ $('photo_upload_ajax_img').destroy(); //Remove that ajax image if(!$('upload_response')){ //No response text yet - first try here var resp_el = new Element('div',{ //Create the response element 'class': 'upload_response', 'id': 'upload_response' }).set('text', resp); resp_el.inject($('upload_photo_form'), 'before').highlight('#f9e680', '#eb008b'); //stick it before the form }else{ $('upload_response').set('text', resp).highlight('#f9e680', '#eb008b'); //Just set the response text if it failed before } if(resp == 'Success'){ //Good to go $('upload_photo_form').destroy(); //Remove the form since we don't need it anymore var success_resp = 'Thanks for submitting your photo! We\'ll review it and email you as soon as it\'s posted!'; $('upload_response').set('text', success_resp) }else{ //some error occurred var pfs = $('photo_file_submit'); pfs.removeProperty('disabled'); pfs.setProperty('value', 'Upload'); $('photo_upload_faux_container').tween('opacity', 1); update_photo_upload_form(); } } }); } $('upload_photo_form').setProperty('target', 'photo_upload_iframe'); //Set the target of the form to go to the new iFrame var pfs = $('photo_file_submit'); $('upload_photo_form').addEvent('submit', function(e){ //add the submit action for the form pfs.setProperty('disabled', 'true'); pfs.setProperty('value', 'Uploading.'); $('photo_upload_faux_container').tween('opacity', 0); if(!$('photo_upload_ajax_img')){ var ajax_load_bar = new Element('img',{ //create the ajax image 'src': 'images/ajax_loader_bar.gif', 'id': 'photo_upload_ajax_img' }); ajax_load_bar.inject(pfs, 'before'); //put ajax img before the submit button } }); } } function get_iframe_data(id){ var i = $(id); var doc, data; if(i.contentDocument){ doc = i.contentDocument; if(doc.defaultView){ data = doc.defaultView.document.body.innerHTML; }else if(doc.document){ data = doc.document.body.innerHTML; }else if(doc.body){ data = doc.body.innerHTML; }else{ data = false } }else if(i.document){ doc = i.document; if(doc.body){ data = doc.body.innerHTML; }else{ data = false; } }else{ data = false; } return(data); } });