﻿function postTag(){if(document.getElementById('_tag')){if(document.getElementById('_tag').value.length<3){alert('tag has to be at least 3 characters');return false}if(previousTagValue!=document.getElementById('_tag').value){var params=buildParamsFromForm(document.getElementById('FormTag'));tag_posting();loadXMLDoc("POST","/ws/AjaxManager.smile?action=PostTag",params,tag_done);return false}else{alert('you\'ve already tag that!');return false}}return false}previousTagResponse=null;function tag_posting(){window.status="Tagging...";var tag=document.getElementById('_tag').value;document.getElementById('_tag').blur();document.getElementById('_tag').disabled=true;previousTagResponse=document.getElementById('tagResponse').innerHTML;document.getElementById('tagResponse').innerHTML+="<span class='"+tagNewTagClass+"'><a href=\"/?tag="+escape(tag)+tagNearbyAppend+"\" rel='tag' class='suggestedpath'>"+tag+"</a></span>&nbsp; "}previousTagValue=null;function tag_done(){if(req.readyState==4){if(req.status==200&&req.responseText.indexOf('FAILED')!=0){window.status="Tag Saved - Thank You! - "+(new Date());previousTagValue=document.getElementById('_tag').value}else{window.status="";if(req.status==200&&req.responseText.indexOf('FAILED - not authenticated')==0){signOn("#autotag="+escape(document.getElementById('_tag').value));}else alert('We\'re sorry, an unknown error has occurred while processing your request.');document.getElementById('tagResponse').innerHTML=previousTagResponse}document.getElementById('_tag').disabled=false;document.getElementById('_tag').select();document.getElementById('_tag').focus();}}if(window.attachEvent)window.attachEvent("onload",tag_onload);else if(window.addEventListener)window.addEventListener("load",tag_onload,false);function tag_onload(){try{if(window.location.href.indexOf('#autotag=')>-1){if(document.getElementById('_tag')){var x=window.location.href.substring(window.location.href.indexOf('#autotag='),window.location.href.length);x=unescape(x.replace('#autotag=',''));if(x.length>0){document.getElementById('_tag').value=x;if(confirm('tag \''+x+'\' now?')){postTag();}}}else{alert("We're sorry.  In order to post a tag, you must meet the user's criteria.");}}}catch(e){}}