$(document).ready(function(){lastVal=totHistory});var totHistory=0;var positions=new Array();var lastVal;function addHistory(b){totHistory++;positions.push(b.id)}function buildQ(h,i){if(h>i){var f=i;i=h;h=f}h++;i++;var j="";for(var g=h;g<i;g++){if(g!=h){j+=","}j+=".com-"+positions[g-1]}return j}function addComment(f,h){var e;if($(".waveButton").length){return false}if(!f){e=$("#commentArea")}else{e=$(f).closest(".waveComment")}if(!h){h=0}var g='<div class="waveComment addComment">				<div class="comment">			<div class="commentText">				<textarea class="textArea" rows="0" cols="0" name=""></textarea>				<div>					<input type="button" class="waveButton" value="Mentés" onclick="addSubmit(this,'+h+')" />&nbsp;<input type="button" class="waveButton round-all" value="Mégsem" onclick="cancelAdd(this);return false" />				</div>			</div>		</div>	</div>';e.append(g)}function cancelAdd(b){$(b).closest(".waveComment").remove()}function addSubmit(j,f){var i=$(j).closest(".commentText");var h=i.find("textarea").val();var g=$(j).closest(".waveComment");if(h.length<1){return false}$(j).parent().html('<img src="./design/images/ajax_load.gif" width="16" height="16" />');$.ajax({type:"POST",url:"savecomment.php",data:"comment="+encodeURIComponent(h)+"&parent="+f,success:function(a){var b=parseInt(a);if(b){g.addClass("com-"+b);addHistory({id:b});lastVal=totHistory}transForm(h,i)}})}function transForm(f,d){var e=f;d.html(e)};
