function UpdateForm(div,lonLat){div.html('<form action="#" id="update_form">'+'<input type="hidden" value="'+lonLat.lon+','+lonLat.lat+'" name="lonlat" /> <br />'+'<p><label>שם:</label><br />'+'<input type="text" value="" name="user_name" size="15" tabindex=1 /> </p>'+'<p><label>דואר אלקטרוני:</label><br />'+'<input type="text" value="" name="user_email" size="15" tabindex=2 /></p>'+'<label>סוג העדכון:</label>'+'<div style="float:right; margin-left: 20px; margin-bottom: 1em;">'+'<input type="radio" name="type" value="1"> עדכון שם</input><br />'+'<input type="radio" name="type" value="2"> רחוב חסר</input><br />'+'<input type="radio" name="type" value="3"> תיקון כביש</input><br />'+'</div>'+'<div style="float:right;">'+'<input type="radio" name="type" value="4"> ישוב חסר</input><br />'+'<input type="radio" name="type" value="5"> אחר</input><br />'+'</div>'+'<p style="clear:both;"><label>הערה:</label><br />'+'<textarea id="textareainput" name="user_update" rows="10" cols="30"></textarea></p>'+'<p class="submit"><span id="update_indicator" style="display:none; height: 16px; width: 16px; float: left; background : url(\'/img/indicator.gif\') no-repeat;"></span><input type="button" id="do_update" value="שלח" tabindex=3 /></p>'+'</form>');$('#do_update').click(this.sendForm.bind(this));}
UpdateForm.prototype.sendForm=function(){var form=jQuery("#update_form");if(!$("input[name=user_name]").val()){alert('אנא מלא את שמך');return;}
email_exp=/.+@.+\..+/;email=$("input[name=user_email]").val();if(!email||!email_exp.exec(email)){alert('אנא מלא את כתובת הדואר האלקטרוני על מנת שנוכל לעדכן אותך');return;}
if($("input[name=type]").fieldValue()==''){alert('אנא בחר את סוג הבעיה');return;}
if(!$("textarea[name=user_update]").val()){alert('אנא מלא את תיאור הבעייה');return;}
var q=form.formSerialize();$('#update_indicator').show();$.ajax({type:"POST",url:"/libs/update_report.php",data:q+"&stam="+(new Date()).getTime(),success:this.handleResult.bind(this),error:this.handleFailure.bind(this)});}
UpdateForm.prototype.handleResult=function(msg){$('#update_indicator').hide();var jsonReply=eval("("+msg+")");if(!jsonReply.reply.error){$('#update_form').html('<p>העדכון התקבל, תודה!</p>');}else{$('#update_form').html('<p>שגיאה: '+jsonReply.reply.message+'</p>');}}
UpdateForm.prototype.handleFailure=function(){$('#update_indicator').hide();$('#update_form').html('<p>אירעה שגיאה בעת קליטת העדכון. אנא נסה שנית מאוחר יותר.</p>');}