var currentpic; currentpic=0; var currentdiv; var currentdivname; var defaulteditfield; var defaultcontent; var defaultcaptioncontent; function showAddTagForm() { document.getElementById('addtagform').innerHTML = '
One tag at a time.
No quotes please.
'; } function removeAddTagForm() { document.getElementById('addtagform').innerHTML = 'Add a tag
'; } function saveNewTag(pic) { var newtag; newtag = document.getElementById('newtag').value; newtag = encodeURIComponent(newtag); sUrl = 'https://www.santaclarita.com/photos/save_new_tag.php?photo_id='+pic+'&tag='+newtag+'&tkn=efb497e2&phototkn=a5209e3a&r=5512'+Math.floor(Math.random()*999999); $.get(sUrl, function( data ) { handleSaveTagSuccess(data); }); } function flashRow(obj) { obj.bgColor = "#FFFF99"; // This is the flash color, typically a light yellow } function unFlashRow(obj) { obj.bgColor = "#ffffff"; // This is the original background color } function defaultEditField(pic) { var defaultcode; defaultcode = 'Edit Photo Info     x'; return defaultcode; } function showPhotoEditField(pic) { var sUrl; currentdivname = 'edit'+pic; currentdiv = document.getElementById(currentdivname); currentpic=pic; sUrl = 'https://www.santaclarita.com/photos/get_edit_form.php?photo_id='+currentpic+'&r=3259'+Math.floor(Math.random()*999999);; $.get(sUrl, function( data ) { handleSaveTagSuccess(data); }); } function savePhotoTitleField(pic, title) { var sUrl; var titlefield; var titleval; titlefield = document.getElementById('title'+pic); titleval = titlefield.value; currentpic = pic; title = encodeURIComponent(currentdiv.value); sUrl = 'https://www.santaclarita.com/photos/save_title_form.php?photo_id='+pic+'&title='+titleval+'&tkn=efb497e2&phototkn=a5209e3a&r=5898'+Math.floor(Math.random()*999999); $.get(sUrl, function( data ) { handleSaveTitleSuccess(data); }); } function savePhotoEditField(pic) { var sUrl; var title; var tags; var caption; currentdivname = 'edit'+pic; currentdiv = document.getElementById(currentdivname); currentpic=pic; title = encodeURIComponent(document.getElementById('title'+pic).value); tags = encodeURIComponent(document.getElementById('tags'+pic).value); caption = encodeURIComponent(document.getElementById('caption'+pic).value); sUrl = 'https://www.santaclarita.com/photos/save_edit_form.php?photo_id='+currentpic+'&title='+title+'&tags='+tags+'&caption='+caption+'&tkn=efb497e2&r=2068'+Math.floor(Math.random()*999999); $.get(sUrl, function( data ) { handleSaveSuccess(data); }); } function savePhotoCaptionField(pic) { var sUrl; caption = encodeURIComponent(document.getElementById('caption'+pic).value); sUrl = 'https://www.santaclarita.com/photos/save_caption_form.php?photo_id='+currentpic+'&caption='+caption+'&tkn=efb497e2&phototkn=a5209e3a&r=5947'+Math.floor(Math.random()*999999); $.get(sUrl, function( data ) { handleSaveCaptionSuccess(data); }); } function cancelPhotoEditField(pic) { var divname; divname = 'edit'+pic; document.getElementById(divname).innerHTML = defaultEditField(pic); } function cancelPhotoTitleField(pic) { var divname; document.getElementById('editabletitledisplay').innerHTML = defaultcontent; document.getElementById('editabletitleform').innerHTML = ''; } function cancelPhotoCaptionField(pic) { var divname; document.getElementById('editablecaptiondisplay').innerHTML = defaultcaptioncontent; document.getElementById('editablecaptionform').innerHTML = ''; } function confirmPhotoDelete(pic) { if(confirm('Are you sure you want to delete this Photo? This cannot be undone.')) { window.location = "https://www.santaclarita.com/photos/my_photos.php?delete="+pic+"&tkn=efb497e2&confirmed=1&page="; } } function showPhotoEditableTitleForm(photoid, defaultit, editformurl, divname) { var sUrl; defaultcontent = document.getElementById('editabletitledisplay').innerHTML; currentdiv = document.getElementById(divname); currentpic=photoid; sUrl = 'https://www.santaclarita.com/photos/get_edit_title_form.php?photo_id='+currentpic+'&r=5970'+Math.floor(Math.random()*999999);; $.get(sUrl, function( data ) { handleEditFormSuccess(data); }); } function showPhotoEditableCaptionForm(photoid) { var sUrl; defaultcaptioncontent = document.getElementById('editablecaptiondisplay').innerHTML; currentpic=photoid; sUrl = 'https://www.santaclarita.com/photos/get_edit_caption_form.php?photo_id='+currentpic+'&r=75'+Math.floor(Math.random()*999999);; $.get(sUrl, function( data ) { handleEditCaptionFormSuccess(data); }); } var handleSuccess = function(data){ if(data && data !== undefined){ currentdiv.innerHTML = data; } } var handleFailure = function(o){ if(o.responseText !== undefined){ currentdiv.innerHTML = defaultEditField(currentpic); } } var handleEditFailure = function(o){ if(o.responseText !== undefined){ currentdiv.innerHTML = defaultcontent; } } var handleSaveSuccess = function(o){ var titledivname; var titlediv; if(o.responseText !== undefined){ titledivname = 'pic'+currentpic+'title'; titlediv = document.getElementById(titledivname); titlediv.innerHTML = ''+o.responseText+''; currentdiv.innerHTML = defaultEditField(currentpic); } } var handleSaveTitleSuccess = function(data){ var titledivname; var titlediv; if(data && data !== undefined){ document.getElementById('editabletitledisplay').innerHTML = data; document.getElementById('editabletitledisplaysmall').innerHTML = '"'+data+'" - '; document.getElementById('editabletitleform').innerHTML = ''; } } var handleSaveCaptionSuccess = function(data){ if(data && data !== undefined){ document.getElementById('editablecaptiondisplay').innerHTML = data; document.getElementById('editablecaptionform').innerHTML = ''; } } var handleTitleFailure = function(data){ if(data && data !== undefined){ currentdiv.innerHTML = defaultcontent; } } var handleEditFormSuccess = function(data){ if(data && data !== undefined){ currentdiv.innerHTML = data; document.getElementById('editabletitledisplay').innerHTML=''; } } var handleEditCaptionFormSuccess = function(data){ if(data && data !== undefined){ document.getElementById('editablecaptiondisplay').innerHTML=''; document.getElementById('editablecaptionform').innerHTML=data; } } var handleCaptionFailure = function(o){ if(o.responseText !== undefined){ document.getElementById('editablecaptiondisplay').innerHTML=defaultcaptioncontent; document.getElementById('editablecaptionform').innerHTML=''; } } var handleSaveTagSuccess = function(data){ if(data && data !== undefined){ document.getElementById('taglist').innerHTML = document.getElementById('taglist').innerHTML + '
'+data+'
'; removeAddTagForm(); } } var handleTagFailure = function(o){ if(o.responseText !== undefined){ removeAddTagForm(); } } var callback = { success:handleSuccess, failure: handleFailure }; var savecallback = { success:handleSaveSuccess, failure: handleFailure }; var savetitlecallback = { success:handleSaveTitleSuccess, failure: handleTitleFailure }; var savecaptioncallback = { success:handleSaveCaptionSuccess, failure: handleCaptionFailure }; var savetagcallback = { success:handleSaveTagSuccess, failure: handleTagFailure }; var editformcallback = { success:handleEditFormSuccess, failure: handleEditFailure }; var editcaptionformcallback = { success:handleEditCaptionFormSuccess, failure: handleCaptionFailure };