function verify(url, text){
	if (text=='')
		text='Are you sure you want to delete this comment?';
	if (confirm(text)){
		document.location = url;
	}
	return void(0);
}

// setup everything when document is ready
jQuery(document).ready(function($) {

	/*if (WPWallSettings.expand_box != 'on')
		$("#wall_post").css("display","none");*/
	
	$("#wall_post_toggle").click(function(){
		$("#wall_post").slideToggle("fast");
		$("#wall_post #comment").focus();
		$("#wall_post #author").focus();
	});
			  
    $("#submit_wall_post").click(function() {
          // target identifies the element(s) to update with the server response 
		  
		var owner = $("#wpwall_owner").val();
		var msg = $("#wpwall_comment").val();
		if (msg == "") {
			$('#wallresponse').html('> digite a sua sugestão');
			$('#wallresponse').show("slow");
			$("#wpwall_comment").select();
			return false;
		}
		
		var dataString = 'owner=' + owner + '&wpwall_comment=' + msg;
		$('#wallresponse').html('enviando...');
		
		$.ajax({
		  type: "POST",
		  url: $("#wpwall_url").val(),
		  data: dataString,
		  success: function(responseText, statusText) {
      		$('#wallcomments').hide()
			.html(responseText)
			.fadeIn(1000, function() {
			  
			});
            $("#wpwall_comment").attr('value', '');
			$('#wallresponse').html("<div id='msgCtb'></div>");
			$('#msgCtb').hide()
			.html("Mensagem enviada!<br>")
			.fadeIn(1000, function() {
			  
			});
		  },
		  error: function(request) {
				if (request.responseText.search(/<title>WordPress &rsaquo; Error<\/title>/) != -1) {
						var data = request.responseText.match(/<p>(.*)<\/p>/);
						$('#wallresponse').html('<span class="wall-error">'+ data[1] +'</span>');
				} else {
						$('#wallresponse').html('<span class="wall-error">Houve algum problema? <a href="mailto:site@ideafixa.com">Avise-nos</a>.</span>');
				}       
				$("#wpwall_comment").attr('value', '');                      
           } 
		 });
		return false;
		     
    });   
    
    
     $('.wallnav #img_left').click(function(){
     
     		var page= $('#wallcomments #page_left');
	  		var url = $("#wpwall_url").val();
			var owner = $("#wpwall_owner").val();
	  		
			$('#wallcomments').load(url +'?refresh=' + page[0].value + '&owner=' + owner);
      });
     
     
     $('.wallnav #img_right').click(function(){
     
     		var page= $('#wallcomments #page_right');
	  		var url = $("#wpwall_url").val();
			var owner = $("#wpwall_owner").val();
	  		$('#wallcomments').load(url +'?refresh=' + page[0].value + '&owner=' + owner);
      });
     
});